servo: Merge #19752 - style: Use Python's True instead of string for arbitrary Python code in mako (from CYBAI:fix-mako-true); r=nox
authorCYBAI <cyb.ai.815@gmail.com>
Fri, 12 Jan 2018 10:56:30 -0600
changeset 453345 4c0e52aa8c09ebc6be490837dbcf3c28a339c7c1
parent 453344 392278bcc755c3ea4c65c4ffb8833bd7b92b06ff
child 453346 142001babb39d7cce8b88a2103ba8863fce685ad
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnox
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #19752 - style: Use Python's True instead of string for arbitrary Python code in mako (from CYBAI:fix-mako-true); r=nox As discussion in IRC with @nox and @gootorov , it's more correct to use Python's `True` for `${arbitrary Python code}` in mako. Following is related IRC logs ``` 15:39 nox As I said, that's because there are 2 ways to invoke the things with Mako. 15:40 nox ${arbitrary Python code} vs <%named_helper ..>...</%named_helper> 15:40 nox IIRC <%foo bar=True></%foo> is not valid Mako syntax, 15:40 nox but with bar="True" it is. 15:42 cybai gootorov: I did meet some issues when moving makos if I set "True" instead of Python's `True`. Thus, like nox mentioned above, it's related to how the code works 15:44 gootorov nox: Alright, I got it now, thanks. There are a couple ${function} blocks that still use `boxed="True" though. They aren't <%named_helpers>, shouldn't they use Python's True too, then? 15:45 nox gootorov: I think there is an issue because this specific attribute is also used as a string through other <%helpers>, 15:46 nox gootorov: Seems like it's not an issue anymore because the boxed attribute is passed to arg_to_bool, 15:46 nox which either returns the boolean as is or check whether it's a "True" or "False" string. 15:47 nox gootorov: So indeed, you can probably make those use booleans now. 15:47 gootorov nox: Okay, got it, thanks for the explanation :) ``` --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests Source-Repo: https://github.com/servo/servo Source-Revision: 865181b6e676fc9b76447ad5172e275b9861ca5e
servo/components/style/properties/longhand/border.mako.rs
servo/components/style/properties/longhand/box.mako.rs
servo/components/style/properties/longhand/effects.mako.rs
servo/components/style/properties/longhand/inherited_svg.mako.rs
servo/components/style/properties/longhand/inherited_table.mako.rs
servo/components/style/properties/longhand/list.mako.rs
servo/components/style/properties/longhand/position.mako.rs
--- a/servo/components/style/properties/longhand/border.mako.rs
+++ b/servo/components/style/properties/longhand/border.mako.rs
@@ -205,17 +205,17 @@
 
 ${helpers.predefined_type("border-image-source", "ImageLayer",
     initial_value="Either::First(None_)",
     initial_specified_value="Either::First(None_)",
     spec="https://drafts.csswg.org/css-backgrounds/#the-background-image",
     vector=False,
     animation_value_type="discrete",
     flags="APPLIES_TO_FIRST_LETTER",
-    boxed="True")}
+    boxed=True)}
 
 ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
     parse_method="parse_non_negative",
     initial_value="computed::LengthOrNumberRect::all(computed::LengthOrNumber::zero())",
     initial_specified_value="specified::LengthOrNumberRect::all(specified::LengthOrNumber::zero())",
     spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset",
     animation_value_type="discrete",
     flags="APPLIES_TO_FIRST_LETTER",
