diff --git a/core/src/avm1/object/stage_object.rs b/core/src/avm1/object/stage_object.rs index f92591327..860576ee7 100644 --- a/core/src/avm1/object/stage_object.rs +++ b/core/src/avm1/object/stage_object.rs @@ -609,7 +609,7 @@ fn set_width<'gc>( val: Value<'gc>, ) -> Result<(), Error<'gc>> { if let Some(val) = property_coerce_to_number(activation, val)? { - this.set_width(activation.context.gc_context, val); + this.set_width(&mut activation.context, val); } Ok(()) } @@ -624,7 +624,7 @@ fn set_height<'gc>( val: Value<'gc>, ) -> Result<(), Error<'gc>> { if let Some(val) = property_coerce_to_number(activation, val)? { - this.set_height(activation.context.gc_context, val); + this.set_height(&mut activation.context, val); } Ok(()) } diff --git a/core/src/avm2/globals/flash/display/display_object.rs b/core/src/avm2/globals/flash/display/display_object.rs index c82cba23c..c9bf59ea0 100644 --- a/core/src/avm2/globals/flash/display/display_object.rs +++ b/core/src/avm2/globals/flash/display/display_object.rs @@ -130,9 +130,8 @@ pub fn set_height<'gc>( ) -> Result, Error<'gc>> { if let Some(dobj) = this.as_display_object() { let new_height = args.get_f64(activation, 0)?; - if new_height >= 0.0 { - dobj.set_height(activation.context.gc_context, new_height); + dobj.set_height(&mut activation.context, new_height); } } @@ -187,9 +186,8 @@ pub fn set_width<'gc>( ) -> Result, Error<'gc>> { if let Some(dobj) = this.as_display_object() { let new_width = args.get_f64(activation, 0)?; - if new_width >= 0.0 { - dobj.set_width(activation.context.gc_context, new_width); + dobj.set_width(&mut activation.context, new_width); } } diff --git a/core/src/display_object.rs b/core/src/display_object.rs index 4d1a9aec1..6836303ef 100644 --- a/core/src/display_object.rs +++ b/core/src/display_object.rs @@ -1353,7 +1353,8 @@ pub trait TDisplayObject<'gc>: /// The width is based on the AABB of the object. /// Set by the ActionScript `_width`/`width` properties. /// This does odd things on rotated clips to match the behavior of Flash. - fn set_width(&self, gc_context: &Mutation<'gc>, value: f64) { + fn set_width(&self, context: &mut UpdateContext<'_, 'gc>, value: f64) { + let gc_context = context.gc_context; let object_bounds = self.bounds(); let object_width = object_bounds.width().to_pixels(); let object_height = object_bounds.height().to_pixels(); @@ -1400,7 +1401,8 @@ pub trait TDisplayObject<'gc>: /// Sets the pixel height of this display object in local space. /// Set by the ActionScript `_height`/`height` properties. /// This does odd things on rotated clips to match the behavior of Flash. - fn set_height(&self, gc_context: &Mutation<'gc>, value: f64) { + fn set_height(&self, context: &mut UpdateContext<'_, 'gc>, value: f64) { + let gc_context = context.gc_context; let object_bounds = self.bounds(); let object_width = object_bounds.width().to_pixels(); let object_height = object_bounds.height().to_pixels(); diff --git a/core/src/display_object/edit_text.rs b/core/src/display_object/edit_text.rs index ba16c5d97..103c9f0c3 100644 --- a/core/src/display_object/edit_text.rs +++ b/core/src/display_object/edit_text.rs @@ -1887,14 +1887,12 @@ impl<'gc> TDisplayObject<'gc> for EditText<'gc> { .to_pixels() } - fn set_width(&self, gc_context: &Mutation<'gc>, value: f64) { - let mut write = self.0.write(gc_context); - - write.bounds.set_width(Twips::from_pixels(value)); - write.base.base.set_transformed_by_script(true); - - drop(write); - self.redraw_border(gc_context); + fn set_width(&self, context: &mut UpdateContext<'_, 'gc>, value: f64) { + let mut edit_text = self.0.write(context.gc_context); + edit_text.bounds.set_width(Twips::from_pixels(value)); + edit_text.base.base.set_transformed_by_script(true); + drop(edit_text); + self.relayout(context); } fn height(&self) -> f64 { @@ -1904,14 +1902,12 @@ impl<'gc> TDisplayObject<'gc> for EditText<'gc> { .to_pixels() } - fn set_height(&self, gc_context: &Mutation<'gc>, value: f64) { - let mut write = self.0.write(gc_context); - - write.bounds.set_height(Twips::from_pixels(value)); - write.base.base.set_transformed_by_script(true); - - drop(write); - self.redraw_border(gc_context); + fn set_height(&self, context: &mut UpdateContext<'_, 'gc>, value: f64) { + let mut edit_text = self.0.write(context.gc_context); + edit_text.bounds.set_height(Twips::from_pixels(value)); + edit_text.base.base.set_transformed_by_script(true); + drop(edit_text); + self.relayout(context); } fn set_matrix(&self, gc_context: &Mutation<'gc>, matrix: Matrix) {