Changeset 288196 in webkit


Ignore:
Timestamp:
Jan 19, 2022 5:43:32 AM (6 months ago)
Author:
Antti Koivisto
Message:

[:has() pseudo-class] Compute specificity correctly
https://bugs.webkit.org/show_bug.cgi?id=235351

Reviewed by Alexey Shvayka.

LayoutTests/imported/w3c:

  • web-platform-tests/css/selectors/has-complexity.html:

Fix specificity used in this test.

  • web-platform-tests/css/selectors/has-specificity-expected.txt: Added.
  • web-platform-tests/css/selectors/has-specificity.html: Added.

Source/WebCore:

"The specificity of an ':is()', ':not()', or ':has()' pseudo-class is replaced by
the specificity of the most specific complex selector in its selector list argument."

https://www.w3.org/TR/selectors-4/#specificity-rules

Test: imported/w3c/web-platform-tests/css/selectors/has-specificity.html

  • css/CSSSelector.cpp:

(WebCore::simpleSelectorSpecificityInternal):

Compute :has() specificity like :is() and :not().

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r288184 r288196  
     12022-01-19  Antti Koivisto  <antti@apple.com>
     2
     3        [:has() pseudo-class] Compute specificity correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=235351
     5
     6        Reviewed by Alexey Shvayka.
     7
     8        * web-platform-tests/css/selectors/has-complexity.html:
     9
     10        Fix specificity used in this test.
     11
     12        * web-platform-tests/css/selectors/has-specificity-expected.txt: Added.
     13        * web-platform-tests/css/selectors/has-specificity.html: Added.
     14
    1152022-01-18  Sergio Villar Senin  <svillar@igalia.com>
    216
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/has-complexity.html

    r288012 r288196  
    1010main:has(span) .subject { color: red }
    1111main:has(span + span) .subject { color: green }
    12 main:has(final) .subject { color: blue }
     12main:has(span + final) .subject { color: blue }
    1313main:has(nonexistent + span) .subject { color: black }
    1414main:has(span) span { color: black }
  • trunk/Source/WebCore/ChangeLog

    r288185 r288196  
     12022-01-19  Antti Koivisto  <antti@apple.com>
     2
     3        [:has() pseudo-class] Compute specificity correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=235351
     5
     6        Reviewed by Alexey Shvayka.
     7
     8        "The specificity of an ':is()', ':not()', or ':has()' pseudo-class is replaced by
     9        the specificity of the most specific complex selector in its selector list argument."
     10
     11        https://www.w3.org/TR/selectors-4/#specificity-rules
     12
     13        Test: imported/w3c/web-platform-tests/css/selectors/has-specificity.html
     14
     15        * css/CSSSelector.cpp:
     16        (WebCore::simpleSelectorSpecificityInternal):
     17
     18        Compute :has() specificity like :is() and :not().
     19
    1202022-01-19  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/WebCore/css/CSSSelector.cpp

    r287222 r288196  
    125125        case CSSSelector::PseudoClassMatches:
    126126        case CSSSelector::PseudoClassNot:
     127        case CSSSelector::PseudoClassHas:
    127128            return maxSpecificity(*simpleSelector.selectorList());
    128129        case CSSSelector::PseudoClassWhere:
Note: See TracChangeset for help on using the changeset viewer.