--- a/servo/components/style/properties/longhand/box.mako.rs
+++ b/servo/components/style/properties/longhand/box.mako.rs
@@ -384,17 +384,17 @@
     )}
 % endfor
 
 ${helpers.predefined_type("scroll-snap-destination",
                           "Position",
                           "computed::Position::zero()",
                           products="gecko",
                           gecko_pref="layout.css.scroll-snap.enabled",
-                          boxed="True",
+                          boxed=True,
                           spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
                           animation_value_type="discrete")}
 
 ${helpers.predefined_type(
     "scroll-snap-coordinate",
     "Position",
     "computed::Position::zero()",
     vector=True,
@@ -500,17 +500,17 @@
                           spec="https://drafts.csswg.org/css-transforms/#perspective",
                           extra_prefixes="moz webkit",
                           flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
                           animation_value_type="ComputedValue")}
 
 ${helpers.predefined_type("perspective-origin",
                           "position::Position",
                           "computed::position::Position::center()",
-                          boxed="True",
+                          boxed=True,
                           extra_prefixes="moz webkit",
                           spec="https://drafts.csswg.org/css-transforms-2/#perspective-origin-property",
                           animation_value_type="ComputedValue")}
 
 ${helpers.single_keyword("backface-visibility",
                          "visible hidden",
                          spec="https://drafts.csswg.org/css-transforms/#backface-visibility-property",
                          extra_prefixes="moz webkit",
@@ -584,17 +584,17 @@
                          gecko_ffi_name="mAppearance",
                          gecko_constant_prefix="ThemeWidgetType_NS_THEME",
                          products="gecko",
                          spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance)",
                          animation_value_type="discrete")}
 
 ${helpers.predefined_type("-moz-binding", "UrlOrNone", "Either::Second(None_)",
                           products="gecko",
-                          boxed="True" if product == "gecko" else "False",
+                          boxed= product == "gecko",
                           animation_value_type="none",
                           gecko_ffi_name="mBinding",
                           spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding)")}
 
 ${helpers.single_keyword("-moz-orient",
                           "inline block horizontal vertical",
                           products="gecko",
                           gecko_ffi_name="mOrient",
--- a/servo/components/style/properties/longhand/effects.mako.rs
+++ b/servo/components/style/properties/longhand/effects.mako.rs
@@ -25,17 +25,17 @@
     flags="APPLIES_TO_FIRST_LETTER",
     spec="https://drafts.csswg.org/css-backgrounds/#box-shadow",
 )}
 
 ${helpers.predefined_type("clip",
                           "ClipRectOrAuto",
                           "computed::ClipRectOrAuto::auto()",
                           animation_value_type="ComputedValue",
-                          boxed="True",
+                          boxed=True,
                           allow_quirks=True,
                           spec="https://drafts.fxtf.org/css-masking/#clip-property")}
 
 ${helpers.predefined_type(
     "filter",
     "Filter",
     None,
     vector=True,
--- a/servo/components/style/properties/longhand/inherited_svg.mako.rs
+++ b/servo/components/style/properties/longhand/inherited_svg.mako.rs
@@ -109,29 +109,29 @@
 ${helpers.single_keyword("clip-rule", "nonzero evenodd",
                          products="gecko",
                          gecko_enum_prefix="StyleFillRule",
                          animation_value_type="discrete",
                          spec="https://www.w3.org/TR/SVG11/masking.html#ClipRuleProperty")}
 
 ${helpers.predefined_type("marker-start", "UrlOrNone", "Either::Second(None_)",
                           products="gecko",
-                          boxed="True" if product == "gecko" else "False",
+                          boxed= product == "gecko",
                           animation_value_type="discrete",
                           spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
 
 ${helpers.predefined_type("marker-mid", "UrlOrNone", "Either::Second(None_)",
                           products="gecko",
-                          boxed="True" if product == "gecko" else "False",
+                          boxed= product == "gecko",
                           animation_value_type="discrete",
                           spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
 
 ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
                           products="gecko",
-                          boxed="True" if product == "gecko" else "False",
+                          boxed= product == "gecko",
                           animation_value_type="discrete",
                           spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
 
 ${helpers.predefined_type("paint-order", "SVGPaintOrder", "computed::SVGPaintOrder::normal()",
                           products="gecko",
                           animation_value_type="discrete",
                           gecko_pref="svg.paint-order.enabled",
                           spec="https://www.w3.org/TR/SVG2/painting.html#PaintOrder")}
--- a/servo/components/style/properties/longhand/inherited_table.mako.rs
+++ b/servo/components/style/properties/longhand/inherited_table.mako.rs
@@ -19,10 +19,10 @@
                          needs_conversion="True",
                          animation_value_type="discrete",
                          spec="https://drafts.csswg.org/css-tables/#propdef-caption-side")}
 
 ${helpers.predefined_type("border-spacing",
                           "BorderSpacing",
                           "computed::BorderSpacing::zero()",
                           animation_value_type="BorderSpacing",
-                          boxed="True",
+                          boxed=True,
                           spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing")}
--- a/servo/components/style/properties/longhand/list.mako.rs
+++ b/servo/components/style/properties/longhand/list.mako.rs
@@ -30,17 +30,17 @@
         animation_value_type="discrete",
         spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type")}
 % else:
     ${helpers.predefined_type("list-style-type",
                               "ListStyleType",
                               "computed::ListStyleType::disc()",
                               initial_specified_value="specified::ListStyleType::disc()",
                               animation_value_type="discrete",
-                              boxed="True",
+                              boxed=True,
                               spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type")}
 % endif
 
 ${helpers.predefined_type("list-style-image",
                           "ListStyleImage",
                           initial_value="specified::ListStyleImage::none()",
                           initial_specified_value="specified::ListStyleImage::none()",
                           animation_value_type="discrete",
@@ -53,10 +53,10 @@
                           animation_value_type="discrete",
                           spec="https://drafts.csswg.org/css-content/#propdef-quotes")}
 
 ${helpers.predefined_type("-moz-image-region",
                           "ClipRectOrAuto",
                           "computed::ClipRectOrAuto::auto()",
                           animation_value_type="ComputedValue",
                           products="gecko",
-                          boxed="True",
+                          boxed=True,
                           spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-region)")}
--- a/servo/components/style/properties/longhand/position.mako.rs
+++ b/servo/components/style/properties/longhand/position.mako.rs
@@ -242,17 +242,17 @@ macro_rules! impl_align_conversions {
 ${helpers.single_keyword("object-fit", "fill contain cover none scale-down",
                          products="gecko", animation_value_type="discrete",
                          spec="https://drafts.csswg.org/css-images/#propdef-object-fit")}
 
 ${helpers.predefined_type("object-position",
                           "Position",
                           "computed::Position::zero()",
                           products="gecko",
-                          boxed="True",
+                          boxed=True,
                           spec="https://drafts.csswg.org/css-images-3/#the-object-position",
                           animation_value_type="ComputedValue")}
 
 % for kind in ["row", "column"]:
     ${helpers.predefined_type("grid-%s-gap" % kind,
                               "NonNegativeLengthOrPercentage",
                               "computed::NonNegativeLengthOrPercentage::zero()",
                               spec="https://drafts.csswg.org/css-grid/#propdef-grid-%s-gap" % kind,