mirror of
https://github.com/servo/servo.git
synced 2025-08-01 03:30:33 +01:00
style: Make invalidations with offset zero "universal" invalidations.
We'll use this for querySelector / querySelectorAll. Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
a296e386af
commit
191c39f28c
2 changed files with 9 additions and 2 deletions
|
@ -338,8 +338,7 @@ pub fn matches_compound_selector<E>(
|
|||
where
|
||||
E: Element
|
||||
{
|
||||
debug_assert_ne!(from_offset, 0);
|
||||
if cfg!(debug_assertions) {
|
||||
if cfg!(debug_assertions) && from_offset != 0 {
|
||||
selector.combinator_at_parse_order(from_offset - 1); // This asserts.
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,10 @@ impl Invalidation {
|
|||
/// Whether this invalidation is effective for the next sibling or
|
||||
/// descendant after us.
|
||||
fn effective_for_next(&self) -> bool {
|
||||
if self.offset == 0 {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(emilio): For pseudo-elements this should be mostly false, except
|
||||
// for the weird pseudos in <input type="number">.
|
||||
//
|
||||
|
@ -124,6 +128,10 @@ impl Invalidation {
|
|||
}
|
||||
|
||||
fn kind(&self) -> InvalidationKind {
|
||||
if self.offset == 0 {
|
||||
return InvalidationKind::Descendant;
|
||||
}
|
||||
|
||||
if self.selector.combinator_at_parse_order(self.offset - 1).is_ancestor() {
|
||||
InvalidationKind::Descendant
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue