style: Avoid overriding the root font size from a getDefaultComputedStyle call.
draft
style: Avoid overriding the root font size from a getDefaultComputedStyle call.
MozReview-Commit-ID: 2WFyGj868fJ
--- 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.