[webkit-changes] [WebKit/WebKit] b2e941: Fix :is(:host) both as a subject and as an ancestor

Matthieu Dubet noreply at github.com
Wed Aug 7 15:15:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b2e941c46d19000ece893d2f79e9ff52fda755a5
      https://github.com/WebKit/WebKit/commit/b2e941c46d19000ece893d2f79e9ff52fda755a5
  Author: Matthieu Dubet <m_dubet at apple.com>
  Date:   2024-08-07 (Wed, 07 Aug 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/css/host-matching-expected.html
    A LayoutTests/fast/css/host-matching.html
    M Source/WebCore/css/CSSSelector.cpp
    M Source/WebCore/css/CSSSelector.h
    M Source/WebCore/css/SelectorChecker.cpp
    M Source/WebCore/css/SelectorChecker.h
    M Source/WebCore/css/parser/CSSSelectorParser.cpp
    M Source/WebCore/css/parser/MutableCSSSelector.cpp
    M Source/WebCore/css/parser/MutableCSSSelector.h
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/RuleSet.cpp
    M Source/WebCore/style/RuleSet.h

  Log Message:
  -----------
  Fix :is(:host) both as a subject and as an ancestor
https://bugs.webkit.org/show_bug.cgi?id=264628
rdar://118582384

Reviewed by Antti Koivisto.

As ancestor: we always follow the Shadow DOM host, and check a posteriori
that we have successfully matched an :host pseudoclass.

As subject: rules containg compound :host will not end up in the host bucket
but in the universal bucket of the shadow host, we mark those as such and collect them when needed.

* LayoutTests/TestExpectations:
* LayoutTests/fast/css/host-matching-expected.html: Added.
* LayoutTests/fast/css/host-matching.html: Added.
* Source/WebCore/css/CSSSelector.cpp:
(WebCore::CSSSelector::RareData::deepCopy const):
(WebCore::CSSSelector::isHostPseudoClass const):
* Source/WebCore/css/CSSSelector.h:
* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchHostPseudoClass const):
(WebCore::localContextForParent):
(WebCore::SelectorChecker::matchRecursively const):
(WebCore::SelectorChecker::checkOne const):
* Source/WebCore/css/SelectorChecker.h:
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
* Source/WebCore/css/parser/MutableCSSSelector.cpp:
(WebCore::MutableCSSSelector::isHostPseudoSelector const): Deleted.
* Source/WebCore/css/parser/MutableCSSSelector.h:
(WebCore::MutableCSSSelector::isHostPseudoClass const):
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::matchHostPseudoClassRules):
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::hasHostPseudoClassSubjectInSelectorList):
(WebCore::Style::isHostSelectorMatchingInShadowTree):
(WebCore::Style::RuleSet::addRule):
* Source/WebCore/style/RuleSet.h:
(WebCore::Style::RuleSet::hasHostPseudoClassRulesInUniversalBucket const):

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



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


More information about the webkit-changes mailing list