Skip to content

Commit 6b96001

Browse files
committed
avm1: Implement TextField.styleSheet
1 parent b6b961a commit 6b96001

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

core/src/avm1/globals/text_field.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const PROTO_DECLS: &[Declaration] = declare_properties! {
9797
"thickness" => property(tf_getter!(thickness), tf_setter!(set_thickness));
9898
// NOTE: `tabEnabled` is not a built-in property of TextField.
9999
"tabIndex" => property(tf_getter!(tab_index), tf_setter!(set_tab_index); VERSION_6);
100+
"styleSheet" => property(tf_getter!(style_sheet), tf_setter!(set_style_sheet); VERSION_7);
100101
};
101102

102103
/// Implements `TextField`
@@ -955,3 +956,26 @@ pub fn set_condense_white<'gc>(
955956
this.set_condense_white(activation.context, condense_white);
956957
Ok(())
957958
}
959+
960+
pub fn style_sheet<'gc>(
961+
this: EditText<'gc>,
962+
_activation: &mut Activation<'_, 'gc>,
963+
) -> Result<Value<'gc>, Error<'gc>> {
964+
Ok(match this.style_sheet_avm1() {
965+
Some(style_sheet) => Value::Object(style_sheet),
966+
None => Value::Undefined,
967+
})
968+
}
969+
970+
pub fn set_style_sheet<'gc>(
971+
this: EditText<'gc>,
972+
activation: &mut Activation<'_, 'gc>,
973+
value: Value<'gc>,
974+
) -> Result<(), Error<'gc>> {
975+
let style_sheet = match value {
976+
Value::Object(object) => Some(object),
977+
_ => None,
978+
};
979+
this.set_style_sheet_avm1(activation.context, style_sheet);
980+
Ok(())
981+
}

0 commit comments

Comments
 (0)