Have a concrete SelectorImpl type everywhere in the style crate.

It is conditionally compiled to one implementation or the other
(Gecko or Servo) with `#[cfg(…)]`.
This commit is contained in:
Simon Sapin 2016-07-19 17:40:14 +02:00
parent 4b7060554b
commit 5c70dfab01
16 changed files with 236 additions and 232 deletions

View file

@ -10,6 +10,8 @@ use selectors::parser::SelectorImpl;
use std::fmt::Debug;
use stylesheets::Stylesheet;
pub type AttrString = <TheSelectorImpl as SelectorImpl>::AttrString;
#[cfg(feature = "servo")]
pub use servo_selector_impl::ServoSelectorImpl;
@ -66,7 +68,7 @@ impl PseudoElementCascadeType {
}
}
pub trait ElementExt: Element {
pub trait ElementExt: Element<Impl=TheSelectorImpl, AttrString=<TheSelectorImpl as SelectorImpl>::AttrString> {
fn is_link(&self) -> bool;
}
@ -102,7 +104,7 @@ pub trait SelectorImplExt : SelectorImpl + Clone + Debug + Sized + 'static {
fn pseudo_class_state_flag(pc: &Self::NonTSPseudoClass) -> ElementState;
fn get_user_or_user_agent_stylesheets() -> &'static [Stylesheet<Self>];
fn get_user_or_user_agent_stylesheets() -> &'static [Stylesheet];
fn get_quirks_mode_stylesheet() -> Option<&'static Stylesheet<Self>>;
fn get_quirks_mode_stylesheet() -> Option<&'static Stylesheet>;
}