Remove SelectorImpl aliases

This commit is contained in:
Simon Sapin 2016-11-21 19:13:02 +01:00
parent 82b13d50e3
commit 81a3de3299
15 changed files with 78 additions and 85 deletions

View file

@ -128,8 +128,8 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
/// Recalculates style for a set of animations. This does *not* run with the DOM
/// lock held.
// NB: This is specific for ServoSelectorImpl, since the layout context and the
// flows are ServoSelectorImpl specific too. If that goes away at some point,
// NB: This is specific for SelectorImpl, since the layout context and the
// flows are SelectorImpl specific too. If that goes away at some point,
// this should be made generic.
pub fn recalc_style_for_animations(context: &SharedLayoutContext,
flow: &mut Flow,

View file

@ -92,7 +92,7 @@ use style::properties::{DeclaredValue, Importance};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
use style::properties::longhands::{background_image, border_spacing, font_family, font_size, overflow_x};
use style::restyle_hints::RESTYLE_SELF;
use style::selector_parser::{NonTSPseudoClass, RestyleDamage, ServoSelectorImpl, SelectorParser};
use style::selector_parser::{NonTSPseudoClass, RestyleDamage, SelectorImpl, SelectorParser};
use style::sink::Push;
use style::stylist::ApplicableDeclarationBlock;
use style::values::CSSFloat;
@ -2141,9 +2141,9 @@ impl VirtualMethods for Element {
}
impl<'a> ::selectors::MatchAttrGeneric for Root<Element> {
type Impl = ServoSelectorImpl;
type Impl = SelectorImpl;
fn match_attr<F>(&self, attr: &AttrSelector<ServoSelectorImpl>, test: F) -> bool
fn match_attr<F>(&self, attr: &AttrSelector<SelectorImpl>, test: F) -> bool
where F: Fn(&str) -> bool
{
use ::selectors::Element;

View file

@ -82,7 +82,7 @@ use std::mem;
use std::ops::Range;
use std::sync::Arc;
use style::dom::OpaqueNode;
use style::selector_parser::{ServoSelectorImpl, SelectorParser};
use style::selector_parser::{SelectorImpl, SelectorParser};
use style::stylesheets::Stylesheet;
use style::thread_state;
use uuid::Uuid;
@ -304,12 +304,12 @@ impl Node {
}
pub struct QuerySelectorIterator {
selectors: Vec<Selector<ServoSelectorImpl>>,
selectors: Vec<Selector<SelectorImpl>>,
iterator: TreeIterator,
}
impl<'a> QuerySelectorIterator {
fn new(iter: TreeIterator, selectors: Vec<Selector<ServoSelectorImpl>>)
fn new(iter: TreeIterator, selectors: Vec<Selector<SelectorImpl>>)
-> QuerySelectorIterator {
QuerySelectorIterator {
selectors: selectors,

View file

@ -66,7 +66,7 @@ use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthe
use style::dom::UnsafeNode;
use style::element_state::*;
use style::properties::{ComputedValues, PropertyDeclarationBlock};
use style::selector_parser::{NonTSPseudoClass, PseudoElement, RestyleDamage, ServoSelectorImpl};
use style::selector_parser::{NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl};
use style::sink::Push;
use style::str::is_whitespace;
use style::stylist::ApplicableDeclarationBlock;
@ -560,9 +560,9 @@ fn as_element<'le>(node: LayoutJS<Node>) -> Option<ServoLayoutElement<'le>> {
}
impl<'le> ::selectors::MatchAttrGeneric for ServoLayoutElement<'le> {
type Impl = ServoSelectorImpl;
type Impl = SelectorImpl;
fn match_attr<F>(&self, attr: &AttrSelector<ServoSelectorImpl>, test: F) -> bool
fn match_attr<F>(&self, attr: &AttrSelector<SelectorImpl>, test: F) -> bool
where F: Fn(&str) -> bool {
use ::selectors::Element;
let name = if self.is_html_element_in_html_document() {
@ -1097,9 +1097,9 @@ impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
/// Note that the element implementation is needed only for selector matching,
/// not for inheritance (styles are inherited appropiately).
impl<'le> ::selectors::MatchAttrGeneric for ServoThreadSafeLayoutElement<'le> {
type Impl = ServoSelectorImpl;
type Impl = SelectorImpl;
fn match_attr<F>(&self, attr: &AttrSelector<ServoSelectorImpl>, test: F) -> bool
fn match_attr<F>(&self, attr: &AttrSelector<SelectorImpl>, test: F) -> bool
where F: Fn(&str) -> bool {
match attr.namespace {
NamespaceConstraint::Specific(ref ns) => {

View file

@ -22,7 +22,7 @@ use style::data::ElementData;
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
use style::dom::OpaqueNode;
use style::properties::ServoComputedValues;
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, RestyleDamage, ServoSelectorImpl};
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, RestyleDamage, SelectorImpl};
#[derive(Copy, PartialEq, Clone, Debug)]
pub enum PseudoElementType<T> {
@ -147,7 +147,7 @@ impl<ConcreteNode> Iterator for TreeIterator<ConcreteNode>
pub trait ThreadSafeLayoutNode: Clone + Copy + GetLayoutData + NodeInfo + PartialEq + Sized {
type ConcreteThreadSafeLayoutElement:
ThreadSafeLayoutElement<ConcreteThreadSafeLayoutNode = Self>
+ ::selectors::Element<Impl=ServoSelectorImpl>;
+ ::selectors::Element<Impl=SelectorImpl>;
type ChildrenIterator: Iterator<Item = Self> + Sized;
/// Converts self into an `OpaqueNode`.
@ -271,7 +271,7 @@ pub trait DangerousThreadSafeLayoutNode: ThreadSafeLayoutNode {
}
pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
::selectors::Element<Impl=ServoSelectorImpl> +
::selectors::Element<Impl=SelectorImpl> +
GetLayoutData +
PresentationalHintsSynthetizer {
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<ConcreteThreadSafeLayoutElement = Self>;

View file

@ -11,9 +11,6 @@ use std::borrow::Cow;
use std::fmt;
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
// FIXME remove
pub use self::SelectorImpl as GeckoSelectorImpl;
/// NOTE: The boolean field represents whether this element is an anonymous box.
///
/// This is just for convenience, instead of recomputing it. Also, note that

View file

@ -9,7 +9,7 @@ use gecko_bindings::bindings;
use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::ServoElementSnapshotFlags as Flags;
use restyle_hints::ElementSnapshot;
use selector_parser::TheSelectorImpl;
use selector_parser::SelectorImpl;
use selectors::parser::AttrSelector;
use string_cache::Atom;
@ -36,9 +36,9 @@ impl GeckoElementSnapshot {
}
impl ::selectors::MatchAttr for GeckoElementSnapshot {
type Impl = TheSelectorImpl;
type Impl = SelectorImpl;
fn match_attr_has(&self, attr: &AttrSelector<TheSelectorImpl>) -> bool {
fn match_attr_has(&self, attr: &AttrSelector<SelectorImpl>) -> bool {
unsafe {
bindings::Gecko_SnapshotHasAttr(self.0,
attr.ns_or_null(),
@ -46,7 +46,7 @@ impl ::selectors::MatchAttr for GeckoElementSnapshot {
}
}
fn match_attr_equals(&self, attr: &AttrSelector<TheSelectorImpl>, value: &Atom) -> bool {
fn match_attr_equals(&self, attr: &AttrSelector<SelectorImpl>, value: &Atom) -> bool {
unsafe {
bindings::Gecko_SnapshotAttrEquals(self.0,
attr.ns_or_null(),
@ -56,7 +56,7 @@ impl ::selectors::MatchAttr for GeckoElementSnapshot {
}
}
fn match_attr_equals_ignore_ascii_case(&self, attr: &AttrSelector<TheSelectorImpl>, value: &Atom) -> bool {
fn match_attr_equals_ignore_ascii_case(&self, attr: &AttrSelector<SelectorImpl>, value: &Atom) -> bool {
unsafe {
bindings::Gecko_SnapshotAttrEquals(self.0,
attr.ns_or_null(),
@ -65,7 +65,7 @@ impl ::selectors::MatchAttr for GeckoElementSnapshot {
/* ignoreCase = */ true)
}
}
fn match_attr_includes(&self, attr: &AttrSelector<TheSelectorImpl>, value: &Atom) -> bool {
fn match_attr_includes(&self, attr: &AttrSelector<SelectorImpl>, value: &Atom) -> bool {
unsafe {
bindings::Gecko_SnapshotAttrIncludes(self.0,
attr.ns_or_null(),
@ -73,7 +73,7 @@ impl ::selectors::MatchAttr for GeckoElementSnapshot {
value.as_ptr())
}
}
fn match_attr_dash(&self, attr: &AttrSelector<TheSelectorImpl>, value: &Atom) -> bool {
fn match_attr_dash(&self, attr: &AttrSelector<SelectorImpl>, value: &Atom) -> bool {
unsafe {
bindings::Gecko_SnapshotAttrDashEquals(self.0,
attr.ns_or_null(),
@ -81,7 +81,7 @@ impl ::selectors::MatchAttr for GeckoElementSnapshot {
value.as_ptr())
}
}
fn match_attr_prefix(&self, attr: &AttrSelector<TheSelectorImpl>, value: &Atom) -> bool {
fn match_attr_prefix(&self, attr: &AttrSelector<SelectorImpl>, value: &Atom) -> bool {
unsafe {
bindings::Gecko_SnapshotAttrHasPrefix(self.0,
attr.ns_or_null(),
@ -89,7 +89,7 @@ impl ::selectors::MatchAttr for GeckoElementSnapshot {
value.as_ptr())
}
}
fn match_attr_substring(&self, attr: &AttrSelector<TheSelectorImpl>, value: &Atom) -> bool {
fn match_attr_substring(&self, attr: &AttrSelector<SelectorImpl>, value: &Atom) -> bool {
unsafe {
bindings::Gecko_SnapshotAttrHasSubstring(self.0,
attr.ns_or_null(),
@ -97,7 +97,7 @@ impl ::selectors::MatchAttr for GeckoElementSnapshot {
value.as_ptr())
}
}
fn match_attr_suffix(&self, attr: &AttrSelector<TheSelectorImpl>, value: &Atom) -> bool {
fn match_attr_suffix(&self, attr: &AttrSelector<SelectorImpl>, value: &Atom) -> bool {
unsafe {
bindings::Gecko_SnapshotAttrHasSuffix(self.0,
attr.ns_or_null(),

View file

@ -12,7 +12,7 @@ use dom::{OpaqueNode, PresentationalHintsSynthetizer};
use element_state::ElementState;
use error_reporting::StdoutErrorReporter;
use gecko::restyle_damage::GeckoRestyleDamage;
use gecko::selector_parser::{GeckoSelectorImpl, NonTSPseudoClass, PseudoElement};
use gecko::selector_parser::{SelectorImpl, NonTSPseudoClass, PseudoElement};
use gecko::snapshot_helpers;
use gecko_bindings::bindings;
use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator};
@ -532,7 +532,7 @@ pub trait AttrSelectorHelpers {
fn select_name(&self, is_html_element_in_html_document: bool) -> *mut nsIAtom;
}
impl AttrSelectorHelpers for AttrSelector<GeckoSelectorImpl> {
impl AttrSelectorHelpers for AttrSelector<SelectorImpl> {
fn ns_or_null(&self) -> *mut nsIAtom {
match self.namespace {
NamespaceConstraint::Any => ptr::null_mut(),
@ -550,7 +550,7 @@ impl AttrSelectorHelpers for AttrSelector<GeckoSelectorImpl> {
}
impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
type Impl = GeckoSelectorImpl;
type Impl = SelectorImpl;
fn match_attr_has(&self, attr: &AttrSelector<Self::Impl>) -> bool {
unsafe {

View file

@ -17,7 +17,7 @@ use dom::{TElement, TNode, TRestyleDamage, UnsafeNode};
use properties::{CascadeFlags, ComputedValues, SHAREABLE, cascade};
use properties::longhands::display::computed_value as display;
use rule_tree::StrongRuleNode;
use selector_parser::{PseudoElement, RestyleDamage, TheSelectorImpl};
use selector_parser::{PseudoElement, RestyleDamage, SelectorImpl};
use selectors::MatchAttr;
use selectors::bloom::BloomFilter;
use selectors::matching::{AFFECTED_BY_PSEUDO_ELEMENTS, MatchingReason, StyleRelations};
@ -535,7 +535,7 @@ pub trait MatchMethods : TElement {
// Compute the pseudo rule nodes.
let mut per_pseudo: PseudoRuleNodes = HashMap::with_hasher(Default::default());
TheSelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
SelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
debug_assert!(applicable_declarations.is_empty());
stylist.push_applicable_declarations(self, parent_bf, None,
Some(&pseudo.clone()),

View file

@ -8,11 +8,11 @@ use Atom;
use element_state::*;
#[cfg(feature = "servo")]
use heapsize::HeapSizeOf;
use selector_parser::{AttrValue, ElementExt, NonTSPseudoClass, Snapshot, TheSelectorImpl};
use selector_parser::{AttrValue, ElementExt, NonTSPseudoClass, Snapshot, SelectorImpl};
use selectors::{Element, MatchAttr};
use selectors::matching::{MatchingReason, StyleRelations};
use selectors::matching::matches_complex_selector;
use selectors::parser::{AttrSelector, Combinator, ComplexSelector, SelectorImpl, SimpleSelector};
use selectors::parser::{AttrSelector, Combinator, ComplexSelector, SimpleSelector};
use std::clone::Clone;
use std::sync::Arc;
@ -60,7 +60,7 @@ impl HeapSizeOf for RestyleHint {
/// still need to take the ElementWrapper approach for attribute-dependent
/// style. So we do it the same both ways for now to reduce complexity, but it's
/// worth measuring the performance impact (if any) of the mStateMask approach.
pub trait ElementSnapshot : Sized + MatchAttr<Impl=TheSelectorImpl> {
pub trait ElementSnapshot : Sized + MatchAttr<Impl=SelectorImpl> {
/// The state of the snapshot, if any.
fn state(&self) -> Option<ElementState>;
@ -103,9 +103,9 @@ impl<'a, E> ElementWrapper<'a, E>
impl<'a, E> MatchAttr for ElementWrapper<'a, E>
where E: ElementExt,
{
type Impl = TheSelectorImpl;
type Impl = SelectorImpl;
fn match_attr_has(&self, attr: &AttrSelector<TheSelectorImpl>) -> bool {
fn match_attr_has(&self, attr: &AttrSelector<SelectorImpl>) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
=> snapshot.match_attr_has(attr),
@ -114,7 +114,7 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
fn match_attr_equals(&self,
attr: &AttrSelector<TheSelectorImpl>,
attr: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
@ -124,7 +124,7 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
fn match_attr_equals_ignore_ascii_case(&self,
attr: &AttrSelector<TheSelectorImpl>,
attr: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
@ -134,7 +134,7 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
fn match_attr_includes(&self,
attr: &AttrSelector<TheSelectorImpl>,
attr: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
@ -144,7 +144,7 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
fn match_attr_dash(&self,
attr: &AttrSelector<TheSelectorImpl>,
attr: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
@ -154,7 +154,7 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
fn match_attr_prefix(&self,
attr: &AttrSelector<TheSelectorImpl>,
attr: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
@ -164,7 +164,7 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
fn match_attr_substring(&self,
attr: &AttrSelector<TheSelectorImpl>,
attr: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
@ -174,7 +174,7 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
fn match_attr_suffix(&self,
attr: &AttrSelector<TheSelectorImpl>,
attr: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
match self.snapshot {
Some(snapshot) if snapshot.has_attrs()
@ -185,10 +185,10 @@ impl<'a, E> MatchAttr for ElementWrapper<'a, E>
}
impl<'a, E> Element for ElementWrapper<'a, E>
where E: ElementExt<Impl=TheSelectorImpl>
where E: ElementExt<Impl=SelectorImpl>
{
fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool {
let flag = TheSelectorImpl::pseudo_class_state_flag(&pseudo_class);
let flag = SelectorImpl::pseudo_class_state_flag(&pseudo_class);
if flag == ElementState::empty() {
self.element.match_non_ts_pseudo_class(pseudo_class)
} else {
@ -223,11 +223,11 @@ impl<'a, E> Element for ElementWrapper<'a, E>
self.element.is_html_element_in_html_document()
}
fn get_local_name(&self) -> &<Self::Impl as SelectorImpl>::BorrowedLocalName {
fn get_local_name(&self) -> &<Self::Impl as ::selectors::SelectorImpl>::BorrowedLocalName {
self.element.get_local_name()
}
fn get_namespace(&self) -> &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl {
fn get_namespace(&self) -> &<Self::Impl as ::selectors::SelectorImpl>::BorrowedNamespaceUrl {
self.element.get_namespace()
}
@ -265,14 +265,14 @@ impl<'a, E> Element for ElementWrapper<'a, E>
}
}
fn selector_to_state(sel: &SimpleSelector<TheSelectorImpl>) -> ElementState {
fn selector_to_state(sel: &SimpleSelector<SelectorImpl>) -> ElementState {
match *sel {
SimpleSelector::NonTSPseudoClass(ref pc) => TheSelectorImpl::pseudo_class_state_flag(pc),
SimpleSelector::NonTSPseudoClass(ref pc) => SelectorImpl::pseudo_class_state_flag(pc),
_ => ElementState::empty(),
}
}
fn is_attr_selector(sel: &SimpleSelector<TheSelectorImpl>) -> bool {
fn is_attr_selector(sel: &SimpleSelector<SelectorImpl>) -> bool {
match *sel {
SimpleSelector::ID(_) |
SimpleSelector::Class(_) |
@ -341,7 +341,7 @@ impl Sensitivities {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
struct Dependency {
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
selector: Arc<ComplexSelector<TheSelectorImpl>>,
selector: Arc<ComplexSelector<SelectorImpl>>,
hint: RestyleHint,
sensitivities: Sensitivities,
}
@ -388,7 +388,7 @@ impl DependencySet {
self.common_deps.len() + self.attr_deps.len() + self.state_deps.len()
}
pub fn note_selector(&mut self, selector: &Arc<ComplexSelector<TheSelectorImpl>>) {
pub fn note_selector(&mut self, selector: &Arc<ComplexSelector<SelectorImpl>>) {
let mut cur = selector;
let mut combinator: Option<Combinator> = None;
loop {

View file

@ -10,11 +10,7 @@ use selectors::Element;
use selectors::parser::{AttrSelector, SelectorList};
use stylesheets::{Origin, Namespaces};
pub type AttrValue = <TheSelectorImpl as ::selectors::SelectorImpl>::AttrValue;
// FIXME remove
pub use self::SelectorImpl as TheSelectorImpl;
pub use self::SelectorImpl as ServoSelectorImpl;
pub type AttrValue = <SelectorImpl as ::selectors::SelectorImpl>::AttrValue;
#[cfg(feature = "servo")]
pub use servo::selector_parser::*;
@ -103,7 +99,7 @@ impl PseudoElementCascadeType {
}
}
pub trait ElementExt: Element<Impl=TheSelectorImpl> {
pub trait ElementExt: Element<Impl=SelectorImpl> {
fn is_link(&self) -> bool;
}
@ -131,7 +127,7 @@ impl SelectorImpl {
}
}
pub fn attr_exists_selector_is_shareable(attr_selector: &AttrSelector<TheSelectorImpl>) -> bool {
pub fn attr_exists_selector_is_shareable(attr_selector: &AttrSelector<SelectorImpl>) -> bool {
// NB(pcwalton): If you update this, remember to update the corresponding list in
// `can_share_style_with()` as well.
common_style_affecting_attributes().iter().any(|common_attr_info| {
@ -142,7 +138,7 @@ pub fn attr_exists_selector_is_shareable(attr_selector: &AttrSelector<TheSelecto
})
}
pub fn attr_equals_selector_is_shareable(attr_selector: &AttrSelector<TheSelectorImpl>,
pub fn attr_equals_selector_is_shareable(attr_selector: &AttrSelector<SelectorImpl>,
value: &AttrValue) -> bool {
// FIXME(pcwalton): Remove once we start actually supporting RTL text. This is in
// here because the UA style otherwise disables all style sharing completely.

View file

@ -16,7 +16,7 @@ use properties::{PropertyDeclaration, PropertyDeclarationBlock};
use quickersort::sort_by;
use restyle_hints::{RestyleHint, DependencySet};
use rule_tree::{RuleTree, StrongRuleNode, StyleSource};
use selector_parser::{ElementExt, TheSelectorImpl, PseudoElement, Snapshot};
use selector_parser::{ElementExt, SelectorImpl, PseudoElement, Snapshot};
use selectors::Element;
use selectors::bloom::BloomFilter;
use selectors::matching::{AFFECTED_BY_STYLE_ATTRIBUTE, AFFECTED_BY_PRESENTATIONAL_HINTS};
@ -89,12 +89,12 @@ pub struct Stylist {
/// Selectors in the page affecting siblings
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
sibling_affecting_selectors: Vec<Selector<TheSelectorImpl>>,
sibling_affecting_selectors: Vec<Selector<SelectorImpl>>,
/// Selectors in the page matching elements with non-common style-affecting
/// attributes.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
non_common_style_affecting_attributes_selectors: Vec<Selector<TheSelectorImpl>>,
non_common_style_affecting_attributes_selectors: Vec<Selector<SelectorImpl>>,
}
impl Stylist {
@ -119,7 +119,7 @@ impl Stylist {
non_common_style_affecting_attributes_selectors: vec![]
};
TheSelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
SelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
stylist.pseudos_map.insert(pseudo, PerPseudoElementSelectorMap::new());
});
@ -139,7 +139,7 @@ impl Stylist {
self.element_map = PerPseudoElementSelectorMap::new();
self.pseudos_map = Default::default();
self.animations = Default::default();
TheSelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
SelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
self.pseudos_map.insert(pseudo, PerPseudoElementSelectorMap::new());
});
@ -246,7 +246,7 @@ impl Stylist {
debug!(" - Got {} deps for style-hint calculation",
state_deps.len());
TheSelectorImpl::each_precomputed_pseudo_element(|pseudo| {
SelectorImpl::each_precomputed_pseudo_element(|pseudo| {
// TODO: Consider not doing this and just getting the rules on the
// fly. It should be a bit slower, but we'd take rid of the
// extra field, and avoid this precomputation entirely.
@ -271,7 +271,7 @@ impl Stylist {
parent: Option<&Arc<ComputedValues>>,
inherit_all: bool)
-> Option<(Arc<ComputedValues>, StrongRuleNode)> {
debug_assert!(TheSelectorImpl::pseudo_element_cascade_type(pseudo).is_precomputed());
debug_assert!(SelectorImpl::pseudo_element_cascade_type(pseudo).is_precomputed());
if let Some(declarations) = self.precomputed_pseudo_element_decls.get(pseudo) {
// FIXME(emilio): When we've taken rid of the cascade we can just
// use into_iter.
@ -330,11 +330,11 @@ impl Stylist {
pseudo: &PseudoElement,
parent: &Arc<ComputedValues>)
-> Option<(Arc<ComputedValues>, StrongRuleNode)>
where E: Element<Impl=TheSelectorImpl> +
where E: Element<Impl=SelectorImpl> +
fmt::Debug +
PresentationalHintsSynthetizer
{
debug_assert!(TheSelectorImpl::pseudo_element_cascade_type(pseudo).is_lazy());
debug_assert!(SelectorImpl::pseudo_element_cascade_type(pseudo).is_lazy());
if self.pseudos_map.get(pseudo).is_none() {
return None;
}
@ -418,7 +418,7 @@ impl Stylist {
pseudo_element: Option<&PseudoElement>,
applicable_declarations: &mut V,
reason: MatchingReason) -> StyleRelations
where E: Element<Impl=TheSelectorImpl> +
where E: Element<Impl=SelectorImpl> +
fmt::Debug +
PresentationalHintsSynthetizer,
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock>
@ -427,7 +427,7 @@ impl Stylist {
debug_assert!(style_attribute.is_none() || pseudo_element.is_none(),
"Style attributes do not apply to pseudo-elements");
debug_assert!(pseudo_element.is_none() ||
!TheSelectorImpl::pseudo_element_cascade_type(pseudo_element.as_ref().unwrap())
!SelectorImpl::pseudo_element_cascade_type(pseudo_element.as_ref().unwrap())
.is_precomputed());
let map = match pseudo_element {
@ -731,7 +731,7 @@ impl SelectorMap {
relations: &mut StyleRelations,
reason: MatchingReason,
importance: Importance)
where E: Element<Impl=TheSelectorImpl>,
where E: Element<Impl=SelectorImpl>,
V: VecLike<ApplicableDeclarationBlock>
{
if self.empty {
@ -831,7 +831,7 @@ impl SelectorMap {
relations: &mut StyleRelations,
reason: MatchingReason,
importance: Importance)
where E: Element<Impl=TheSelectorImpl>,
where E: Element<Impl=SelectorImpl>,
Str: Borrow<BorrowedStr> + Eq + Hash,
BorrowedStr: Eq + Hash,
Vector: VecLike<ApplicableDeclarationBlock>
@ -856,7 +856,7 @@ impl SelectorMap {
relations: &mut StyleRelations,
reason: MatchingReason,
importance: Importance)
where E: Element<Impl=TheSelectorImpl>,
where E: Element<Impl=SelectorImpl>,
V: VecLike<ApplicableDeclarationBlock>
{
for rule in rules.iter() {
@ -927,7 +927,7 @@ impl SelectorMap {
}
/// Retrieve the name if it is a type selector, or None otherwise.
pub fn get_local_name(rule: &Rule) -> Option<LocalNameSelector<TheSelectorImpl>> {
pub fn get_local_name(rule: &Rule) -> Option<LocalNameSelector<SelectorImpl>> {
for ss in &rule.selector.compound_selector {
if let SimpleSelector::LocalName(ref n) = *ss {
return Some(LocalNameSelector {
@ -948,7 +948,7 @@ pub struct Rule {
// that it matches. Selector contains an owned vector (through
// ComplexSelector) and we want to avoid the allocation.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
pub selector: Arc<ComplexSelector<TheSelectorImpl>>,
pub selector: Arc<ComplexSelector<SelectorImpl>>,
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
pub style_rule: Arc<RwLock<StyleRule>>,
pub source_order: usize,

View file

@ -20,7 +20,7 @@ Servo [extends][selector-impl-ext] that trait in order to allow a few more
things to be shared between Stylo and Servo.
The main Servo implementation (the one that is used in regular builds) is
[ServoSelectorImpl][servo-selector-impl].
[SelectorImpl][servo-selector-impl].
<a name="dom-glue"></a>
## DOM glue
@ -139,7 +139,7 @@ that you didn't find it here so it can be added :)
[stylo]: https://public.etherpad-mozilla.org/p/stylo
[selector-impl]: http://doc.servo.org/selectors/parser/trait.SelectorImpl.html
[selector-impl-ext]: http://doc.servo.org/style/selector_parser/trait.SelectorImplExt.html
[servo-selector-impl]: http://doc.servo.org/style/servo_selector_parser/struct.ServoSelectorImpl.html
[servo-selector-impl]: http://doc.servo.org/style/servo_selector_parser/struct.SelectorImpl.html
[tree-structural-pseudo-classes]: https://www.w3.org/TR/selectors4/#structural-pseudos
[style-dom-traits]: http://doc.servo.org/style/dom/index.html
[layout-wrapper]: http://doc.servo.org/layout/wrapper/index.html

View file

@ -16,7 +16,7 @@ use style::context::{LocalStyleContextCreationInfo, ReflowGoal, SharedStyleConte
use style::dom::{NodeInfo, StylingMode, TElement, TNode};
use style::error_reporting::StdoutErrorReporter;
use style::gecko::data::{NUM_THREADS, PerDocumentStyleData};
use style::gecko::selector_parser::{GeckoSelectorImpl, PseudoElement};
use style::gecko::selector_parser::{SelectorImpl, PseudoElement};
use style::gecko::snapshot::GeckoElementSnapshot;
use style::gecko::traversal::RecalcStyleOnly;
use style::gecko::wrapper::{GeckoElement, GeckoNode};
@ -350,7 +350,7 @@ pub extern "C" fn Servo_ComputedValues_GetForPseudoElement(parent_style: ServoCo
let element = GeckoElement(match_element);
match GeckoSelectorImpl::pseudo_element_cascade_type(&pseudo) {
match SelectorImpl::pseudo_element_cascade_type(&pseudo) {
PseudoElementCascadeType::Eager => {
let maybe_computed = element.get_pseudo_style(&pseudo);
maybe_computed.map_or_else(parent_or_null, FFIArcHelpers::into_strong)

View file

@ -4,10 +4,10 @@
use cssparser::{Parser, ToCss};
use selectors::parser::SelectorList;
use style::selector_parser::{TheSelectorImpl, SelectorParser};
use style::selector_parser::{SelectorImpl, SelectorParser};
use style::stylesheets::{Origin, Namespaces};
fn parse(input: &mut Parser) -> Result<SelectorList<TheSelectorImpl>, ()> {
fn parse(input: &mut Parser) -> Result<SelectorList<SelectorImpl>, ()> {
let mut ns = Namespaces::default();
ns.prefixes.insert("svg".into(), ns!(svg));
let parser = SelectorParser {