From 1da31f5cf388268d07db49905610311e880f7f55 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:13:59 +0900 Subject: [PATCH 01/14] Introduce IntermediateRGBA type. We need to store color values that each components exceeds its normal range (i.e. [0, 1]) during animation operations (e.g. interpolation). We clamp it right before we insert animated values into the cascade. --- .../helpers/animated_properties.mako.rs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 2816db15a36..2ee9a9fe346 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2041,6 +2041,58 @@ impl Interpolate for Either } } +#[derive(Copy, Clone, Debug, PartialEq)] +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] +/// Unlike RGBA, each component value may exceed the range [0.0, 1.0]. +pub struct IntermediateRGBA { + /// The red component. + pub red: f32, + /// The green component. + pub green: f32, + /// The blue component. + pub blue: f32, + /// The alpha component. + pub alpha: f32, +} + +impl IntermediateRGBA { + /// Returns a transparent color. + #[inline] + pub fn transparent() -> Self { + Self::new(0., 0., 0., 0.) + } + + /// Returns a new color. + #[inline] + pub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Self { + IntermediateRGBA { red: red, green: green, blue: blue, alpha: alpha } + } +} + +/// Unlike Interpolate for RGBA we don't clamp any component values. +impl Interpolate for IntermediateRGBA { + #[inline] + fn interpolate(&self, other: &IntermediateRGBA, progress: f64) -> Result { + let alpha = try!(self.alpha.interpolate(&other.alpha, progress)); + if alpha == 0. { + // Ideally we should return color value that only alpha component is + // 0, but this is what current gecko does. + Ok(IntermediateRGBA::transparent()) + } else { + let red = try!((self.red * self.alpha) + .interpolate(&(other.red * other.alpha), progress)) + * 1. / alpha; + let green = try!((self.green * self.alpha) + .interpolate(&(other.green * other.alpha), progress)) + * 1. / alpha; + let blue = try!((self.blue * self.alpha) + .interpolate(&(other.blue * other.alpha), progress)) + * 1. / alpha; + Ok(IntermediateRGBA::new(red, green, blue, alpha)) + } + } +} + /// We support ComputeDistance for an API in gecko to test the transition per property. impl ComputeDistance for AnimationValue { From 94fb839fdde0a086d8e4471c32210a8c7d1df64b Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:18:43 +0900 Subject: [PATCH 02/14] Rename animation_type to animation_value_type. --- components/style/properties/data.py | 17 ++-- .../helpers/animated_properties.mako.rs | 8 +- .../properties/longhand/background.mako.rs | 20 ++-- .../style/properties/longhand/border.mako.rs | 22 ++--- .../style/properties/longhand/box.mako.rs | 98 +++++++++---------- .../style/properties/longhand/color.mako.rs | 2 +- .../style/properties/longhand/column.mako.rs | 16 +-- .../properties/longhand/counters.mako.rs | 6 +- .../style/properties/longhand/effects.mako.rs | 10 +- .../style/properties/longhand/font.mako.rs | 44 ++++----- .../properties/longhand/inherited_box.mako.rs | 16 +-- .../properties/longhand/inherited_svg.mako.rs | 40 ++++---- .../longhand/inherited_table.mako.rs | 8 +- .../longhand/inherited_text.mako.rs | 53 +++++----- .../style/properties/longhand/list.mako.rs | 10 +- .../style/properties/longhand/margin.mako.rs | 2 +- .../style/properties/longhand/outline.mako.rs | 10 +- .../style/properties/longhand/padding.mako.rs | 2 +- .../properties/longhand/pointing.mako.rs | 12 +-- .../properties/longhand/position.mako.rs | 60 ++++++------ .../style/properties/longhand/svg.mako.rs | 36 +++---- .../style/properties/longhand/table.mako.rs | 4 +- .../style/properties/longhand/text.mako.rs | 12 +-- .../style/properties/longhand/ui.mako.rs | 6 +- .../style/properties/longhand/xul.mako.rs | 14 +-- 25 files changed, 265 insertions(+), 263 deletions(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 895c1b12a90..d01ba34e009 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -135,7 +135,7 @@ def arg_to_bool(arg): class Longhand(object): - def __init__(self, style_struct, name, spec=None, animation_type=None, derived_from=None, keyword=None, + def __init__(self, style_struct, name, spec=None, animation_value_type=None, derived_from=None, keyword=None, predefined_type=None, custom_cascade=False, experimental=False, internal=False, need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False, allowed_in_keyframe_block=True, complex_color=False, cast_type='u8', @@ -176,14 +176,15 @@ class Longhand(object): # This is done like this since just a plain bool argument seemed like # really random. - if animation_type is None: - raise TypeError("animation_type should be specified for (" + name + ")") - animation_types = ["none", "normal", "discrete"] - if animation_type not in animation_types: - raise TypeError("animation_type should be one of (" + str(animation_types) + ")") - self.animation_type = animation_type + if animation_value_type is None: + raise TypeError("animation_value_type should be specified for (" + name + ")") + animation_value_types = ["none", "normal", "discrete"] + if animation_value_type not in animation_value_types: + raise TypeError("animation_value_type should be one of (" + + str(animation_value_types) + ")") + self.animation_value_type = animation_value_type - self.animatable = animation_type != "none" + self.animatable = animation_value_type != "none" if self.logical: # Logical properties will be animatable (i.e. the animation type is # discrete). For now, it is still non-animatable. diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 2ee9a9fe346..c353f66ff3c 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -134,7 +134,7 @@ impl TransitionProperty { pub fn is_discrete(&self) -> bool { match *self { % for prop in data.longhands: - % if prop.animation_type == "discrete": + % if prop.animation_value_type == "discrete": TransitionProperty::${prop.camel_case} => true, % endif % endfor @@ -324,7 +324,7 @@ impl AnimatedProperty { % if prop.animatable: AnimatedProperty::${prop.camel_case}(ref from, ref to) => { // https://w3c.github.io/web-animations/#discrete-animation-type - % if prop.animation_type == "discrete": + % if prop.animation_value_type == "discrete": let value = if progress < 0.5 { *from } else { *to }; % else: let value = match from.interpolate(to, progress) { @@ -531,7 +531,7 @@ impl Interpolate for AnimationValue { (&AnimationValue::${prop.camel_case}(ref from), &AnimationValue::${prop.camel_case}(ref to)) => { // https://w3c.github.io/web-animations/#discrete-animation-type - % if prop.animation_type == "discrete": + % if prop.animation_value_type == "discrete": if progress < 0.5 { Ok(AnimationValue::${prop.camel_case}(*from)) } else { @@ -2100,7 +2100,7 @@ impl ComputeDistance for AnimationValue { match (self, other) { % for prop in data.longhands: % if prop.animatable: - % if prop.animation_type == "normal": + % if prop.animation_value_type == "normal": (&AnimationValue::${prop.camel_case}(ref from), &AnimationValue::${prop.camel_case}(ref to)) => { from.compute_distance(to) diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 2c085cfe9b9..16981f7cc0b 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -10,9 +10,9 @@ ${helpers.predefined_type("background-color", "CSSColor", "::cssparser::Color::RGBA(::cssparser::RGBA::transparent())", initial_specified_value="SpecifiedValue::transparent()", spec="https://drafts.csswg.org/css-backgrounds/#background-color", - animation_type="normal", complex_color=True)} + animation_value_type="normal", complex_color=True)} -<%helpers:vector_longhand name="background-image" animation_type="none" +<%helpers:vector_longhand name="background-image" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#the-background-image" has_uncacheable_values="${product == 'gecko'}"> use std::fmt; @@ -89,7 +89,7 @@ ${helpers.predefined_type("background-color", "CSSColor", } -<%helpers:vector_longhand name="background-position-x" animation_type="normal" +<%helpers:vector_longhand name="background-position-x" animation_value_type="normal" spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-x" delegate_animate="True"> use std::fmt; @@ -140,7 +140,7 @@ ${helpers.predefined_type("background-color", "CSSColor", } -<%helpers:vector_longhand name="background-position-y" animation_type="normal" +<%helpers:vector_longhand name="background-position-y" animation_value_type="normal" spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-y" delegate_animate="True"> use std::fmt; @@ -192,7 +192,7 @@ ${helpers.predefined_type("background-color", "CSSColor", } -<%helpers:vector_longhand name="background-repeat" animation_type="none" +<%helpers:vector_longhand name="background-repeat" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat"> use std::fmt; use style_traits::ToCss; @@ -308,22 +308,22 @@ ${helpers.single_keyword("background-attachment", "scroll fixed" + (" local" if product == "gecko" else ""), vector=True, spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("background-clip", "border-box padding-box content-box", extra_gecko_values="text", vector=True, extra_prefixes="webkit", spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("background-origin", "padding-box border-box content-box", vector=True, extra_prefixes="webkit", spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin", - animation_type="none")} + animation_value_type="none")} -<%helpers:vector_longhand name="background-size" animation_type="normal" extra_prefixes="webkit" +<%helpers:vector_longhand name="background-size" animation_value_type="normal" extra_prefixes="webkit" spec="https://drafts.csswg.org/css-backgrounds/#the-background-size"> use cssparser::Token; use std::ascii::AsciiExt; @@ -528,5 +528,5 @@ ${helpers.single_keyword("background-blend-mode", """normal multiply screen overlay darken lighten color-dodge color-burn hard-light soft-light difference exclusion hue saturation color luminosity""", - vector=True, products="gecko", animation_type="none", + vector=True, products="gecko", animation_value_type="none", spec="https://drafts.fxtf.org/compositing/#background-blend-mode")} diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index 5c5670b7977..a825d6bea50 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -20,7 +20,7 @@ "::cssparser::Color::CurrentColor", alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-color"), spec=maybe_logical_spec(side, "color"), - animation_type="normal", logical = side[1])} + animation_value_type="normal", logical = side[1])} % endfor % for side in ALL_SIDES: @@ -29,14 +29,14 @@ need_clone=True, alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-style"), spec=maybe_logical_spec(side, "style"), - animation_type="none", logical = side[1])} + animation_value_type="none", logical = side[1])} % endfor ${helpers.gecko_keyword_conversion(Keyword('border-style', "none solid double dotted dashed hidden groove ridge inset outset"), type="::values::specified::BorderStyle")} % for side in ALL_SIDES: - <%helpers:longhand name="border-${side[0]}-width" animation_type="normal" logical="${side[1]}" + <%helpers:longhand name="border-${side[0]}-width" animation_value_type="normal" logical="${side[1]}" alias="${maybe_moz_logical_alias(product, side, '-moz-border-%s-width')}" spec="${maybe_logical_spec(side, 'width')}"> use app_units::Au; @@ -70,14 +70,14 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style', "parse", extra_prefixes="webkit", spec="https://drafts.csswg.org/css-backgrounds/#border-%s-radius" % corner, boxed=True, - animation_type="normal")} + animation_value_type="normal")} % endfor ${helpers.single_keyword("box-decoration-break", "slice clone", gecko_enum_prefix="StyleBoxDecorationBreak", gecko_inexhaustive=True, spec="https://drafts.csswg.org/css-break/#propdef-box-decoration-break", - products="gecko", animation_type="none")} + products="gecko", animation_value_type="none")} ${helpers.single_keyword("-moz-float-edge", "content-box margin-box", gecko_ffi_name="mFloatEdge", @@ -85,9 +85,9 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box", gecko_inexhaustive=True, products="gecko", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-float-edge)", - animation_type="none")} + animation_value_type="none")} -<%helpers:longhand name="border-image-source" animation_type="none" boxed="True" +<%helpers:longhand name="border-image-source" animation_value_type="none" boxed="True" spec="https://drafts.csswg.org/css-backgrounds/#border-image-source"> use std::fmt; use style_traits::ToCss; @@ -163,7 +163,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box", } -<%helpers:longhand name="border-image-outset" animation_type="none" +<%helpers:longhand name="border-image-outset" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset"> use std::fmt; use style_traits::ToCss; @@ -279,7 +279,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box", } -<%helpers:longhand name="border-image-repeat" animation_type="none" +<%helpers:longhand name="border-image-repeat" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat"> use std::fmt; use style_traits::ToCss; @@ -357,7 +357,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box", } -<%helpers:longhand name="border-image-width" animation_type="none" +<%helpers:longhand name="border-image-width" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#border-image-width"> use std::fmt; use style_traits::ToCss; @@ -557,7 +557,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box", } -<%helpers:longhand name="border-image-slice" boxed="True" animation_type="none" +<%helpers:longhand name="border-image-slice" boxed="True" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#border-image-slice"> use std::fmt; use style_traits::ToCss; diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index e07e974fe82..26f051bf456 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -12,7 +12,7 @@ // TODO(SimonSapin): don't parse `inline-table`, since we don't support it <%helpers:longhand name="display" need_clone="True" - animation_type="none" + animation_value_type="none" custom_cascade="${product == 'servo'}" spec="https://drafts.csswg.org/css-display/#propdef-display"> <% @@ -101,13 +101,13 @@ ${helpers.single_keyword("-moz-top-layer", "none top", gecko_constant_prefix="NS_STYLE_TOP_LAYER", gecko_ffi_name="mTopLayer", need_clone=True, - products="gecko", animation_type="none", internal=True, + products="gecko", animation_value_type="none", internal=True, spec="Internal (not web-exposed)")} ${helpers.single_keyword("position", "static absolute relative fixed", need_clone="True", extra_gecko_values="sticky", - animation_type="none", + animation_value_type="none", flags="CREATES_STACKING_CONTEXT ABSPOS_CB", spec="https://drafts.csswg.org/css-position/#position-property")} @@ -116,7 +116,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed", // https://drafts.csswg.org/css-logical-props/#float-clear extra_specified="inline-start inline-end" needs_conversion="True" - animation_type="none" + animation_value_type="none" need_clone="True" gecko_enum_prefix="StyleFloat" gecko_inexhaustive="True" @@ -157,7 +157,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed", // https://drafts.csswg.org/css-logical-props/#float-clear extra_specified="inline-start inline-end" needs_conversion="True" - animation_type="none" + animation_value_type="none" gecko_enum_prefix="StyleClear" gecko_ffi_name="mBreakType" spec="https://www.w3.org/TR/CSS2/visuren.html#flow-control"> @@ -192,7 +192,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed", <%helpers:longhand name="-servo-display-for-hypothetical-box" - animation_type="none" + animation_value_type="none" derived_from="display" products="servo" spec="Internal (not web-exposed)"> @@ -211,7 +211,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed", -<%helpers:longhand name="vertical-align" animation_type="normal" +<%helpers:longhand name="vertical-align" animation_value_type="normal" spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align"> use std::fmt; use style_traits::ToCss; @@ -342,24 +342,24 @@ ${helpers.single_keyword("position", "static absolute relative fixed", // CSS 2.1, Section 11 - Visual effects ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box", - products="servo", animation_type="none", internal=True, + products="servo", animation_value_type="none", internal=True, spec="Internal, not web-exposed, \ may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")} ${helpers.single_keyword("overflow-clip-box", "padding-box content-box", - products="gecko", animation_type="none", internal=True, + products="gecko", animation_value_type="none", internal=True, spec="Internal, not web-exposed, \ may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")} // FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`. ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", extra_gecko_values="clip", - need_clone=True, animation_type="none", + need_clone=True, animation_value_type="none", gecko_constant_prefix="NS_STYLE_OVERFLOW", spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-x")} // FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`. -<%helpers:longhand name="overflow-y" need_clone="True" animation_type="none" +<%helpers:longhand name="overflow-y" need_clone="True" animation_value_type="none" spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y"> use super::overflow_x; @@ -406,7 +406,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", <%helpers:vector_longhand name="transition-duration" need_index="True" - animation_type="none" + animation_value_type="none" extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-transitions/#propdef-transition-duration"> use values::specified::Time; @@ -437,7 +437,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", // TODO(pcwalton): Lots more timing functions. <%helpers:vector_longhand name="transition-timing-function" need_index="True" - animation_type="none" + animation_value_type="none" extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function"> use self::computed_value::StartEnd; @@ -729,7 +729,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", <%helpers:vector_longhand name="transition-property" allow_empty="True" need_index="True" - animation_type="none" + animation_value_type="none" extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property"> @@ -762,7 +762,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", <%helpers:vector_longhand name="transition-delay" need_index="True" - animation_type="none" + animation_value_type="none" extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-transitions/#propdef-transition-delay"> pub use properties::longhands::transition_duration::single_value::SpecifiedValue; @@ -773,7 +773,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", <%helpers:vector_longhand name="animation-name" need_index="True" - animation_type="none", + animation_value_type="none", extra_prefixes="moz webkit" allowed_in_keyframe_block="False" spec="https://drafts.csswg.org/css-animations/#propdef-animation-name"> @@ -854,7 +854,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", <%helpers:vector_longhand name="animation-duration" need_index="True" - animation_type="none", + animation_value_type="none", extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-animations/#propdef-animation-duration", allowed_in_keyframe_block="False"> @@ -866,7 +866,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", <%helpers:vector_longhand name="animation-timing-function" need_index="True" - animation_type="none", + animation_value_type="none", extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-animations/#propdef-animation-timing-function", allowed_in_keyframe_block="True"> @@ -879,7 +879,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", <%helpers:vector_longhand name="animation-iteration-count" need_index="True" - animation_type="none", + animation_value_type="none", extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count", allowed_in_keyframe_block="False"> @@ -948,7 +948,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", ${helpers.single_keyword("animation-direction", "normal reverse alternate alternate-reverse", need_index=True, - animation_type="none", + animation_value_type="none", vector=True, gecko_enum_prefix="PlaybackDirection", custom_consts=animation_direction_custom_consts, @@ -962,7 +962,7 @@ ${helpers.single_keyword("animation-play-state", "running paused", need_clone=True, need_index=True, - animation_type="none", + animation_value_type="none", vector=True, extra_prefixes="moz webkit", spec="https://drafts.csswg.org/css-animations/#propdef-animation-play-state", @@ -971,7 +971,7 @@ ${helpers.single_keyword("animation-play-state", ${helpers.single_keyword("animation-fill-mode", "none forwards backwards both", need_index=True, - animation_type="none", + animation_value_type="none", vector=True, gecko_enum_prefix="FillMode", extra_prefixes="moz webkit", @@ -980,7 +980,7 @@ ${helpers.single_keyword("animation-fill-mode", <%helpers:vector_longhand name="animation-delay" need_index="True" - animation_type="none", + animation_value_type="none", extra_prefixes="moz webkit", spec="https://drafts.csswg.org/css-animations/#propdef-animation-delay", allowed_in_keyframe_block="False"> @@ -990,7 +990,7 @@ ${helpers.single_keyword("animation-fill-mode", pub use properties::longhands::transition_duration::single_value::SpecifiedValue; -<%helpers:longhand products="gecko" name="scroll-snap-points-y" animation_type="none" +<%helpers:longhand products="gecko" name="scroll-snap-points-y" animation_value_type="none" spec="Nonstandard (https://www.w3.org/TR/2015/WD-css-snappoints-1-20150326/#scroll-snap-points)"> use std::fmt; use style_traits::ToCss; @@ -1085,7 +1085,7 @@ ${helpers.single_keyword("animation-fill-mode", } -<%helpers:longhand products="gecko" name="scroll-snap-points-x" animation_type="none" +<%helpers:longhand products="gecko" name="scroll-snap-points-x" animation_value_type="none" spec="Nonstandard (https://www.w3.org/TR/2015/WD-css-snappoints-1-20150326/#scroll-snap-points)"> pub use super::scroll_snap_points_y::SpecifiedValue; pub use super::scroll_snap_points_y::computed_value; @@ -1100,7 +1100,7 @@ ${helpers.predefined_type("scroll-snap-destination", products="gecko", boxed="True", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)", - animation_type="normal")} + animation_value_type="normal")} ${helpers.predefined_type("scroll-snap-coordinate", "Position", @@ -1108,14 +1108,14 @@ ${helpers.predefined_type("scroll-snap-coordinate", vector=True, products="gecko", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)", - animation_type="normal", + animation_value_type="normal", allow_empty=True, delegate_animate=True)} <%helpers:longhand name="transform" extra_prefixes="webkit" - animation_type="normal" + animation_value_type="normal" flags="CREATES_STACKING_CONTEXT FIXPOS_CB" spec="https://drafts.csswg.org/css-transforms/#propdef-transform"> use app_units::Au; @@ -2031,16 +2031,16 @@ ${helpers.single_keyword("scroll-behavior", "auto smooth", products="gecko", spec="https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("scroll-snap-type-x", "none mandatory proximity", products="gecko", gecko_constant_prefix="NS_STYLE_SCROLL_SNAP_TYPE", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x)", - animation_type="none")} + animation_value_type="none")} -<%helpers:longhand products="gecko" name="scroll-snap-type-y" animation_type="none" +<%helpers:longhand products="gecko" name="scroll-snap-type-y" animation_value_type="none" spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x)"> pub use super::scroll_snap_type_x::SpecifiedValue; pub use super::scroll_snap_type_x::computed_value; @@ -2055,26 +2055,26 @@ ${helpers.single_keyword("isolation", products="gecko", spec="https://drafts.fxtf.org/compositing/#isolation", flags="CREATES_STACKING_CONTEXT", - animation_type="none")} + animation_value_type="none")} // TODO add support for logical values recto and verso ${helpers.single_keyword("page-break-after", "auto always avoid left right", products="gecko", spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-after", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("page-break-before", "auto always avoid left right", products="gecko", spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-before", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("page-break-inside", "auto avoid", products="gecko", gecko_ffi_name="mBreakInside", gecko_constant_prefix="NS_STYLE_PAGE_BREAK", spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-inside", - animation_type="none")} + animation_value_type="none")} // CSS Basic User Interface Module Level 3 // http://dev.w3.org/csswg/css-ui @@ -2083,7 +2083,7 @@ ${helpers.single_keyword("resize", "none both horizontal vertical", products="gecko", spec="https://drafts.csswg.org/css-ui/#propdef-resize", - animation_type="none")} + animation_value_type="none")} ${helpers.predefined_type("perspective", @@ -2094,9 +2094,9 @@ ${helpers.predefined_type("perspective", spec="https://drafts.csswg.org/css-transforms/#perspective", extra_prefixes="moz webkit", flags="CREATES_STACKING_CONTEXT FIXPOS_CB", - animation_type="normal")} + animation_value_type="normal")} -<%helpers:longhand name="perspective-origin" boxed="True" animation_type="normal" extra_prefixes="moz webkit" +<%helpers:longhand name="perspective-origin" boxed="True" animation_value_type="normal" extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-transforms/#perspective-origin-property"> use std::fmt; use style_traits::ToCss; @@ -2176,14 +2176,14 @@ ${helpers.single_keyword("backface-visibility", "visible hidden", spec="https://drafts.csswg.org/css-transforms/#backface-visibility-property", extra_prefixes="moz webkit", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("transform-box", "border-box fill-box view-box", gecko_enum_prefix="StyleGeometryBox", products="gecko", spec="https://drafts.csswg.org/css-transforms/#transform-box", - animation_type="none")} + animation_value_type="none")} // `auto` keyword is not supported in gecko yet. ${helpers.single_keyword("transform-style", @@ -2192,9 +2192,9 @@ ${helpers.single_keyword("transform-style", spec="https://drafts.csswg.org/css-transforms/#transform-style-property", extra_prefixes="moz webkit", flags="CREATES_STACKING_CONTEXT FIXPOS_CB", - animation_type="none")} + animation_value_type="none")} -<%helpers:longhand name="transform-origin" animation_type="normal" extra_prefixes="moz webkit" boxed="True" +<%helpers:longhand name="transform-origin" animation_value_type="normal" extra_prefixes="moz webkit" boxed="True" spec="https://drafts.csswg.org/css-transforms/#transform-origin-property"> use app_units::Au; use std::fmt; @@ -2320,7 +2320,7 @@ ${helpers.single_keyword("transform-style", // FIXME: `size` and `content` values are not implemented and `strict` is implemented // like `content`(layout style paint) in gecko. We should implement `size` and `content`, // also update the glue once they are implemented in gecko. -<%helpers:longhand name="contain" animation_type="none" products="gecko" need_clone="True" +<%helpers:longhand name="contain" animation_value_type="none" products="gecko" need_clone="True" spec="https://drafts.csswg.org/css-contain/#contain-property"> use std::fmt; use style_traits::ToCss; @@ -2420,7 +2420,7 @@ ${helpers.single_keyword("appearance", products="gecko", spec="https://drafts.csswg.org/css-ui-4/#appearance-switching", alias="-webkit-appearance", - animation_type="none")} + animation_value_type="none")} // Non-standard ${helpers.single_keyword("-moz-appearance", @@ -2450,11 +2450,11 @@ ${helpers.single_keyword("-moz-appearance", gecko_constant_prefix="NS_THEME", products="gecko", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance)", - animation_type="none")} + animation_value_type="none")} ${helpers.predefined_type("-moz-binding", "UrlOrNone", "Either::Second(None_)", products="gecko", - animation_type="none", + animation_value_type="none", gecko_ffi_name="mBinding", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding)", disable_when_testing="True")} @@ -2465,9 +2465,9 @@ ${helpers.single_keyword("-moz-orient", gecko_ffi_name="mOrient", gecko_enum_prefix="StyleOrient", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-orient)", - animation_type="none")} + animation_value_type="none")} -<%helpers:longhand name="will-change" products="gecko" animation_type="none" +<%helpers:longhand name="will-change" products="gecko" animation_value_type="none" spec="https://drafts.csswg.org/css-will-change/#will-change"> use cssparser::serialize_identifier; use std::fmt; @@ -2531,7 +2531,7 @@ ${helpers.single_keyword("-moz-orient", } -<%helpers:longhand name="shape-outside" products="gecko" animation_type="none" boxed="True" +<%helpers:longhand name="shape-outside" products="gecko" animation_value_type="none" boxed="True" spec="https://drafts.csswg.org/css-shapes/#shape-outside-property"> use std::fmt; use style_traits::ToCss; diff --git a/components/style/properties/longhand/color.mako.rs b/components/style/properties/longhand/color.mako.rs index 0474bcb837d..18812044f03 100644 --- a/components/style/properties/longhand/color.mako.rs +++ b/components/style/properties/longhand/color.mako.rs @@ -8,7 +8,7 @@ <% from data import to_rust_ident %> -<%helpers:longhand name="color" need_clone="True" animation_type="normal" +<%helpers:longhand name="color" need_clone="True" animation_value_type="normal" spec="https://drafts.csswg.org/css-color/#color"> use cssparser::RGBA; use std::fmt; diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index fef81ca9ac4..e1e32e9d20a 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -12,7 +12,7 @@ ${helpers.predefined_type("column-width", initial_specified_value="Either::Second(Auto)", parse_method="parse_non_negative_length", extra_prefixes="moz", - animation_type="normal", + animation_value_type="normal", experimental=True, spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")} @@ -23,7 +23,7 @@ ${helpers.predefined_type("column-count", parse_method="parse_positive", initial_specified_value="Either::Second(Auto)", experimental="True", - animation_type="normal", + animation_value_type="normal", extra_prefixes="moz", spec="https://drafts.csswg.org/css-multicol/#propdef-column-count")} @@ -33,15 +33,15 @@ ${helpers.predefined_type("column-gap", parse_method='parse_non_negative_length', extra_prefixes="moz", experimental=True, - animation_type="normal", + animation_value_type="normal", spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")} ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.csswg.org/css-multicol/#propdef-column-fill")} // https://drafts.csswg.org/css-multicol-1/#propdef-column-rule-width -<%helpers:longhand name="column-rule-width" products="gecko" animation_type="normal" extra_prefixes="moz" +<%helpers:longhand name="column-rule-width" products="gecko" animation_value_type="normal" extra_prefixes="moz" spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width"> use app_units::Au; use std::fmt; @@ -75,18 +75,18 @@ ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", ${helpers.predefined_type("column-rule-color", "CSSColor", "::cssparser::Color::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_type="normal", extra_prefixes="moz", + products="gecko", animation_value_type="normal", extra_prefixes="moz", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-color")} // It's not implemented in servo or gecko yet. ${helpers.single_keyword("column-span", "none all", - products="none", animation_type="none", + products="none", animation_value_type="none", spec="https://drafts.csswg.org/css-multicol/#propdef-column-span")} ${helpers.single_keyword("column-rule-style", "none hidden dotted dashed solid double groove ridge inset outset", products="gecko", extra_prefixes="moz", gecko_constant_prefix="NS_STYLE_BORDER_STYLE", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-style")} diff --git a/components/style/properties/longhand/counters.mako.rs b/components/style/properties/longhand/counters.mako.rs index 6d0c26808da..c8dc8ebb4ce 100644 --- a/components/style/properties/longhand/counters.mako.rs +++ b/components/style/properties/longhand/counters.mako.rs @@ -6,7 +6,7 @@ <% data.new_style_struct("Counters", inherited=False, gecko_name="Content") %> -<%helpers:longhand name="content" boxed="True" animation_type="none" +<%helpers:longhand name="content" boxed="True" animation_value_type="none" spec="https://drafts.csswg.org/css-content/#propdef-content"> use cssparser::Token; use std::ascii::AsciiExt; @@ -235,7 +235,7 @@ } -<%helpers:longhand name="counter-increment" animation_type="none" +<%helpers:longhand name="counter-increment" animation_value_type="none" spec="https://drafts.csswg.org/css-lists/#propdef-counter-increment"> use std::fmt; use style_traits::ToCss; @@ -362,7 +362,7 @@ } -<%helpers:longhand name="counter-reset" animation_type="none" +<%helpers:longhand name="counter-reset" animation_value_type="none" spec="https://drafts.csswg.org/css-lists-3/#propdef-counter-reset"> pub use super::counter_increment::{SpecifiedValue, computed_value, get_initial_value}; use super::counter_increment::parse_common; diff --git a/components/style/properties/longhand/effects.mako.rs b/components/style/properties/longhand/effects.mako.rs index 16df2dc6eed..9970b964fcd 100644 --- a/components/style/properties/longhand/effects.mako.rs +++ b/components/style/properties/longhand/effects.mako.rs @@ -10,12 +10,12 @@ ${helpers.predefined_type("opacity", "Opacity", "1.0", - animation_type="normal", + animation_value_type="normal", flags="CREATES_STACKING_CONTEXT", spec="https://drafts.csswg.org/css-color/#opacity")} <%helpers:vector_longhand name="box-shadow" allow_empty="True" - animation_type="normal" extra_prefixes="webkit" + animation_value_type="normal" extra_prefixes="webkit" spec="https://drafts.csswg.org/css-backgrounds/#box-shadow"> use cssparser; use std::fmt; @@ -80,12 +80,12 @@ ${helpers.predefined_type("opacity", ${helpers.predefined_type("clip", "ClipRectOrAuto", "computed::ClipRectOrAuto::auto()", - animation_type="normal", + animation_value_type="normal", boxed="True", spec="https://drafts.fxtf.org/css-masking/#clip-property")} // FIXME: This prop should be animatable -<%helpers:longhand name="filter" animation_type="none" extra_prefixes="webkit" +<%helpers:longhand name="filter" animation_value_type="none" extra_prefixes="webkit" flags="CREATES_STACKING_CONTEXT FIXPOS_CB" spec="https://drafts.fxtf.org/filters/#propdef-filter"> //pub use self::computed_value::T as SpecifiedValue; @@ -523,6 +523,6 @@ ${helpers.single_keyword("mix-blend-mode", """normal multiply screen overlay darken lighten color-dodge color-burn hard-light soft-light difference exclusion hue saturation color luminosity""", gecko_constant_prefix="NS_STYLE_BLEND", - animation_type="none", + animation_value_type="none", flags="CREATES_STACKING_CONTEXT", spec="https://drafts.fxtf.org/compositing/#propdef-mix-blend-mode")} diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 66ea134733d..65edd9914f3 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -62,7 +62,7 @@ } -<%helpers:longhand name="font-family" animation_type="none" need_index="True" boxed="${product == 'gecko'}" +<%helpers:longhand name="font-family" animation_value_type="none" need_index="True" boxed="${product == 'gecko'}" spec="https://drafts.csswg.org/css-fonts/#propdef-font-family"> use properties::longhands::system_font::SystemFont; use self::computed_value::{FontFamily, FamilyName}; @@ -333,7 +333,7 @@ ${helpers.single_keyword_system("font-style", gecko_constant_prefix="NS_FONT_STYLE", gecko_ffi_name="mFont.style", spec="https://drafts.csswg.org/css-fonts/#propdef-font-style", - animation_type="none")} + animation_value_type="none")} <% font_variant_caps_custom_consts= { "small-caps": "SMALLCAPS", @@ -349,9 +349,9 @@ ${helpers.single_keyword_system("font-variant-caps", gecko_ffi_name="mFont.variantCaps", spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-caps", custom_consts=font_variant_caps_custom_consts, - animation_type="none")} + animation_value_type="none")} -<%helpers:longhand name="font-weight" need_clone="True" animation_type="normal" +<%helpers:longhand name="font-weight" need_clone="True" animation_value_type="normal" spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight"> use std::fmt; use style_traits::ToCss; @@ -549,7 +549,7 @@ ${helpers.single_keyword_system("font-variant-caps", } -<%helpers:longhand name="font-size" need_clone="True" animation_type="normal" +<%helpers:longhand name="font-size" need_clone="True" animation_value_type="normal" spec="https://drafts.csswg.org/css-fonts/#propdef-font-size"> use app_units::Au; use properties::longhands::system_font::SystemFont; @@ -934,7 +934,7 @@ ${helpers.single_keyword_system("font-variant-caps", } -<%helpers:longhand products="gecko" name="font-size-adjust" animation_type="normal" +<%helpers:longhand products="gecko" name="font-size-adjust" animation_value_type="normal" spec="https://drafts.csswg.org/css-fonts/#propdef-font-size-adjust"> use properties::longhands::system_font::SystemFont; use std::fmt; @@ -1076,7 +1076,7 @@ ${helpers.single_keyword_system("font-variant-caps", } -<%helpers:longhand products="gecko" name="font-synthesis" animation_type="none" +<%helpers:longhand products="gecko" name="font-synthesis" animation_value_type="none" spec="https://drafts.csswg.org/css-fonts/#propdef-font-synthesis"> use std::fmt; use style_traits::ToCss; @@ -1148,7 +1148,7 @@ ${helpers.single_keyword_system("font-stretch", gecko_constant_prefix="NS_FONT_STRETCH", cast_type='i16', spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword_system("font-kerning", "auto none normal", @@ -1156,11 +1156,11 @@ ${helpers.single_keyword_system("font-kerning", gecko_ffi_name="mFont.kerning", gecko_constant_prefix="NS_FONT_KERNING", spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch", - animation_type="none")} + animation_value_type="none")} /// FIXME: Implement proper handling of each values. /// https://github.com/servo/servo/issues/15957 -<%helpers:longhand name="font-variant-alternates" products="gecko" animation_type="none" +<%helpers:longhand name="font-variant-alternates" products="gecko" animation_value_type="none" spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-alternates"> use properties::longhands::system_font::SystemFont; use std::fmt; @@ -1296,7 +1296,7 @@ macro_rules! exclusive_value { } } -<%helpers:longhand name="font-variant-east-asian" products="gecko" animation_type="none" +<%helpers:longhand name="font-variant-east-asian" products="gecko" animation_value_type="none" spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-east-asian"> use properties::longhands::system_font::SystemFont; use std::fmt; @@ -1437,7 +1437,7 @@ macro_rules! exclusive_value { } -<%helpers:longhand name="font-variant-ligatures" products="gecko" animation_type="none" +<%helpers:longhand name="font-variant-ligatures" products="gecko" animation_value_type="none" spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-ligatures"> use properties::longhands::system_font::SystemFont; use std::fmt; @@ -1588,7 +1588,7 @@ macro_rules! exclusive_value { } -<%helpers:longhand name="font-variant-numeric" products="gecko" animation_type="none" +<%helpers:longhand name="font-variant-numeric" products="gecko" animation_value_type="none" spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-numeric"> use properties::longhands::system_font::SystemFont; use std::fmt; @@ -1738,9 +1738,9 @@ ${helpers.single_keyword_system("font-variant-position", gecko_ffi_name="mFont.variantPosition", gecko_constant_prefix="NS_FONT_VARIANT_POSITION", spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-position", - animation_type="none")} + animation_value_type="none")} -<%helpers:longhand name="font-feature-settings" products="none" animation_type="none" extra_prefixes="moz" +<%helpers:longhand name="font-feature-settings" products="none" animation_value_type="none" extra_prefixes="moz" spec="https://drafts.csswg.org/css-fonts/#propdef-font-feature-settings"> use std::fmt; use style_traits::ToCss; @@ -1850,7 +1850,7 @@ ${helpers.single_keyword_system("font-variant-position", } -<%helpers:longhand name="font-language-override" products="gecko" animation_type="none" +<%helpers:longhand name="font-language-override" products="gecko" animation_value_type="none" extra_prefixes="moz" boxed="True" spec="https://drafts.csswg.org/css-fonts-3/#propdef-font-language-override"> use properties::longhands::system_font::SystemFont; @@ -1990,7 +1990,7 @@ ${helpers.single_keyword_system("font-variant-position", } -<%helpers:longhand name="-x-lang" products="gecko" animation_type="none" internal="True" +<%helpers:longhand name="-x-lang" products="gecko" animation_value_type="none" internal="True" spec="Internal (not web-exposed)"> use values::HasViewportPercentage; use values::computed::ComputedValueAsSpecified; @@ -2027,7 +2027,7 @@ ${helpers.single_keyword_system("font-variant-position", // MathML properties -<%helpers:longhand name="-moz-script-size-multiplier" products="gecko" animation_type="none" +<%helpers:longhand name="-moz-script-size-multiplier" products="gecko" animation_value_type="none" predefined_type="Number" gecko_ffi_name="mScriptSizeMultiplier" spec="Internal (not web-exposed)" internal="True" disable_when_testing="True"> @@ -2053,7 +2053,7 @@ ${helpers.single_keyword_system("font-variant-position", } -<%helpers:longhand name="-moz-script-level" products="gecko" animation_type="none" +<%helpers:longhand name="-moz-script-level" products="gecko" animation_value_type="none" predefined_type="Integer" gecko_ffi_name="mScriptLevel" spec="Internal (not web-exposed)" internal="True" disable_when_testing="True" need_clone="True"> @@ -2136,7 +2136,7 @@ ${helpers.single_keyword("-moz-math-display", gecko_ffi_name="mMathDisplay", products="gecko", spec="Internal (not web-exposed)", - animation_type="none", + animation_value_type="none", need_clone="True")} ${helpers.single_keyword("-moz-math-variant", @@ -2148,10 +2148,10 @@ ${helpers.single_keyword("-moz-math-variant", gecko_ffi_name="mMathVariant", products="gecko", spec="Internal (not web-exposed)", - animation_type="none", + animation_value_type="none", needs_conversion=True)} -<%helpers:longhand name="-moz-script-min-size" products="gecko" animation_type="none" +<%helpers:longhand name="-moz-script-min-size" products="gecko" animation_value_type="none" predefined_type="Length" gecko_ffi_name="mScriptMinSize" spec="Internal (not web-exposed)" internal="True" disable_when_testing="True"> diff --git a/components/style/properties/longhand/inherited_box.mako.rs b/components/style/properties/longhand/inherited_box.mako.rs index f919a95d406..92c8720b495 100644 --- a/components/style/properties/longhand/inherited_box.mako.rs +++ b/components/style/properties/longhand/inherited_box.mako.rs @@ -11,7 +11,7 @@ ${helpers.single_keyword("visibility", "visible hidden", extra_gecko_values="collapse", gecko_ffi_name="mVisible", - animation_type="normal", + animation_value_type="normal", spec="https://drafts.csswg.org/css-box/#propdef-visibility")} // CSS Writing Modes Level 3 @@ -24,10 +24,10 @@ ${helpers.single_keyword("writing-mode", tb=vertical-rl tb-rl=vertical-rl", experimental=True, need_clone=True, - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode")} -${helpers.single_keyword("direction", "ltr rtl", need_clone=True, animation_type="none", +${helpers.single_keyword("direction", "ltr rtl", need_clone=True, animation_value_type="none", spec="https://drafts.csswg.org/css-writing-modes/#propdef-direction", needs_conversion=True)} @@ -36,14 +36,14 @@ ${helpers.single_keyword("text-orientation", extra_gecko_aliases="sideways-right=sideways", products="gecko", need_clone=True, - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-writing-modes/#propdef-text-orientation")} // CSS Color Module Level 4 // https://drafts.csswg.org/css-color/ ${helpers.single_keyword("color-adjust", "economy exact", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-color/#propdef-color-adjust")} <% image_rendering_custom_consts = { "crisp-edges": "CRISPEDGES", @@ -55,13 +55,13 @@ ${helpers.single_keyword("image-rendering", extra_gecko_values="optimizespeed optimizequality -moz-crisp-edges", extra_servo_values="pixelated crisp-edges", custom_consts=image_rendering_custom_consts, - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-images/#propdef-image-rendering")} // Image Orientation <%helpers:longhand name="image-orientation" products="gecko" - animation_type="none" + animation_value_type="none" spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \ /// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation"> use std::fmt; @@ -202,7 +202,7 @@ ${helpers.single_keyword("image-rendering", <%helpers:longhand name="-servo-under-display-none" derived_from="display" products="servo" - animation_type="none" + animation_value_type="none" spec="Nonstandard (internal layout use only)"> use std::fmt; use style_traits::ToCss; diff --git a/components/style/properties/longhand/inherited_svg.mako.rs b/components/style/properties/longhand/inherited_svg.mako.rs index a11796fcdb9..51f952c6697 100644 --- a/components/style/properties/longhand/inherited_svg.mako.rs +++ b/components/style/properties/longhand/inherited_svg.mako.rs @@ -17,51 +17,51 @@ ${helpers.single_keyword("text-anchor", "start middle end", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG/text.html#TextAnchorProperty")} // Section 11 - Painting: Filling, Stroking and Marker Symbols ${helpers.single_keyword("color-interpolation", "srgb auto linearrgb", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperty")} ${helpers.single_keyword("color-interpolation-filters", "linearrgb auto srgb", products="gecko", gecko_constant_prefix="NS_STYLE_COLOR_INTERPOLATION", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationFiltersProperty")} ${helpers.predefined_type( "fill", "SVGPaint", "::values::computed::SVGPaint::black()", products="gecko", - animation_type="none", + animation_value_type="none", boxed=True, spec="https://www.w3.org/TR/SVG2/painting.html#SpecifyingFillPaint")} ${helpers.predefined_type("fill-opacity", "Opacity", "1.0", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#FillOpacityProperty")} ${helpers.single_keyword("fill-rule", "nonzero evenodd", gecko_enum_prefix="StyleFillRule", gecko_inexhaustive=True, - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#FillRuleProperty")} ${helpers.single_keyword("shape-rendering", "auto optimizespeed crispedges geometricprecision", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#ShapeRenderingProperty")} ${helpers.predefined_type( "stroke", "SVGPaint", "Default::default()", products="gecko", - animation_type="none", + animation_value_type="none", boxed=True, spec="https://www.w3.org/TR/SVG2/painting.html#SpecifyingStrokePaint")} @@ -70,24 +70,24 @@ ${helpers.predefined_type( "computed::LengthOrPercentage::one()", "parse_numbers_are_pixels_non_negative", products="gecko", - animation_type="normal", + animation_value_type="normal", spec="https://www.w3.org/TR/SVG2/painting.html#StrokeWidth")} ${helpers.single_keyword("stroke-linecap", "butt round square", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#StrokeLinecapProperty")} ${helpers.single_keyword("stroke-linejoin", "miter round bevel", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#StrokeLinejoinProperty")} ${helpers.predefined_type("stroke-miterlimit", "Number", "4.0", "parse_at_least_one", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#StrokeMiterlimitProperty")} ${helpers.predefined_type("stroke-opacity", "Opacity", "1.0", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#StrokeOpacityProperty")} ${helpers.predefined_type("stroke-dasharray", @@ -97,7 +97,7 @@ ${helpers.predefined_type("stroke-dasharray", vector="True", allow_empty="True", products="gecko", - animation_type="none", + animation_value_type="none", space_separated_allowed="True", spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing")} @@ -106,7 +106,7 @@ ${helpers.predefined_type( "computed::LengthOrPercentage::zero()", "parse_numbers_are_pixels", products="gecko", - animation_type="normal", + animation_value_type="normal", spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing")} // Section 14 - Clipping, Masking and Compositing @@ -114,26 +114,26 @@ ${helpers.single_keyword("clip-rule", "nonzero evenodd", products="gecko", gecko_enum_prefix="StyleFillRule", gecko_inexhaustive=True, - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG11/masking.html#ClipRuleProperty")} ${helpers.predefined_type("marker-start", "UrlOrNone", "Either::Second(None_)", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")} ${helpers.predefined_type("marker-mid", "UrlOrNone", "Either::Second(None_)", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")} ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")} <%helpers:longhand name="paint-order" - animation_type="none" + animation_value_type="none" products="gecko" spec="https://www.w3.org/TR/SVG2/painting.html#PaintOrder"> diff --git a/components/style/properties/longhand/inherited_table.mako.rs b/components/style/properties/longhand/inherited_table.mako.rs index c202d0abe62..3069482976e 100644 --- a/components/style/properties/longhand/inherited_table.mako.rs +++ b/components/style/properties/longhand/inherited_table.mako.rs @@ -8,19 +8,19 @@ ${helpers.single_keyword("border-collapse", "separate collapse", gecko_constant_prefix="NS_STYLE_BORDER", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-border-collapse")} ${helpers.single_keyword("empty-cells", "show hide", gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-empty-cells")} ${helpers.single_keyword("caption-side", "top bottom", extra_gecko_values="right left top-outside bottom-outside", needs_conversion="True", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-caption-side")} -<%helpers:longhand name="border-spacing" animation_type="none" boxed="True" +<%helpers:longhand name="border-spacing" animation_value_type="none" boxed="True" spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing"> use app_units::Au; use std::fmt; diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 0b1cf0a0229..e5ab05155df 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -6,7 +6,7 @@ <% from data import Keyword %> <% data.new_style_struct("InheritedText", inherited=True, gecko_name="Text") %> -<%helpers:longhand name="line-height" animation_type="normal" +<%helpers:longhand name="line-height" animation_value_type="normal" spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height"> use std::fmt; use style_traits::ToCss; @@ -165,25 +165,25 @@ ${helpers.single_keyword("text-transform", "none capitalize uppercase lowercase", extra_gecko_values="full-width", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-text/#propdef-text-transform")} ${helpers.single_keyword("hyphens", "manual none auto", gecko_enum_prefix="StyleHyphens", - products="gecko", animation_type="none", extra_prefixes="moz", + products="gecko", animation_value_type="none", extra_prefixes="moz", spec="https://drafts.csswg.org/css-text/#propdef-hyphens")} // TODO: Support ${helpers.single_keyword("-moz-text-size-adjust", "auto none", gecko_constant_prefix="NS_STYLE_TEXT_SIZE_ADJUST", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.csswg.org/css-size-adjust/#adjustment-control", alias="-webkit-text-size-adjust")} ${helpers.predefined_type("text-indent", "LengthOrPercentage", "computed::LengthOrPercentage::Length(Au(0))", - animation_type="normal", + animation_value_type="normal", spec="https://drafts.csswg.org/css-text/#propdef-text-indent")} // Also known as "word-wrap" (which is more popular because of IE), but this is the preferred @@ -191,7 +191,7 @@ ${helpers.predefined_type("text-indent", ${helpers.single_keyword("overflow-wrap", "normal break-word", gecko_constant_prefix="NS_STYLE_OVERFLOWWRAP", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap", alias="word-wrap")} @@ -199,7 +199,7 @@ ${helpers.single_keyword("overflow-wrap", ${helpers.single_keyword("word-break", "normal break-all keep-all", gecko_constant_prefix="NS_STYLE_WORDBREAK", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-text/#propdef-word-break")} // TODO(pcwalton): Support `text-justify: distribute`. @@ -208,7 +208,7 @@ ${helpers.single_keyword("word-break", extra_gecko_values="inter-character" extra_specified="${'distribute' if product == 'gecko' else ''}" gecko_enum_prefix="StyleTextJustify" - animation_type="none" + animation_value_type="none" spec="https://drafts.csswg.org/css-text/#propdef-text-justify"> use values::HasViewportPercentage; no_viewport_percentage!(SpecifiedValue); @@ -248,11 +248,11 @@ ${helpers.single_keyword("text-align-last", "auto start end left right center justify", products="gecko", gecko_constant_prefix="NS_STYLE_TEXT_ALIGN", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-text/#propdef-text-align-last")} // TODO make this a shorthand and implement text-align-last/text-align-all -<%helpers:longhand name="text-align" animation_type="none" need_clone="True" +<%helpers:longhand name="text-align" animation_value_type="none" need_clone="True" spec="https://drafts.csswg.org/css-text/#propdef-text-align"> use values::computed::ComputedValueAsSpecified; use values::HasViewportPercentage; @@ -406,7 +406,7 @@ ${helpers.single_keyword("text-align-last", % endif -<%helpers:longhand name="letter-spacing" animation_type="normal" +<%helpers:longhand name="letter-spacing" animation_value_type="normal" spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing"> use std::fmt; use style_traits::ToCss; @@ -492,7 +492,7 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="word-spacing" animation_type="normal" +<%helpers:longhand name="word-spacing" animation_value_type="normal" spec="https://drafts.csswg.org/css-text/#propdef-word-spacing"> use std::fmt; use style_traits::ToCss; @@ -581,7 +581,7 @@ ${helpers.single_keyword("text-align-last", <%helpers:longhand name="-servo-text-decorations-in-effect" derived_from="display text-decoration" need_clone="True" products="servo" - animation_type="none" + animation_value_type="none" spec="Nonstandard (Internal property used by Servo)"> use cssparser::RGBA; use std::fmt; @@ -669,7 +669,7 @@ ${helpers.single_keyword("text-align-last", extra_gecko_values="-moz-pre-space" gecko_constant_prefix="NS_STYLE_WHITESPACE" needs_conversion="True" - animation_type="none" + animation_value_type="none" spec="https://drafts.csswg.org/css-text/#propdef-white-space"> use values::computed::ComputedValueAsSpecified; use values::HasViewportPercentage; @@ -711,7 +711,7 @@ ${helpers.single_keyword("text-align-last", % endif -<%helpers:longhand name="text-shadow" animation_type="normal" +<%helpers:longhand name="text-shadow" animation_value_type="normal" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-shadow"> use cssparser; use std::fmt; @@ -921,7 +921,8 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="text-emphasis-style" products="gecko" need_clone="True" boxed="True" animation_type="none" +<%helpers:longhand name="text-emphasis-style" products="gecko" need_clone="True" boxed="True" + animation_value_type="none" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-style"> use computed_values::writing_mode::T as writing_mode; use std::fmt; @@ -1129,7 +1130,7 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="text-emphasis-position" animation_type="none" products="gecko" +<%helpers:longhand name="text-emphasis-position" animation_value_type="none" products="gecko" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-position"> use std::fmt; use values::computed::ComputedValueAsSpecified; @@ -1204,7 +1205,7 @@ ${helpers.single_keyword("text-align-last", ${helpers.predefined_type("text-emphasis-color", "CSSColor", "::cssparser::Color::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_type="normal", + products="gecko", animation_value_type="normal", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-color")} @@ -1213,7 +1214,7 @@ ${helpers.predefined_type( "-moz-tab-size", "LengthOrNumber", "::values::Either::Second(8.0)", "parse_non_negative", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.csswg.org/css-text-3/#tab-size-property")} @@ -1222,7 +1223,7 @@ ${helpers.predefined_type( ${helpers.predefined_type( "-webkit-text-fill-color", "CSSColor", "CSSParserColor::CurrentColor", - products="gecko", animation_type="normal", + products="gecko", animation_value_type="normal", complex_color=True, need_clone=True, spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color")} @@ -1230,11 +1231,11 @@ ${helpers.predefined_type( "-webkit-text-stroke-color", "CSSColor", "CSSParserColor::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_type="normal", + products="gecko", animation_value_type="normal", complex_color=True, need_clone=True, spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")} -<%helpers:longhand products="gecko" name="-webkit-text-stroke-width" animation_type="none" +<%helpers:longhand products="gecko" name="-webkit-text-stroke-width" animation_value_type="none" spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width"> use app_units::Au; use std::fmt; @@ -1266,22 +1267,22 @@ ${helpers.predefined_type( // CSS Ruby Layout Module Level 1 // https://drafts.csswg.org/css-ruby/ ${helpers.single_keyword("ruby-align", "space-around start center space-between", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.csswg.org/css-ruby/#ruby-align-property")} ${helpers.single_keyword("ruby-position", "over under", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.csswg.org/css-ruby/#ruby-position-property")} // CSS Writing Modes Module Level 3 // https://drafts.csswg.org/css-writing-modes-3/ ${helpers.single_keyword("text-combine-upright", "none all", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.csswg.org/css-writing-modes-3/#text-combine-upright")} // SVG 1.1: Section 11 - Painting: Filling, Stroking and Marker Symbols ${helpers.single_keyword("text-rendering", "auto optimizespeed optimizelegibility geometricprecision", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG11/painting.html#TextRenderingProperty")} diff --git a/components/style/properties/longhand/list.mako.rs b/components/style/properties/longhand/list.mako.rs index 514e3bd6133..cf9cc65122d 100644 --- a/components/style/properties/longhand/list.mako.rs +++ b/components/style/properties/longhand/list.mako.rs @@ -6,7 +6,7 @@ <% data.new_style_struct("List", inherited=True) %> -${helpers.single_keyword("list-style-position", "outside inside", animation_type="none", +${helpers.single_keyword("list-style-position", "outside inside", animation_value_type="none", spec="https://drafts.csswg.org/css-lists/#propdef-list-style-position")} // TODO(pcwalton): Implement the full set of counter styles per CSS-COUNTER-STYLES [1] 6.1: @@ -34,14 +34,14 @@ ${helpers.single_keyword("list-style-type", """ """, gecko_constant_prefix="NS_STYLE_LIST_STYLE", needs_conversion="True", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type")} ${helpers.predefined_type("list-style-image", "UrlOrNone", "Either::Second(None_)", - initial_specified_value="Either::Second(None_)", animation_type="none", + initial_specified_value="Either::Second(None_)", animation_value_type="none", spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image")} -<%helpers:longhand name="quotes" animation_type="none" +<%helpers:longhand name="quotes" animation_value_type="none" spec="https://drafts.csswg.org/css-content/#propdef-quotes"> use cssparser::Token; use std::borrow::Cow; @@ -118,7 +118,7 @@ ${helpers.predefined_type("list-style-image", "UrlOrNone", "Either::Second(None_ ${helpers.predefined_type("-moz-image-region", "ClipRectOrAuto", "computed::ClipRectOrAuto::auto()", - animation_type="none", + animation_value_type="none", 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/margin.mako.rs b/components/style/properties/longhand/margin.mako.rs index e9a0f2f0a4c..f31a54c585d 100644 --- a/components/style/properties/longhand/margin.mako.rs +++ b/components/style/properties/longhand/margin.mako.rs @@ -15,6 +15,6 @@ ${helpers.predefined_type("margin-%s" % side[0], "LengthOrPercentageOrAuto", "computed::LengthOrPercentageOrAuto::Length(Au(0))", alias=maybe_moz_logical_alias(product, side, "-moz-margin-%s"), - animation_type="normal", logical = side[1], spec = spec, + animation_value_type="normal", logical = side[1], spec = spec, allowed_in_page_rule=True)} % endfor diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs index 810e3ed41c1..7ec8bd878b3 100644 --- a/components/style/properties/longhand/outline.mako.rs +++ b/components/style/properties/longhand/outline.mako.rs @@ -12,10 +12,10 @@ // TODO(pcwalton): `invert` ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - animation_type="normal", complex_color=True, need_clone=True, + animation_value_type="normal", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-ui/#propdef-outline-color")} -<%helpers:longhand name="outline-style" need_clone="True" animation_type="none" +<%helpers:longhand name="outline-style" need_clone="True" animation_value_type="none" spec="https://drafts.csswg.org/css-ui/#propdef-outline-style"> use std::fmt; @@ -64,7 +64,7 @@ ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::Curr } -<%helpers:longhand name="outline-width" animation_type="normal" +<%helpers:longhand name="outline-width" animation_value_type="normal" spec="https://drafts.csswg.org/css-ui/#propdef-outline-width"> use app_units::Au; use std::fmt; @@ -124,9 +124,9 @@ ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::Curr "computed::BorderRadiusSize::zero()", "parse", products="gecko", boxed=True, - animation_type="none", + animation_value_type="none", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)")} % endfor -${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo gecko", animation_type="normal", +${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo gecko", animation_value_type="normal", spec="https://drafts.csswg.org/css-ui/#propdef-outline-offset")} diff --git a/components/style/properties/longhand/padding.mako.rs b/components/style/properties/longhand/padding.mako.rs index 6f2596088ff..a36bf710f17 100644 --- a/components/style/properties/longhand/padding.mako.rs +++ b/components/style/properties/longhand/padding.mako.rs @@ -16,7 +16,7 @@ "computed::LengthOrPercentage::Length(Au(0))", "parse_non_negative", alias=maybe_moz_logical_alias(product, side, "-moz-padding-%s"), - animation_type="normal", + animation_value_type="normal", logical = side[1], spec = spec)} % endfor diff --git a/components/style/properties/longhand/pointing.mako.rs b/components/style/properties/longhand/pointing.mako.rs index 78f5809e58a..230fbfa8694 100644 --- a/components/style/properties/longhand/pointing.mako.rs +++ b/components/style/properties/longhand/pointing.mako.rs @@ -6,7 +6,7 @@ <% data.new_style_struct("Pointing", inherited=True, gecko_name="UserInterface") %> -<%helpers:longhand name="cursor" boxed="${product == 'gecko'}" animation_type="none" +<%helpers:longhand name="cursor" boxed="${product == 'gecko'}" animation_value_type="none" spec="https://drafts.csswg.org/css-ui/#cursor"> pub use self::computed_value::T as SpecifiedValue; use values::HasViewportPercentage; @@ -147,7 +147,7 @@ // NB: `pointer-events: auto` (and use of `pointer-events` in anything that isn't SVG, in fact) // is nonstandard, slated for CSS4-UI. // TODO(pcwalton): SVG-only values. -${helpers.single_keyword("pointer-events", "auto none", animation_type="none", +${helpers.single_keyword("pointer-events", "auto none", animation_value_type="none", extra_gecko_values="visiblepainted visiblefill visiblestroke visible painted fill stroke", spec="https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty")} @@ -155,14 +155,14 @@ ${helpers.single_keyword("-moz-user-input", "auto none enabled disabled", products="gecko", gecko_ffi_name="mUserInput", gecko_enum_prefix="StyleUserInput", gecko_inexhaustive=True, - animation_type="none", + animation_value_type="none", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-input)")} ${helpers.single_keyword("-moz-user-modify", "read-only read-write write-only", products="gecko", gecko_ffi_name="mUserModify", gecko_enum_prefix="StyleUserModify", needs_conversion=True, - animation_type="none", + animation_value_type="none", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-modify)")} ${helpers.single_keyword("-moz-user-focus", @@ -170,13 +170,13 @@ ${helpers.single_keyword("-moz-user-focus", products="gecko", gecko_ffi_name="mUserFocus", gecko_enum_prefix="StyleUserFocus", gecko_inexhaustive=True, - animation_type="none", + animation_value_type="none", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-focus)")} ${helpers.predefined_type("caret-color", "ColorOrAuto", "Either::Second(Auto)", spec="https://drafts.csswg.org/css-ui/#caret-color", - animation_type="normal", + animation_value_type="normal", boxed=True, products="gecko")} diff --git a/components/style/properties/longhand/position.mako.rs b/components/style/properties/longhand/position.mako.rs index eedab26f452..0da6bcbbc63 100644 --- a/components/style/properties/longhand/position.mako.rs +++ b/components/style/properties/longhand/position.mako.rs @@ -13,21 +13,21 @@ ${helpers.predefined_type(side, "LengthOrPercentageOrAuto", "computed::LengthOrPercentageOrAuto::Auto", spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side, - animation_type="normal")} + animation_value_type="normal")} % endfor // offset-* logical properties, map to "top" / "left" / "bottom" / "right" % for side in LOGICAL_SIDES: ${helpers.predefined_type("offset-%s" % side, "LengthOrPercentageOrAuto", "computed::LengthOrPercentageOrAuto::Auto", spec="https://drafts.csswg.org/css-logical-props/#propdef-offset-%s" % side, - animation_type="normal", logical=True)} + animation_value_type="normal", logical=True)} % endfor ${helpers.predefined_type("z-index", "IntegerOrAuto", "Either::Second(Auto)", spec="https://www.w3.org/TR/CSS2/visuren.html#z-index", flags="CREATES_STACKING_CONTEXT", - animation_type="normal")} + animation_value_type="normal")} // CSS Flexible Box Layout Module Level 1 @@ -36,25 +36,25 @@ ${helpers.predefined_type("z-index", "IntegerOrAuto", // Flex container properties ${helpers.single_keyword("flex-direction", "row row-reverse column column-reverse", spec="https://drafts.csswg.org/css-flexbox/#flex-direction-property", - extra_prefixes="webkit", animation_type="none")} + extra_prefixes="webkit", animation_value_type="none")} ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property", - extra_prefixes="webkit", animation_type="none")} + extra_prefixes="webkit", animation_value_type="none")} % if product == "servo": // FIXME: Update Servo to support the same Syntax as Gecko. ${helpers.single_keyword("justify-content", "flex-start stretch flex-end center space-between space-around", extra_prefixes="webkit", spec="https://drafts.csswg.org/css-align/#propdef-justify-content", - animation_type="none")} + animation_value_type="none")} % else: ${helpers.predefined_type(name="justify-content", type="AlignJustifyContent", initial_value="specified::AlignJustifyContent::normal()", spec="https://drafts.csswg.org/css-align/#propdef-justify-content", extra_prefixes="webkit", - animation_type="none")} + animation_value_type="none")} % endif % if product == "servo": @@ -62,33 +62,33 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", ${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around", extra_prefixes="webkit", spec="https://drafts.csswg.org/css-align/#propdef-align-content", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("align-items", "stretch flex-start flex-end center baseline", extra_prefixes="webkit", spec="https://drafts.csswg.org/css-flexbox/#align-items-property", - animation_type="discrete")} + animation_value_type="discrete")} % else: ${helpers.predefined_type(name="align-content", type="AlignJustifyContent", initial_value="specified::AlignJustifyContent::normal()", spec="https://drafts.csswg.org/css-align/#propdef-align-content", extra_prefixes="webkit", - animation_type="none")} + animation_value_type="none")} ${helpers.predefined_type(name="align-items", type="AlignItems", initial_value="specified::AlignItems::normal()", spec="https://drafts.csswg.org/css-align/#propdef-align-items", extra_prefixes="webkit", - animation_type="discrete")} + animation_value_type="discrete")} ${helpers.predefined_type(name="justify-items", type="JustifyItems", initial_value="specified::JustifyItems::auto()", spec="https://drafts.csswg.org/css-align/#propdef-justify-items", - animation_type="none")} + animation_value_type="none")} % endif // Flex item properties @@ -96,13 +96,13 @@ ${helpers.predefined_type("flex-grow", "Number", "0.0", "parse_non_negative", spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property", extra_prefixes="webkit", - animation_type="normal")} + animation_value_type="normal")} ${helpers.predefined_type("flex-shrink", "Number", "1.0", "parse_non_negative", spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property", extra_prefixes="webkit", - animation_type="normal")} + animation_value_type="normal")} // https://drafts.csswg.org/css-align/#align-self-property % if product == "servo": @@ -111,26 +111,26 @@ ${helpers.predefined_type("flex-shrink", "Number", need_clone=True, extra_prefixes="webkit", spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self", - animation_type="none")} + animation_value_type="none")} % else: ${helpers.predefined_type(name="align-self", type="AlignJustifySelf", initial_value="specified::AlignJustifySelf::auto()", spec="https://drafts.csswg.org/css-align/#align-self-property", extra_prefixes="webkit", - animation_type="none")} + animation_value_type="none")} ${helpers.predefined_type(name="justify-self", type="AlignJustifySelf", initial_value="specified::AlignJustifySelf::auto()", spec="https://drafts.csswg.org/css-align/#justify-self-property", - animation_type="none")} + animation_value_type="none")} % endif // https://drafts.csswg.org/css-flexbox/#propdef-order ${helpers.predefined_type("order", "Integer", "0", extra_prefixes="webkit", - animation_type="normal", + animation_value_type="normal", spec="https://drafts.csswg.org/css-flexbox/#order-property")} // FIXME: Gecko doesn't support content value yet. @@ -143,7 +143,7 @@ ${helpers.predefined_type("flex-basis", "parse_non_negative", spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property", extra_prefixes="webkit", - animation_type="normal" if product == "gecko" else "none")} + animation_value_type="normal" if product == "gecko" else "none")} % for (size, logical) in ALL_SIZES: <% @@ -157,7 +157,7 @@ ${helpers.predefined_type("flex-basis", "computed::LengthOrPercentageOrAuto::Auto", "parse_non_negative", spec=spec % size, - animation_type="normal", logical = logical)} + animation_value_type="normal", logical = logical)} % if product == "gecko": % for min_max in ["min", "max"]: <% @@ -171,7 +171,7 @@ ${helpers.predefined_type("flex-basis", // Keyword values are only valid in the inline direction; they must // be replaced with auto/none in block. <%helpers:longhand name="${min_max}-${size}" spec="${spec % ('%s-%s' % (min_max, size))}" - animation_type="normal" logical="${logical}" predefined_type="${MinMax}Length"> + animation_value_type="normal" logical="${logical}" predefined_type="${MinMax}Length"> use std::fmt; use style_traits::ToCss; @@ -253,13 +253,13 @@ ${helpers.predefined_type("flex-basis", "computed::LengthOrPercentage::Length(Au(0))", "parse_non_negative", spec=spec % ("min-%s" % size), - animation_type="normal", logical = logical)} + animation_value_type="normal", logical = logical)} ${helpers.predefined_type("max-%s" % size, "LengthOrPercentageOrNone", "computed::LengthOrPercentageOrNone::None", "parse_non_negative", spec=spec % ("min-%s" % size), - animation_type="normal", logical = logical)} + animation_value_type="normal", logical = logical)} % endif % endfor @@ -267,10 +267,10 @@ ${helpers.single_keyword("box-sizing", "content-box border-box", extra_prefixes="moz webkit", spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing", - animation_type="none")} + animation_value_type="none")} ${helpers.single_keyword("object-fit", "fill contain cover none scale-down", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.csswg.org/css-images/#propdef-object-fit")} ${helpers.predefined_type("object-position", @@ -279,21 +279,21 @@ ${helpers.predefined_type("object-position", products="gecko", boxed="True", spec="https://drafts.csswg.org/css-images-3/#the-object-position", - animation_type="normal")} + animation_value_type="normal")} % for kind in ["row", "column"]: ${helpers.predefined_type("grid-%s-gap" % kind, "LengthOrPercentage", "computed::LengthOrPercentage::Length(Au(0))", spec="https://drafts.csswg.org/css-grid/#propdef-grid-%s-gap" % kind, - animation_type="normal", + animation_value_type="normal", products="gecko")} % for range in ["start", "end"]: ${helpers.predefined_type("grid-%s-%s" % (kind, range), "GridLine", "Default::default()", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-grid/#propdef-grid-%s-%s" % (kind, range), products="gecko", boxed=True)} @@ -304,7 +304,7 @@ ${helpers.predefined_type("object-position", ${helpers.predefined_type("grid-auto-%ss" % kind, "TrackSize", "Default::default()", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-grid/#propdef-grid-auto-%ss" % kind, products="gecko", boxed=True)} @@ -313,7 +313,7 @@ ${helpers.predefined_type("object-position", <%helpers:longhand name="grid-auto-flow" spec="https://drafts.csswg.org/css-grid/#propdef-grid-auto-flow" products="gecko" - animation_type="none"> + animation_value_type="none"> use std::fmt; use style_traits::ToCss; use values::HasViewportPercentage; diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index ddcf86c35f6..90ac4bce1ce 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -11,11 +11,11 @@ ${helpers.single_keyword("dominant-baseline", """auto use-script no-change reset-size ideographic alphabetic hanging mathematical central middle text-after-edge text-before-edge""", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG11/text.html#DominantBaselineProperty")} ${helpers.single_keyword("vector-effect", "none non-scaling-stroke", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVGTiny12/painting.html#VectorEffectProperty")} // Section 13 - Gradients and Patterns @@ -24,12 +24,12 @@ ${helpers.predefined_type( "stop-color", "CSSColor", "CSSParserColor::RGBA(RGBA::new(0, 0, 0, 255))", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVGTiny12/painting.html#StopColorProperty")} ${helpers.predefined_type("stop-opacity", "Opacity", "1.0", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVGTiny12/painting.html#propdef-stop-opacity")} // Section 15 - Filter Effects @@ -38,27 +38,27 @@ ${helpers.predefined_type( "flood-color", "CSSColor", "CSSParserColor::RGBA(RGBA::new(0, 0, 0, 255))", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG/filters.html#FloodColorProperty")} ${helpers.predefined_type("flood-opacity", "Opacity", - "1.0", products="gecko", animation_type="none", + "1.0", products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG/filters.html#FloodOpacityProperty")} ${helpers.predefined_type( "lighting-color", "CSSColor", "CSSParserColor::RGBA(RGBA::new(255, 255, 255, 255))", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://www.w3.org/TR/SVG/filters.html#LightingColorProperty")} // CSS Masking Module Level 1 // https://drafts.fxtf.org/css-masking ${helpers.single_keyword("mask-type", "luminance alpha", - products="gecko", animation_type="none", + products="gecko", animation_value_type="none", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-type")} -<%helpers:longhand name="clip-path" animation_type="none" products="gecko" boxed="True" +<%helpers:longhand name="clip-path" animation_value_type="none" products="gecko" boxed="True" flags="CREATES_STACKING_CONTEXT" spec="https://drafts.fxtf.org/css-masking/#propdef-clip-path"> use std::fmt; @@ -91,10 +91,10 @@ ${helpers.single_keyword("mask-mode", "match-source alpha luminance", vector=True, products="gecko", - animation_type="none", + animation_value_type="none", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-mode")} -<%helpers:vector_longhand name="mask-repeat" products="gecko" animation_type="none" extra_prefixes="webkit" +<%helpers:vector_longhand name="mask-repeat" products="gecko" animation_value_type="none" extra_prefixes="webkit" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-repeat"> pub use properties::longhands::background_repeat::single_value::parse; pub use properties::longhands::background_repeat::single_value::SpecifiedValue; @@ -113,7 +113,7 @@ ${helpers.single_keyword("mask-mode", } -<%helpers:vector_longhand name="mask-position-x" products="gecko" animation_type="normal" extra_prefixes="webkit" +<%helpers:vector_longhand name="mask-position-x" products="gecko" animation_value_type="normal" extra_prefixes="webkit" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position"> pub use properties::longhands::background_position_x::single_value::get_initial_value; pub use properties::longhands::background_position_x::single_value::get_initial_position_value; @@ -141,7 +141,7 @@ ${helpers.single_keyword("mask-mode", } -<%helpers:vector_longhand name="mask-position-y" products="gecko" animation_type="normal" extra_prefixes="webkit" +<%helpers:vector_longhand name="mask-position-y" products="gecko" animation_value_type="normal" extra_prefixes="webkit" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position"> pub use properties::longhands::background_position_y::single_value::get_initial_value; pub use properties::longhands::background_position_y::single_value::get_initial_position_value; @@ -175,7 +175,7 @@ ${helpers.single_keyword("mask-clip", vector=True, products="gecko", extra_prefixes="webkit", - animation_type="none", + animation_value_type="none", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-clip")} ${helpers.single_keyword("mask-origin", @@ -184,10 +184,10 @@ ${helpers.single_keyword("mask-origin", vector=True, products="gecko", extra_prefixes="webkit", - animation_type="none", + animation_value_type="none", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin")} -<%helpers:longhand name="mask-size" products="gecko" animation_type="normal" extra_prefixes="webkit" +<%helpers:longhand name="mask-size" products="gecko" animation_value_type="normal" extra_prefixes="webkit" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size"> use properties::longhands::background_size; pub use ::properties::longhands::background_size::SpecifiedValue; @@ -209,10 +209,10 @@ ${helpers.single_keyword("mask-composite", vector=True, products="gecko", extra_prefixes="webkit", - animation_type="none", + animation_value_type="none", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-composite")} -<%helpers:vector_longhand name="mask-image" products="gecko" animation_type="none" extra_prefixes="webkit" +<%helpers:vector_longhand name="mask-image" products="gecko" animation_value_type="none" extra_prefixes="webkit" has_uncacheable_values="${product == 'gecko'}" flags="CREATES_STACKING_CONTEXT", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image"> diff --git a/components/style/properties/longhand/table.mako.rs b/components/style/properties/longhand/table.mako.rs index 9dfbb920d1e..3b1c8709a94 100644 --- a/components/style/properties/longhand/table.mako.rs +++ b/components/style/properties/longhand/table.mako.rs @@ -7,12 +7,12 @@ <% data.new_style_struct("Table", inherited=False) %> ${helpers.single_keyword("table-layout", "auto fixed", - gecko_ffi_name="mLayoutStrategy", animation_type="none", + gecko_ffi_name="mLayoutStrategy", animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-table-layout")} <%helpers:longhand name="-x-span" products="gecko" spec="Internal-only (for `` pres attr)" - animation_type="none" + animation_value_type="none" internal="True"> use values::HasViewportPercentage; use values::computed::ComputedValueAsSpecified; diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index 1cfc2803786..c9f17026ef3 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -12,7 +12,7 @@ Method("has_overline", "bool"), Method("has_line_through", "bool")]) %> -<%helpers:longhand name="text-overflow" animation_type="none" boxed="True" +<%helpers:longhand name="text-overflow" animation_value_type="none" boxed="True" spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow"> use std::fmt; use style_traits::ToCss; @@ -97,13 +97,13 @@ ${helpers.single_keyword("unicode-bidi", "normal embed isolate bidi-override isolate-override plaintext", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-writing-modes/#propdef-unicode-bidi")} // FIXME: This prop should be animatable. <%helpers:longhand name="text-decoration-line" custom_cascade="${product == 'servo'}" - animation_type="none" + animation_value_type="none" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line"> use std::fmt; use style_traits::ToCss; @@ -219,7 +219,7 @@ ${helpers.single_keyword("unicode-bidi", ${helpers.single_keyword("text-decoration-style", "solid double dotted dashed wavy -moz-none", products="gecko", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style")} ${helpers.predefined_type( @@ -228,11 +228,11 @@ ${helpers.predefined_type( initial_specified_value="specified::CSSColor::currentcolor()", complex_color=True, products="gecko", - animation_type="normal", + animation_value_type="normal", spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-color")} <%helpers:longhand name="initial-letter" - animation_type="none" + animation_value_type="none" products="gecko" spec="https://drafts.csswg.org/css-inline/#sizing-drop-initials"> use std::fmt; diff --git a/components/style/properties/longhand/ui.mako.rs b/components/style/properties/longhand/ui.mako.rs index 4bc32c6cc9d..dff6e846050 100644 --- a/components/style/properties/longhand/ui.mako.rs +++ b/components/style/properties/longhand/ui.mako.rs @@ -13,7 +13,7 @@ // we should probably remove from gecko (https://bugzilla.mozilla.org/show_bug.cgi?id=1328331) ${helpers.single_keyword("ime-mode", "auto normal active disabled inactive", products="gecko", gecko_ffi_name="mIMEMode", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-ui/#input-method-editor")} ${helpers.single_keyword("-moz-user-select", "auto text none all element elements" + @@ -22,11 +22,11 @@ ${helpers.single_keyword("-moz-user-select", "auto text none all element element alias="-webkit-user-select", gecko_ffi_name="mUserSelect", gecko_enum_prefix="StyleUserSelect", - animation_type="none", + animation_value_type="none", spec="https://drafts.csswg.org/css-ui-4/#propdef-user-select")} ${helpers.single_keyword("-moz-window-dragging", "default drag no-drag", products="gecko", gecko_ffi_name="mWindowDragging", gecko_enum_prefix="StyleWindowDragging", - animation_type="none", + animation_value_type="none", spec="None (Nonstandard Firefox-only property)")} diff --git a/components/style/properties/longhand/xul.mako.rs b/components/style/properties/longhand/xul.mako.rs index b59c36f002d..e86e3fc9ee1 100644 --- a/components/style/properties/longhand/xul.mako.rs +++ b/components/style/properties/longhand/xul.mako.rs @@ -12,20 +12,20 @@ ${helpers.single_keyword("-moz-box-align", "stretch start center baseline end", products="gecko", gecko_ffi_name="mBoxAlign", gecko_enum_prefix="StyleBoxAlign", gecko_inexhaustive=True, - animation_type="none", + animation_value_type="none", alias="-webkit-box-align", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-align)")} ${helpers.single_keyword("-moz-box-direction", "normal reverse", products="gecko", gecko_ffi_name="mBoxDirection", gecko_enum_prefix="StyleBoxDirection", - animation_type="none", + animation_value_type="none", alias="-webkit-box-direction", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-direction)")} ${helpers.predefined_type("-moz-box-flex", "Number", "0.0", "parse_non_negative", products="gecko", gecko_ffi_name="mBoxFlex", - animation_type="none", + animation_value_type="none", alias="-webkit-box-flex", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)")} @@ -33,21 +33,21 @@ ${helpers.single_keyword("-moz-box-orient", "horizontal vertical", products="gecko", gecko_ffi_name="mBoxOrient", extra_gecko_aliases="inline-axis=horizontal block-axis=vertical", gecko_enum_prefix="StyleBoxOrient", - animation_type="none", + animation_value_type="none", alias="-webkit-box-orient", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-orient)")} ${helpers.single_keyword("-moz-box-pack", "start center end justify", products="gecko", gecko_ffi_name="mBoxPack", gecko_enum_prefix="StyleBoxPack", - animation_type="none", + animation_value_type="none", alias="-webkit-box-pack", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-pack)")} ${helpers.single_keyword("-moz-stack-sizing", "stretch-to-fit ignore", products="gecko", gecko_ffi_name="mStretchStack", gecko_constant_prefix="NS_STYLE_STACK_SIZING", - animation_type="none", + animation_value_type="none", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-stack-sizing)")} ${helpers.predefined_type("-moz-box-ordinal-group", "Integer", "0", @@ -55,5 +55,5 @@ ${helpers.predefined_type("-moz-box-ordinal-group", "Integer", "0", products="gecko", alias="-webkit-box-ordinal-group", gecko_ffi_name="mBoxOrdinal", - animation_type="none", + animation_value_type="none", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-box-ordinal-group)")} From ce51ff3a9af1e673c22dc2a6e0b89cbb8f115958 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:19:31 +0900 Subject: [PATCH 03/14] Check animation_value_type is not 'discrete' instead of 'normal' for ComputeDistance. We will introduce various new animation_value_type in subsequent patches, so we should just check 'discrete' type for properties that we can't compute distance. --- components/style/properties/helpers/animated_properties.mako.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index c353f66ff3c..4f2d0c0b574 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2100,7 +2100,7 @@ impl ComputeDistance for AnimationValue { match (self, other) { % for prop in data.longhands: % if prop.animatable: - % if prop.animation_value_type == "normal": + % if prop.animation_value_type != "discrete": (&AnimationValue::${prop.camel_case}(ref from), &AnimationValue::${prop.camel_case}(ref to)) => { from.compute_distance(to) From e47d30f668b755385680dd1dc21eb0edc5d2f7e9 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:19:46 +0900 Subject: [PATCH 04/14] Rename 'normal' of animation_value_type to 'ComputedValue'. --- components/style/properties/data.py | 2 +- .../properties/longhand/background.mako.rs | 8 +++--- .../style/properties/longhand/border.mako.rs | 6 ++--- .../style/properties/longhand/box.mako.rs | 16 ++++++----- .../style/properties/longhand/color.mako.rs | 2 +- .../style/properties/longhand/column.mako.rs | 10 +++---- .../style/properties/longhand/effects.mako.rs | 6 ++--- .../style/properties/longhand/font.mako.rs | 6 ++--- .../properties/longhand/inherited_box.mako.rs | 2 +- .../properties/longhand/inherited_svg.mako.rs | 4 +-- .../longhand/inherited_text.mako.rs | 16 +++++------ .../style/properties/longhand/margin.mako.rs | 2 +- .../style/properties/longhand/outline.mako.rs | 7 ++--- .../style/properties/longhand/padding.mako.rs | 2 +- .../properties/longhand/pointing.mako.rs | 2 +- .../properties/longhand/position.mako.rs | 27 ++++++++++--------- .../style/properties/longhand/svg.mako.rs | 8 +++--- .../style/properties/longhand/text.mako.rs | 2 +- 18 files changed, 67 insertions(+), 61 deletions(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index d01ba34e009..1c9c0ea794f 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -178,7 +178,7 @@ class Longhand(object): # really random. if animation_value_type is None: raise TypeError("animation_value_type should be specified for (" + name + ")") - animation_value_types = ["none", "normal", "discrete"] + animation_value_types = ["none", "discrete", "ComputedValue"] if animation_value_type not in animation_value_types: raise TypeError("animation_value_type should be one of (" + str(animation_value_types) + ")") diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 16981f7cc0b..3ff33c0981d 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -10,7 +10,7 @@ ${helpers.predefined_type("background-color", "CSSColor", "::cssparser::Color::RGBA(::cssparser::RGBA::transparent())", initial_specified_value="SpecifiedValue::transparent()", spec="https://drafts.csswg.org/css-backgrounds/#background-color", - animation_value_type="normal", complex_color=True)} + animation_value_type="ComputedValue", complex_color=True)} <%helpers:vector_longhand name="background-image" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#the-background-image" @@ -89,7 +89,7 @@ ${helpers.predefined_type("background-color", "CSSColor", } -<%helpers:vector_longhand name="background-position-x" animation_value_type="normal" +<%helpers:vector_longhand name="background-position-x" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-x" delegate_animate="True"> use std::fmt; @@ -140,7 +140,7 @@ ${helpers.predefined_type("background-color", "CSSColor", } -<%helpers:vector_longhand name="background-position-y" animation_value_type="normal" +<%helpers:vector_longhand name="background-position-y" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-y" delegate_animate="True"> use std::fmt; @@ -323,7 +323,7 @@ ${helpers.single_keyword("background-origin", spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin", animation_value_type="none")} -<%helpers:vector_longhand name="background-size" animation_value_type="normal" extra_prefixes="webkit" +<%helpers:vector_longhand name="background-size" animation_value_type="ComputedValue" extra_prefixes="webkit" spec="https://drafts.csswg.org/css-backgrounds/#the-background-size"> use cssparser::Token; use std::ascii::AsciiExt; diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index a825d6bea50..be4b76a1a10 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -20,7 +20,7 @@ "::cssparser::Color::CurrentColor", alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-color"), spec=maybe_logical_spec(side, "color"), - animation_value_type="normal", logical = side[1])} + animation_value_type="ComputedValue", logical = side[1])} % endfor % for side in ALL_SIDES: @@ -36,7 +36,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style', "none solid double dotted dashed hidden groove ridge inset outset"), type="::values::specified::BorderStyle")} % for side in ALL_SIDES: - <%helpers:longhand name="border-${side[0]}-width" animation_value_type="normal" logical="${side[1]}" + <%helpers:longhand name="border-${side[0]}-width" animation_value_type="ComputedValue" logical="${side[1]}" alias="${maybe_moz_logical_alias(product, side, '-moz-border-%s-width')}" spec="${maybe_logical_spec(side, 'width')}"> use app_units::Au; @@ -70,7 +70,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style', "parse", extra_prefixes="webkit", spec="https://drafts.csswg.org/css-backgrounds/#border-%s-radius" % corner, boxed=True, - animation_value_type="normal")} + animation_value_type="ComputedValue")} % endfor ${helpers.single_keyword("box-decoration-break", "slice clone", diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 26f051bf456..73adf4aa335 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -211,7 +211,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed", -<%helpers:longhand name="vertical-align" animation_value_type="normal" +<%helpers:longhand name="vertical-align" animation_value_type="ComputedValue" spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align"> use std::fmt; use style_traits::ToCss; @@ -1100,7 +1100,7 @@ ${helpers.predefined_type("scroll-snap-destination", products="gecko", boxed="True", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)", - animation_value_type="normal")} + animation_value_type="ComputedValue")} ${helpers.predefined_type("scroll-snap-coordinate", "Position", @@ -1108,14 +1108,14 @@ ${helpers.predefined_type("scroll-snap-coordinate", vector=True, products="gecko", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)", - animation_value_type="normal", + animation_value_type="ComputedValue", allow_empty=True, delegate_animate=True)} <%helpers:longhand name="transform" extra_prefixes="webkit" - animation_value_type="normal" + animation_value_type="ComputedValue" flags="CREATES_STACKING_CONTEXT FIXPOS_CB" spec="https://drafts.csswg.org/css-transforms/#propdef-transform"> use app_units::Au; @@ -2094,9 +2094,11 @@ ${helpers.predefined_type("perspective", spec="https://drafts.csswg.org/css-transforms/#perspective", extra_prefixes="moz webkit", flags="CREATES_STACKING_CONTEXT FIXPOS_CB", - animation_value_type="normal")} + animation_value_type="ComputedValue")} -<%helpers:longhand name="perspective-origin" boxed="True" animation_value_type="normal" extra_prefixes="moz webkit" +<%helpers:longhand name="perspective-origin" boxed="True" + animation_value_type="ComputedValue" + extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-transforms/#perspective-origin-property"> use std::fmt; use style_traits::ToCss; @@ -2194,7 +2196,7 @@ ${helpers.single_keyword("transform-style", flags="CREATES_STACKING_CONTEXT FIXPOS_CB", animation_value_type="none")} -<%helpers:longhand name="transform-origin" animation_value_type="normal" extra_prefixes="moz webkit" boxed="True" +<%helpers:longhand name="transform-origin" animation_value_type="ComputedValue" extra_prefixes="moz webkit" boxed="True" spec="https://drafts.csswg.org/css-transforms/#transform-origin-property"> use app_units::Au; use std::fmt; diff --git a/components/style/properties/longhand/color.mako.rs b/components/style/properties/longhand/color.mako.rs index 18812044f03..472bdc7b9f0 100644 --- a/components/style/properties/longhand/color.mako.rs +++ b/components/style/properties/longhand/color.mako.rs @@ -8,7 +8,7 @@ <% from data import to_rust_ident %> -<%helpers:longhand name="color" need_clone="True" animation_value_type="normal" +<%helpers:longhand name="color" need_clone="True" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-color/#color"> use cssparser::RGBA; use std::fmt; diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index e1e32e9d20a..44f02ad3dbf 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -12,7 +12,7 @@ ${helpers.predefined_type("column-width", initial_specified_value="Either::Second(Auto)", parse_method="parse_non_negative_length", extra_prefixes="moz", - animation_value_type="normal", + animation_value_type="ComputedValue", experimental=True, spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")} @@ -23,7 +23,7 @@ ${helpers.predefined_type("column-count", parse_method="parse_positive", initial_specified_value="Either::Second(Auto)", experimental="True", - animation_value_type="normal", + animation_value_type="ComputedValue", extra_prefixes="moz", spec="https://drafts.csswg.org/css-multicol/#propdef-column-count")} @@ -33,7 +33,7 @@ ${helpers.predefined_type("column-gap", parse_method='parse_non_negative_length', extra_prefixes="moz", experimental=True, - animation_value_type="normal", + animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")} ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", @@ -41,7 +41,7 @@ ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", spec="https://drafts.csswg.org/css-multicol/#propdef-column-fill")} // https://drafts.csswg.org/css-multicol-1/#propdef-column-rule-width -<%helpers:longhand name="column-rule-width" products="gecko" animation_value_type="normal" extra_prefixes="moz" +<%helpers:longhand name="column-rule-width" products="gecko" animation_value_type="ComputedValue" extra_prefixes="moz" spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width"> use app_units::Au; use std::fmt; @@ -75,7 +75,7 @@ ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", ${helpers.predefined_type("column-rule-color", "CSSColor", "::cssparser::Color::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_value_type="normal", extra_prefixes="moz", + products="gecko", animation_value_type="ComputedValue", extra_prefixes="moz", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-color")} diff --git a/components/style/properties/longhand/effects.mako.rs b/components/style/properties/longhand/effects.mako.rs index 9970b964fcd..bb26426b583 100644 --- a/components/style/properties/longhand/effects.mako.rs +++ b/components/style/properties/longhand/effects.mako.rs @@ -10,12 +10,12 @@ ${helpers.predefined_type("opacity", "Opacity", "1.0", - animation_value_type="normal", + animation_value_type="ComputedValue", flags="CREATES_STACKING_CONTEXT", spec="https://drafts.csswg.org/css-color/#opacity")} <%helpers:vector_longhand name="box-shadow" allow_empty="True" - animation_value_type="normal" extra_prefixes="webkit" + animation_value_type="ComputedValue" extra_prefixes="webkit" spec="https://drafts.csswg.org/css-backgrounds/#box-shadow"> use cssparser; use std::fmt; @@ -80,7 +80,7 @@ ${helpers.predefined_type("opacity", ${helpers.predefined_type("clip", "ClipRectOrAuto", "computed::ClipRectOrAuto::auto()", - animation_value_type="normal", + animation_value_type="ComputedValue", boxed="True", spec="https://drafts.fxtf.org/css-masking/#clip-property")} diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 65edd9914f3..b3e166b052d 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -351,7 +351,7 @@ ${helpers.single_keyword_system("font-variant-caps", custom_consts=font_variant_caps_custom_consts, animation_value_type="none")} -<%helpers:longhand name="font-weight" need_clone="True" animation_value_type="normal" +<%helpers:longhand name="font-weight" need_clone="True" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight"> use std::fmt; use style_traits::ToCss; @@ -549,7 +549,7 @@ ${helpers.single_keyword_system("font-variant-caps", } -<%helpers:longhand name="font-size" need_clone="True" animation_value_type="normal" +<%helpers:longhand name="font-size" need_clone="True" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-fonts/#propdef-font-size"> use app_units::Au; use properties::longhands::system_font::SystemFont; @@ -934,7 +934,7 @@ ${helpers.single_keyword_system("font-variant-caps", } -<%helpers:longhand products="gecko" name="font-size-adjust" animation_value_type="normal" +<%helpers:longhand products="gecko" name="font-size-adjust" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-fonts/#propdef-font-size-adjust"> use properties::longhands::system_font::SystemFont; use std::fmt; diff --git a/components/style/properties/longhand/inherited_box.mako.rs b/components/style/properties/longhand/inherited_box.mako.rs index 92c8720b495..01ee640f852 100644 --- a/components/style/properties/longhand/inherited_box.mako.rs +++ b/components/style/properties/longhand/inherited_box.mako.rs @@ -11,7 +11,7 @@ ${helpers.single_keyword("visibility", "visible hidden", extra_gecko_values="collapse", gecko_ffi_name="mVisible", - animation_value_type="normal", + animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-box/#propdef-visibility")} // CSS Writing Modes Level 3 diff --git a/components/style/properties/longhand/inherited_svg.mako.rs b/components/style/properties/longhand/inherited_svg.mako.rs index 51f952c6697..480f4a7adfb 100644 --- a/components/style/properties/longhand/inherited_svg.mako.rs +++ b/components/style/properties/longhand/inherited_svg.mako.rs @@ -70,7 +70,7 @@ ${helpers.predefined_type( "computed::LengthOrPercentage::one()", "parse_numbers_are_pixels_non_negative", products="gecko", - animation_value_type="normal", + animation_value_type="ComputedValue", spec="https://www.w3.org/TR/SVG2/painting.html#StrokeWidth")} ${helpers.single_keyword("stroke-linecap", "butt round square", @@ -106,7 +106,7 @@ ${helpers.predefined_type( "computed::LengthOrPercentage::zero()", "parse_numbers_are_pixels", products="gecko", - animation_value_type="normal", + animation_value_type="ComputedValue", spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing")} // Section 14 - Clipping, Masking and Compositing diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index e5ab05155df..4238d23222d 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -6,7 +6,7 @@ <% from data import Keyword %> <% data.new_style_struct("InheritedText", inherited=True, gecko_name="Text") %> -<%helpers:longhand name="line-height" animation_value_type="normal" +<%helpers:longhand name="line-height" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height"> use std::fmt; use style_traits::ToCss; @@ -183,7 +183,7 @@ ${helpers.single_keyword("-moz-text-size-adjust", "auto none", ${helpers.predefined_type("text-indent", "LengthOrPercentage", "computed::LengthOrPercentage::Length(Au(0))", - animation_value_type="normal", + animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-text/#propdef-text-indent")} // Also known as "word-wrap" (which is more popular because of IE), but this is the preferred @@ -406,7 +406,7 @@ ${helpers.single_keyword("text-align-last", % endif -<%helpers:longhand name="letter-spacing" animation_value_type="normal" +<%helpers:longhand name="letter-spacing" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing"> use std::fmt; use style_traits::ToCss; @@ -492,7 +492,7 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="word-spacing" animation_value_type="normal" +<%helpers:longhand name="word-spacing" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-text/#propdef-word-spacing"> use std::fmt; use style_traits::ToCss; @@ -711,7 +711,7 @@ ${helpers.single_keyword("text-align-last", % endif -<%helpers:longhand name="text-shadow" animation_value_type="normal" +<%helpers:longhand name="text-shadow" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-shadow"> use cssparser; use std::fmt; @@ -1205,7 +1205,7 @@ ${helpers.single_keyword("text-align-last", ${helpers.predefined_type("text-emphasis-color", "CSSColor", "::cssparser::Color::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_value_type="normal", + products="gecko", animation_value_type="ComputedValue", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-color")} @@ -1223,7 +1223,7 @@ ${helpers.predefined_type( ${helpers.predefined_type( "-webkit-text-fill-color", "CSSColor", "CSSParserColor::CurrentColor", - products="gecko", animation_value_type="normal", + products="gecko", animation_value_type="ComputedValue", complex_color=True, need_clone=True, spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color")} @@ -1231,7 +1231,7 @@ ${helpers.predefined_type( "-webkit-text-stroke-color", "CSSColor", "CSSParserColor::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_value_type="normal", + products="gecko", animation_value_type="ComputedValue", complex_color=True, need_clone=True, spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")} diff --git a/components/style/properties/longhand/margin.mako.rs b/components/style/properties/longhand/margin.mako.rs index f31a54c585d..1fe4e7cca61 100644 --- a/components/style/properties/longhand/margin.mako.rs +++ b/components/style/properties/longhand/margin.mako.rs @@ -15,6 +15,6 @@ ${helpers.predefined_type("margin-%s" % side[0], "LengthOrPercentageOrAuto", "computed::LengthOrPercentageOrAuto::Length(Au(0))", alias=maybe_moz_logical_alias(product, side, "-moz-margin-%s"), - animation_value_type="normal", logical = side[1], spec = spec, + animation_value_type="ComputedValue", logical = side[1], spec = spec, allowed_in_page_rule=True)} % endfor diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs index 7ec8bd878b3..c5112047e2c 100644 --- a/components/style/properties/longhand/outline.mako.rs +++ b/components/style/properties/longhand/outline.mako.rs @@ -12,7 +12,7 @@ // TODO(pcwalton): `invert` ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - animation_value_type="normal", complex_color=True, need_clone=True, + animation_value_type="ComputedValue", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-ui/#propdef-outline-color")} <%helpers:longhand name="outline-style" need_clone="True" animation_value_type="none" @@ -64,7 +64,7 @@ ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::Curr } -<%helpers:longhand name="outline-width" animation_value_type="normal" +<%helpers:longhand name="outline-width" animation_value_type="ComputedValue" spec="https://drafts.csswg.org/css-ui/#propdef-outline-width"> use app_units::Au; use std::fmt; @@ -128,5 +128,6 @@ ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::Curr spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)")} % endfor -${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo gecko", animation_value_type="normal", +${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo gecko", + animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-ui/#propdef-outline-offset")} diff --git a/components/style/properties/longhand/padding.mako.rs b/components/style/properties/longhand/padding.mako.rs index a36bf710f17..593deb769ac 100644 --- a/components/style/properties/longhand/padding.mako.rs +++ b/components/style/properties/longhand/padding.mako.rs @@ -16,7 +16,7 @@ "computed::LengthOrPercentage::Length(Au(0))", "parse_non_negative", alias=maybe_moz_logical_alias(product, side, "-moz-padding-%s"), - animation_value_type="normal", + animation_value_type="ComputedValue", logical = side[1], spec = spec)} % endfor diff --git a/components/style/properties/longhand/pointing.mako.rs b/components/style/properties/longhand/pointing.mako.rs index 230fbfa8694..de7d56ae66a 100644 --- a/components/style/properties/longhand/pointing.mako.rs +++ b/components/style/properties/longhand/pointing.mako.rs @@ -177,6 +177,6 @@ ${helpers.predefined_type("caret-color", "ColorOrAuto", "Either::Second(Auto)", spec="https://drafts.csswg.org/css-ui/#caret-color", - animation_value_type="normal", + animation_value_type="ComputedValue", boxed=True, products="gecko")} diff --git a/components/style/properties/longhand/position.mako.rs b/components/style/properties/longhand/position.mako.rs index 0da6bcbbc63..3f995b10873 100644 --- a/components/style/properties/longhand/position.mako.rs +++ b/components/style/properties/longhand/position.mako.rs @@ -13,21 +13,21 @@ ${helpers.predefined_type(side, "LengthOrPercentageOrAuto", "computed::LengthOrPercentageOrAuto::Auto", spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side, - animation_value_type="normal")} + animation_value_type="ComputedValue")} % endfor // offset-* logical properties, map to "top" / "left" / "bottom" / "right" % for side in LOGICAL_SIDES: ${helpers.predefined_type("offset-%s" % side, "LengthOrPercentageOrAuto", "computed::LengthOrPercentageOrAuto::Auto", spec="https://drafts.csswg.org/css-logical-props/#propdef-offset-%s" % side, - animation_value_type="normal", logical=True)} + animation_value_type="ComputedValue", logical=True)} % endfor ${helpers.predefined_type("z-index", "IntegerOrAuto", "Either::Second(Auto)", spec="https://www.w3.org/TR/CSS2/visuren.html#z-index", flags="CREATES_STACKING_CONTEXT", - animation_value_type="normal")} + animation_value_type="ComputedValue")} // CSS Flexible Box Layout Module Level 1 @@ -96,13 +96,13 @@ ${helpers.predefined_type("flex-grow", "Number", "0.0", "parse_non_negative", spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property", extra_prefixes="webkit", - animation_value_type="normal")} + animation_value_type="ComputedValue")} ${helpers.predefined_type("flex-shrink", "Number", "1.0", "parse_non_negative", spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property", extra_prefixes="webkit", - animation_value_type="normal")} + animation_value_type="ComputedValue")} // https://drafts.csswg.org/css-align/#align-self-property % if product == "servo": @@ -130,7 +130,7 @@ ${helpers.predefined_type("flex-shrink", "Number", // https://drafts.csswg.org/css-flexbox/#propdef-order ${helpers.predefined_type("order", "Integer", "0", extra_prefixes="webkit", - animation_value_type="normal", + animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-flexbox/#order-property")} // FIXME: Gecko doesn't support content value yet. @@ -143,7 +143,7 @@ ${helpers.predefined_type("flex-basis", "parse_non_negative", spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property", extra_prefixes="webkit", - animation_value_type="normal" if product == "gecko" else "none")} + animation_value_type="ComputedValue" if product == "gecko" else "none")} % for (size, logical) in ALL_SIZES: <% @@ -157,7 +157,7 @@ ${helpers.predefined_type("flex-basis", "computed::LengthOrPercentageOrAuto::Auto", "parse_non_negative", spec=spec % size, - animation_value_type="normal", logical = logical)} + animation_value_type="ComputedValue", logical = logical)} % if product == "gecko": % for min_max in ["min", "max"]: <% @@ -171,7 +171,8 @@ ${helpers.predefined_type("flex-basis", // Keyword values are only valid in the inline direction; they must // be replaced with auto/none in block. <%helpers:longhand name="${min_max}-${size}" spec="${spec % ('%s-%s' % (min_max, size))}" - animation_value_type="normal" logical="${logical}" predefined_type="${MinMax}Length"> + animation_value_type="ComputedValue" + logical="${logical}" predefined_type="${MinMax}Length"> use std::fmt; use style_traits::ToCss; @@ -253,13 +254,13 @@ ${helpers.predefined_type("flex-basis", "computed::LengthOrPercentage::Length(Au(0))", "parse_non_negative", spec=spec % ("min-%s" % size), - animation_value_type="normal", logical = logical)} + animation_value_type="ComputedValue", logical = logical)} ${helpers.predefined_type("max-%s" % size, "LengthOrPercentageOrNone", "computed::LengthOrPercentageOrNone::None", "parse_non_negative", spec=spec % ("min-%s" % size), - animation_value_type="normal", logical = logical)} + animation_value_type="ComputedValue", logical = logical)} % endif % endfor @@ -279,14 +280,14 @@ ${helpers.predefined_type("object-position", products="gecko", boxed="True", spec="https://drafts.csswg.org/css-images-3/#the-object-position", - animation_value_type="normal")} + animation_value_type="ComputedValue")} % for kind in ["row", "column"]: ${helpers.predefined_type("grid-%s-gap" % kind, "LengthOrPercentage", "computed::LengthOrPercentage::Length(Au(0))", spec="https://drafts.csswg.org/css-grid/#propdef-grid-%s-gap" % kind, - animation_value_type="normal", + animation_value_type="ComputedValue", products="gecko")} % for range in ["start", "end"]: diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index 90ac4bce1ce..eb9f9156a42 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -113,7 +113,8 @@ ${helpers.single_keyword("mask-mode", } -<%helpers:vector_longhand name="mask-position-x" products="gecko" animation_value_type="normal" extra_prefixes="webkit" +<%helpers:vector_longhand name="mask-position-x" products="gecko" + animation_value_type="ComputedValue" extra_prefixes="webkit" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position"> pub use properties::longhands::background_position_x::single_value::get_initial_value; pub use properties::longhands::background_position_x::single_value::get_initial_position_value; @@ -141,7 +142,8 @@ ${helpers.single_keyword("mask-mode", } -<%helpers:vector_longhand name="mask-position-y" products="gecko" animation_value_type="normal" extra_prefixes="webkit" +<%helpers:vector_longhand name="mask-position-y" products="gecko" + animation_value_type="ComputedValue" extra_prefixes="webkit" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position"> pub use properties::longhands::background_position_y::single_value::get_initial_value; pub use properties::longhands::background_position_y::single_value::get_initial_position_value; @@ -187,7 +189,7 @@ ${helpers.single_keyword("mask-origin", animation_value_type="none", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin")} -<%helpers:longhand name="mask-size" products="gecko" animation_value_type="normal" extra_prefixes="webkit" +<%helpers:longhand name="mask-size" products="gecko" animation_value_type="ComputedValue" extra_prefixes="webkit" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size"> use properties::longhands::background_size; pub use ::properties::longhands::background_size::SpecifiedValue; diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index c9f17026ef3..e042c43e047 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -228,7 +228,7 @@ ${helpers.predefined_type( initial_specified_value="specified::CSSColor::currentcolor()", complex_color=True, products="gecko", - animation_value_type="normal", + animation_value_type="ComputedValue", spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-color")} <%helpers:longhand name="initial-letter" From d70e4aa2291a8e942040c16572b17a5974bb3e85 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:20:05 +0900 Subject: [PATCH 05/14] Use IntermediateRGBA to store overflowed RGBA components during interpolation. --- components/style/properties/data.py | 6 +-- .../helpers/animated_properties.mako.rs | 49 +++++++++++++++++-- .../style/properties/longhand/color.mako.rs | 3 +- 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 1c9c0ea794f..c935e00a79f 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -178,13 +178,11 @@ class Longhand(object): # really random. if animation_value_type is None: raise TypeError("animation_value_type should be specified for (" + name + ")") - animation_value_types = ["none", "discrete", "ComputedValue"] - if animation_value_type not in animation_value_types: - raise TypeError("animation_value_type should be one of (" + - str(animation_value_types) + ")") self.animation_value_type = animation_value_type self.animatable = animation_value_type != "none" + self.is_animatable_with_computed_value = animation_value_type == "ComputedValue" \ + or animation_value_type == "discrete" if self.logical: # Logical properties will be animatable (i.e. the animation type is # discrete). For now, it is still non-animatable. diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 4f2d0c0b574..c3fcef2f51e 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -384,7 +384,11 @@ pub enum AnimationValue { % for prop in data.longhands: % if prop.animatable: /// ${prop.name} - ${prop.camel_case}(longhands::${prop.ident}::computed_value::T), + % if prop.is_animatable_with_computed_value: + ${prop.camel_case}(longhands::${prop.ident}::computed_value::T), + % else: + ${prop.camel_case}(${prop.animation_value_type}), + % endif % endif % endfor } @@ -402,7 +406,13 @@ impl AnimationValue { % if prop.boxed: Box::new(longhands::${prop.ident}::SpecifiedValue::from_computed_value(from))) % else: - longhands::${prop.ident}::SpecifiedValue::from_computed_value(from)) + longhands::${prop.ident}::SpecifiedValue::from_computed_value( + % if prop.is_animatable_with_computed_value: + from + % else: + &from.into() + % endif + )) % endif } % endif @@ -426,7 +436,13 @@ impl AnimationValue { longhands::system_font::resolve_system_font(sf, context); } % endif - Some(AnimationValue::${prop.camel_case}(val.to_computed_value(context))) + Some(AnimationValue::${prop.camel_case}( + % if prop.is_animatable_with_computed_value: + val.to_computed_value(context) + % else: + From::from(&val.to_computed_value(context)) + % endif + )) }, % endif % endfor @@ -454,6 +470,9 @@ impl AnimationValue { inherit_struct.clone_${prop.ident}() }, }; + % if not prop.is_animatable_with_computed_value: + let computed = From::from(&computed); + % endif Some(AnimationValue::${prop.camel_case}(computed)) }, % endif @@ -514,7 +533,12 @@ impl AnimationValue { % if prop.animatable: TransitionProperty::${prop.camel_case} => { AnimationValue::${prop.camel_case}( + % if prop.is_animatable_with_computed_value: computed_values.get_${prop.style_struct.ident.strip("_")}().clone_${prop.ident}()) + % else: + From::from(&computed_values.get_${prop.style_struct.ident.strip("_")}() + .clone_${prop.ident}())) + % endif } % endif % endfor @@ -2041,6 +2065,25 @@ impl Interpolate for Either } } +impl <'a> From<<&'a IntermediateRGBA> for RGBA { + fn from(extended_rgba: &IntermediateRGBA) -> RGBA { + // RGBA::from_floats clamps each component values. + RGBA::from_floats(extended_rgba.red, + extended_rgba.green, + extended_rgba.blue, + extended_rgba.alpha) + } +} + +impl <'a> From<<&'a RGBA> for IntermediateRGBA { + fn from(rgba: &RGBA) -> IntermediateRGBA { + IntermediateRGBA::new(rgba.red_f32(), + rgba.green_f32(), + rgba.blue_f32(), + rgba.alpha_f32()) + } +} + #[derive(Copy, Clone, Debug, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// Unlike RGBA, each component value may exceed the range [0.0, 1.0]. diff --git a/components/style/properties/longhand/color.mako.rs b/components/style/properties/longhand/color.mako.rs index 472bdc7b9f0..4fae6d6e33f 100644 --- a/components/style/properties/longhand/color.mako.rs +++ b/components/style/properties/longhand/color.mako.rs @@ -8,7 +8,8 @@ <% from data import to_rust_ident %> -<%helpers:longhand name="color" need_clone="True" animation_value_type="ComputedValue" +<%helpers:longhand name="color" need_clone="True" + animation_value_type="IntermediateRGBA" spec="https://drafts.csswg.org/css-color/#color"> use cssparser::RGBA; use std::fmt; From 8de605f0dd77b51390733f785d187172684a2aed Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:20:21 +0900 Subject: [PATCH 06/14] ComputedDistance for IntermediateRGBA. --- .../helpers/animated_properties.mako.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index c3fcef2f51e..6ed00b5d4ca 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2325,6 +2325,31 @@ impl ComputeDistance for CSSParserColor { } } +impl ComputeDistance for IntermediateRGBA { + #[inline] + fn compute_distance(&self, other: &Self) -> Result { + self.compute_squared_distance(other).map(|sq| sq.sqrt()) + } + + #[inline] + fn compute_squared_distance(&self, other: &Self) -> Result { + let start = [ self.alpha, + self.red * self.alpha, + self.green * self.alpha, + self.blue * self.alpha ]; + let end = [ other.alpha, + other.red * other.alpha, + other.green * other.alpha, + other.blue * other.alpha ]; + let diff = start.iter().zip(&end) + .fold(0.0f64, |n, (&a, &b)| { + let diff = (a - b) as f64; + n + diff * diff + }); + Ok(diff) + } +} + impl ComputeDistance for CalcLengthOrPercentage { #[inline] fn compute_distance(&self, other: &Self) -> Result { From 58345771574111e1aad0351958f2ec1398f2116c Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:20:37 +0900 Subject: [PATCH 07/14] Introduce IntermediateColor to store currentcolor or IntermeditateRGBA. --- .../helpers/animated_properties.mako.rs | 47 +++++++++++++++++++ .../properties/longhand/background.mako.rs | 2 +- .../style/properties/longhand/border.mako.rs | 2 +- .../style/properties/longhand/column.mako.rs | 2 +- .../longhand/inherited_text.mako.rs | 6 +-- .../style/properties/longhand/outline.mako.rs | 2 +- .../style/properties/longhand/text.mako.rs | 2 +- 7 files changed, 55 insertions(+), 8 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 6ed00b5d4ca..f923588338a 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2771,3 +2771,50 @@ impl ComputeDistance for Either } } } + +#[derive(Copy, Clone, Debug, PartialEq)] +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] +#[allow(missing_docs)] +pub enum IntermediateColor { + CurrentColor, + IntermediateRGBA(IntermediateRGBA), +} + +impl Interpolate for IntermediateColor { + #[inline] + fn interpolate(&self, other: &Self, progress: f64) -> Result { + match (*self, *other) { + (IntermediateColor::IntermediateRGBA(ref this), IntermediateColor::IntermediateRGBA(ref other)) => { + this.interpolate(other, progress).map(IntermediateColor::IntermediateRGBA) + } + // FIXME: Bug 1345709: Implement currentColor animations. + _ => Err(()), + } + } +} + +impl <'a> From<<&'a CSSParserColor> for IntermediateColor { + fn from(color: &CSSParserColor) -> IntermediateColor { + match *color { + CSSParserColor::RGBA(ref color) => + IntermediateColor::IntermediateRGBA(IntermediateRGBA::new(color.red_f32(), + color.green_f32(), + color.blue_f32(), + color.alpha_f32())), + CSSParserColor::CurrentColor => IntermediateColor::CurrentColor, + } + } +} + +impl <'a> From<<&'a IntermediateColor> for CSSParserColor { + fn from(color: &IntermediateColor) -> CSSParserColor { + match *color { + IntermediateColor::IntermediateRGBA(ref color) => + CSSParserColor::RGBA(RGBA::from_floats(color.red, + color.green, + color.blue, + color.alpha)), + IntermediateColor::CurrentColor => CSSParserColor::CurrentColor, + } + } +} diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 3ff33c0981d..96119dd2c02 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -10,7 +10,7 @@ ${helpers.predefined_type("background-color", "CSSColor", "::cssparser::Color::RGBA(::cssparser::RGBA::transparent())", initial_specified_value="SpecifiedValue::transparent()", spec="https://drafts.csswg.org/css-backgrounds/#background-color", - animation_value_type="ComputedValue", complex_color=True)} + animation_value_type="IntermediateColor", complex_color=True)} <%helpers:vector_longhand name="background-image" animation_value_type="none" spec="https://drafts.csswg.org/css-backgrounds/#the-background-image" diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index be4b76a1a10..cad750ba165 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -20,7 +20,7 @@ "::cssparser::Color::CurrentColor", alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-color"), spec=maybe_logical_spec(side, "color"), - animation_value_type="ComputedValue", logical = side[1])} + animation_value_type="IntermediateColor", logical = side[1])} % endfor % for side in ALL_SIDES: diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index 44f02ad3dbf..64d8c86b7f4 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -75,7 +75,7 @@ ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", ${helpers.predefined_type("column-rule-color", "CSSColor", "::cssparser::Color::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_value_type="ComputedValue", extra_prefixes="moz", + products="gecko", animation_value_type="IntermediateColor", extra_prefixes="moz", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-color")} diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 4238d23222d..4811689e5fc 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -1205,7 +1205,7 @@ ${helpers.single_keyword("text-align-last", ${helpers.predefined_type("text-emphasis-color", "CSSColor", "::cssparser::Color::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_value_type="ComputedValue", + products="gecko", animation_value_type="IntermediateColor", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-color")} @@ -1223,7 +1223,7 @@ ${helpers.predefined_type( ${helpers.predefined_type( "-webkit-text-fill-color", "CSSColor", "CSSParserColor::CurrentColor", - products="gecko", animation_value_type="ComputedValue", + products="gecko", animation_value_type="IntermediateColor", complex_color=True, need_clone=True, spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color")} @@ -1231,7 +1231,7 @@ ${helpers.predefined_type( "-webkit-text-stroke-color", "CSSColor", "CSSParserColor::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - products="gecko", animation_value_type="ComputedValue", + products="gecko", animation_value_type="IntermediateColor", complex_color=True, need_clone=True, spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")} diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs index c5112047e2c..fcfebe6a00e 100644 --- a/components/style/properties/longhand/outline.mako.rs +++ b/components/style/properties/longhand/outline.mako.rs @@ -12,7 +12,7 @@ // TODO(pcwalton): `invert` ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::CurrentColor", initial_specified_value="specified::CSSColor::currentcolor()", - animation_value_type="ComputedValue", complex_color=True, need_clone=True, + animation_value_type="IntermediateColor", complex_color=True, need_clone=True, spec="https://drafts.csswg.org/css-ui/#propdef-outline-color")} <%helpers:longhand name="outline-style" need_clone="True" animation_value_type="none" diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index e042c43e047..4d29e2b0e77 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -228,7 +228,7 @@ ${helpers.predefined_type( initial_specified_value="specified::CSSColor::currentcolor()", complex_color=True, products="gecko", - animation_value_type="ComputedValue", + animation_value_type="IntermediateColor", spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-color")} <%helpers:longhand name="initial-letter" From 486578fe740aaf1ca6b75f07026324fc402e940c Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:28:16 +0900 Subject: [PATCH 08/14] Use IntermediateColor for caret-color. --- .../helpers/animated_properties.mako.rs | 43 ++++++++++++++++++- .../properties/longhand/pointing.mako.rs | 2 +- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index f923588338a..56a83bce2f9 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -404,8 +404,8 @@ impl AnimationValue { AnimationValue::${prop.camel_case}(ref from) => { PropertyDeclaration::${prop.camel_case}( % if prop.boxed: - Box::new(longhands::${prop.ident}::SpecifiedValue::from_computed_value(from))) - % else: + Box::new( + % endif longhands::${prop.ident}::SpecifiedValue::from_computed_value( % if prop.is_animatable_with_computed_value: from @@ -413,6 +413,8 @@ impl AnimationValue { &from.into() % endif )) + % if prop.boxed: + ) % endif } % endif @@ -2136,6 +2138,43 @@ impl Interpolate for IntermediateRGBA { } } +impl<'a> From<<&'a Either> for Either { + fn from(from: &Either) -> Either { + match *from { + Either::First(ref from) => + match *from { + CSSParserColor::RGBA(ref color) => + Either::First(IntermediateColor::IntermediateRGBA( + IntermediateRGBA::new(color.red_f32(), + color.green_f32(), + color.blue_f32(), + color.alpha_f32()))), + CSSParserColor::CurrentColor => + Either::First(IntermediateColor::CurrentColor), + }, + Either::Second(Auto) => Either::Second(Auto), + } + } +} + +impl<'a> From<<&'a Either> for Either { + fn from(from: &Either) -> Either { + match *from { + Either::First(ref from) => + match *from { + IntermediateColor::IntermediateRGBA(ref color) => + Either::First(CSSParserColor::RGBA(RGBA::from_floats(color.red, + color.green, + color.blue, + color.alpha))), + IntermediateColor::CurrentColor => + Either::First(CSSParserColor::CurrentColor), + }, + Either::Second(Auto) => Either::Second(Auto), + } + } +} + /// We support ComputeDistance for an API in gecko to test the transition per property. impl ComputeDistance for AnimationValue { diff --git a/components/style/properties/longhand/pointing.mako.rs b/components/style/properties/longhand/pointing.mako.rs index de7d56ae66a..7a4af51c8ca 100644 --- a/components/style/properties/longhand/pointing.mako.rs +++ b/components/style/properties/longhand/pointing.mako.rs @@ -177,6 +177,6 @@ ${helpers.predefined_type("caret-color", "ColorOrAuto", "Either::Second(Auto)", spec="https://drafts.csswg.org/css-ui/#caret-color", - animation_value_type="ComputedValue", + animation_value_type="Either", boxed=True, products="gecko")} From 09e728b43d3c2780e74ff4611b862188ec16a3d5 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:30:49 +0900 Subject: [PATCH 09/14] ComputedDistance for IntermediateColor. --- .../helpers/animated_properties.mako.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 56a83bce2f9..7121688f750 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2389,6 +2389,23 @@ impl ComputeDistance for IntermediateRGBA { } } +impl ComputeDistance for IntermediateColor { + #[inline] + fn compute_distance(&self, other: &Self) -> Result { + self.compute_squared_distance(other).map(|sq| sq.sqrt()) + } + + #[inline] + fn compute_squared_distance(&self, other: &Self) -> Result { + match (*self, *other) { + (IntermediateColor::IntermediateRGBA(ref this), IntermediateColor::IntermediateRGBA(ref other)) => { + this.compute_squared_distance(other) + }, + _ => Ok(0.0), + } + } +} + impl ComputeDistance for CalcLengthOrPercentage { #[inline] fn compute_distance(&self, other: &Self) -> Result { From 2d808bf162badeb545ddb9e683e698ba6afc476a Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:31:04 +0900 Subject: [PATCH 10/14] Introduce a macro to implement Interpolate trait for box-shadow and text-shadow. This macro will be used for implementation of intermediate type shadows as well. In the case of intermediate types transparent_color will be IntermediateRGB::transparent(). --- .../helpers/animated_properties.mako.rs | 179 ++++++++---------- 1 file changed, 77 insertions(+), 102 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 7121688f750..a90214d89d6 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1002,114 +1002,89 @@ impl Interpolate for ClipRect { } } -/// https://drafts.csswg.org/css-transitions/#animtype-shadow-list -impl Interpolate for TextShadow { - #[inline] - fn interpolate(&self, other: &Self, progress: f64) -> Result { - Ok(TextShadow { - offset_x: try!(self.offset_x.interpolate(&other.offset_x, progress)), - offset_y: try!(self.offset_y.interpolate(&other.offset_y, progress)), - blur_radius: try!(self.blur_radius.interpolate(&other.blur_radius, progress)), - color: try!(self.color.interpolate(&other.color, progress)), - }) +<%def name="impl_interpolate_for_shadow(item, transparent_color)"> + impl Interpolate for ${item} { + #[inline] + fn interpolate(&self, other: &Self, progress: f64) -> Result { + % if "Box" in item: + // It can't be interpolated if inset does not match. + if self.inset != other.inset { + return Err(()); + } + % endif + + let x = try!(self.offset_x.interpolate(&other.offset_x, progress)); + let y = try!(self.offset_y.interpolate(&other.offset_y, progress)); + let color = try!(self.color.interpolate(&other.color, progress)); + let blur = try!(self.blur_radius.interpolate(&other.blur_radius, progress)); + % if "Box" in item: + let spread = try!(self.spread_radius.interpolate(&other.spread_radius, progress)); + % endif + + Ok(${item} { + offset_x: x, + offset_y: y, + blur_radius: blur, + color: color, + % if "Box" in item: + spread_radius: spread, + inset: self.inset, + % endif + }) + } } -} -/// https://drafts.csswg.org/css-transitions/#animtype-shadow-list -impl Interpolate for TextShadowList { - #[inline] - fn interpolate(&self, other: &Self, progress: f64) -> Result { - let zero = TextShadow { - offset_x: Au(0), - offset_y: Au(0), - blur_radius: Au(0), - color: CSSParserColor::RGBA(RGBA::transparent()), - }; - - let max_len = cmp::max(self.0.len(), other.0.len()); - let mut result = Vec::with_capacity(max_len); - - for i in 0..max_len { - let shadow = match (self.0.get(i), other.0.get(i)) { - (Some(shadow), Some(other)) - => try!(shadow.interpolate(other, progress)), - (Some(shadow), None) => { - shadow.interpolate(&zero, progress).unwrap() - } - (None, Some(shadow)) => { - zero.interpolate(&shadow, progress).unwrap() - } - (None, None) => unreachable!(), + /// https://drafts.csswg.org/css-transitions/#animtype-shadow-list + impl Interpolate for ${item}List { + #[inline] + fn interpolate(&self, other: &Self, progress: f64) -> Result { + // The inset value must change + % if "Box" in item: + let mut zero = ${item} { + % else: + let zero = ${item} { + % endif + offset_x: Au(0), + offset_y: Au(0), + blur_radius: Au(0), + color: ${transparent_color}, + % if "Box" in item: + spread_radius: Au(0), + inset: false, + % endif }; - result.push(shadow); + + let max_len = cmp::max(self.0.len(), other.0.len()); + let mut result = Vec::with_capacity(max_len); + + for i in 0..max_len { + let shadow = match (self.0.get(i), other.0.get(i)) { + (Some(shadow), Some(other)) + => try!(shadow.interpolate(other, progress)), + (Some(shadow), None) => { + % if "Box" in item: + zero.inset = shadow.inset; + % endif + shadow.interpolate(&zero, progress).unwrap() + } + (None, Some(shadow)) => { + % if "Box" in item: + zero.inset = shadow.inset; + % endif + zero.interpolate(&shadow, progress).unwrap() + } + (None, None) => unreachable!(), + }; + result.push(shadow); + } + + Ok(${item}List(result)) } - - Ok(TextShadowList(result)) } -} + - -impl Interpolate for BoxShadowList { - #[inline] - fn interpolate(&self, other: &Self, progress: f64) -> Result { - // The inset value must change - let mut zero = BoxShadow { - offset_x: Au(0), - offset_y: Au(0), - spread_radius: Au(0), - blur_radius: Au(0), - color: CSSParserColor::RGBA(RGBA::transparent()), - inset: false, - }; - - let max_len = cmp::max(self.0.len(), other.0.len()); - let mut result = Vec::with_capacity(max_len); - - for i in 0..max_len { - let shadow = match (self.0.get(i), other.0.get(i)) { - (Some(shadow), Some(other)) - => try!(shadow.interpolate(other, progress)), - (Some(shadow), None) => { - zero.inset = shadow.inset; - shadow.interpolate(&zero, progress).unwrap() - } - (None, Some(shadow)) => { - zero.inset = shadow.inset; - zero.interpolate(&shadow, progress).unwrap() - } - (None, None) => unreachable!(), - }; - result.push(shadow); - } - - Ok(BoxShadowList(result)) - } -} - -/// https://drafts.csswg.org/css-transitions/#animtype-shadow-list -impl Interpolate for BoxShadow { - #[inline] - fn interpolate(&self, other: &Self, progress: f64) -> Result { - if self.inset != other.inset { - return Err(()); - } - - let x = try!(self.offset_x.interpolate(&other.offset_x, progress)); - let y = try!(self.offset_y.interpolate(&other.offset_y, progress)); - let color = try!(self.color.interpolate(&other.color, progress)); - let spread = try!(self.spread_radius.interpolate(&other.spread_radius, progress)); - let blur = try!(self.blur_radius.interpolate(&other.blur_radius, progress)); - - Ok(BoxShadow { - offset_x: x, - offset_y: y, - blur_radius: blur, - spread_radius: spread, - color: color, - inset: self.inset, - }) - } -} +${impl_interpolate_for_shadow('BoxShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} +${impl_interpolate_for_shadow('TextShadow', 'CSSParserColor::RGBA(RGBA::transparent())',)} impl Interpolate for LengthOrNone { fn interpolate(&self, other: &Self, progress: f64) -> Result { From 424e4f9d359b958016051dd283296a9b9e960b4f Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:31:19 +0900 Subject: [PATCH 11/14] Use IntermediateColor for box-shadow. --- .../helpers/animated_properties.mako.rs | 71 +++++++++++++++++++ .../style/properties/longhand/effects.mako.rs | 3 +- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index a90214d89d6..f80d0335261 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2849,3 +2849,74 @@ impl <'a> From<<&'a IntermediateColor> for CSSParserColor { } } } + +<%def name="impl_intermediate_type_for_shadow(type)"> + #[derive(Copy, Clone, Debug, PartialEq)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + #[allow(missing_docs)] + /// Intermediate type for box-shadow and text-shadow. + /// The difference between normal shadow type is that this type uses + /// IntermediateColor instead of ParserColor. + pub struct Intermediate${type}Shadow { + pub offset_x: Au, + pub offset_y: Au, + pub blur_radius: Au, + pub color: IntermediateColor, + % if type == "Box": + pub spread_radius: Au, + pub inset: bool, + % endif + } + + #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + #[allow(missing_docs)] + /// Intermediate type for box-shadow list and text-shadow list. + pub struct Intermediate${type}ShadowList(pub Vec); + + impl <'a> From<<&'a Intermediate${type}ShadowList> for ${type}ShadowList { + fn from(shadow_list: &Intermediate${type}ShadowList) -> ${type}ShadowList { + ${type}ShadowList(shadow_list.0.iter().map(|s| s.into()).collect()) + } + } + + impl <'a> From<<&'a ${type}ShadowList> for Intermediate${type}ShadowList { + fn from(shadow_list: &${type}ShadowList) -> Intermediate${type}ShadowList { + Intermediate${type}ShadowList(shadow_list.0.iter().map(|s| s.into()).collect()) + } + } + + impl <'a> From<<&'a Intermediate${type}Shadow> for ${type}Shadow { + fn from(shadow: &Intermediate${type}Shadow) -> ${type}Shadow { + ${type}Shadow { + offset_x: shadow.offset_x, + offset_y: shadow.offset_y, + blur_radius: shadow.blur_radius, + color: (&shadow.color).into(), + % if type == "Box": + spread_radius: shadow.spread_radius, + inset: shadow.inset, + % endif + } + } + } + + impl <'a> From<<&'a ${type}Shadow> for Intermediate${type}Shadow { + fn from(shadow: &${type}Shadow) -> Intermediate${type}Shadow { + Intermediate${type}Shadow { + offset_x: shadow.offset_x, + offset_y: shadow.offset_y, + blur_radius: shadow.blur_radius, + color: (&shadow.color).into(), + % if type == "Box": + spread_radius: shadow.spread_radius, + inset: shadow.inset, + % endif + } + } + } + ${impl_interpolate_for_shadow('Intermediate%sShadow' % type, + 'IntermediateColor::IntermediateRGBA(IntermediateRGBA::transparent())')} + + +${impl_intermediate_type_for_shadow('Box')} diff --git a/components/style/properties/longhand/effects.mako.rs b/components/style/properties/longhand/effects.mako.rs index bb26426b583..7fde2f816e2 100644 --- a/components/style/properties/longhand/effects.mako.rs +++ b/components/style/properties/longhand/effects.mako.rs @@ -15,7 +15,8 @@ ${helpers.predefined_type("opacity", spec="https://drafts.csswg.org/css-color/#opacity")} <%helpers:vector_longhand name="box-shadow" allow_empty="True" - animation_value_type="ComputedValue" extra_prefixes="webkit" + animation_value_type="IntermediateBoxShadowList" + extra_prefixes="webkit" spec="https://drafts.csswg.org/css-backgrounds/#box-shadow"> use cssparser; use std::fmt; From 1e9c118f7f056ad63fd394b592b1663bc2141c93 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:31:38 +0900 Subject: [PATCH 12/14] ComputedDistance for IntermediateBoxShadow. --- .../style/properties/helpers/animated_properties.mako.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index f80d0335261..b0f49486742 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2709,7 +2709,7 @@ impl ComputeDistance for TextShadowList { } } -impl ComputeDistance for BoxShadow { +impl ComputeDistance for IntermediateBoxShadow { #[inline] fn compute_distance(&self, other: &Self) -> Result { self.compute_squared_distance(other).map(|sd| sd.sqrt()) @@ -2729,7 +2729,7 @@ impl ComputeDistance for BoxShadow { } } -impl ComputeDistance for BoxShadowList { +impl ComputeDistance for IntermediateBoxShadowList { #[inline] fn compute_distance(&self, other: &Self) -> Result { self.compute_squared_distance(other).map(|sd| sd.sqrt()) @@ -2738,12 +2738,12 @@ impl ComputeDistance for BoxShadowList { #[inline] fn compute_squared_distance(&self, other: &Self) -> Result { // The inset value must change - let mut zero = BoxShadow { + let mut zero = IntermediateBoxShadow { offset_x: Au(0), offset_y: Au(0), spread_radius: Au(0), blur_radius: Au(0), - color: CSSParserColor::RGBA(RGBA::transparent()), + color: IntermediateColor::IntermediateRGBA(IntermediateRGBA::transparent()), inset: false, }; From 46e567e6886aa3a34b0c0875b3ad21555f38cfa4 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:31:54 +0900 Subject: [PATCH 13/14] Use IntermediateColor for text-shadow. --- .../style/properties/helpers/animated_properties.mako.rs | 1 + components/style/properties/longhand/inherited_text.mako.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index b0f49486742..cceac6e22d4 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2920,3 +2920,4 @@ impl <'a> From<<&'a IntermediateColor> for CSSParserColor { ${impl_intermediate_type_for_shadow('Box')} +${impl_intermediate_type_for_shadow('Text')} diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 4811689e5fc..f47178e9c76 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -711,7 +711,8 @@ ${helpers.single_keyword("text-align-last", % endif -<%helpers:longhand name="text-shadow" animation_value_type="ComputedValue" +<%helpers:longhand name="text-shadow" + animation_value_type="IntermediateTextShadowList", spec="https://drafts.csswg.org/css-text-decor/#propdef-text-shadow"> use cssparser; use std::fmt; From 0ec5a64a713b77c1b035e75a2e5f35beaf9ca261 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 24 Apr 2017 15:32:07 +0900 Subject: [PATCH 14/14] ComputedDistance for IntermediateTextShadow. --- .../style/properties/helpers/animated_properties.mako.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index cceac6e22d4..50c31752a30 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2660,7 +2660,7 @@ impl ComputeDistance for ClipRect { } } -impl ComputeDistance for TextShadow { +impl ComputeDistance for IntermediateTextShadow { #[inline] fn compute_distance(&self, other: &Self) -> Result { self.compute_squared_distance(other).map(|sd| sd.sqrt()) @@ -2676,7 +2676,7 @@ impl ComputeDistance for TextShadow { } } -impl ComputeDistance for TextShadowList { +impl ComputeDistance for IntermediateTextShadowList { #[inline] fn compute_distance(&self, other: &Self) -> Result { self.compute_squared_distance(other).map(|sd| sd.sqrt()) @@ -2684,11 +2684,11 @@ impl ComputeDistance for TextShadowList { #[inline] fn compute_squared_distance(&self, other: &Self) -> Result { - let zero = TextShadow { + let zero = IntermediateTextShadow { offset_x: Au(0), offset_y: Au(0), blur_radius: Au(0), - color: CSSParserColor::RGBA(RGBA::transparent()), + color: IntermediateColor::IntermediateRGBA(IntermediateRGBA::transparent()), }; let max_len = cmp::max(self.0.len(), other.0.len());