style: Remove SharedStyleContext::quirks_mode.

This commit is contained in:
Emilio Cobos Álvarez 2017-08-25 12:22:31 +02:00
parent 772a8464eb
commit 723d31a4d8
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 16 additions and 25 deletions

View file

@ -67,7 +67,7 @@ use style::CaseSensitivityExt;
use style::applicable_declarations::ApplicableDeclarationBlock;
use style::attr::AttrValue;
use style::computed_values::display;
use style::context::{QuirksMode, SharedStyleContext};
use style::context::SharedStyleContext;
use style::data::ElementData;
use style::dom::{LayoutIterator, NodeInfo, OpaqueNode};
use style::dom::{PresentationalHintsSynthesizer, TElement, TNode, UnsafeNode};
@ -357,10 +357,6 @@ impl<'ld> ServoLayoutDocument<'ld> {
unsafe { self.document.will_paint(); }
}
pub fn quirks_mode(&self) -> QuirksMode {
unsafe { self.document.quirks_mode() }
}
pub fn style_shared_lock(&self) -> &StyleSharedRwLock {
unsafe { self.document.style_shared_lock() }
}

View file

@ -260,9 +260,6 @@ pub struct LayoutThread {
// rather limit the dependency on that module here.
layout_threads: usize,
/// Which quirks mode are we rendering the document in?
quirks_mode: Option<QuirksMode>,
/// Paint time metrics.
paint_time_metrics: PaintTimeMetrics,
}
@ -543,7 +540,6 @@ impl LayoutThread {
Timer::new()
},
layout_threads: layout_threads,
quirks_mode: None,
paint_time_metrics: paint_time_metrics,
}
}
@ -582,7 +578,6 @@ impl LayoutThread {
registered_speculative_painters: &self.registered_painters,
local_context_creation_data: Mutex::new(thread_local_style_context_creation_data),
timer: self.timer.clone(),
quirks_mode: self.quirks_mode.unwrap(),
traversal_flags: TraversalFlags::empty(),
snapshot_map: snapshot_map,
},
@ -1068,7 +1063,6 @@ impl LayoutThread {
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let document = unsafe { ServoLayoutNode::new(&data.document) };
let document = document.as_document().unwrap();
self.quirks_mode = Some(document.quirks_mode());
// FIXME(pcwalton): Combine `ReflowGoal` and `ReflowQueryType`. Then remove this assert.
debug_assert!((data.reflow_info.goal == ReflowGoal::ForDisplay &&

View file

@ -506,7 +506,7 @@ fn compute_style_for_animation_step(context: &SharedStyleContext,
/* visited_style = */ None,
font_metrics_provider,
CascadeFlags::empty(),
context.quirks_mode);
context.quirks_mode());
computed
}
}

View file

@ -137,9 +137,6 @@ pub struct SharedStyleContext<'a> {
/// them.
pub timer: Timer,
/// The QuirksMode state which the document needs to be rendered with
pub quirks_mode: QuirksMode,
/// Flags controlling how we traverse the tree.
pub traversal_flags: TraversalFlags,
@ -174,6 +171,11 @@ impl<'a> SharedStyleContext<'a> {
pub fn device_pixel_ratio(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
self.stylist.device().device_pixel_ratio()
}
/// The quirks mode of the document.
pub fn quirks_mode(&self) -> QuirksMode {
self.stylist.quirks_mode()
}
}
/// The structure holds various intermediate inputs that are eventually used by

View file

@ -580,7 +580,7 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
MatchingMode::Normal,
None,
VisitedHandlingMode::AllLinksVisitedAndUnvisited,
self.shared_context.quirks_mode,
self.shared_context.quirks_mode(),
);
let matching_result = matches_compound_selector(
@ -774,7 +774,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
&mut self,
map: &InvalidationMap,
) {
let quirks_mode = self.shared_context.quirks_mode;
let quirks_mode = self.shared_context.quirks_mode();
let removed_id = self.removed_id;
if let Some(ref id) = removed_id {
if let Some(deps) = map.id_to_selector.get(id, quirks_mode) {
@ -821,7 +821,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
) {
map.lookup_with_additional(
self.lookup_element,
self.shared_context.quirks_mode,
self.shared_context.quirks_mode(),
self.removed_id,
self.classes_removed,
&mut |dependency| {
@ -841,7 +841,7 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
) {
map.lookup_with_additional(
self.lookup_element,
self.shared_context.quirks_mode,
self.shared_context.quirks_mode(),
self.removed_id,
self.classes_removed,
&mut |dependency| {
@ -885,11 +885,11 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
let mut now_context =
MatchingContext::new_for_visited(MatchingMode::Normal, None,
VisitedHandlingMode::AllLinksUnvisited,
self.shared_context.quirks_mode);
self.shared_context.quirks_mode());
let mut then_context =
MatchingContext::new_for_visited(MatchingMode::Normal, None,
VisitedHandlingMode::AllLinksUnvisited,
self.shared_context.quirks_mode);
self.shared_context.quirks_mode());
let matched_then =
matches_selector(&dependency.selector,

View file

@ -363,7 +363,7 @@ where
MatchingMode::Normal,
Some(bloom_filter),
visited_handling,
self.context.shared.quirks_mode
self.context.shared.quirks_mode(),
);
let stylist = &self.context.shared.stylist;
@ -437,7 +437,7 @@ where
MatchingMode::ForStatelessPseudoElement,
Some(bloom_filter),
visited_handling,
self.context.shared.quirks_mode
self.context.shared.quirks_mode(),
);
let map = &mut self.context.thread_local.selector_flags;
@ -528,7 +528,7 @@ where
Some(&mut cascade_info),
&self.context.thread_local.font_metrics_provider,
cascade_flags,
self.context.shared.quirks_mode
self.context.shared.quirks_mode(),
);
cascade_info.finish(&self.element.as_node());

View file

@ -197,7 +197,6 @@ fn create_shared_context<'a>(global_style_data: &GlobalStyleData,
options: global_style_data.options.clone(),
guards: StylesheetGuards::same(guard),
timer: Timer::new(),
quirks_mode: per_doc_data.stylist.quirks_mode(),
traversal_flags: traversal_flags,
snapshot_map: snapshot_map,
}