style: Avoid overriding the root font size from a getDefaultComputedStyle call. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 07 Jul 2017 20:29:43 +0200
changeset 605444 231bb86bd99242194dcc94d327f20a6f10d03dba
parent 605443 68509badb6f69659e4c806a858823452140ff027
child 605445 f292198201787a299db0d19e4e0de5d6a03ca6d1
child 605447 0fb3365053c18962a58fa96c45f6f67488243159
child 605448 0f840402e25b6e798f34df06150a973ef3e28b4d
push id67406
push userbmo:emilio+bugs@crisal.io
push dateFri, 07 Jul 2017 18:39:02 +0000
milestone56.0a1
style: Avoid overriding the root font size from a getDefaultComputedStyle call. MozReview-Commit-ID: 2WFyGj868fJ
servo/components/style/matching.rs
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -548,17 +548,22 @@ trait PrivateMatchMethods: TElement {
             child_cascade_requirement =
                 self.accumulate_damage(&context.shared,
                                        &mut data.restyle,
                                        old_values.as_ref().map(|v| v.as_ref()),
                                        &new_values,
                                        None);
 
             // Handle root font-size changes.
-            if self.is_root() && !self.is_native_anonymous() {
+            //
+            // TODO(emilio): This should arguably be outside of the patch for
+            // getComputedStyle/getDefaultComputedStyle, but it's unclear how to
+            // do it without duplicating a bunch of code.
+            if self.is_root() && !self.is_native_anonymous() &&
+                !context.shared.traversal_flags.for_default_styles() {
                 // The new root font-size has already been updated on the Device
                 // in properties::apply_declarations.
                 let device = context.shared.stylist.device();
                 let new_font_size = new_values.get_font().clone_font_size();
 
                 // If the root font-size changed since last time, and something
                 // in the document did use rem units, ensure we recascade the
                 // entire tree.