[webkit-changes] [WebKit/WebKit] a88e58: Match elements without parent with child-indexed p...

Antti Koivisto noreply at github.com
Fri May 26 21:03:46 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a88e588d1688042b428816f652ca9e869994b4c0
      https://github.com/WebKit/WebKit/commit/a88e588d1688042b428816f652ca9e869994b4c0
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/editing/pasteboard/paste-as-quotation-then-paste-crash-expected.txt
    M LayoutTests/fast/css/first-letter-capitalized-edit-select-crash-expected.txt
    M LayoutTests/fast/css/first-letter-style-relation-crash-expected.txt
    M LayoutTests/fast/layers/remove-scrollable-area-crash-expected.txt
    M LayoutTests/fast/selectors/active-hover-quirks-expected.txt
    M LayoutTests/fast/selectors/active-hover-strict-expected.txt
    M LayoutTests/fast/selectors/active-quirks-expected.txt
    M LayoutTests/fast/selectors/active-strict-expected.txt
    M LayoutTests/fast/selectors/hover-quirks-expected.txt
    M LayoutTests/fast/selectors/hover-strict-expected.txt
    R LayoutTests/fast/selectors/nth-child-matching-first-on-root-expected.txt
    R LayoutTests/fast/selectors/nth-child-matching-first-on-root.html
    R LayoutTests/fast/selectors/nth-child-of-has-parent-expected.txt
    R LayoutTests/fast/selectors/nth-child-of-has-parent.html
    R LayoutTests/fast/selectors/nth-child-on-root-expected.txt
    R LayoutTests/fast/selectors/nth-child-on-root.html
    R LayoutTests/fast/selectors/nth-last-child-matching-first-on-root-expected.txt
    R LayoutTests/fast/selectors/nth-last-child-matching-first-on-root.html
    R LayoutTests/fast/selectors/nth-last-child-on-root-expected.txt
    R LayoutTests/fast/selectors/nth-last-child-on-root.html
    M LayoutTests/fast/selectors/resources/hover-active-quirks-utility.js
    M LayoutTests/fast/selectors/resources/hover-active-strict-utility.js
    M LayoutTests/imported/w3c/web-platform-tests/css/selectors/child-indexed-pseudo-class-expected.txt
    M LayoutTests/platform/mac/http/tests/misc/acid3-expected.txt
    M LayoutTests/platform/wpe/http/tests/misc/acid3-expected.txt
    M Source/WebCore/css/SelectorChecker.cpp
    M Source/WebCore/cssjit/SelectorCompiler.cpp

  Log Message:
  -----------
  Match elements without parent with child-indexed pseudo-classes
https://bugs.webkit.org/show_bug.cgi?id=238822
rdar://91637426

Reviewed by Yusuke Suzuki.

The spec is now written in terms of siblings, allowing also the root element
match child-indexed pseudo-classes.

https://drafts.csswg.org/selectors-4/#child-index

* LayoutTests/TestExpectations:
* LayoutTests/fast/css/first-letter-capitalized-edit-select-crash-expected.txt:
* LayoutTests/fast/css/first-letter-style-relation-crash-expected.txt:
* LayoutTests/fast/selectors/active-hover-quirks-expected.txt:
* LayoutTests/fast/selectors/active-hover-strict-expected.txt:
* LayoutTests/fast/selectors/active-quirks-expected.txt:
* LayoutTests/fast/selectors/active-strict-expected.txt:
* LayoutTests/fast/selectors/hover-quirks-expected.txt:
* LayoutTests/fast/selectors/hover-strict-expected.txt:
* LayoutTests/fast/selectors/nth-child-matching-first-on-root-expected.txt: Removed.
* LayoutTests/fast/selectors/nth-child-matching-first-on-root.html: Removed.
* LayoutTests/fast/selectors/nth-child-of-has-parent-expected.txt: Removed.
* LayoutTests/fast/selectors/nth-child-of-has-parent.html: Removed.
* LayoutTests/fast/selectors/nth-child-on-root-expected.txt: Removed.
* LayoutTests/fast/selectors/nth-child-on-root.html: Removed.
* LayoutTests/fast/selectors/nth-last-child-matching-first-on-root-expected.txt: Removed.
* LayoutTests/fast/selectors/nth-last-child-matching-first-on-root.html: Removed.
* LayoutTests/fast/selectors/nth-last-child-on-root-expected.txt: Removed.
* LayoutTests/fast/selectors/nth-last-child-on-root.html: Removed.

WPTs cover these cases.

* LayoutTests/fast/selectors/resources/hover-active-quirks-utility.js:
* LayoutTests/fast/selectors/resources/hover-active-strict-utility.js:
(test):
* LayoutTests/imported/w3c/web-platform-tests/css/selectors/child-indexed-pseudo-class-expected.txt:
* LayoutTests/platform/mac/http/tests/misc/acid3-expected.txt:

Legacy Acid3 score drops to 97, matching other engines.

* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):

Remove the parent element/shadow root requirements.

* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsFirstChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsLastChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsOnlyChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthChildRelationUpdate):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthLastChildParentCheckAndRelationUpdate):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElementOrShadowRoot): Deleted.
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthChildParentCheckAndRelationUpdate): Deleted.

Remove the parent element/shadow root requirements.
Simplify the logic by only testing for the parent element for marking purposes.

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




More information about the webkit-changes mailing list