mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Rename SimpleSelector to Component.
MozReview-Commit-ID: JfaZpHSkG8h
This commit is contained in:
parent
cf06e2bf1e
commit
cebacc7faa
7 changed files with 205 additions and 209 deletions
|
@ -1198,11 +1198,11 @@ pub trait MatchMethods : TElement {
|
|||
// > fn with_really_simple_selectors(&self, f: <H: Hash>|&H|);
|
||||
|
||||
|
||||
// In terms of `SimpleSelector`s, these two functions will insert and remove:
|
||||
// - `SimpleSelector::LocalName`
|
||||
// - `SimpleSelector::Namepace`
|
||||
// - `SimpleSelector::ID`
|
||||
// - `SimpleSelector::Class`
|
||||
// In terms of `Component`s, these two functions will insert and remove:
|
||||
// - `Component::LocalName`
|
||||
// - `Component::Namepace`
|
||||
// - `Component::ID`
|
||||
// - `Component::Class`
|
||||
|
||||
/// Inserts and removes the matching `Descendant` selectors from a bloom
|
||||
/// filter. This is used to speed up CSS selector matching to remove
|
||||
|
|
|
@ -17,8 +17,8 @@ use selector_parser::{AttrValue, NonTSPseudoClass, Snapshot, SelectorImpl};
|
|||
use selectors::{Element, MatchAttr};
|
||||
use selectors::matching::{ElementSelectorFlags, StyleRelations};
|
||||
use selectors::matching::matches_selector;
|
||||
use selectors::parser::{AttrSelector, Combinator, ComplexSelector, SelectorInner, SelectorIter};
|
||||
use selectors::parser::{SelectorMethods, SimpleSelector};
|
||||
use selectors::parser::{AttrSelector, Combinator, ComplexSelector, Component};
|
||||
use selectors::parser::{SelectorInner, SelectorIter, SelectorMethods};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use std::clone::Clone;
|
||||
|
||||
|
@ -388,24 +388,24 @@ impl<'a, E> Element for ElementWrapper<'a, E>
|
|||
}
|
||||
}
|
||||
|
||||
fn selector_to_state(sel: &SimpleSelector<SelectorImpl>) -> ElementState {
|
||||
fn selector_to_state(sel: &Component<SelectorImpl>) -> ElementState {
|
||||
match *sel {
|
||||
SimpleSelector::NonTSPseudoClass(ref pc) => pc.state_flag(),
|
||||
Component::NonTSPseudoClass(ref pc) => pc.state_flag(),
|
||||
_ => ElementState::empty(),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_attr_selector(sel: &SimpleSelector<SelectorImpl>) -> bool {
|
||||
fn is_attr_selector(sel: &Component<SelectorImpl>) -> bool {
|
||||
match *sel {
|
||||
SimpleSelector::ID(_) |
|
||||
SimpleSelector::Class(_) |
|
||||
SimpleSelector::AttrExists(_) |
|
||||
SimpleSelector::AttrEqual(_, _, _) |
|
||||
SimpleSelector::AttrIncludes(_, _) |
|
||||
SimpleSelector::AttrDashMatch(_, _) |
|
||||
SimpleSelector::AttrPrefixMatch(_, _) |
|
||||
SimpleSelector::AttrSubstringMatch(_, _) |
|
||||
SimpleSelector::AttrSuffixMatch(_, _) => true,
|
||||
Component::ID(_) |
|
||||
Component::Class(_) |
|
||||
Component::AttrExists(_) |
|
||||
Component::AttrEqual(_, _, _) |
|
||||
Component::AttrIncludes(_, _) |
|
||||
Component::AttrDashMatch(_, _) |
|
||||
Component::AttrPrefixMatch(_, _) |
|
||||
Component::AttrSubstringMatch(_, _) |
|
||||
Component::AttrSuffixMatch(_, _) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -416,22 +416,22 @@ fn is_attr_selector(sel: &SimpleSelector<SelectorImpl>) -> bool {
|
|||
///
|
||||
/// We use this for selectors that can have different matching behavior between
|
||||
/// siblings that are otherwise identical as far as the cache is concerned.
|
||||
fn needs_cache_revalidation(sel: &SimpleSelector<SelectorImpl>) -> bool {
|
||||
fn needs_cache_revalidation(sel: &Component<SelectorImpl>) -> bool {
|
||||
match *sel {
|
||||
SimpleSelector::Empty |
|
||||
SimpleSelector::FirstChild |
|
||||
SimpleSelector::LastChild |
|
||||
SimpleSelector::OnlyChild |
|
||||
SimpleSelector::NthChild(..) |
|
||||
SimpleSelector::NthLastChild(..) |
|
||||
SimpleSelector::NthOfType(..) |
|
||||
SimpleSelector::NthLastOfType(..) |
|
||||
SimpleSelector::FirstOfType |
|
||||
SimpleSelector::LastOfType |
|
||||
SimpleSelector::OnlyOfType => true,
|
||||
Component::Empty |
|
||||
Component::FirstChild |
|
||||
Component::LastChild |
|
||||
Component::OnlyChild |
|
||||
Component::NthChild(..) |
|
||||
Component::NthLastChild(..) |
|
||||
Component::NthOfType(..) |
|
||||
Component::NthLastOfType(..) |
|
||||
Component::FirstOfType |
|
||||
Component::LastOfType |
|
||||
Component::OnlyOfType => true,
|
||||
// FIXME(emilio): This sets the "revalidation" flag for :any, which is
|
||||
// probably expensive given we use it a lot in UA sheets.
|
||||
SimpleSelector::NonTSPseudoClass(ref p) => p.state_flag().is_empty(),
|
||||
Component::NonTSPseudoClass(ref p) => p.state_flag().is_empty(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ impl SelectorVisitor for SensitivitiesVisitor {
|
|||
true
|
||||
}
|
||||
|
||||
fn visit_simple_selector(&mut self, s: &SimpleSelector<SelectorImpl>) -> bool {
|
||||
fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
|
||||
self.sensitivities.states.insert(selector_to_state(s));
|
||||
|
||||
if !self.sensitivities.attrs {
|
||||
|
|
|
@ -27,7 +27,7 @@ use selectors::bloom::BloomFilter;
|
|||
use selectors::matching::{AFFECTED_BY_ANIMATIONS, AFFECTED_BY_TRANSITIONS};
|
||||
use selectors::matching::{AFFECTED_BY_STYLE_ATTRIBUTE, AFFECTED_BY_PRESENTATIONAL_HINTS};
|
||||
use selectors::matching::{ElementSelectorFlags, StyleRelations, matches_selector};
|
||||
use selectors::parser::{Selector, SelectorInner, SimpleSelector, LocalName as LocalNameSelector};
|
||||
use selectors::parser::{Component, Selector, SelectorInner, LocalName as LocalNameSelector};
|
||||
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
||||
use sink::Push;
|
||||
use smallvec::VecLike;
|
||||
|
@ -1182,7 +1182,7 @@ impl SelectorMap {
|
|||
for ss in rule.selector.complex.iter() {
|
||||
// TODO(pradeep): Implement case-sensitivity based on the
|
||||
// document type and quirks mode.
|
||||
if let SimpleSelector::ID(ref id) = *ss {
|
||||
if let Component::ID(ref id) = *ss {
|
||||
return Some(id.clone());
|
||||
}
|
||||
}
|
||||
|
@ -1195,7 +1195,7 @@ impl SelectorMap {
|
|||
for ss in rule.selector.complex.iter() {
|
||||
// TODO(pradeep): Implement case-sensitivity based on the
|
||||
// document type and quirks mode.
|
||||
if let SimpleSelector::Class(ref class) = *ss {
|
||||
if let Component::Class(ref class) = *ss {
|
||||
return Some(class.clone());
|
||||
}
|
||||
}
|
||||
|
@ -1206,7 +1206,7 @@ impl SelectorMap {
|
|||
/// Retrieve the name if it is a type selector, or None otherwise.
|
||||
pub fn get_local_name(rule: &Rule) -> Option<LocalNameSelector<SelectorImpl>> {
|
||||
for ss in rule.selector.complex.iter() {
|
||||
if let SimpleSelector::LocalName(ref n) = *ss {
|
||||
if let Component::LocalName(ref n) = *ss {
|
||||
return Some(LocalNameSelector {
|
||||
name: n.name.clone(),
|
||||
lower_name: n.lower_name.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue