Bug 1341775 - Part 6: stylo: Ensure float is computed after position; r?heycam draft
authorManish Goregaokar <manishearth@gmail.com>
Tue, 21 Mar 2017 12:57:04 -0700
changeset 503891 c141d473a71a3801c53926a531bb27ddb4109158
parent 503890 df1c49a5f73ad8c3ca9a90cbaf58a033ea98fddc
child 550537 520e1264aa1531068d20b94e612db9aacf5c12fd
push id50693
push userbmo:manishearth@gmail.com
push dateThu, 23 Mar 2017 18:29:23 +0000
reviewersheycam
bugs1341775
milestone55.0a1
Bug 1341775 - Part 6: stylo: Ensure float is computed after position; r?heycam MozReview-Commit-ID: 3UM844C2WYb
layout/reftests/floats/reftest-stylo.list
servo/components/style/properties/properties.mako.rs
--- a/layout/reftests/floats/reftest-stylo.list
+++ b/layout/reftests/floats/reftest-stylo.list
@@ -86,20 +86,20 @@ fails == float-in-rtl-vrl-3d.html float-
 == float-in-rtl-vrl-4b.html float-in-rtl-vrl-4b.html
 == float-in-rtl-vrl-4c.html float-in-rtl-vrl-4c.html
 fails == float-in-rtl-vrl-4d.html float-in-rtl-vrl-4d.html
 == orthogonal-floats-1a.html orthogonal-floats-1a.html
 == orthogonal-floats-1b.html orthogonal-floats-1b.html
 fails == orthogonal-floats-1c.html orthogonal-floats-1c.html
 fails == orthogonal-floats-1d.html orthogonal-floats-1d.html
 
-fails pref(layout.css.float-logical-values.enabled,true) == logical-float-side-1.html logical-float-side-1.html
-fails pref(layout.css.float-logical-values.enabled,true) == logical-float-side-2.html logical-float-side-2.html
-fails pref(layout.css.float-logical-values.enabled,true) == logical-float-side-3.html logical-float-side-3.html
-fails pref(layout.css.float-logical-values.enabled,true) == logical-float-side-4.html logical-float-side-4.html
+pref(layout.css.float-logical-values.enabled,true) == logical-float-side-1.html logical-float-side-1.html
+pref(layout.css.float-logical-values.enabled,true) == logical-float-side-2.html logical-float-side-2.html
+pref(layout.css.float-logical-values.enabled,true) == logical-float-side-3.html logical-float-side-3.html
+pref(layout.css.float-logical-values.enabled,true) == logical-float-side-4.html logical-float-side-4.html
 
 fails == float-in-rtl-slr-1a.html float-in-rtl-slr-1a.html
 fails == float-in-rtl-slr-1b.html float-in-rtl-slr-1b.html
 fails == float-in-rtl-slr-1c.html float-in-rtl-slr-1c.html
 fails == float-in-rtl-slr-1d.html float-in-rtl-slr-1d.html
 fails == float-in-rtl-slr-2a.html float-in-rtl-slr-2a.html
 fails == float-in-rtl-slr-2b.html float-in-rtl-slr-2b.html
 fails == float-in-rtl-slr-2c.html float-in-rtl-slr-2c.html
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -1943,16 +1943,17 @@ pub fn apply_declarations<'a, F, I>(devi
     // virtual dispatch instead.
     % for category_to_cascade_now in ["early", "other"]:
         % if category_to_cascade_now == "early":
             // Pull these out so that we can
             // compute them in a specific order without
             // introducing more iterations
             let mut font_size = None;
             let mut font_family = None;
+            let mut float = None;
         % endif
         for declaration in iter_declarations() {
             let longhand_id = match declaration.id() {
                 PropertyDeclarationId::Longhand(id) => id,
                 PropertyDeclarationId::Custom(..) => continue,
             };
 
             // The computed value of some properties depends on the
@@ -2001,16 +2002,20 @@ pub fn apply_declarations<'a, F, I>(devi
                 if LonghandId::FontSize == longhand_id {
                     font_size = Some(declaration);
                     continue;
                 }
                 if LonghandId::FontFamily == longhand_id {
                     font_family = Some(declaration);
                     continue;
                 }
+                if LonghandId::Float == longhand_id {
+                    float = Some(declaration);
+                    continue;
+                }
             % endif
 
             let discriminant = longhand_id as usize;
             (CASCADE_PROPERTY[discriminant])(declaration,
                                              inherited_style,
                                              default_style,
                                              &mut context,
                                              &mut cacheable,
@@ -2060,16 +2065,27 @@ pub fn apply_declarations<'a, F, I>(devi
                 (CASCADE_PROPERTY[discriminant])(&size,
                                                  inherited_style,
                                                  default_style,
                                                  &mut context,
                                                  &mut cacheable,
                                                  &mut cascade_info,
                                                  error_reporter);
             }
+            // float must be computed after position, but before display
+            if let Some(declaration) = float {
+                let discriminant = LonghandId::Float as usize;
+                (CASCADE_PROPERTY[discriminant])(declaration,
+                                                 inherited_style,
+                                                 default_style,
+                                                 &mut context,
+                                                 &mut cacheable,
+                                                 &mut cascade_info,
+                                                 error_reporter);
+            }
         % endif
     % endfor
 
     let mut style = context.style;
 
     let positioned = matches!(style.get_box().clone_position(),
         longhands::position::SpecifiedValue::absolute |
         longhands::position::SpecifiedValue::fixed);