mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Stylo: Correct style match for element instances under a use-element tree.
This commit is contained in:
parent
4d997f0d0c
commit
727725ac3d
6 changed files with 170 additions and 137 deletions
|
@ -532,8 +532,12 @@ fn matches_complex_selector_internal<E, F>(mut selector_iter: SelectorIter<E::Im
|
|||
SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant)
|
||||
}
|
||||
Combinator::Child | Combinator::Descendant => {
|
||||
(element.parent_element(),
|
||||
SelectorMatchingResult::NotMatchedGlobally)
|
||||
if element.blocks_ancestor_combinators() {
|
||||
(None, SelectorMatchingResult::NotMatchedGlobally)
|
||||
} else {
|
||||
(element.parent_element(),
|
||||
SelectorMatchingResult::NotMatchedGlobally)
|
||||
}
|
||||
}
|
||||
Combinator::PseudoElement => {
|
||||
(element.pseudo_element_originating_element(),
|
||||
|
|
|
@ -85,4 +85,11 @@ pub trait Element: Sized + Debug {
|
|||
/// Note: this can be false even if `.parent_element()` is `None`
|
||||
/// if the parent node is a `DocumentFragment`.
|
||||
fn is_root(&self) -> bool;
|
||||
|
||||
/// Return true if we want to stop lookup ancestor of the current
|
||||
/// element while matching complex selectors with descendant/child
|
||||
/// combinator.
|
||||
fn blocks_ancestor_combinators(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue