mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
Allow inserting elements into the style sharing cache even when they are affected by id selectors.
This commit is contained in:
parent
ad1309552d
commit
4c320a9c75
2 changed files with 4 additions and 8 deletions
|
@ -21,13 +21,11 @@ bitflags! {
|
||||||
/// This is used to implement efficient sharing.
|
/// This is used to implement efficient sharing.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub flags StyleRelations: usize {
|
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
|
/// 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 << 1,
|
const AFFECTED_BY_PRESENTATIONAL_HINTS = 1 << 0,
|
||||||
/// Whether this element has pseudo-element styles. Computed externally.
|
/// 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
|
// TODO: case-sensitivity depends on the document type and quirks mode
|
||||||
Component::ID(ref id) => {
|
Component::ID(ref id) => {
|
||||||
relation_if!(element.get_id().map_or(false, |attr| attr == *id),
|
element.get_id().map_or(false, |attr| attr == *id)
|
||||||
AFFECTED_BY_ID_SELECTOR)
|
|
||||||
}
|
}
|
||||||
Component::Class(ref class) => {
|
Component::Class(ref class) => {
|
||||||
element.has_class(class)
|
element.has_class(class)
|
||||||
|
|
|
@ -23,8 +23,7 @@ pub fn relations_are_shareable(relations: &StyleRelations) -> bool {
|
||||||
use selectors::matching::*;
|
use selectors::matching::*;
|
||||||
// If we start sharing things that are AFFECTED_BY_PSEUDO_ELEMENTS, we need
|
// If we start sharing things that are AFFECTED_BY_PSEUDO_ELEMENTS, we need
|
||||||
// to track revalidation selectors on a per-pseudo-element basis.
|
// to track revalidation selectors on a per-pseudo-element basis.
|
||||||
!relations.intersects(AFFECTED_BY_ID_SELECTOR |
|
!relations.intersects(AFFECTED_BY_PSEUDO_ELEMENTS)
|
||||||
AFFECTED_BY_PSEUDO_ELEMENTS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether, given two elements, they have pointer-equal computed values.
|
/// Whether, given two elements, they have pointer-equal computed values.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue