aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-07-08 10:28:10 -0700
committerGitHub <noreply@github.com>2017-07-08 10:28:10 -0700
commit7a17de4fd0688a116b6a53607e040e90dc7c9652 (patch)
treed0d3f8a59c1b4b784d632dc4c473a58a11515e00
parent41a7e6391b707961568cfcadf8a5741af22e7ffd (diff)
parentc2cc6b08f8306d6f621bf32168edf55e9d071d9f (diff)
downloadservo-7a17de4fd0688a116b6a53607e040e90dc7c9652.tar.gz
servo-7a17de4fd0688a116b6a53607e040e90dc7c9652.zip
Auto merge of #17639 - emilio:gdcs-rem, r=heycam
style: Avoid overriding the root font size from a getDefaultComputedStyle call <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17639) <!-- Reviewable:end -->
-rw-r--r--components/style/matching.rs21
-rw-r--r--components/style/properties/properties.mako.rs6
2 files changed, 14 insertions, 13 deletions
diff --git a/components/style/matching.rs b/components/style/matching.rs
index 1b9f0307a9d..5629a0e8b97 100644
--- a/components/style/matching.rs
+++ b/components/style/matching.rs
@@ -341,7 +341,6 @@ trait PrivateMatchMethods: TElement {
if self.is_native_anonymous() || cascade_target == CascadeTarget::EagerPseudo {
cascade_flags.insert(PROHIBIT_DISPLAY_CONTENTS);
} else if self.is_root() {
- debug_assert!(self.owner_doc_matches_for_testing(shared_context.stylist.device()));
cascade_flags.insert(IS_ROOT_ELEMENT);
}
@@ -554,18 +553,26 @@ trait PrivateMatchMethods: TElement {
None);
// Handle root font-size changes.
- if self.is_root() && !self.is_native_anonymous() {
- // The new root font-size has already been updated on the Device
- // in properties::apply_declarations.
+ //
+ // TODO(emilio): This should arguably be outside of the path 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() {
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.
- if old_values.map_or(false, |v| v.get_font().clone_font_size() != new_font_size) &&
- device.used_root_font_size() {
- child_cascade_requirement = ChildCascadeRequirement::MustCascadeDescendants;
+ if old_values.map_or(true, |v| v.get_font().clone_font_size() != new_font_size) {
+ // FIXME(emilio): This can fire when called from a document
+ // from the bfcache (bug 1376897).
+ debug_assert!(self.owner_doc_matches_for_testing(device));
+ device.set_root_font_size(new_font_size);
+ if device.used_root_font_size() {
+ child_cascade_requirement = ChildCascadeRequirement::MustCascadeDescendants;
+ }
}
}
}
diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs
index b69b3bacbc8..cd6278167b9 100644
--- a/components/style/properties/properties.mako.rs
+++ b/components/style/properties/properties.mako.rs
@@ -2901,11 +2901,6 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
error_reporter);
% endif
}
-
- if context.is_root_element {
- let s = context.style.get_font().clone_font_size();
- context.device.set_root_font_size(s);
- }
% endif
% endfor
@@ -2938,7 +2933,6 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
style.build()
}
-
/// See StyleAdjuster::adjust_for_border_width.
pub fn adjust_border_width(style: &mut StyleBuilder) {
% for side in ["top", "right", "bottom", "left"]: