diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index f06ced47160..d211ab88063 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -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() } } diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 59796fe3f92..24c85c8598b 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -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, - /// 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 && diff --git a/components/style/animation.rs b/components/style/animation.rs index 05bd3de0531..a4272b98e7d 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -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 } } diff --git a/components/style/context.rs b/components/style/context.rs index 591ea98a003..c7c5d2ae354 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -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 { 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 diff --git a/components/style/invalidation/element/invalidator.rs b/components/style/invalidation/element/invalidator.rs index 7edc3609429..a42af0872c4 100644 --- a/components/style/invalidation/element/invalidator.rs +++ b/components/style/invalidation/element/invalidator.rs @@ -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, diff --git a/components/style/style_resolver.rs b/components/style/style_resolver.rs index cfdef9e296b..53add177b2c 100644 --- a/components/style/style_resolver.rs +++ b/components/style/style_resolver.rs @@ -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()); diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index fbf4ab9f061..d9ac5f3190d 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -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, }