mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Don't use the invalidation machinery unless we may get some benefit from it.
MozReview-Commit-ID: 8Wpn2bjuHBQ
This commit is contained in:
parent
6b3821ae27
commit
dd7196949f
1 changed files with 8 additions and 1 deletions
|
@ -340,7 +340,14 @@ where
|
||||||
let root_element = root.as_element();
|
let root_element = root.as_element();
|
||||||
matching_context.scope_element = root_element.map(|e| e.opaque());
|
matching_context.scope_element = root_element.map(|e| e.opaque());
|
||||||
|
|
||||||
if root_element.is_some() {
|
// The invalidation mechanism is only useful in presence of combinators.
|
||||||
|
//
|
||||||
|
// We could do that check properly here, though checking the length of the
|
||||||
|
// selectors is a good heuristic.
|
||||||
|
let invalidation_may_be_useful =
|
||||||
|
selector_list.0.iter().any(|s| s.len() > 1);
|
||||||
|
|
||||||
|
if root_element.is_some() || !invalidation_may_be_useful {
|
||||||
query_selector_slow::<E, Q>(
|
query_selector_slow::<E, Q>(
|
||||||
root,
|
root,
|
||||||
selector_list,
|
selector_list,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue