зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1810657 - Apply slow selector flags before matching r=emilio
This patch fixes a bug introduced by bug 1808228/D166266, where, if an element does not initially match :nth-child(An+B of selector list) or :nth-last-child(An+B of selector list), changing a sibling or ancestor will not invalidate that element. Differential Revision: https://phabricator.services.mozilla.com/D166982
This commit is contained in:
Родитель
cd4137f9be
Коммит
4e80d75bce
|
@ -891,18 +891,6 @@ where
|
|||
if element.ignores_nth_child_selectors() {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* This condition could be bound as element_matches_selectors and used in
|
||||
* nth_child_index() as element_matches_selectors &&
|
||||
* list_matches_complex_selector(selectors, &curr, context)
|
||||
* , but since element_matches_selectors would need still need to be
|
||||
* computed in that case in order to utilize the cache, there would be no
|
||||
* performance benefit for building up nth-{,last-}child(.. of ..) caches
|
||||
* where the element does not match the selector list.
|
||||
*/
|
||||
if !selectors.is_empty() && !list_matches_complex_selector(selectors, element, context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let NthSelectorData { ty, a, b, .. } = *nth_data;
|
||||
let is_of_type = ty.is_of_type();
|
||||
|
@ -940,6 +928,10 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
if !selectors.is_empty() && !list_matches_complex_selector(selectors, element, context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// :first/last-child are rather trivial to match, don't bother with the
|
||||
// cache.
|
||||
if is_edge_child_selector {
|
||||
|
|
Загрузка…
Ссылка в новой задаче