Changeset 287362 in webkit


Ignore:
Timestamp:
Dec 22, 2021 10:33:49 AM (7 months ago)
Author:
Antti Koivisto
Message:

[:has() pseudo-class] :has() selector does not render on first pass?
https://bugs.webkit.org/show_bug.cgi?id=234531

Reviewed by Simon Fraser.

Source/WebCore:

With :has() identical sibling elements can have different style which breaks the current
assumptions of the style sharing optimization.

Test: fast/selectors/has-style-sharing.html

  • style/StyleSharingResolver.cpp:

(WebCore::Style::SharingResolver::resolve):

Disable style sharing in presence of :has() rules for now.

For a less heavy-handed approach we need to start testing for :has() rules similar to what is already done
for sibling and attribute rules.

LayoutTests:

Test case by Alex Riviere.

  • fast/selectors/has-style-sharing-expected.html: Added.
  • fast/selectors/has-style-sharing.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287358 r287362  
     12021-12-22  Antti Koivisto  <antti@apple.com>
     2
     3        [:has() pseudo-class] :has() selector does not render on first pass?
     4        https://bugs.webkit.org/show_bug.cgi?id=234531
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test case by Alex Riviere.
     9
     10        * fast/selectors/has-style-sharing-expected.html: Added.
     11        * fast/selectors/has-style-sharing.html: Added.
     12
    1132021-12-22  Commit Queue  <commit-queue@webkit.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r287361 r287362  
     12021-12-22  Antti Koivisto  <antti@apple.com>
     2
     3        [:has() pseudo-class] :has() selector does not render on first pass?
     4        https://bugs.webkit.org/show_bug.cgi?id=234531
     5
     6        Reviewed by Simon Fraser.
     7
     8        With :has() identical sibling elements can have different style which breaks the current
     9        assumptions of the style sharing optimization.
     10
     11        Test: fast/selectors/has-style-sharing.html
     12
     13        * style/StyleSharingResolver.cpp:
     14        (WebCore::Style::SharingResolver::resolve):
     15
     16        Disable style sharing in presence of :has() rules for now.
     17
     18        For a less heavy-handed approach we need to start testing for :has() rules similar to what is already done
     19        for sibling and attribute rules.
     20
    1212021-12-22  Michael Saboff  <msaboff@apple.com>
    222
  • trunk/Source/WebCore/style/StyleSharingResolver.cpp

    r285630 r287362  
    108108            return nullptr;
    109109    }
     110    // FIXME: Do something smarter here, for example RuleSet based matching like with attribute/sibling selectors.
     111    if (Scope::forNode(element).usesHasPseudoClass())
     112        return nullptr;
    110113
    111114    Context context {
Note: See TracChangeset for help on using the changeset viewer.