diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index fe8b2de3499..18f2e3fa27e 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3333,6 +3333,38 @@ fn static_assert() { } } + #[allow(non_snake_case)] + pub fn clone__moz_image_region(&self) -> longhands::_moz_image_region::computed_value::T { + use values::{Auto, Either}; + use values::computed::ClipRect; + + // There is no ideal way to detect auto type for structs::nsRect and its components, so + // if all components are zero, we use Auto. + if self.gecko.mImageRegion.x == 0 && + self.gecko.mImageRegion.y == 0 && + self.gecko.mImageRegion.width == 0 && + self.gecko.mImageRegion.height == 0 { + return Either::Second(Auto); + } + + let get_clip_rect_component = |value: structs::nscoord| -> Option { + if value == 0 { + None + } else { + Some(Au(value)) + } + }; + + Either::First(ClipRect { + top: get_clip_rect_component(self.gecko.mImageRegion.y), + right: get_clip_rect_component(self.gecko.mImageRegion.width).map( + |v| v + Au(self.gecko.mImageRegion.x)), + bottom: get_clip_rect_component(self.gecko.mImageRegion.height).map( + |v| v + Au(self.gecko.mImageRegion.y)), + left: get_clip_rect_component(self.gecko.mImageRegion.x), + }) + } + ${impl_simple_copy('_moz_image_region', 'mImageRegion')} diff --git a/components/style/properties/longhand/list.mako.rs b/components/style/properties/longhand/list.mako.rs index 34f51b97b9d..620695f3eba 100644 --- a/components/style/properties/longhand/list.mako.rs +++ b/components/style/properties/longhand/list.mako.rs @@ -228,7 +228,7 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu ${helpers.predefined_type("-moz-image-region", "ClipRectOrAuto", "computed::ClipRectOrAuto::auto()", - animation_value_type="none", + animation_value_type="ComputedValue", products="gecko", boxed="True", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-region)")}