mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Auto merge of #17223 - BorisChiou:stylo/animation/tab_size, r=hiro,Manishearth
stylo: Make -moz-{tab-size, box-flex, image-region, outline-radius} animatable. Make -moz-tab-size, -moz-box-flex, -moz-image-region, and -moz-outline-radius animatable, so test_transitions_per_property.html doesn't get any exception of these properties. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix Bug 1370803, Bug 1370808, Bug 1370845, and Bug 1370846. - [X] These changes do not require tests because we have test in Gecko side already. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17223) <!-- Reviewable:end -->
This commit is contained in:
commit
e386e42481
5 changed files with 58 additions and 9 deletions
|
@ -566,7 +566,7 @@ def set_gecko_property(ffi_name, expr):
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%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)]
|
#[allow(non_snake_case)]
|
||||||
pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) {
|
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}));
|
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("_", ""),
|
<% impl_corner_style_coord("_moz_outline_radius_%s" % corner.ident.replace("_", ""),
|
||||||
"mOutlineRadius",
|
"mOutlineRadius",
|
||||||
corner.x_index,
|
corner.x_index,
|
||||||
corner.y_index) %>
|
corner.y_index,
|
||||||
|
need_clone=True) %>
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
pub fn outline_has_nonzero_width(&self) -> bool {
|
pub fn outline_has_nonzero_width(&self) -> bool {
|
||||||
|
@ -3318,12 +3319,50 @@ fn static_assert() {
|
||||||
Either::First(rect) => {
|
Either::First(rect) => {
|
||||||
self.gecko.mImageRegion.x = rect.left.unwrap_or(Au(0)).0;
|
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.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.height = match rect.bottom {
|
||||||
self.gecko.mImageRegion.width = rect.right.unwrap_or(Au(0)).0 - self.gecko.mImageRegion.x;
|
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<Au> {
|
||||||
|
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')}
|
${impl_simple_copy('_moz_image_region', 'mImageRegion')}
|
||||||
|
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
@ -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')"></%call>
|
<%call expr="impl_coord_copy('_moz_tab_size', 'mTabSize')"></%call>
|
||||||
|
|
||||||
<% text_size_adjust_keyword = Keyword("text-size-adjust", "auto none") %>
|
<% text_size_adjust_keyword = Keyword("text-size-adjust", "auto none") %>
|
||||||
|
|
|
@ -697,7 +697,7 @@ ${helpers.predefined_type(
|
||||||
"-moz-tab-size", "LengthOrNumber",
|
"-moz-tab-size", "LengthOrNumber",
|
||||||
"::values::Either::Second(8.0)",
|
"::values::Either::Second(8.0)",
|
||||||
"parse_non_negative",
|
"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")}
|
spec="https://drafts.csswg.org/css-text-3/#tab-size-property")}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
|
||||||
${helpers.predefined_type("-moz-image-region",
|
${helpers.predefined_type("-moz-image-region",
|
||||||
"ClipRectOrAuto",
|
"ClipRectOrAuto",
|
||||||
"computed::ClipRectOrAuto::auto()",
|
"computed::ClipRectOrAuto::auto()",
|
||||||
animation_value_type="none",
|
animation_value_type="ComputedValue",
|
||||||
products="gecko",
|
products="gecko",
|
||||||
boxed="True",
|
boxed="True",
|
||||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-region)")}
|
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-region)")}
|
||||||
|
|
|
@ -70,13 +70,12 @@ ${helpers.predefined_type("outline-width",
|
||||||
spec="https://drafts.csswg.org/css-ui/#propdef-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.
|
// 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"]:
|
% for corner in ["topleft", "topright", "bottomright", "bottomleft"]:
|
||||||
${helpers.predefined_type("-moz-outline-radius-" + corner, "BorderCornerRadius",
|
${helpers.predefined_type("-moz-outline-radius-" + corner, "BorderCornerRadius",
|
||||||
"computed::LengthOrPercentage::zero().into()",
|
"computed::LengthOrPercentage::zero().into()",
|
||||||
products="gecko",
|
products="gecko",
|
||||||
boxed=True,
|
boxed=True,
|
||||||
animation_value_type="none",
|
animation_value_type="ComputedValue",
|
||||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)")}
|
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)")}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ ${helpers.single_keyword("-moz-box-direction", "normal reverse",
|
||||||
|
|
||||||
${helpers.predefined_type("-moz-box-flex", "Number", "0.0", "parse_non_negative",
|
${helpers.predefined_type("-moz-box-flex", "Number", "0.0", "parse_non_negative",
|
||||||
products="gecko", gecko_ffi_name="mBoxFlex",
|
products="gecko", gecko_ffi_name="mBoxFlex",
|
||||||
animation_value_type="none",
|
animation_value_type="ComputedValue",
|
||||||
alias="-webkit-box-flex",
|
alias="-webkit-box-flex",
|
||||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)")}
|
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)")}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue