diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 0df0ee4bde6..3905400ce8d 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -566,7 +566,7 @@ def set_gecko_property(ffi_name, expr): % endif -<%def name="impl_corner_style_coord(ident, gecko_ffi_name, x_index, y_index, need_clone=False)"> +<%def name="impl_corner_style_coord(ident, gecko_ffi_name, x_index, y_index, need_clone)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { v.0.width.to_gecko_style_coord(&mut self.gecko.${gecko_ffi_name}.data_at_mut(${x_index})); @@ -1485,7 +1485,8 @@ fn static_assert() { <% impl_corner_style_coord("_moz_outline_radius_%s" % corner.ident.replace("_", ""), "mOutlineRadius", corner.x_index, - corner.y_index) %> + corner.y_index, + need_clone=True) %> % endfor pub fn outline_has_nonzero_width(&self) -> bool { @@ -3318,12 +3319,50 @@ fn static_assert() { Either::First(rect) => { self.gecko.mImageRegion.x = rect.left.unwrap_or(Au(0)).0; self.gecko.mImageRegion.y = rect.top.unwrap_or(Au(0)).0; - self.gecko.mImageRegion.height = rect.bottom.unwrap_or(Au(0)).0 - self.gecko.mImageRegion.y; - self.gecko.mImageRegion.width = rect.right.unwrap_or(Au(0)).0 - self.gecko.mImageRegion.x; + self.gecko.mImageRegion.height = match rect.bottom { + Some(value) => value.0 - self.gecko.mImageRegion.y, + None => 0, + }; + self.gecko.mImageRegion.width = match rect.right { + Some(value) => value.0 - self.gecko.mImageRegion.x, + None => 0, + }; } } } + #[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')} @@ -3781,6 +3820,17 @@ fn static_assert() { } } + #[allow(non_snake_case)] + pub fn clone__moz_tab_size(&self) -> longhands::_moz_tab_size::computed_value::T { + use values::Either; + + match self.gecko.mTabSize.as_value() { + CoordDataValue::Coord(coord) => Either::First(Au(coord)), + CoordDataValue::Factor(number) => Either::Second(number), + _ => unreachable!(), + } + } + <%call expr="impl_coord_copy('_moz_tab_size', 'mTabSize')"> <% text_size_adjust_keyword = Keyword("text-size-adjust", "auto none") %> diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 649caa5cece..f78059017b5 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -697,7 +697,7 @@ ${helpers.predefined_type( "-moz-tab-size", "LengthOrNumber", "::values::Either::Second(8.0)", "parse_non_negative", - products="gecko", animation_value_type="none", + products="gecko", animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-text-3/#tab-size-property")} 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)")} diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs index 03ec187135e..2b5b2841ba6 100644 --- a/components/style/properties/longhand/outline.mako.rs +++ b/components/style/properties/longhand/outline.mako.rs @@ -70,13 +70,12 @@ ${helpers.predefined_type("outline-width", spec="https://drafts.csswg.org/css-ui/#propdef-outline-width")} // The -moz-outline-radius-* properties are non-standard and not on a standards track. -// TODO: Should they animate? % for corner in ["topleft", "topright", "bottomright", "bottomleft"]: ${helpers.predefined_type("-moz-outline-radius-" + corner, "BorderCornerRadius", "computed::LengthOrPercentage::zero().into()", products="gecko", boxed=True, - animation_value_type="none", + animation_value_type="ComputedValue", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)")} % endfor diff --git a/components/style/properties/longhand/xul.mako.rs b/components/style/properties/longhand/xul.mako.rs index 34b3de89e0b..9573a2a6c38 100644 --- a/components/style/properties/longhand/xul.mako.rs +++ b/components/style/properties/longhand/xul.mako.rs @@ -26,7 +26,7 @@ ${helpers.single_keyword("-moz-box-direction", "normal reverse", ${helpers.predefined_type("-moz-box-flex", "Number", "0.0", "parse_non_negative", products="gecko", gecko_ffi_name="mBoxFlex", - animation_value_type="none", + animation_value_type="ComputedValue", alias="-webkit-box-flex", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)")}