[webkit-changes] [WebKit/WebKit] 12307b: Invalidate :has(:is(:host(...) ...)) correctly

Cameron McCormack noreply at github.com
Thu Sep 7 23:51:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 12307bbe8a5a1eb20864ff71890f87469666c7d9
      https://github.com/WebKit/WebKit/commit/12307bbe8a5a1eb20864ff71890f87469666c7d9
  Author: Cameron McCormack <heycam at apple.com>
  Date:   2023-09-07 (Thu, 07 Sep 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/host-pseudo-class-in-has-expected.txt
    M Source/WebCore/style/RuleSet.cpp

  Log Message:
  -----------
  Invalidate :has(:is(:host(...) ...)) correctly
https://bugs.webkit.org/show_bug.cgi?id=253945
rdar://106768205

Reviewed by Antti Koivisto.

RuleSet records whether it contains any :host() rules that could
possibly match correctly in a shadow tree -- it checks that the :host()
only appears in the leftmost compound. Invalidation uses this state to
determine whether we need to traverse into a shadow tree, when a class
changes on a host element.

But this is not sufficient to invalidate rules like:

:has(:is(:host(...) div))

This is a properly used :host() selector, since it appears in the
leftmost position. So we adjust isHostSelectorMatchingInShadowTree to
look into nested selector list arguments like those found in :has().

* LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/host-pseudo-class-in-has-expected.txt:
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::isHostSelectorMatchingInShadowTree):

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




More information about the webkit-changes mailing list