[webkit-changes] [WebKit/WebKit] 897279: CSS Nesting: nested selector matching

Matthieu Dubet noreply at github.com
Sat Dec 31 01:09:31 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8972793414d954d8dd57676c6f8f2298a001e73e
      https://github.com/WebKit/WebKit/commit/8972793414d954d8dd57676c6f8f2298a001e73e
  Author: Matthieu Dubet <m_dubet at apple.com>
  Date:   2022-12-31 (Sat, 31 Dec 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-001-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-002-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-003-expected.txt
    M Source/WebCore/css/CSSSelector.cpp
    M Source/WebCore/css/CSSSelector.h
    M Source/WebCore/css/CSSSelectorList.cpp
    M Source/WebCore/css/SelectorChecker.cpp
    M Source/WebCore/css/StyleRule.cpp
    M Source/WebCore/css/StyleRule.h
    M Source/WebCore/css/parser/CSSParserSelector.cpp
    M Source/WebCore/css/parser/CSSParserSelector.h
    M Source/WebCore/css/parser/CSSSelectorParser.cpp
    M Source/WebCore/css/parser/CSSSelectorParser.h
    M Source/WebCore/cssjit/SelectorCompiler.cpp
    M Source/WebCore/style/RuleData.h
    M Source/WebCore/style/RuleSetBuilder.cpp
    M Source/WebCore/style/RuleSetBuilder.h

  Log Message:
  -----------
  CSS Nesting: nested selector matching
https://bugs.webkit.org/show_bug.cgi?id=249746
rdar://103147183

Reviewed by Antti Koivisto.

This patch implements nested selector matching by
creating the flat equivalent of the nested selector
at rule set builder time.
All the following steps (matching, selector jit compilation,...)
should be automatically working because they will operate on regular flat selector,
without any parent selector inside them.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-002-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-003-expected.txt:
* Source/WebCore/css/CSSSelector.cpp:
(WebCore::simpleSelectorSpecificity):
(WebCore::CSSSelector::selectorText const):
(WebCore::CSSSelector::RareData::RareData):
(WebCore::CSSSelector::RareData::deepCopy const):
(WebCore::CSSSelector::CSSSelector):
(WebCore::CSSSelector::visitAllSimpleSelectors const):
(WebCore::CSSSelector::resolveNestingParentSelectors):
(WebCore::CSSSelector::hasExplicitNestingParent const):
* Source/WebCore/css/CSSSelector.h:
(WebCore::CSSSelector::selectorList):
(WebCore::CSSSelector::setNotLastInSelectorList):
(WebCore::CSSSelector::isFirstInTagHistory const):
(WebCore::CSSSelector::isLastInTagHistory const):
(WebCore::CSSSelector::setLastInTagHistory):
(WebCore::CSSSelector::tagHistory):
(WebCore::CSSSelector::CSSSelector): Deleted.
* Source/WebCore/css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::CSSSelectorList):
* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
* Source/WebCore/css/StyleRule.cpp:
(WebCore::StyleRule::StyleRule):
* Source/WebCore/css/StyleRule.h:
* Source/WebCore/css/parser/CSSParserSelector.cpp:
(WebCore::CSSParserSelector::CSSParserSelector):
* Source/WebCore/css/parser/CSSParserSelector.h:
(WebCore::CSSParserSelector::selector):
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumeRelativeNestedSelector):
(WebCore::CSSSelectorParser::consumeNesting):
(WebCore::CSSSelectorParser::resolveNestingParent):
* Source/WebCore/css/parser/CSSSelectorParser.h:
* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
* Source/WebCore/style/RuleData.h:
(WebCore::Style::RuleData::selector const):
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::addStyleRule):
* Source/WebCore/style/RuleSetBuilder.h:

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




More information about the webkit-changes mailing list