Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 281e57821ea91d94b3896b9cc2eac7b7eff0be3b
https://github.com/WebKit/WebKit/commit/281e57821ea91d94b3896b9cc2eac7b7eff0be3b
Author: Antti Koivisto <[email protected]>
Date: 2026-06-03 (Wed, 03 Jun 2026)
Changed paths:
A LayoutTests/fast/selectors/has-complexity-traversal-count-expected.txt
A LayoutTests/fast/selectors/has-complexity-traversal-count.html
M LayoutTests/platform/glib/TestExpectations
M LayoutTests/platform/mac-wk2/TestExpectations
M Source/WebCore/style/ChildChangeInvalidation.cpp
M Source/WebCore/style/ChildChangeInvalidation.h
M Source/WebCore/style/StyleScopeRuleSets.cpp
M Source/WebCore/style/StyleScopeRuleSets.h
Log Message:
-----------
REGRESSION(311870@main): [macOS Release x86_64]
imported/w3c/web-platform-tests/css/selectors/invalidation/has-complexity.html
is a constant TIMEOUT
https://bugs.webkit.org/show_bug.cgi?id=315668
rdar://178056302
Reviewed by Alan Baradlay.
311870@main fixed a part of invalidation code that had not worked at all
because an overflowing bitfield.
That exposed a O(n^2) performance issue with sibling combinator style
invalidation.
Fix by expanding the existing hasAlreadyMatchedAndMutationIsIrrelevant
optimization in ChildChangeInvalidation
to cover sibling combinator visits. Order-insensitive :has() arguments are
skipped there entirely since the
changed element's own traversal already covers them. Arguments using only
sibling combinators (+/~) are
short-circuited when the mutation is at the end of the element list, where a
pre-existing sibling's match is
provably unaffected by it (which also makes the end-of-list removal case
linear).
Test: fast/selectors/has-complexity-traversal-count.html
* LayoutTests/fast/selectors/has-complexity-traversal-count-expected.txt: Added.
* LayoutTests/fast/selectors/has-complexity-traversal-count.html: Added.
Add a test that records invalidation traversal counts for the cases tested by
has-complexity.html.
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/style/ChildChangeInvalidation.cpp:
(WebCore::Style::ChildChangeInvalidation::invalidateForChangedElement):
(WebCore::Style::ChildChangeInvalidation::invalidateForHasSiblings):
* Source/WebCore/style/ChildChangeInvalidation.h:
* Source/WebCore/style/StyleScopeRuleSets.cpp:
(WebCore::Style::HasArgumentSiblingInfo::isOrderSensitive const):
(WebCore::Style::HasArgumentSiblingInfo::isStructuralSibling const):
(WebCore::Style::scanHasArgument):
(WebCore::Style::hasArgumentSiblingInfo):
(WebCore::Style::ensureInvalidationRuleSets):
* Source/WebCore/style/StyleScopeRuleSets.h:
Canonical link: https://commits.webkit.org/314509@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications