style: Remove StyleRelations.

They're unused now. We can add them back if needed.

MozReview-Commit-ID: 92Y2Na0ZbVn
This commit is contained in:
Emilio Cobos Álvarez 2017-07-11 16:29:49 +02:00
parent d3c8844549
commit 6d6c80e79b
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 1 additions and 36 deletions

View file

@ -5,19 +5,6 @@
use attr::CaseSensitivity; use attr::CaseSensitivity;
use bloom::BloomFilter; use bloom::BloomFilter;
bitflags! {
/// Set of flags that determine the different kind of elements affected by
/// the selector matching process.
///
/// This is used to implement efficient sharing.
#[derive(Default)]
pub flags StyleRelations: usize {
/// Whether this element is affected by presentational hints. This is
/// computed externally (that is, in Servo).
const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 0,
}
}
/// What kind of selector matching mode we should use. /// What kind of selector matching mode we should use.
/// ///
/// There are two modes of selector matching. The difference is only noticeable /// There are two modes of selector matching. The difference is only noticeable
@ -87,9 +74,6 @@ impl QuirksMode {
/// transient data that applies to only a single selector. /// transient data that applies to only a single selector.
#[derive(Clone)] #[derive(Clone)]
pub struct MatchingContext<'a> { pub struct MatchingContext<'a> {
/// Output that records certains relations between elements noticed during
/// matching (and also extended after matching).
pub relations: StyleRelations,
/// Input with the matching mode we should use when matching selectors. /// Input with the matching mode we should use when matching selectors.
pub matching_mode: MatchingMode, pub matching_mode: MatchingMode,
/// Input with the bloom filter used to fast-reject selectors. /// Input with the bloom filter used to fast-reject selectors.
@ -114,7 +98,6 @@ impl<'a> MatchingContext<'a> {
-> Self -> Self
{ {
Self { Self {
relations: StyleRelations::empty(),
matching_mode: matching_mode, matching_mode: matching_mode,
bloom_filter: bloom_filter, bloom_filter: bloom_filter,
visited_handling: VisitedHandlingMode::AllLinksUnvisited, visited_handling: VisitedHandlingMode::AllLinksUnvisited,
@ -132,7 +115,6 @@ impl<'a> MatchingContext<'a> {
-> Self -> Self
{ {
Self { Self {
relations: StyleRelations::empty(),
matching_mode: matching_mode, matching_mode: matching_mode,
bloom_filter: bloom_filter, bloom_filter: bloom_filter,
visited_handling: visited_handling, visited_handling: visited_handling,

View file

@ -714,8 +714,6 @@ fn matches_simple_selector<E, F>(
matches_last_child(element, flags_setter) matches_last_child(element, flags_setter)
} }
Component::Root => { Component::Root => {
// We never share styles with an element with no parent, so no point
// in creating a new StyleRelation.
element.is_root() element.is_root()
} }
Component::Empty => { Component::Empty => {

View file

@ -26,7 +26,7 @@ use selector_parser::{SelectorImpl, PseudoElement};
use selectors::attr::NamespaceConstraint; use selectors::attr::NamespaceConstraint;
use selectors::bloom::BloomFilter; use selectors::bloom::BloomFilter;
use selectors::matching::{ElementSelectorFlags, matches_selector, MatchingContext, MatchingMode}; use selectors::matching::{ElementSelectorFlags, matches_selector, MatchingContext, MatchingMode};
use selectors::matching::{VisitedHandlingMode, AFFECTED_BY_PRESENTATIONAL_HINTS}; use selectors::matching::VisitedHandlingMode;
use selectors::parser::{AncestorHashes, Combinator, Component, Selector, SelectorAndHashes}; use selectors::parser::{AncestorHashes, Combinator, Component, Selector, SelectorAndHashes};
use selectors::parser::{SelectorIter, SelectorMethods}; use selectors::parser::{SelectorIter, SelectorMethods};
use selectors::sink::Push; use selectors::sink::Push;
@ -1145,7 +1145,6 @@ impl Stylist {
self.quirks_mode, self.quirks_mode,
flags_setter, flags_setter,
CascadeLevel::UANormal); CascadeLevel::UANormal);
debug!("UA normal: {:?}", context.relations);
if pseudo_element.is_none() && !only_default_rules { if pseudo_element.is_none() && !only_default_rules {
// Step 2: Presentational hints. // Step 2: Presentational hints.
@ -1160,12 +1159,7 @@ impl Stylist {
assert_eq!(declaration.level(), CascadeLevel::PresHints); assert_eq!(declaration.level(), CascadeLevel::PresHints);
} }
} }
// Note the existence of presentational attributes so that the
// style sharing cache can avoid re-querying them if they don't
// exist.
context.relations |= AFFECTED_BY_PRESENTATIONAL_HINTS;
} }
debug!("preshints: {:?}", context.relations);
} }
// NB: the following condition, although it may look somewhat // NB: the following condition, although it may look somewhat
@ -1185,7 +1179,6 @@ impl Stylist {
self.quirks_mode, self.quirks_mode,
flags_setter, flags_setter,
CascadeLevel::UserNormal); CascadeLevel::UserNormal);
debug!("user normal: {:?}", context.relations);
} else { } else {
debug!("skipping user rules"); debug!("skipping user rules");
} }
@ -1194,7 +1187,6 @@ impl Stylist {
let cut_off_inheritance = let cut_off_inheritance =
element.get_declarations_from_xbl_bindings(pseudo_element, element.get_declarations_from_xbl_bindings(pseudo_element,
applicable_declarations); applicable_declarations);
debug!("XBL: {:?}", context.relations);
if rule_hash_target.matches_user_and_author_rules() && !only_default_rules { if rule_hash_target.matches_user_and_author_rules() && !only_default_rules {
// Gecko skips author normal rules if cutting off inheritance. // Gecko skips author normal rules if cutting off inheritance.
@ -1208,7 +1200,6 @@ impl Stylist {
self.quirks_mode, self.quirks_mode,
flags_setter, flags_setter,
CascadeLevel::AuthorNormal); CascadeLevel::AuthorNormal);
debug!("author normal: {:?}", context.relations);
} else { } else {
debug!("skipping author normal rules due to cut off inheritance"); debug!("skipping author normal rules due to cut off inheritance");
} }
@ -1224,7 +1215,6 @@ impl Stylist {
ApplicableDeclarationBlock::from_declarations(sa.clone(), ApplicableDeclarationBlock::from_declarations(sa.clone(),
CascadeLevel::StyleAttributeNormal)); CascadeLevel::StyleAttributeNormal));
} }
debug!("style attr: {:?}", context.relations);
// Step 5: SMIL override. // Step 5: SMIL override.
// Declarations from SVG SMIL animation elements. // Declarations from SVG SMIL animation elements.
@ -1234,7 +1224,6 @@ impl Stylist {
ApplicableDeclarationBlock::from_declarations(so.clone(), ApplicableDeclarationBlock::from_declarations(so.clone(),
CascadeLevel::SMILOverride)); CascadeLevel::SMILOverride));
} }
debug!("SMIL: {:?}", context.relations);
// Step 6: Animations. // Step 6: Animations.
// The animations sheet (CSS animations, script-generated animations, // The animations sheet (CSS animations, script-generated animations,
@ -1245,7 +1234,6 @@ impl Stylist {
ApplicableDeclarationBlock::from_declarations(anim.clone(), ApplicableDeclarationBlock::from_declarations(anim.clone(),
CascadeLevel::Animations)); CascadeLevel::Animations));
} }
debug!("animation: {:?}", context.relations);
} else { } else {
debug!("skipping style attr and SMIL & animation rules"); debug!("skipping style attr and SMIL & animation rules");
} }
@ -1264,12 +1252,9 @@ impl Stylist {
ApplicableDeclarationBlock::from_declarations(anim.clone(), ApplicableDeclarationBlock::from_declarations(anim.clone(),
CascadeLevel::Transitions)); CascadeLevel::Transitions));
} }
debug!("transition: {:?}", context.relations);
} else { } else {
debug!("skipping transition rules"); debug!("skipping transition rules");
} }
debug!("push_applicable_declarations: shareable: {:?}", context.relations);
} }
/// Given an id, returns whether there might be any rules for that id in any /// Given an id, returns whether there might be any rules for that id in any