diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 2a7700faa6d..402ce7ef4b1 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2862,6 +2862,25 @@ fn static_assert() { } } + pub fn clone_will_change(&self) -> longhands::will_change::computed_value::T { + use properties::longhands::will_change::computed_value::T; + use gecko_bindings::structs::nsIAtom; + use gecko_string_cache::Atom; + use values::CustomIdent; + + if self.gecko.mWillChange.mBuffer.len() == 0 { + T::Auto + } else { + T::AnimateableFeatures( + self.gecko.mWillChange.mBuffer.iter().map(|gecko_atom| { + CustomIdent( + unsafe { Atom::from_addrefed(*gecko_atom as *mut nsIAtom) } + ) + }).collect() + ) + } + } + <% impl_shape_source("shape_outside", "mShapeOutside") %> pub fn set_contain(&mut self, v: longhands::contain::computed_value::T) { @@ -3078,6 +3097,30 @@ fn static_assert() { } + pub fn clone_${shorthand}_repeat(&self) -> longhands::${shorthand}_repeat::computed_value::T { + use properties::longhands::${shorthand}_repeat::single_value::computed_value::T; + use properties::longhands::${shorthand}_repeat::single_value::computed_value::RepeatKeyword; + use gecko_bindings::structs::StyleImageLayerRepeat; + + fn to_servo(repeat: StyleImageLayerRepeat) -> RepeatKeyword { + match repeat { + StyleImageLayerRepeat::Repeat => RepeatKeyword::Repeat, + StyleImageLayerRepeat::Space => RepeatKeyword::Space, + StyleImageLayerRepeat::Round => RepeatKeyword::Round, + StyleImageLayerRepeat::NoRepeat => RepeatKeyword::NoRepeat, + x => panic!("Found unexpected value in style struct for ${shorthand}_repeat property: {:?}", x), + } + } + + longhands::${shorthand}_repeat::computed_value::T ( + self.gecko.${image_layers_field}.mLayers.iter() + .take(self.gecko.${image_layers_field}.mRepeatCount as usize) + .map(|ref layer| { + T(to_servo(layer.mRepeat.mXRepeat), to_servo(layer.mRepeat.mYRepeat)) + }).collect() + ) + } + <% impl_simple_image_array_property("clip", shorthand, image_layers_field, "mClip", struct_name) %> <% impl_simple_image_array_property("origin", shorthand, image_layers_field, "mOrigin", struct_name) %> @@ -3918,6 +3961,33 @@ fn static_assert() { self.gecko.mTextEmphasisStyle = other.gecko.mTextEmphasisStyle; } + pub fn clone_text_emphasis_style(&self) -> longhands::text_emphasis_style::computed_value::T { + use properties::longhands::text_emphasis_style::computed_value::{T, KeywordValue}; + use properties::longhands::text_emphasis_style::ShapeKeyword; + + if self.gecko.mTextEmphasisStyle == structs::NS_STYLE_TEXT_EMPHASIS_STYLE_NONE as u8 { + return T::None; + } else if self.gecko.mTextEmphasisStyle == structs::NS_STYLE_TEXT_EMPHASIS_STYLE_STRING as u8 { + return T::String(self.gecko.mTextEmphasisStyleString.to_string()); + } + + let fill = self.gecko.mTextEmphasisStyle & structs::NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN as u8 == 0; + let shape = + match self.gecko.mTextEmphasisStyle as u32 & !structs::NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN { + structs::NS_STYLE_TEXT_EMPHASIS_STYLE_DOT => ShapeKeyword::Dot, + structs::NS_STYLE_TEXT_EMPHASIS_STYLE_CIRCLE => ShapeKeyword::Circle, + structs::NS_STYLE_TEXT_EMPHASIS_STYLE_DOUBLE_CIRCLE => ShapeKeyword::DoubleCircle, + structs::NS_STYLE_TEXT_EMPHASIS_STYLE_TRIANGLE => ShapeKeyword::Triangle, + structs::NS_STYLE_TEXT_EMPHASIS_STYLE_SESAME => ShapeKeyword::Sesame, + x => panic!("Unexpected value in style struct for text-emphasis-style property: {:?}", x) + }; + + T::Keyword(KeywordValue { + fill: fill, + shape: shape + }) + } + <%call expr="impl_app_units('_webkit_text_stroke_width', 'mWebkitTextStrokeWidth', need_clone=True)"> #[allow(non_snake_case)] diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 5ab9b7b504d..821e7c428e4 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -31,7 +31,7 @@ ${helpers.predefined_type("background-image", "ImageLayer", animation_value_type="ComputedValue", vector=True, delegate_animate=True)} % endfor -<%helpers:vector_longhand name="background-repeat" animation_value_type="none" +<%helpers:vector_longhand name="background-repeat" animation_value_type="discrete" spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat"> 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 27aa4d0b8b4..b970745461d 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -1874,7 +1874,7 @@ ${helpers.single_keyword("-moz-orient", gecko_inexhaustive="True", animation_value_type="discrete")} -<%helpers:longhand name="will-change" products="gecko" animation_value_type="none" +<%helpers:longhand name="will-change" products="gecko" animation_value_type="discrete" spec="https://drafts.csswg.org/css-will-change/#will-change"> use std::fmt; use style_traits::ToCss; diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 26f7e374398..a544c4a9736 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -417,8 +417,8 @@ ${helpers.predefined_type( spec="https://drafts.csswg.org/css-text-decor-3/#text-shadow-property", )} -<%helpers:longhand name="text-emphasis-style" products="gecko" need_clone="True" boxed="True" - animation_value_type="none" +<%helpers:longhand name="text-emphasis-style" products="gecko" boxed="True" + animation_value_type="discrete" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-style"> use computed_values::writing_mode::T as writing_mode; use std::fmt; diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index 05e5e508351..b000a105427 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -70,7 +70,7 @@ ${helpers.single_keyword("mask-mode", animation_value_type="discrete", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-mode")} -<%helpers:vector_longhand name="mask-repeat" products="gecko" animation_value_type="none" extra_prefixes="webkit" +<%helpers:vector_longhand name="mask-repeat" products="gecko" animation_value_type="discrete" 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;