diff options
author | Boris Zbarsky <bzbarsky@mit.edu> | 2017-06-01 19:41:41 -0400 |
---|---|---|
committer | Boris Zbarsky <bzbarsky@mit.edu> | 2017-06-05 13:32:05 -0400 |
commit | 4c320a9c75eef87cf333165d3ad7f77aceffa028 (patch) | |
tree | 786ed18cfe91747a394718ec3084bf41c12ba66d /components | |
parent | ad1309552df418488b7547b869944b9af78c3204 (diff) | |
download | servo-4c320a9c75eef87cf333165d3ad7f77aceffa028.tar.gz servo-4c320a9c75eef87cf333165d3ad7f77aceffa028.zip |
Allow inserting elements into the style sharing cache even when they are affected by id selectors.
Diffstat (limited to 'components')
-rw-r--r-- | components/selectors/matching.rs | 9 | ||||
-rw-r--r-- | components/style/sharing/checks.rs | 3 |
2 files changed, 4 insertions, 8 deletions
diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs index 07050d8c91b..444d24a7d1c 100644 --- a/components/selectors/matching.rs +++ b/components/selectors/matching.rs @@ -21,13 +21,11 @@ bitflags! { /// This is used to implement efficient sharing. #[derive(Default)] pub flags StyleRelations: usize { - /// Whether this element is affected by an ID selector. - const AFFECTED_BY_ID_SELECTOR = 1 << 0, /// Whether this element is affected by presentational hints. This is /// computed externally (that is, in Servo). - const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 1, + const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 0, /// Whether this element has pseudo-element styles. Computed externally. - const AFFECTED_BY_PSEUDO_ELEMENTS = 1 << 2, + const AFFECTED_BY_PSEUDO_ELEMENTS = 1 << 1, } } @@ -539,8 +537,7 @@ fn matches_simple_selector<E, F>( } // TODO: case-sensitivity depends on the document type and quirks mode Component::ID(ref id) => { - relation_if!(element.get_id().map_or(false, |attr| attr == *id), - AFFECTED_BY_ID_SELECTOR) + element.get_id().map_or(false, |attr| attr == *id) } Component::Class(ref class) => { element.has_class(class) diff --git a/components/style/sharing/checks.rs b/components/style/sharing/checks.rs index 581022392d6..bfd1778484f 100644 --- a/components/style/sharing/checks.rs +++ b/components/style/sharing/checks.rs @@ -23,8 +23,7 @@ pub fn relations_are_shareable(relations: &StyleRelations) -> bool { use selectors::matching::*; // If we start sharing things that are AFFECTED_BY_PSEUDO_ELEMENTS, we need // to track revalidation selectors on a per-pseudo-element basis. - !relations.intersects(AFFECTED_BY_ID_SELECTOR | - AFFECTED_BY_PSEUDO_ELEMENTS) + !relations.intersects(AFFECTED_BY_PSEUDO_ELEMENTS) } /// Whether, given two elements, they have pointer-equal computed values. |