Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cb0399799e0723a1aba1802cb674c58e1379cc9a
      
https://github.com/WebKit/WebKit/commit/cb0399799e0723a1aba1802cb674c58e1379cc9a
  Author: Antti Koivisto <[email protected]>
  Date:   2026-04-24 (Fri, 24 Apr 2026)

  Changed paths:
    M Source/WebCore/css/SelectorChecker.cpp
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/Node.h
    M Source/WebCore/style/ChildChangeInvalidation.cpp
    M Source/WebCore/style/ChildChangeInvalidation.h
    M Source/WebCore/style/StyleRelations.cpp
    M Source/WebCore/style/StyleRelations.h

  Log Message:
  -----------
  [:has() perf] Split AffectedByHasWithSiblingRelationship bit into forward and 
backward direction bits
https://bugs.webkit.org/show_bug.cgi?id=313235
rdar://175514604

Reviewed by Alan Baradlay.

This reduces invalidation traversal with sibling combinators and nth-child 
pseudo classes in :has().
In the common case of appending children to the end it will typically be 
avoided completely.

* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchHasPseudoClass const):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::resetStyleRelations):
* Source/WebCore/dom/Element.h:
(WebCore::Element::affectedByHasWithBackwardSiblingRelationship const):
(WebCore::Element::affectedByHasWithForwardSiblingRelationship const):
(WebCore::Element::setAffectedByHasWithBackwardSiblingRelationship):
(WebCore::Element::setAffectedByHasWithForwardSiblingRelationship):
(WebCore::Element::affectedByHasWithSiblingRelationship const): Deleted.
(WebCore::Element::setAffectedByHasWithSiblingRelationship): Deleted.
* Source/WebCore/dom/Node.h:

Split the bit.

* Source/WebCore/style/ChildChangeInvalidation.cpp:
(WebCore::Style::ChildChangeInvalidation::invalidateForHasSiblings):

Factor into a function.
Do a forward or a backward traversal based on the direction bit.

(WebCore::Style::ChildChangeInvalidation::invalidateForHasBeforeMutation):
(WebCore::Style::ChildChangeInvalidation::invalidateForHasAfterMutation):
(WebCore::Style::ChildChangeInvalidation::traverseRemainingExistingSiblings): 
Deleted.
* Source/WebCore/style/ChildChangeInvalidation.h:
* Source/WebCore/style/StyleRelations.cpp:
(WebCore::Style::commitRelationsToRenderStyle):
(WebCore::Style::commitRelations):
* Source/WebCore/style/StyleRelations.h:

Canonical link: https://commits.webkit.org/311957@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to