Avoid pattern matching to clone Copy variants of PropertyDeclaration 🐉🐲

This commit is contained in:
Anthony Ramine 2018-02-08 01:22:34 +01:00
parent 335cb4c9f4
commit 5d8e70dc27
5 changed files with 88 additions and 63 deletions

View file

@ -226,6 +226,58 @@ class Longhand(object):
def enabled_in_content(self):
return self.enabled_in == "content"
def specified_type(self):
if self.predefined_type and not self.is_vector:
ty = "::values::specified::{}".format(self.predefined_type)
else:
ty = "longhands::{}::SpecifiedValue".format(self.ident)
if self.boxed:
ty = "Box<{}>".format(ty)
return ty
def specified_is_copy(self):
if self.is_vector or self.boxed:
return False
if self.predefined_type:
return self.predefined_type in {
"AlignContent",
"AlignItems",
"AlignSelf",
"BackgroundRepeat",
"BorderImageRepeat",
"BorderStyle",
"Contain",
"FontStyleAdjust",
"FontSynthesis",
"FontWeight",
"GridAutoFlow",
"ImageOrientation",
"InitialLetter",
"Integer",
"IntegerOrAuto",
"JustifyContent",
"JustifyItems",
"JustifySelf",
"MozForceBrokenImageIcon",
"MozScriptLevel",
"MozScriptMinSize",
"MozScriptSizeMultiplier",
"NonNegativeNumber",
"Opacity",
"OutlineStyle",
"OverscrollBehavior",
"Percentage",
"PositiveIntegerOrAuto",
"SVGPaintOrder",
"ScrollSnapType",
"TextDecorationLine",
"TouchAction",
"TransformStyle",
"XSpan",
"XTextZoom",
}
return bool(self.keyword)
class Shorthand(object):
def __init__(self, name, sub_properties, spec=None, servo_pref=None, gecko_pref=None,