Bug 1410028 - style: Ensure logical longhands appear before their physical counter-part. r=xidorn, a=ritu
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 23 Oct 2017 05:34:49 -0500
changeset 432777 213357b2f20dbb7870d78d8c560f79ebba0a4c2d
parent 432776 fe7c2a8b65809b1f21b5574f3dc763cb47da5044
child 432778 c11525bd0ab2150a9f9ea82d851a4208d66f5ca5
push id8056
push userryanvm@gmail.com
push dateThu, 26 Oct 2017 15:24:01 +0000
treeherdermozilla-beta@5f5a87b79586 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn, ritu
bugs1410028
milestone57.0
Bug 1410028 - style: Ensure logical longhands appear before their physical counter-part. r=xidorn, a=ritu MozReview-Commit-ID: KPIbt1e2Eq Source-Repo: https://github.com/servo/servo Source-Revision: 6381fdf75018a52cbd8c55af717a848840f922a6
servo/components/style/properties/properties.mako.rs
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -197,21 +197,47 @@ pub mod shorthands {
     <%include file="/shorthand/outline.mako.rs" />
     <%include file="/shorthand/padding.mako.rs" />
     <%include file="/shorthand/position.mako.rs" />
     <%include file="/shorthand/inherited_svg.mako.rs" />
     <%include file="/shorthand/text.mako.rs" />
 
     // We don't defined the 'all' shorthand using the regular helpers:shorthand
     // mechanism, since it causes some very large types to be generated.
-    <% data.declare_shorthand("all",
-                              [p.name for p in data.longhands
-                                if p.name not in ['direction', 'unicode-bidi']
-                                      and not p.internal],
-                              spec="https://drafts.csswg.org/css-cascade-3/#all-shorthand") %>
+    //
+    // Also, make sure logical properties appear before its physical
+    // counter-parts, in order to prevent bugs like:
+    //
+    //   https://bugzilla.mozilla.org/show_bug.cgi?id=1410028
+    //
+    // FIXME(emilio): Adopt the resolution from:
+    //
+    //   https://github.com/w3c/csswg-drafts/issues/1898
+    //
+    // when there is one, whatever that is.
+    <%
+        logical_longhands = []
+        other_longhands = []
+
+        for p in data.longhands:
+            if p.name in ['direction', 'unicode-bidi']:
+                continue;
+            if p.internal:
+                continue;
+            if p.logical:
+                logical_longhands.append(p.name)
+            else:
+                other_longhands.append(p.name)
+
+        data.declare_shorthand(
+            "all",
+            logical_longhands + other_longhands,
+            spec="https://drafts.csswg.org/css-cascade-3/#all-shorthand"
+        )
+    %>
 }
 
 /// A module with all the code related to animated properties.
 ///
 /// This needs to be "included" by mako at least after all longhand modules,
 /// given they populate the global data.
 pub mod animated_properties {
     <%include file="/helpers/animated_properties.mako.rs" />