servo: Merge #17057 - Don't set root font size when styling NAC (from Manishearth:nonac); r=emilio

try at https://treeherder.mozilla.org/#/jobs?repo=try&revision=ad4acc4941dd91d10e3646ecd7fa03576fc75342

Source-Repo: https://github.com/servo/servo
Source-Revision: 6706c818371c18e23e75de59aebc7327be67ead8

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : b2e8b38256872ea7d3d9a384e209f600bc6f91ca
This commit is contained in:
Manish Goregaokar 2017-05-27 00:18:01 -05:00
Родитель 7386600327
Коммит 32ba75ea69
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -13,8 +13,9 @@ use data::{ComputedStyle, ElementData, RestyleData};
use dom::{TElement, TNode};
use font_metrics::FontMetricsProvider;
use log::LogLevel::Trace;
use properties::{ALLOW_SET_ROOT_FONT_SIZE, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP};
use properties::{AnimationRules, CascadeFlags, ComputedValues};
use properties::{SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, VISITED_DEPENDENT_ONLY, cascade};
use properties::{VISITED_DEPENDENT_ONLY, cascade};
use properties::longhands::display::computed_value as display;
use restyle_hints::{RESTYLE_CSS_ANIMATIONS, RESTYLE_CSS_TRANSITIONS, RestyleReplacements};
use restyle_hints::{RESTYLE_STYLE_ATTRIBUTE, RESTYLE_SMIL};
@ -256,6 +257,9 @@ trait PrivateMatchMethods: TElement {
if cascade_visited.visited_dependent_only() {
cascade_flags.insert(VISITED_DEPENDENT_ONLY);
}
if !self.is_native_anonymous() {
cascade_flags.insert(ALLOW_SET_ROOT_FONT_SIZE);
}
// Grab the inherited values.
let parent_el;

Просмотреть файл

@ -2483,6 +2483,15 @@ bitflags! {
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 0x02,
/// Whether to only cascade properties that are visited dependent.
const VISITED_DEPENDENT_ONLY = 0x04,
/// Should we modify the device's root font size
/// when computing the root?
///
/// Not set for native anonymous content since some NAC
/// form their own root, but share the device.
///
/// ::backdrop and all NAC will resolve rem units against
/// the toplevel root element now.
const ALLOW_SET_ROOT_FONT_SIZE = 0x08,
}
}
@ -2773,7 +2782,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
% endif
}
if is_root_element {
if is_root_element && flags.contains(ALLOW_SET_ROOT_FONT_SIZE) {
let s = context.style.get_font().clone_font_size();
context.device.set_root_font_size(s);
}