diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-07-15 16:31:20 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-07-21 14:24:04 -0700 |
commit | 611e611215a2826677b2fa255a166ce65fc221e4 (patch) | |
tree | 016db21394f13a21e453bd84f73ab0f2b63fcf30 /components/style/selector_impl.rs | |
parent | ca9bc23b391b92d1a6e16f565b531a7fac68852c (diff) | |
download | servo-611e611215a2826677b2fa255a166ce65fc221e4.tar.gz servo-611e611215a2826677b2fa255a166ce65fc221e4.zip |
style: Rewrite the restyle hints code to allow different kinds of element snapshots, and use it for Gecko.
This is a rewrite for how style interfaces with its consumers in order to allow
different representations for an element snapshot.
This also changes the requirements of an element snapshot, requiring them to
only implement MatchAttr, instead of MatchAttrGeneric. This is important for
stylo since implementing MatchAttrGeneric is way more difficult for us given the
atom limitations. This also allows for more performant implementations in the
Gecko side of things.
Diffstat (limited to 'components/style/selector_impl.rs')
-rw-r--r-- | components/style/selector_impl.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/components/style/selector_impl.rs b/components/style/selector_impl.rs index a95499092cf..64b5725ebd0 100644 --- a/components/style/selector_impl.rs +++ b/components/style/selector_impl.rs @@ -5,6 +5,7 @@ //! The pseudo-classes and pseudo-elements supported by the style system. use element_state::ElementState; +use restyle_hints; use selectors::Element; use selectors::parser::SelectorImpl; use std::fmt::Debug; @@ -13,13 +14,16 @@ use stylesheets::Stylesheet; pub type AttrString = <TheSelectorImpl as SelectorImpl>::AttrString; #[cfg(feature = "servo")] -pub use servo_selector_impl::ServoSelectorImpl; +pub use servo_selector_impl::*; #[cfg(feature = "servo")] -pub use servo_selector_impl::{ServoSelectorImpl as TheSelectorImpl, PseudoElement, NonTSPseudoClass}; +pub use servo_selector_impl::{ServoSelectorImpl as TheSelectorImpl, ServoElementSnapshot as ElementSnapshot}; #[cfg(feature = "gecko")] -pub use gecko_selector_impl::{GeckoSelectorImpl as TheSelectorImpl, PseudoElement, NonTSPseudoClass}; +pub use gecko_selector_impl::*; + +#[cfg(feature = "gecko")] +pub use gecko_selector_impl::{GeckoSelectorImpl as TheSelectorImpl, GeckoElementSnapshot as ElementSnapshot}; /// This function determines if a pseudo-element is eagerly cascaded or not. /// @@ -69,6 +73,8 @@ impl PseudoElementCascadeType { } pub trait ElementExt: Element<Impl=TheSelectorImpl, AttrString=<TheSelectorImpl as SelectorImpl>::AttrString> { + type Snapshot: restyle_hints::ElementSnapshot<AttrString = Self::AttrString> + 'static; + fn is_link(&self) -> bool; } |