Bug 1481781 - Add check for non-Copy specified value to ensure specified_is_copy always returns the right result. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D2931

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Xidorn Quan 2018-08-08 12:07:34 +00:00
Родитель de751cd3e6
Коммит 3b8f9b869d
3 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -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):

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 {
${" |\n".join("{}(..)".format(v["name"]) for v in copy)} => {
unsafe { debug_unreachable!() }