Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ffffbfafc4cd8c6819a7598243d3bc4f29af5d61
      
https://github.com/WebKit/WebKit/commit/ffffbfafc4cd8c6819a7598243d3bc4f29af5d61
  Author: Ryosuke Niwa <[email protected]>
  Date:   2024-01-18 (Thu, 18 Jan 2024)

  Changed paths:
    M Source/WebCore/dom/ContainerNode.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Node.cpp
    M Source/WebCore/dom/Node.h
    M Source/WebCore/dom/SelectorQuery.cpp
    M Source/WebCore/dom/SelectorQuery.h

  Log Message:
  -----------
   invalidateNodeListAndCollectionCachesInAncestorsForAttribute shouldn't call 
invalidateQuerySelectorAllResults in most cases
https://bugs.webkit.org/show_bug.cgi?id=267626

Reviewed by Yusuke Suzuki.

Invalidation was happening too frequently. Only invalidate when class 
attribute's value change. Also, instead of invalidating
the all results entries at once, remove specific selector results which were 
affected by the class attribute change.

To do this, this PR moves the invalidation logic from 
Node::invalidateNodeListAndCollectionCachesInAncestorsForAttribute to
Element::classAttributeChanged, which has access to space separated class name 
list.

* Source/WebCore/dom/ContainerNode.cpp:
(WebCore::ContainerNode::querySelectorAll):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::addResultForSelectorAll):
(WebCore::Document::invalidateQuerySelectorAllResultsForClassAttributeChange): 
Added.
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::classAttributeChanged):
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::invalidateNodeListAndCollectionCachesInAncestorsForAttribute):
* Source/WebCore/dom/Node.h:
* Source/WebCore/dom/SelectorQuery.cpp:
(WebCore::SelectorDataList::classNameToMatch const): Added.
* Source/WebCore/dom/SelectorQuery.h:
(WebCore::SelectorQuery::classNameToMatch const): Added.

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to