mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
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
This commit is contained in:
parent
e7945bbfcb
commit
e22850dc85
3 changed files with 29 additions and 1 deletions
|
@ -290,14 +290,22 @@ class Longhand(object):
|
||||||
"AlignContent",
|
"AlignContent",
|
||||||
"AlignItems",
|
"AlignItems",
|
||||||
"AlignSelf",
|
"AlignSelf",
|
||||||
|
"Appearance",
|
||||||
"BackgroundRepeat",
|
"BackgroundRepeat",
|
||||||
"BorderImageRepeat",
|
"BorderImageRepeat",
|
||||||
"BorderStyle",
|
"BorderStyle",
|
||||||
|
"Clear",
|
||||||
"ColumnCount",
|
"ColumnCount",
|
||||||
"Contain",
|
"Contain",
|
||||||
|
"Display",
|
||||||
|
"Float",
|
||||||
|
"FontSizeAdjust",
|
||||||
|
"FontStretch",
|
||||||
|
"FontStyle",
|
||||||
"FontStyleAdjust",
|
"FontStyleAdjust",
|
||||||
"FontSynthesis",
|
"FontSynthesis",
|
||||||
"FontWeight",
|
"FontWeight",
|
||||||
|
"GreaterThanOrEqualToOneNumber",
|
||||||
"GridAutoFlow",
|
"GridAutoFlow",
|
||||||
"InitialLetter",
|
"InitialLetter",
|
||||||
"Integer",
|
"Integer",
|
||||||
|
@ -311,10 +319,13 @@ class Longhand(object):
|
||||||
"NonNegativeNumber",
|
"NonNegativeNumber",
|
||||||
"Opacity",
|
"Opacity",
|
||||||
"OutlineStyle",
|
"OutlineStyle",
|
||||||
|
"OverflowClipBox",
|
||||||
"OverscrollBehavior",
|
"OverscrollBehavior",
|
||||||
"Percentage",
|
"Percentage",
|
||||||
|
"SVGOpacity",
|
||||||
"SVGPaintOrder",
|
"SVGPaintOrder",
|
||||||
"ScrollSnapType",
|
"ScrollSnapType",
|
||||||
|
"TextAlign",
|
||||||
"TextDecorationLine",
|
"TextDecorationLine",
|
||||||
"TouchAction",
|
"TouchAction",
|
||||||
"TransformStyle",
|
"TransformStyle",
|
||||||
|
@ -322,6 +333,8 @@ class Longhand(object):
|
||||||
"XTextZoom",
|
"XTextZoom",
|
||||||
"ZIndex",
|
"ZIndex",
|
||||||
}
|
}
|
||||||
|
if self.name == "overflow-y":
|
||||||
|
return True
|
||||||
return bool(self.keyword)
|
return bool(self.keyword)
|
||||||
|
|
||||||
def animated_type(self):
|
def animated_type(self):
|
||||||
|
|
|
@ -448,7 +448,7 @@ ${helpers.predefined_type(
|
||||||
|
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"perspective-origin",
|
"perspective-origin",
|
||||||
"position::Position",
|
"Position",
|
||||||
"computed::position::Position::center()",
|
"computed::position::Position::center()",
|
||||||
boxed=True,
|
boxed=True,
|
||||||
extra_prefixes=transform_extra_prefixes,
|
extra_prefixes=transform_extra_prefixes,
|
||||||
|
|
|
@ -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>(T);
|
||||||
|
trait AssertCopy { fn assert() {} }
|
||||||
|
trait AssertNotCopy { fn assert() {} }
|
||||||
|
impl<T: Copy> AssertCopy for Helper<T> {}
|
||||||
|
% for ty in set(x["type"] for x in others):
|
||||||
|
impl AssertNotCopy for Helper<${ty}> {}
|
||||||
|
Helper::<${ty}>::assert();
|
||||||
|
% endfor
|
||||||
|
}
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
${" |\n".join("{}(..)".format(v["name"]) for v in copy)} => {
|
${" |\n".join("{}(..)".format(v["name"]) for v in copy)} => {
|
||||||
unsafe { debug_unreachable!() }
|
unsafe { debug_unreachable!() }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue