diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index 899c47b4747..fdf93bf66b8 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -69,7 +69,7 @@ use style::computed_values::display; use style::context::SharedStyleContext; use style::data::ElementData; use style::dom::{DomChildren, LayoutIterator, NodeInfo, OpaqueNode}; -use style::dom::{PresentationalHintsSynthesizer, TElement, TNode}; +use style::dom::{TElement, TNode}; use style::element_state::*; use style::font_metrics::ServoMetricsProvider; use style::properties::{ComputedValues, PropertyDeclarationBlock}; @@ -338,18 +338,6 @@ impl<'le> fmt::Debug for ServoLayoutElement<'le> { } } -impl<'le> PresentationalHintsSynthesizer for ServoLayoutElement<'le> { - fn synthesize_presentational_hints_for_legacy_attributes(&self, - _visited_handling: VisitedHandlingMode, - hints: &mut V) - where V: Push - { - unsafe { - self.element.synthesize_presentational_hints_for_legacy_attributes(hints); - } - } -} - impl<'le> TElement for ServoLayoutElement<'le> { type ConcreteNode = ServoLayoutNode<'le>; type TraversalChildrenIterator = DomChildren; @@ -520,6 +508,19 @@ impl<'le> TElement for ServoLayoutElement<'le> { // FIXME(emilio): We should be able to give the right answer though! false } + + fn synthesize_presentational_hints_for_legacy_attributes( + &self, + _visited_handling: VisitedHandlingMode, + hints: &mut V, + ) + where + V: Push, + { + unsafe { + self.element.synthesize_presentational_hints_for_legacy_attributes(hints); + } + } } impl<'le> PartialEq for ServoLayoutElement<'le> { @@ -1245,10 +1246,3 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> { false } } - -impl<'le> PresentationalHintsSynthesizer for ServoThreadSafeLayoutElement<'le> { - fn synthesize_presentational_hints_for_legacy_attributes(&self, - _visited_handling: VisitedHandlingMode, - _hints: &mut V) - where V: Push {} -} diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index c33e2479734..d18da7b4f01 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -20,7 +20,7 @@ use style::attr::AttrValue; use style::computed_values::display; use style::context::SharedStyleContext; use style::data::ElementData; -use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthesizer, TNode}; +use style::dom::{LayoutIterator, NodeInfo, TNode}; use style::dom::OpaqueNode; use style::font_metrics::ServoMetricsProvider; use style::properties::{CascadeFlags, ComputedValues}; @@ -290,10 +290,14 @@ pub trait DangerousThreadSafeLayoutNode: ThreadSafeLayoutNode { unsafe fn dangerous_next_sibling(&self) -> Option; } -pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug + - ::selectors::Element + - GetLayoutData + - PresentationalHintsSynthesizer { +pub trait ThreadSafeLayoutElement + : Clone + + Copy + + Sized + + Debug + + ::selectors::Element + + GetLayoutData +{ type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode; fn as_node(&self) -> Self::ConcreteThreadSafeLayoutNode; diff --git a/components/style/dom.rs b/components/style/dom.rs index 38d75a1eedb..a9a8897a087 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -311,16 +311,6 @@ fn fmt_subtree(f: &mut fmt::Formatter, stringify: &F, n: N, indent: Ok(()) } -/// A trait used to synthesize presentational hints for HTML element attributes. -pub trait PresentationalHintsSynthesizer { - /// Generate the proper applicable declarations due to presentational hints, - /// and insert them into `hints`. - fn synthesize_presentational_hints_for_legacy_attributes(&self, - visited_handling: VisitedHandlingMode, - hints: &mut V) - where V: Push; -} - /// The element trait, the main abstraction the style crate acts over. pub trait TElement : Eq @@ -331,7 +321,6 @@ pub trait TElement + Copy + Clone + SelectorsElement - + PresentationalHintsSynthesizer { /// The concrete node type. type ConcreteNode: TNode; @@ -808,6 +797,16 @@ pub trait TElement /// Returns whether this element is the main body element of the HTML /// document it is on. fn is_html_document_body_element(&self) -> bool; + + /// Generate the proper applicable declarations due to presentational hints, + /// and insert them into `hints`. + fn synthesize_presentational_hints_for_legacy_attributes( + &self, + visited_handling: VisitedHandlingMode, + hints: &mut V, + ) + where + V: Push; } /// TNode and TElement aren't Send because we want to be careful and explicit diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 9cdcdba9de4..5f7a6ca9719 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -20,8 +20,7 @@ use applicable_declarations::ApplicableDeclarationBlock; use atomic_refcell::{AtomicRefCell, AtomicRef, AtomicRefMut}; use context::{QuirksMode, SharedStyleContext, PostAnimationTasks, UpdateAnimationsTasks}; use data::ElementData; -use dom::{LayoutIterator, NodeInfo, TElement, TNode}; -use dom::{OpaqueNode, PresentationalHintsSynthesizer}; +use dom::{LayoutIterator, NodeInfo, OpaqueNode, TElement, TNode}; use element_state::{ElementState, DocumentState, NS_DOCUMENT_STATE_WINDOW_INACTIVE}; use error_reporting::ParseErrorReporter; use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult}; @@ -1526,23 +1525,7 @@ impl<'le> TElement for GeckoElement<'le> { unsafe { bindings::Gecko_IsDocumentBody(self.0) } } -} -impl<'le> PartialEq for GeckoElement<'le> { - fn eq(&self, other: &Self) -> bool { - self.0 as *const _ == other.0 as *const _ - } -} - -impl<'le> Eq for GeckoElement<'le> {} - -impl<'le> Hash for GeckoElement<'le> { - fn hash(&self, state: &mut H) { - (self.0 as *const _).hash(state); - } -} - -impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> { fn synthesize_presentational_hints_for_legacy_attributes( &self, visited_handling: VisitedHandlingMode, @@ -1690,6 +1673,20 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> { } } +impl<'le> PartialEq for GeckoElement<'le> { + fn eq(&self, other: &Self) -> bool { + self.0 as *const _ == other.0 as *const _ + } +} + +impl<'le> Eq for GeckoElement<'le> {} + +impl<'le> Hash for GeckoElement<'le> { + fn hash(&self, state: &mut H) { + (self.0 as *const _).hash(state); + } +} + impl<'le> ::selectors::Element for GeckoElement<'le> { type Impl = SelectorImpl;