diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 852f16e893e..fa684029288 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1451,7 +1451,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal -<%def name="impl_keyword(ident, gecko_ffi_name, keyword, need_clone, cast_type='u8', **kwargs)"> +<%def name="impl_keyword(ident, gecko_ffi_name, keyword, cast_type='u8', **kwargs)"> <%call expr="impl_keyword_setter(ident, gecko_ffi_name, keyword, cast_type, **kwargs)"> <%call expr="impl_simple_copy(ident, gecko_ffi_name, **kwargs)"> -%if need_clone: <%call expr="impl_keyword_clone(ident, gecko_ffi_name, keyword, cast_type)"> -% endif -<%def name="impl_simple(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_simple(ident, gecko_ffi_name)"> <%call expr="impl_simple_setter(ident, gecko_ffi_name)"> <%call expr="impl_simple_copy(ident, gecko_ffi_name)"> -% if need_clone: - <%call expr="impl_simple_clone(ident, gecko_ffi_name)"> -% endif +<%call expr="impl_simple_clone(ident, gecko_ffi_name)"> -<%def name="impl_absolute_length(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_absolute_length(ident, gecko_ffi_name)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { ${set_gecko_property(gecko_ffi_name, "v.to_i32_au()")} } <%call expr="impl_simple_copy(ident, gecko_ffi_name)"> - % if need_clone: - #[allow(non_snake_case)] - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { - Au(self.gecko.${gecko_ffi_name}).into() - } - % endif + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + Au(self.gecko.${gecko_ffi_name}).into() + } -<%def name="impl_position(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_position(ident, gecko_ffi_name)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { ${set_gecko_property("%s.mXPosition" % gecko_ffi_name, "v.horizontal.into()")} ${set_gecko_property("%s.mYPosition" % gecko_ffi_name, "v.vertical.into()")} } <%call expr="impl_simple_copy(ident, gecko_ffi_name)"> - % if need_clone: - #[allow(non_snake_case)] - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { - longhands::${ident}::computed_value::T { - horizontal: self.gecko.${gecko_ffi_name}.mXPosition.into(), - vertical: self.gecko.${gecko_ffi_name}.mYPosition.into(), - } + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + longhands::${ident}::computed_value::T { + horizontal: self.gecko.${gecko_ffi_name}.mXPosition.into(), + vertical: self.gecko.${gecko_ffi_name}.mYPosition.into(), } - % endif + } -<%def name="impl_color(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_color(ident, gecko_ffi_name)"> <%call expr="impl_color_setter(ident, gecko_ffi_name)"> <%call expr="impl_color_copy(ident, gecko_ffi_name)"> -% if need_clone: - <%call expr="impl_color_clone(ident, gecko_ffi_name)"> -% endif +<%call expr="impl_color_clone(ident, gecko_ffi_name)"> -<%def name="impl_rgba_color(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_rgba_color(ident, gecko_ffi_name)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { ${set_gecko_property(gecko_ffi_name, "convert_rgba_to_nscolor(&v)")} } <%call expr="impl_simple_copy(ident, gecko_ffi_name)"> - % if need_clone: - #[allow(non_snake_case)] - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { - convert_nscolor_to_rgba(${get_gecko_property(gecko_ffi_name)}) - } - % endif + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + convert_nscolor_to_rgba(${get_gecko_property(gecko_ffi_name)}) + } -<%def name="impl_svg_length(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_svg_length(ident, gecko_ffi_name)"> // When context-value is used on an SVG length, the corresponding flag is // set on mContextFlags, and the length field is set to the initial value. @@ -663,7 +651,7 @@ def set_gecko_property(ffi_name, expr): } -<%def name="impl_svg_opacity(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_svg_opacity(ident, gecko_ffi_name)"> <% source_prefix = ident.split("_")[0].upper() + "_OPACITY_SOURCE" %> pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { @@ -724,7 +712,7 @@ def set_gecko_property(ffi_name, expr): } -<%def name="impl_svg_paint(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_svg_paint(ident, gecko_ffi_name)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, mut v: longhands::${ident}::computed_value::T) { use values::generics::svg::SVGPaintKind; @@ -826,7 +814,7 @@ def set_gecko_property(ffi_name, expr): } -<%def name="impl_non_negative_length(ident, gecko_ffi_name, need_clone, inherit_from=None, +<%def name="impl_non_negative_length(ident, gecko_ffi_name, inherit_from=None, round_to_pixels=False)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { @@ -868,15 +856,13 @@ def set_gecko_property(ffi_name, expr): self.copy_${ident}_from(other) } -%if need_clone: #[allow(non_snake_case)] pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { Au(self.gecko.${gecko_ffi_name}).into() } -% endif -<%def name="impl_split_style_coord(ident, gecko_ffi_name, index, need_clone=False)"> +<%def name="impl_split_style_coord(ident, gecko_ffi_name, index)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { v.to_gecko_style_coord(&mut self.gecko.${gecko_ffi_name}.data_at_mut(${index})); @@ -889,17 +875,16 @@ def set_gecko_property(ffi_name, expr): pub fn reset_${ident}(&mut self, other: &Self) { self.copy_${ident}_from(other) } - % if need_clone: - #[allow(non_snake_case)] - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { - use properties::longhands::${ident}::computed_value::T; - T::from_gecko_style_coord(&self.gecko.${gecko_ffi_name}.data_at(${index})) - .expect("clone for ${ident} failed") - } - % endif + + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + use properties::longhands::${ident}::computed_value::T; + T::from_gecko_style_coord(&self.gecko.${gecko_ffi_name}.data_at(${index})) + .expect("clone for ${ident} failed") + } -<%def name="impl_style_coord(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_style_coord(ident, gecko_ffi_name)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { v.to_gecko_style_coord(&mut self.gecko.${gecko_ffi_name}); @@ -912,14 +897,13 @@ def set_gecko_property(ffi_name, expr): pub fn reset_${ident}(&mut self, other: &Self) { self.copy_${ident}_from(other) } - % if need_clone: - #[allow(non_snake_case)] - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { - use properties::longhands::${ident}::computed_value::T; - T::from_gecko_style_coord(&self.gecko.${gecko_ffi_name}) - .expect("clone for ${ident} failed") - } - % endif + + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + use properties::longhands::${ident}::computed_value::T; + T::from_gecko_style_coord(&self.gecko.${gecko_ffi_name}) + .expect("clone for ${ident} failed") + } <%def name="impl_style_sides(ident)"> @@ -956,7 +940,7 @@ def set_gecko_property(ffi_name, expr): } -<%def name="impl_corner_style_coord(ident, gecko_ffi_name, x_index, y_index, need_clone)"> +<%def name="impl_corner_style_coord(ident, gecko_ffi_name, x_index, y_index)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { v.0.width.to_gecko_style_coord(&mut self.gecko.${gecko_ffi_name}.data_at_mut(${x_index})); @@ -973,22 +957,21 @@ def set_gecko_property(ffi_name, expr): pub fn reset_${ident}(&mut self, other: &Self) { self.copy_${ident}_from(other) } - % if need_clone: - #[allow(non_snake_case)] - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { - use values::computed::border::BorderCornerRadius; - let width = GeckoStyleCoordConvertible::from_gecko_style_coord( - &self.gecko.${gecko_ffi_name}.data_at(${x_index})) - .expect("Failed to clone ${ident}"); - let height = GeckoStyleCoordConvertible::from_gecko_style_coord( - &self.gecko.${gecko_ffi_name}.data_at(${y_index})) - .expect("Failed to clone ${ident}"); - BorderCornerRadius::new(width, height) - } - % endif + + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + use values::computed::border::BorderCornerRadius; + let width = GeckoStyleCoordConvertible::from_gecko_style_coord( + &self.gecko.${gecko_ffi_name}.data_at(${x_index})) + .expect("Failed to clone ${ident}"); + let height = GeckoStyleCoordConvertible::from_gecko_style_coord( + &self.gecko.${gecko_ffi_name}.data_at(${y_index})) + .expect("Failed to clone ${ident}"); + BorderCornerRadius::new(width, height) + } -<%def name="impl_css_url(ident, gecko_ffi_name, need_clone=False)"> +<%def name="impl_css_url(ident, gecko_ffi_name)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { use gecko_bindings::sugar::refptr::RefPtr; @@ -1021,26 +1004,26 @@ def set_gecko_property(ffi_name, expr): pub fn reset_${ident}(&mut self, other: &Self) { self.copy_${ident}_from(other) } - % if need_clone: - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { - use values::specified::url::SpecifiedUrl; - use values::None_; - if self.gecko.${gecko_ffi_name}.mRawPtr.is_null() { - Either::Second(None_) - } else { - unsafe { - let ref gecko_url_value = *self.gecko.${gecko_ffi_name}.mRawPtr; - Either::First(SpecifiedUrl::from_url_value_data(&gecko_url_value._base) - .expect("${gecko_ffi_name} could not convert to SpecifiedUrl")) - } + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + use values::specified::url::SpecifiedUrl; + use values::None_; + + if self.gecko.${gecko_ffi_name}.mRawPtr.is_null() { + Either::Second(None_) + } else { + unsafe { + let ref gecko_url_value = *self.gecko.${gecko_ffi_name}.mRawPtr; + Either::First(SpecifiedUrl::from_url_value_data(&gecko_url_value._base) + .expect("${gecko_ffi_name} could not convert to SpecifiedUrl")) } } - % endif + } -<%def name="impl_logical(name, need_clone=False, **kwargs)"> - ${helpers.logical_setter(name, need_clone)} +<%def name="impl_logical(name, **kwargs)"> + ${helpers.logical_setter(name)} <%def name="impl_style_struct(style_struct)"> @@ -1157,18 +1140,12 @@ impl Clone for ${style_struct.gecko_struct_name} { } -<%def name="raw_impl_trait(style_struct, skip_longhands='', skip_additionals='')"> +<%def name="impl_trait(style_struct_name, skip_longhands='')"> <% + style_struct = next(x for x in data.style_structs if x.name == style_struct_name) longhands = [x for x in style_struct.longhands if not (skip_longhands == "*" or x.name in skip_longhands.split())] - # - # Make a list of types we can't auto-generate. - # - force_stub = []; - # These have unusual representations in gecko. - force_stub += ["list-style-type"] - # Types used with predefined_type()-defined properties that we can auto-generate. predefined_types = { "length::LengthOrAuto": impl_style_coord, @@ -1200,8 +1177,7 @@ impl Clone for ${style_struct.gecko_struct_name} { } def longhand_method(longhand): - args = dict(ident=longhand.ident, gecko_ffi_name=longhand.gecko_ffi_name, - need_clone=longhand.need_clone) + args = dict(ident=longhand.ident, gecko_ffi_name=longhand.gecko_ffi_name) # get the method and pass additional keyword or type-specific arguments if longhand.logical: @@ -1217,30 +1193,10 @@ impl Clone for ${style_struct.gecko_struct_name} { method(**args) - picked_longhands, stub_longhands = [], [] + picked_longhands = [] for x in longhands: - if (x.keyword or x.predefined_type in predefined_types or x.logical) and x.name not in force_stub: + if x.keyword or x.predefined_type in predefined_types or x.logical: picked_longhands.append(x) - else: - stub_longhands.append(x) - - # If one of the longhands is not handled - # by either: - # - being a keyword - # - being a predefined longhand - # - being a longhand with manual glue code (i.e. in skip_longhands) - # - being generated as a stub - # - # then we raise an error here. - # - # If you hit this error, please add `product="servo"` to the longhand. - # In case the longhand is used in a shorthand, add it to the force_stub - # list above. - - for stub in stub_longhands: - if stub.name not in force_stub: - raise Exception("Don't know what to do with longhand %s in style struct %s" - % (stub.name,style_struct. gecko_struct_name)) %> impl ${style_struct.gecko_struct_name} { /* @@ -1255,54 +1211,9 @@ impl ${style_struct.gecko_struct_name} { for longhand in picked_longhands: longhand_method(longhand) %> - - /* - * Stubs. - */ - % for longhand in stub_longhands: - #[allow(non_snake_case)] - pub fn set_${longhand.ident}(&mut self, _: longhands::${longhand.ident}::computed_value::T) { - warn!("stylo: Unimplemented property setter: ${longhand.name}"); - } - #[allow(non_snake_case)] - pub fn copy_${longhand.ident}_from(&mut self, _: &Self) { - warn!("stylo: Unimplemented property setter: ${longhand.name}"); - } - #[allow(non_snake_case)] - pub fn reset_${longhand.ident}(&mut self, other: &Self) { - self.copy_${longhand.ident}_from(other) - } - % if longhand.need_clone: - #[allow(non_snake_case)] - pub fn clone_${longhand.ident}(&self) -> longhands::${longhand.ident}::computed_value::T { - unimplemented!() - } - % endif - % if longhand.need_index: - pub fn ${longhand.ident}_count(&self) -> usize { 0 } - pub fn ${longhand.ident}_at(&self, _index: usize) - -> longhands::${longhand.ident}::computed_value::SingleComputedValue { - unimplemented!() - } - % endif - % endfor - <% additionals = [x for x in style_struct.additional_methods - if skip_additionals != "*" and not x.name in skip_additionals.split()] %> - % for additional in additionals: - ${additional.stub()} - % endfor } -<% data.manual_style_structs = [] %> -<%def name="impl_trait(style_struct_name, skip_longhands='', skip_additionals='')"> -<%self:raw_impl_trait style_struct="${next(x for x in data.style_structs if x.name == style_struct_name)}" - skip_longhands="${skip_longhands}" skip_additionals="${skip_additionals}"> -${caller.body()} - -<% data.manual_style_structs.append(style_struct_name) %> - - <%! class Side(object): def __init__(self, name, index): @@ -1359,15 +1270,13 @@ fn static_assert() { <%self:impl_trait style_struct_name="Border" skip_longhands="${skip_border_longhands} border-image-source border-image-outset border-image-repeat border-image-width border-image-slice - ${skip_moz_border_color_longhands}" - skip_additionals="*"> + ${skip_moz_border_color_longhands}"> % for side in SIDES: <% impl_keyword("border_%s_style" % side.ident, "mBorderStyle[%s]" % side.index, border_style_keyword, - on_set="update_border_%s" % side.ident, - need_clone=True) %> + on_set="update_border_%s" % side.ident) %> // This is needed because the initial mComputedBorder value is set to zero. // @@ -1399,12 +1308,11 @@ fn static_assert() { self.gecko.mComputedBorder.${side.ident} = self.gecko.mBorder.${side.ident}; } - <% impl_color("border_%s_color" % side.ident, "(mBorderColor)[%s]" % side.index, need_clone=True) %> + <% impl_color("border_%s_color" % side.ident, "(mBorderColor)[%s]" % side.index) %> <% impl_non_negative_length("border_%s_width" % side.ident, "mComputedBorder.%s" % side.ident, inherit_from="mBorder.%s" % side.ident, - need_clone=True, round_to_pixels=True) %> pub fn border_${side.ident}_has_nonzero_width(&self) -> bool { @@ -1481,8 +1389,7 @@ fn static_assert() { <% impl_corner_style_coord("border_%s_radius" % corner.ident, "mBorderRadius", corner.x_index, - corner.y_index, - need_clone=True) %> + corner.y_index) %> % endfor pub fn set_border_image_source(&mut self, image: longhands::border_image_source::computed_value::T) { @@ -1601,8 +1508,7 @@ fn static_assert() { % for side in SIDES: <% impl_split_style_coord("margin_%s" % side.ident, "mMargin", - side.index, - need_clone=True) %> + side.index) %> % endfor @@ -1613,8 +1519,7 @@ fn static_assert() { % for side in SIDES: <% impl_split_style_coord("padding_%s" % side.ident, "mPadding", - side.index, - need_clone=True) %> + side.index) %> % endfor @@ -1627,8 +1532,7 @@ fn static_assert() { % for side in SIDES: <% impl_split_style_coord("%s" % side.ident, "mOffset", - side.index, - need_clone=True) %> + side.index) %> % endfor pub fn set_z_index(&mut self, v: longhands::z_index::computed_value::T) { @@ -2079,8 +1983,7 @@ fn static_assert() { ["-moz-outline-radius-{0}".format(x.ident.replace("_", "")) for x in CORNERS]) %> <%self:impl_trait style_struct_name="Outline" - skip_longhands="${skip_outline_longhands}" - skip_additionals="*"> + skip_longhands="${skip_outline_longhands}"> #[allow(non_snake_case)] pub fn set_outline_style(&mut self, v: longhands::outline_style::computed_value::T) { @@ -2128,14 +2031,13 @@ fn static_assert() { <% impl_non_negative_length("outline_width", "mActualOutlineWidth", inherit_from="mOutlineWidth", - need_clone=True, round_to_pixels=True) %> + round_to_pixels=True) %> % for corner in CORNERS: <% impl_corner_style_coord("_moz_outline_radius_%s" % corner.ident.replace("_", ""), "mOutlineRadius", corner.x_index, - corner.y_index, - need_clone=True) %> + corner.y_index) %> % endfor pub fn outline_has_nonzero_width(&self) -> bool { @@ -2152,8 +2054,7 @@ fn static_assert() { -moz-min-font-size-ratio -x-text-zoom""" %> <%self:impl_trait style_struct_name="Font" - skip_longhands="${skip_font_longhands}" - skip_additionals="*"> + skip_longhands="${skip_font_longhands}"> <% impl_font_settings("font_feature_settings", "FontSettingTagInt") %> <% impl_font_settings("font_variation_settings", "FontSettingTagFloat") %> @@ -2971,8 +2872,8 @@ fn static_assert() { } % endfor - ${impl_style_coord("scroll_snap_points_x", "mScrollSnapPointsX", True)} - ${impl_style_coord("scroll_snap_points_y", "mScrollSnapPointsY", True)} + ${impl_style_coord("scroll_snap_points_x", "mScrollSnapPointsX")} + ${impl_style_coord("scroll_snap_points_y", "mScrollSnapPointsY")} pub fn set_scroll_snap_coordinate(&mut self, v: I) where I: IntoIterator, @@ -3430,7 +3331,7 @@ fn static_assert() { <% scroll_snap_type_keyword = Keyword("scroll-snap-type", "none mandatory proximity") %> - ${impl_keyword('scroll_snap_type_y', 'mScrollSnapTypeY', scroll_snap_type_keyword, need_clone=True)} + ${impl_keyword('scroll_snap_type_y', 'mScrollSnapTypeY', scroll_snap_type_keyword)} pub fn set_perspective_origin(&mut self, v: longhands::perspective_origin::computed_value::T) { self.gecko.mPerspectiveOrigin[0].set(v.horizontal); @@ -3752,8 +3653,7 @@ fn static_assert() { } } - pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T - { + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { use properties::longhands::${ident}::single_value::computed_value::T as Keyword; % if keyword.needs_cast(): @@ -4079,8 +3979,7 @@ fn static_assert() { background-position-x background-position-y""" %> <%self:impl_trait style_struct_name="Background" - skip_longhands="${skip_background_longhands}" - skip_additionals="*"> + skip_longhands="${skip_background_longhands}"> <% impl_common_image_layer_properties("background") %> <% impl_simple_image_array_property("attachment", "background", "mImage", "mAttachment", "Background") %> @@ -4088,8 +3987,7 @@ fn static_assert() { <%self:impl_trait style_struct_name="List" - skip_longhands="list-style-image list-style-type quotes -moz-image-region" - skip_additionals="*"> + skip_longhands="list-style-image list-style-type quotes -moz-image-region"> pub fn set_list_style_image(&mut self, image: longhands::list_style_image::computed_value::T) { use values::Either; @@ -4634,8 +4532,7 @@ fn static_assert() { <% text_align_keyword = Keyword("text-align", "start end left right center justify -moz-center -moz-left -moz-right char", gecko_strip_moz_prefix=False) %> - ${impl_keyword('text_align', 'mTextAlign', text_align_keyword, need_clone=False)} - ${impl_keyword_clone('text_align', 'mTextAlign', text_align_keyword)} + ${impl_keyword('text_align', 'mTextAlign', text_align_keyword)} pub fn set_text_shadow(&mut self, v: I) where I: IntoIterator, @@ -4814,9 +4711,8 @@ fn static_assert() { }) } - <%call expr="impl_non_negative_length('_webkit_text_stroke_width', - 'mWebkitTextStrokeWidth', - need_clone=True)"> + ${impl_non_negative_length('_webkit_text_stroke_width', + 'mWebkitTextStrokeWidth')} #[allow(non_snake_case)] pub fn set__moz_tab_size(&mut self, v: longhands::_moz_tab_size::computed_value::T) { @@ -4847,8 +4743,7 @@ fn static_assert() { <%self:impl_trait style_struct_name="Text" - skip_longhands="text-decoration-line text-overflow initial-letter" - skip_additionals="*"> + skip_longhands="text-decoration-line text-overflow initial-letter"> ${impl_simple_type_with_conversion("text_decoration_line")} @@ -5106,8 +5001,7 @@ clip-path """ %> <%self:impl_trait style_struct_name="SVG" - skip_longhands="${skip_svg_longhands}" - skip_additionals="*"> + skip_longhands="${skip_svg_longhands}"> <% impl_common_image_layer_properties("mask") %> <% impl_simple_image_array_property("mode", "mask", "mMask", "mMaskMode", "SVG") %> @@ -5116,8 +5010,7 @@ clip-path <%self:impl_trait style_struct_name="InheritedSVG" - skip_longhands="paint-order stroke-dasharray -moz-context-properties" - skip_additionals="*"> + skip_longhands="paint-order stroke-dasharray -moz-context-properties"> pub fn set_paint_order(&mut self, v: longhands::paint_order::computed_value::T) { use self::longhands::paint_order; @@ -5446,7 +5339,7 @@ clip-path longhands::cursor::computed_value::T { images, keyword } } - <%call expr="impl_color('caret_color', 'mCaretColor', need_clone=True)"> + <%call expr="impl_color('caret_color', 'mCaretColor')"> <%self:impl_trait style_struct_name="Column" @@ -5477,7 +5370,7 @@ clip-path } } - <% impl_non_negative_length("column_rule_width", "mColumnRuleWidth", need_clone=True, + <% impl_non_negative_length("column_rule_width", "mColumnRuleWidth", round_to_pixels=True) %> @@ -5741,7 +5634,7 @@ clip-path ${impl_simple_copy("_moz_box_ordinal_group", "mBoxOrdinal")} #[allow(non_snake_case)] - pub fn clone__moz_box_ordinal_group(&self) -> i32{ + pub fn clone__moz_box_ordinal_group(&self) -> i32 { self.gecko.mBoxOrdinal as i32 } @@ -5749,7 +5642,4 @@ clip-path % for style_struct in data.style_structs: ${declare_style_struct(style_struct)} ${impl_style_struct(style_struct)} -% if not style_struct.name in data.manual_style_structs: -<%self:raw_impl_trait style_struct="${style_struct}"> -% endif % endfor diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index e764fcd3d74..b2182d3842a 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -617,8 +617,8 @@ keyword_kwargs = {a: kwargs.pop(a, None) for a in [ 'gecko_constant_prefix', 'gecko_enum_prefix', 'extra_gecko_values', 'extra_servo_values', - 'aliases', 'extra_gecko_aliases', 'extra_servo_aliases', - 'custom_consts', 'gecko_inexhaustive', 'gecko_strip_moz_prefix', + 'aliases', 'extra_gecko_aliases', 'custom_consts', + 'gecko_inexhaustive', 'gecko_strip_moz_prefix', ]} %> @@ -882,7 +882,7 @@ % endif -<%def name="logical_setter(name, need_clone=False)"> +<%def name="logical_setter(name)"> /// Set the appropriate physical property for ${name} given a writing mode. pub fn set_${to_rust_ident(name)}(&mut self, v: longhands::${to_rust_ident(name)}::computed_value::T, @@ -914,18 +914,16 @@ self.copy_${to_rust_ident(name)}_from(other, wm) } - % if need_clone: - /// Get the computed value for the appropriate physical property for - /// ${name} given a writing mode. - pub fn clone_${to_rust_ident(name)}(&self, wm: WritingMode) - -> longhands::${to_rust_ident(name)}::computed_value::T { - <%self:logical_setter_helper name="${name}"> - <%def name="inner(physical_ident)"> - self.clone_${physical_ident}() - - - } - % endif + /// Get the computed value for the appropriate physical property for + /// ${name} given a writing mode. + pub fn clone_${to_rust_ident(name)}(&self, wm: WritingMode) + -> longhands::${to_rust_ident(name)}::computed_value::T { + <%self:logical_setter_helper name="${name}"> + <%def name="inner(physical_ident)"> + self.clone_${physical_ident}() + + + } <%def name="alias_to_nscsspropertyid(alias)"> diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 29ccd1d2560..1e72fb1cbc9 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -15,13 +15,10 @@ use cssparser::Parser; use itertools::{EitherOrBoth, Itertools}; use properties::{CSSWideKeyword, PropertyDeclaration}; use properties::longhands; -use properties::longhands::background_size::computed_value::T as BackgroundSizeList; -use properties::longhands::border_spacing::computed_value::T as BorderSpacing; use properties::longhands::font_weight::computed_value::T as FontWeight; use properties::longhands::font_stretch::computed_value::T as FontStretch; #[cfg(feature = "gecko")] use properties::longhands::font_variation_settings::computed_value::T as FontVariationSettings; -use properties::longhands::line_height::computed_value::T as LineHeight; use properties::longhands::transform::computed_value::ComputedMatrix; use properties::longhands::transform::computed_value::ComputedOperation as TransformOperation; use properties::longhands::transform::computed_value::T as TransformList; @@ -36,24 +33,18 @@ use std::fmt; #[cfg(feature = "gecko")] use hash::FnvHashMap; use style_traits::ParseError; use super::ComputedValues; -#[cfg(feature = "gecko")] -use values::Auto; use values::{CSSFloat, CustomIdent, Either}; use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; -use values::animated::color::{Color as AnimatedColor, RGBA as AnimatedRGBA}; -use values::animated::effects::BoxShadowList as AnimatedBoxShadowList; +use values::animated::color::RGBA as AnimatedRGBA; use values::animated::effects::Filter as AnimatedFilter; use values::animated::effects::FilterList as AnimatedFilterList; -use values::animated::effects::TextShadowList as AnimatedTextShadowList; -use values::computed::{Angle, BorderCornerRadius, CalcLengthOrPercentage}; +use values::computed::{Angle, CalcLengthOrPercentage}; use values::computed::{ClipRect, Context, ComputedUrl}; use values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; -use values::computed::{LengthOrPercentageOrNone, MaxLength, NonNegativeLength}; +use values::computed::{LengthOrPercentageOrNone, MaxLength}; use values::computed::{NonNegativeNumber, Number, NumberOrPercentage, Percentage}; -use values::computed::{PositiveIntegerOrAuto, ToComputedValue}; -#[cfg(feature = "gecko")] use values::computed::MozLength; -use values::computed::length::{NonNegativeLengthOrAuto, NonNegativeLengthOrNormal}; use values::computed::length::NonNegativeLengthOrPercentage; +use values::computed::ToComputedValue; use values::computed::transform::DirectionVector; use values::distance::{ComputeSquaredDistance, SquaredDistance}; #[cfg(feature = "gecko")] use values::generics::FontSettings as GenericFontSettings; @@ -388,10 +379,9 @@ pub enum AnimatedProperty { % for prop in data.longhands: % if prop.animatable: <% - if prop.is_animatable_with_computed_value: - value_type = "longhands::{}::computed_value::T".format(prop.ident) - else: - value_type = prop.animation_value_type + value_type = "longhands::{}::computed_value::T".format(prop.ident) + if not prop.is_animatable_with_computed_value: + value_type = "<{} as ToAnimatedValue>::AnimatedValue".format(value_type) %> /// ${prop.name} ${prop.camel_case}(${value_type}, ${value_type}), @@ -526,7 +516,7 @@ pub enum AnimationValue { % if prop.is_animatable_with_computed_value: ${prop.camel_case}(longhands::${prop.ident}::computed_value::T), % else: - ${prop.camel_case}(${prop.animation_value_type}), + ${prop.camel_case}(::AnimatedValue), % endif % endif % endfor diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 4ec1d3151e8..69dfc229d77 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -24,7 +24,6 @@ ${helpers.predefined_type("background-image", "ImageLayer", spec="https://drafts.csswg.org/css-backgrounds/#the-background-image", vector="True", animation_value_type="discrete", - has_uncacheable_values="True" if product == "gecko" else "False", ignored_when_colors_disabled="True", flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index 3850e99e983..9cb342a162e 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -211,7 +211,6 @@ ${helpers.predefined_type("border-image-source", "ImageLayer", spec="https://drafts.csswg.org/css-backgrounds/#the-background-image", vector=False, animation_value_type="discrete", - has_uncacheable_values=False, flags="APPLIES_TO_FIRST_LETTER", boxed="True")} diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 12f229b3af6..20eea91d83d 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -14,7 +14,6 @@ // We allow "display" to apply to placeholders because we need to make the // placeholder pseudo-element an inline-block in the UA stylesheet in Gecko. <%helpers:longhand name="display" - need_clone="True" animation_value_type="discrete" custom_cascade="${product == 'servo'}" flags="APPLIES_TO_PLACEHOLDER" @@ -185,7 +184,6 @@ context: &mut computed::Context) { longhands::_servo_display_for_hypothetical_box::derive_from_display(context); longhands::_servo_text_decorations_in_effect::derive_from_display(context); - longhands::_servo_under_display_none::derive_from_display(context); } % endif @@ -197,7 +195,7 @@ ${helpers.single_keyword("-moz-top-layer", "none top", gecko_constant_prefix="NS_STYLE_TOP_LAYER", - gecko_ffi_name="mTopLayer", need_clone=True, + gecko_ffi_name="mTopLayer", products="gecko", animation_value_type="none", internal=True, spec="Internal (not web-exposed)")} @@ -361,7 +359,7 @@ ${helpers.single_keyword("overflow-clip-box", "padding-box content-box", // FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`. ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", - need_clone=True, animation_value_type="discrete", + animation_value_type="discrete", extra_gecko_values="-moz-hidden-unscrollable", custom_consts=overflow_custom_consts, gecko_constant_prefix="NS_STYLE_OVERFLOW", @@ -369,7 +367,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", 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_value_type="discrete" +<%helpers:longhand name="overflow-y" animation_value_type="discrete" flags="APPLIES_TO_PLACEHOLDER", spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y"> pub use super::overflow_x::{SpecifiedValue, parse, get_initial_value, computed_value}; @@ -588,7 +586,6 @@ ${helpers.single_keyword("animation-direction", ${helpers.single_keyword("animation-play-state", "running paused", - need_clone=True, need_index=True, animation_value_type="none", vector=True, @@ -1653,7 +1650,7 @@ ${helpers.predefined_type("transform-origin", // 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_value_type="discrete" products="gecko" need_clone="True" +<%helpers:longhand name="contain" animation_value_type="discrete" products="gecko" flags="FIXPOS_CB" spec="https://drafts.csswg.org/css-contain/#contain-property"> use std::fmt; diff --git a/components/style/properties/longhand/color.mako.rs b/components/style/properties/longhand/color.mako.rs index bf5b78dca47..b9722fc8fc9 100644 --- a/components/style/properties/longhand/color.mako.rs +++ b/components/style/properties/longhand/color.mako.rs @@ -15,8 +15,7 @@ ${helpers.predefined_type( animation_value_type="AnimatedRGBA", flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", ignored_when_colors_disabled="True", - spec="https://drafts.csswg.org/css-color/#color", - need_clone="True" + spec="https://drafts.csswg.org/css-color/#color" )} // FIXME(#15973): Add servo support for system colors diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index ddce1a518a8..1d938a256d8 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -56,7 +56,6 @@ ${helpers.predefined_type( products="gecko", animation_value_type="AnimatedColor", extra_prefixes="moz", - need_clone=True, ignored_when_colors_disabled=True, spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-color", )} diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index ec611a4edec..3890332abad 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -68,7 +68,7 @@ macro_rules! impl_gecko_keyword_conversions { } -<%helpers:longhand name="font-family" animation_value_type="discrete" need_index="True" boxed="${product == 'gecko'}" +<%helpers:longhand name="font-family" animation_value_type="discrete" boxed="${product == 'gecko'}" flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER" spec="https://drafts.csswg.org/css-fonts/#propdef-font-family"> use properties::longhands::system_font::SystemFont; @@ -429,7 +429,7 @@ ${helpers.single_keyword_system("font-variant-caps", flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", animation_value_type="discrete")} -<%helpers:longhand name="font-weight" need_clone="True" animation_value_type="ComputedValue" +<%helpers:longhand name="font-weight" animation_value_type="ComputedValue" flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER" spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight"> use properties::longhands::system_font::SystemFont; @@ -596,7 +596,7 @@ ${helpers.single_keyword_system("font-variant-caps", } -<%helpers:longhand name="font-size" need_clone="True" animation_value_type="NonNegativeLength" +<%helpers:longhand name="font-size" animation_value_type="NonNegativeLength" flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER" allow_quirks="True" spec="https://drafts.csswg.org/css-fonts/#propdef-font-size"> use app_units::Au; @@ -2276,7 +2276,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control- <%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" need_clone="True"> + internal="True"> use std::fmt; use style_traits::ToCss; @@ -2356,8 +2356,7 @@ ${helpers.single_keyword("-moz-math-display", gecko_ffi_name="mMathDisplay", products="gecko", spec="Internal (not web-exposed)", - animation_value_type="none", - need_clone="True")} + animation_value_type="none")} ${helpers.single_keyword("-moz-math-variant", """none normal bold italic bold-italic script bold-script @@ -2369,7 +2368,6 @@ ${helpers.single_keyword("-moz-math-variant", products="gecko", spec="Internal (not web-exposed)", animation_value_type="none", - need_clone="True", needs_conversion=True)} <%helpers:longhand name="-moz-script-min-size" products="gecko" animation_value_type="none" diff --git a/components/style/properties/longhand/inherited_box.mako.rs b/components/style/properties/longhand/inherited_box.mako.rs index 87471ccdae7..115a2de202f 100644 --- a/components/style/properties/longhand/inherited_box.mako.rs +++ b/components/style/properties/longhand/inherited_box.mako.rs @@ -249,43 +249,3 @@ ${helpers.single_keyword("image-rendering", } } - -// Used in the bottom-up flow construction traversal to avoid constructing flows for -// descendants of nodes with `display: none`. -<%helpers:longhand name="-servo-under-display-none" - derived_from="display" - products="servo" - animation_value_type="none" - spec="Nonstandard (internal layout use only)"> - use std::fmt; - use style_traits::ToCss; - - #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] - #[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))] - #[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)] - pub struct SpecifiedValue(pub bool); - - pub mod computed_value { - pub type T = super::SpecifiedValue; - } - - pub fn get_initial_value() -> computed_value::T { - SpecifiedValue(false) - } - - impl ToCss for SpecifiedValue { - fn to_css(&self, _: &mut W) -> fmt::Result where W: fmt::Write { - Ok(()) // Internal property - } - } - - #[inline] - pub fn derive_from_display(context: &mut Context) { - use super::display::computed_value::T as Display; - - if context.style().get_box().clone_display() == Display::none { - context.builder - .set__servo_under_display_none(SpecifiedValue(true)); - } - } - diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 9fbab4b6753..5a93dba2c40 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -279,20 +279,19 @@ ${helpers.predefined_type("word-spacing", <%helpers:longhand name="-servo-text-decorations-in-effect" derived_from="display text-decoration" - need_clone="True" products="servo" + products="servo" animation_value_type="none" spec="Nonstandard (Internal property used by Servo)"> - use cssparser::RGBA; use std::fmt; use style_traits::ToCss; - #[derive(Clone, Copy, Debug, PartialEq)] + #[derive(Clone, Copy, Debug, Default, PartialEq)] #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue { - pub underline: Option, - pub overline: Option, - pub line_through: Option, + pub underline: bool, + pub overline: bool, + pub line_through: bool, } trivial_to_computed_value!(SpecifiedValue); @@ -310,19 +309,7 @@ ${helpers.predefined_type("word-spacing", #[inline] pub fn get_initial_value() -> computed_value::T { - SpecifiedValue { - underline: None, - overline: None, - line_through: None, - } - } - - fn maybe(flag: bool, context: &Context) -> Option { - if flag { - Some(context.style().get_color().clone_color()) - } else { - None - } + SpecifiedValue::default() } fn derive(context: &Context) -> computed_value::T { @@ -330,20 +317,13 @@ ${helpers.predefined_type("word-spacing", // declarations in effect and add in the text decorations that this block specifies. let mut result = match context.style().get_box().clone_display() { super::display::computed_value::T::inline_block | - super::display::computed_value::T::inline_table => SpecifiedValue { - underline: None, - overline: None, - line_through: None, - }, + super::display::computed_value::T::inline_table => get_initial_value(), _ => context.builder.get_parent_inheritedtext().clone__servo_text_decorations_in_effect() }; - result.underline = maybe(context.style().get_text().has_underline() - || result.underline.is_some(), context); - result.overline = maybe(context.style().get_text().has_overline() - || result.overline.is_some(), context); - result.line_through = maybe(context.style().get_text().has_line_through() - || result.line_through.is_some(), context); + result.underline |= context.style().get_text().has_underline(); + result.overline |= context.style().get_text().has_overline(); + result.line_through |= context.style().get_text().has_line_through(); result } @@ -705,7 +685,6 @@ ${helpers.predefined_type( initial_specified_value="specified::Color::currentcolor()", products="gecko", animation_value_type="AnimatedColor", - need_clone=True, ignored_when_colors_disabled=True, spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-color", )} @@ -725,7 +704,6 @@ ${helpers.predefined_type( "computed_value::T::currentcolor()", products="gecko", animation_value_type="AnimatedColor", - need_clone=True, ignored_when_colors_disabled=True, flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color", @@ -738,7 +716,7 @@ ${helpers.predefined_type( initial_specified_value="specified::Color::currentcolor()", products="gecko", animation_value_type="AnimatedColor", - need_clone=True, ignored_when_colors_disabled=True, + ignored_when_colors_disabled=True, flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", 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 ee7dcf604d0..8f0359ffdb5 100644 --- a/components/style/properties/longhand/outline.mako.rs +++ b/components/style/properties/longhand/outline.mako.rs @@ -16,7 +16,6 @@ ${helpers.predefined_type( "computed_value::T::currentcolor()", initial_specified_value="specified::Color::currentcolor()", animation_value_type="AnimatedColor", - need_clone=True, ignored_when_colors_disabled=True, spec="https://drafts.csswg.org/css-ui/#propdef-outline-color", )} diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index 9bbd5e22463..5fe3f1f96a0 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -167,5 +167,4 @@ ${helpers.predefined_type("mask-image", "ImageLayer", products="gecko", extra_prefixes="webkit", animation_value_type="discrete", - flags="CREATES_STACKING_CONTEXT", - has_uncacheable_values="True" if product == "gecko" else "False")} + flags="CREATES_STACKING_CONTEXT")} diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index 242ddde4988..586519333d6 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -138,12 +138,10 @@ ${helpers.single_keyword("unicode-bidi", "normal embed isolate bidi-override isolate-override plaintext", animation_value_type="discrete", - need_clone="True", spec="https://drafts.csswg.org/css-writing-modes/#propdef-unicode-bidi")} <%helpers:longhand name="text-decoration-line" custom_cascade="${product == 'servo'}" - need_clone=True animation_value_type="discrete" flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line"> diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 7ecfcc5012a..2536b49a3c8 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1797,14 +1797,13 @@ pub mod style_structs { pub fn reset_${longhand.ident}(&mut self, other: &Self) { self.copy_${longhand.ident}_from(other) } - % if longhand.need_clone: - /// Get the computed value for ${longhand.name}. - #[allow(non_snake_case)] - #[inline] - pub fn clone_${longhand.ident}(&self) -> longhands::${longhand.ident}::computed_value::T { - self.${longhand.ident}.clone() - } - % endif + + /// Get the computed value for ${longhand.name}. + #[allow(non_snake_case)] + #[inline] + pub fn clone_${longhand.ident}(&self) -> longhands::${longhand.ident}::computed_value::T { + self.${longhand.ident}.clone() + } % endif % if longhand.need_index: /// If this longhand is indexed, get the number of elements. @@ -2026,6 +2025,13 @@ impl ComputedValues { pub fn visited_rules(&self) -> Option<<&StrongRuleNode> { self.visited_style.as_ref().and_then(|s| s.rules.as_ref()) } + + /// Returns whether we're in a display: none subtree. + pub fn is_in_display_none_subtree(&self) -> bool { + use properties::computed_value_flags::IS_IN_DISPLAY_NONE_SUBTREE; + + self.flags.contains(IS_IN_DISPLAY_NONE_SUBTREE) + } } #[cfg(feature = "servo")] diff --git a/components/style/servo/restyle_damage.rs b/components/style/servo/restyle_damage.rs index fd62a146ef7..29f055b476a 100644 --- a/components/style/servo/restyle_damage.rs +++ b/components/style/servo/restyle_damage.rs @@ -198,7 +198,6 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam REFLOW, RECONSTRUCT_FLOW], [ get_box.clear, get_box.float, get_box.display, get_box.position, get_counters.content, get_counters.counter_reset, get_counters.counter_increment, - get_inheritedbox._servo_under_display_none, get_list.quotes, get_list.list_style_type, // If these text or font properties change, we need to reconstruct the flow so that diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 841b7483a8e..0cedabb686a 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -52,8 +52,6 @@ use stylesheets::keyframes_rule::KeyframesAnimation; use stylesheets::viewport_rule::{self, MaybeNew, ViewportRule}; use thread_state; -pub use ::fnv::FnvHashMap; - /// The type of the stylesheets that the stylist contains. #[cfg(feature = "servo")] pub type StylistSheet = ::stylesheets::DocumentStyleSheet;