mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
Remove unused StyleRelations.
MozReview-Commit-ID: ed0NiuY9Ek
This commit is contained in:
parent
bdb84c7539
commit
60f846b2ca
3 changed files with 14 additions and 54 deletions
|
@ -18,39 +18,16 @@ bitflags! {
|
||||||
///
|
///
|
||||||
/// This is used to implement efficient sharing.
|
/// This is used to implement efficient sharing.
|
||||||
pub flags StyleRelations: u16 {
|
pub flags StyleRelations: u16 {
|
||||||
/// Whether this element has matched any rule whose matching is
|
|
||||||
/// determined by its position in the tree (i.e., first-child,
|
|
||||||
/// nth-child, etc.).
|
|
||||||
const AFFECTED_BY_CHILD_INDEX = 1 << 1,
|
|
||||||
|
|
||||||
/// Whether this flag is affected by any state (i.e., non
|
|
||||||
/// tree-structural pseudo-class).
|
|
||||||
const AFFECTED_BY_STATE = 1 << 2,
|
|
||||||
|
|
||||||
/// Whether this element is affected by an ID selector.
|
/// Whether this element is affected by an ID selector.
|
||||||
const AFFECTED_BY_ID_SELECTOR = 1 << 3,
|
const AFFECTED_BY_ID_SELECTOR = 1 << 3,
|
||||||
|
|
||||||
/// Whether this element matches the :empty pseudo class.
|
|
||||||
const AFFECTED_BY_EMPTY = 1 << 5,
|
|
||||||
|
|
||||||
/// Whether this element has a style attribute. Computed
|
/// Whether this element has a style attribute. Computed
|
||||||
/// externally.
|
/// externally.
|
||||||
const AFFECTED_BY_STYLE_ATTRIBUTE = 1 << 6,
|
const AFFECTED_BY_STYLE_ATTRIBUTE = 1 << 6,
|
||||||
|
|
||||||
/// Whether this element is affected by presentational hints. This is
|
/// Whether this element is affected by presentational hints. This is
|
||||||
/// computed externally (that is, in Servo).
|
/// computed externally (that is, in Servo).
|
||||||
const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 7,
|
const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 7,
|
||||||
|
|
||||||
/// Whether this element has pseudo-element styles. Computed externally.
|
/// Whether this element has pseudo-element styles. Computed externally.
|
||||||
const AFFECTED_BY_PSEUDO_ELEMENTS = 1 << 8,
|
const AFFECTED_BY_PSEUDO_ELEMENTS = 1 << 8,
|
||||||
|
|
||||||
/// Whether this element has effective animation styles. Computed
|
|
||||||
/// externally.
|
|
||||||
const AFFECTED_BY_ANIMATIONS = 1 << 9,
|
|
||||||
|
|
||||||
/// Whether this element has effective transition styles. Computed
|
|
||||||
/// externally.
|
|
||||||
const AFFECTED_BY_TRANSITIONS = 1 << 10,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,21 +341,17 @@ fn matches_simple_selector<E, F>(
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
Component::NonTSPseudoClass(ref pc) => {
|
Component::NonTSPseudoClass(ref pc) => {
|
||||||
relation_if!(element.match_non_ts_pseudo_class(pc, relations, flags_setter),
|
element.match_non_ts_pseudo_class(pc, relations, flags_setter)
|
||||||
AFFECTED_BY_STATE)
|
|
||||||
}
|
}
|
||||||
Component::FirstChild => {
|
Component::FirstChild => {
|
||||||
relation_if!(matches_first_child(element, flags_setter),
|
matches_first_child(element, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::LastChild => {
|
Component::LastChild => {
|
||||||
relation_if!(matches_last_child(element, flags_setter),
|
matches_last_child(element, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::OnlyChild => {
|
Component::OnlyChild => {
|
||||||
relation_if!(matches_first_child(element, flags_setter) &&
|
matches_first_child(element, flags_setter) &&
|
||||||
matches_last_child(element, flags_setter),
|
matches_last_child(element, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::Root => {
|
Component::Root => {
|
||||||
// We never share styles with an element with no parent, so no point
|
// We never share styles with an element with no parent, so no point
|
||||||
|
@ -387,36 +360,29 @@ fn matches_simple_selector<E, F>(
|
||||||
}
|
}
|
||||||
Component::Empty => {
|
Component::Empty => {
|
||||||
flags_setter(element, HAS_EMPTY_SELECTOR);
|
flags_setter(element, HAS_EMPTY_SELECTOR);
|
||||||
relation_if!(element.is_empty(), AFFECTED_BY_EMPTY)
|
element.is_empty()
|
||||||
}
|
}
|
||||||
Component::NthChild(a, b) => {
|
Component::NthChild(a, b) => {
|
||||||
relation_if!(matches_generic_nth_child(element, a, b, false, false, flags_setter),
|
matches_generic_nth_child(element, a, b, false, false, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::NthLastChild(a, b) => {
|
Component::NthLastChild(a, b) => {
|
||||||
relation_if!(matches_generic_nth_child(element, a, b, false, true, flags_setter),
|
matches_generic_nth_child(element, a, b, false, true, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::NthOfType(a, b) => {
|
Component::NthOfType(a, b) => {
|
||||||
relation_if!(matches_generic_nth_child(element, a, b, true, false, flags_setter),
|
matches_generic_nth_child(element, a, b, true, false, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::NthLastOfType(a, b) => {
|
Component::NthLastOfType(a, b) => {
|
||||||
relation_if!(matches_generic_nth_child(element, a, b, true, true, flags_setter),
|
matches_generic_nth_child(element, a, b, true, true, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::FirstOfType => {
|
Component::FirstOfType => {
|
||||||
relation_if!(matches_generic_nth_child(element, 0, 1, true, false, flags_setter),
|
matches_generic_nth_child(element, 0, 1, true, false, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::LastOfType => {
|
Component::LastOfType => {
|
||||||
relation_if!(matches_generic_nth_child(element, 0, 1, true, true, flags_setter),
|
matches_generic_nth_child(element, 0, 1, true, true, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::OnlyOfType => {
|
Component::OnlyOfType => {
|
||||||
relation_if!(matches_generic_nth_child(element, 0, 1, true, false, flags_setter) &&
|
matches_generic_nth_child(element, 0, 1, true, false, flags_setter) &&
|
||||||
matches_generic_nth_child(element, 0, 1, true, true, flags_setter),
|
matches_generic_nth_child(element, 0, 1, true, true, flags_setter)
|
||||||
AFFECTED_BY_CHILD_INDEX)
|
|
||||||
}
|
}
|
||||||
Component::Negation(ref negated) => {
|
Component::Negation(ref negated) => {
|
||||||
!negated.iter().all(|s| {
|
!negated.iter().all(|s| {
|
||||||
|
|
|
@ -1129,7 +1129,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
elem = prev;
|
elem = prev;
|
||||||
}
|
}
|
||||||
relations.insert(AFFECTED_BY_CHILD_INDEX);
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
NonTSPseudoClass::MozLastNode => {
|
NonTSPseudoClass::MozLastNode => {
|
||||||
|
@ -1141,7 +1140,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
elem = next;
|
elem = next;
|
||||||
}
|
}
|
||||||
relations.insert(AFFECTED_BY_CHILD_INDEX);
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
NonTSPseudoClass::MozOnlyWhitespace => {
|
NonTSPseudoClass::MozOnlyWhitespace => {
|
||||||
|
@ -1149,7 +1147,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
if self.as_node().dom_children().any(|c| c.contains_non_whitespace_content()) {
|
if self.as_node().dom_children().any(|c| c.contains_non_whitespace_content()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
relations.insert(AFFECTED_BY_EMPTY);
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
NonTSPseudoClass::MozTableBorderNonzero |
|
NonTSPseudoClass::MozTableBorderNonzero |
|
||||||
|
|
|
@ -24,7 +24,6 @@ use rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
|
||||||
use selector_parser::{SelectorImpl, PseudoElement, Snapshot};
|
use selector_parser::{SelectorImpl, PseudoElement, Snapshot};
|
||||||
use selectors::Element;
|
use selectors::Element;
|
||||||
use selectors::bloom::BloomFilter;
|
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::{AFFECTED_BY_STYLE_ATTRIBUTE, AFFECTED_BY_PRESENTATIONAL_HINTS};
|
||||||
use selectors::matching::{ElementSelectorFlags, StyleRelations, matches_selector};
|
use selectors::matching::{ElementSelectorFlags, StyleRelations, matches_selector};
|
||||||
use selectors::parser::{Component, Selector, SelectorInner, LocalName as LocalNameSelector};
|
use selectors::parser::{Component, Selector, SelectorInner, LocalName as LocalNameSelector};
|
||||||
|
@ -716,7 +715,6 @@ impl Stylist {
|
||||||
// The animations sheet (CSS animations, script-generated animations,
|
// The animations sheet (CSS animations, script-generated animations,
|
||||||
// and CSS transitions that are no longer tied to CSS markup)
|
// and CSS transitions that are no longer tied to CSS markup)
|
||||||
if let Some(anim) = animation_rules.0 {
|
if let Some(anim) = animation_rules.0 {
|
||||||
relations |= AFFECTED_BY_ANIMATIONS;
|
|
||||||
Push::push(
|
Push::push(
|
||||||
applicable_declarations,
|
applicable_declarations,
|
||||||
ApplicableDeclarationBlock::from_declarations(anim.clone(),
|
ApplicableDeclarationBlock::from_declarations(anim.clone(),
|
||||||
|
@ -773,7 +771,6 @@ impl Stylist {
|
||||||
// Step 10: Transitions.
|
// Step 10: Transitions.
|
||||||
// The transitions sheet (CSS transitions that are tied to CSS markup)
|
// The transitions sheet (CSS transitions that are tied to CSS markup)
|
||||||
if let Some(anim) = animation_rules.1 {
|
if let Some(anim) = animation_rules.1 {
|
||||||
relations |= AFFECTED_BY_TRANSITIONS;
|
|
||||||
Push::push(
|
Push::push(
|
||||||
applicable_declarations,
|
applicable_declarations,
|
||||||
ApplicableDeclarationBlock::from_declarations(anim.clone(), CascadeLevel::Transitions));
|
ApplicableDeclarationBlock::from_declarations(anim.clone(), CascadeLevel::Transitions));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue