From e22850dc85104d867acfab235150795d06f92efa Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 8 Aug 2018 12:07:34 +0000 Subject: [PATCH] style: Add check for non-Copy specified value to ensure specified_is_copy always returns the right result. Differential Revision: https://phabricator.services.mozilla.com/D2931 --- components/style/properties/data.py | 13 +++++++++++++ components/style/properties/longhands/box.mako.rs | 2 +- components/style/properties/properties.mako.rs | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/components/style/properties/data.py b/components/style/properties/data.py index ca05309b4b6..d323243312d 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -290,14 +290,22 @@ class Longhand(object): "AlignContent", "AlignItems", "AlignSelf", + "Appearance", "BackgroundRepeat", "BorderImageRepeat", "BorderStyle", + "Clear", "ColumnCount", "Contain", + "Display", + "Float", + "FontSizeAdjust", + "FontStretch", + "FontStyle", "FontStyleAdjust", "FontSynthesis", "FontWeight", + "GreaterThanOrEqualToOneNumber", "GridAutoFlow", "InitialLetter", "Integer", @@ -311,10 +319,13 @@ class Longhand(object): "NonNegativeNumber", "Opacity", "OutlineStyle", + "OverflowClipBox", "OverscrollBehavior", "Percentage", + "SVGOpacity", "SVGPaintOrder", "ScrollSnapType", + "TextAlign", "TextDecorationLine", "TouchAction", "TransformStyle", @@ -322,6 +333,8 @@ class Longhand(object): "XTextZoom", "ZIndex", } + if self.name == "overflow-y": + return True return bool(self.keyword) def animated_type(self): diff --git a/components/style/properties/longhands/box.mako.rs b/components/style/properties/longhands/box.mako.rs index 765731c13f2..09866c8b692 100644 --- a/components/style/properties/longhands/box.mako.rs +++ b/components/style/properties/longhands/box.mako.rs @@ -448,7 +448,7 @@ ${helpers.predefined_type( ${helpers.predefined_type( "perspective-origin", - "position::Position", + "Position", "computed::position::Position::center()", boxed=True, extra_prefixes=transform_extra_prefixes, diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index fed6d52b7f7..df0b4655702 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -305,6 +305,21 @@ impl Clone for PropertyDeclaration { } } + // This function ensures that all properties not handled above + // do not have a specified value implements Copy. If you hit + // compile error here, you may want to add the type name into + // Longhand.specified_is_copy in data.py. + fn _static_assert_others_are_not_copy() { + struct Helper(T); + trait AssertCopy { fn assert() {} } + trait AssertNotCopy { fn assert() {} } + impl AssertCopy for Helper {} + % for ty in set(x["type"] for x in others): + impl AssertNotCopy for Helper<${ty}> {} + Helper::<${ty}>::assert(); + % endfor + } + match *self { ${" |\n".join("{}(..)".format(v["name"]) for v in copy)} => { unsafe { debug_unreachable!() }