⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286063 in webkit


Ignore:
Timestamp:
Nov 19, 2021, 8:53:01 AM (5 years ago)
Author:
Antti Koivisto
Message:

:hover with descendant selector not invalidated correctly in shadow tree
https://bugs.webkit.org/show_bug.cgi?id=233354

Reviewed by Antoine Quint.

Source/WebCore:

We optimize :hover and :active by only invalidating for descendant selectors with a single tree walk.
This doesn't work correctly for shadow trees as their scoped style may differ and the invalidation
is limited to a single scope anyway.

Fix by doing descendant invalidation for each affected scope.

Test: fast/selectors/hover-descendant-shadow-tree.html

  • dom/Document.cpp:

(WebCore::Document::updateHoverActiveState):

We need to perform scoped descendant invalidation for elements that are parented to ShadowRoot.

LayoutTests:

  • fast/selectors/hover-descendant-shadow-tree-expected.html: Added.
  • fast/selectors/hover-descendant-shadow-tree.html: Added.
  • platform/ios/TestExpectations:
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r286052 r286063  
     12021-11-19  Antti Koivisto  <antti@apple.com>
     2
     3        :hover with descendant selector not invalidated correctly in shadow tree
     4        https://bugs.webkit.org/show_bug.cgi?id=233354
     5
     6        Reviewed by Antoine Quint.
     7
     8        * fast/selectors/hover-descendant-shadow-tree-expected.html: Added.
     9        * fast/selectors/hover-descendant-shadow-tree.html: Added.
     10        * platform/ios/TestExpectations:
     11
    1122021-11-19  Arcady Goldmints-Orlov  <agoldmints@igalia.com>
    213
  • trunk/LayoutTests/platform/ios/TestExpectations

    r285945 r286063  
    711711fast/selectors/active-quirks.html [ Skip ]
    712712fast/selectors/active-strict.html [ Skip ]
     713fast/selectors/hover-descendant-shadow-tree.html [ Skip ]
    713714fast/selectors/hover-invalidation-descendant-clear.html [ Skip ]
    714715fast/selectors/hover-invalidation-descendant-dynamic.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r286061 r286063  
     12021-11-19  Antti Koivisto  <antti@apple.com>
     2
     3        :hover with descendant selector not invalidated correctly in shadow tree
     4        https://bugs.webkit.org/show_bug.cgi?id=233354
     5
     6        Reviewed by Antoine Quint.
     7
     8        We optimize :hover and :active by only invalidating for descendant selectors with a single tree walk.
     9        This doesn't work correctly for shadow trees as their scoped style may differ and the invalidation
     10        is limited to a single scope anyway.
     11
     12        Fix by doing descendant invalidation for each affected scope.
     13
     14        Test: fast/selectors/hover-descendant-shadow-tree.html
     15
     16        * dom/Document.cpp:
     17        (WebCore::Document::updateHoverActiveState):
     18
     19        We need to perform scoped descendant invalidation for elements that are parented to ShadowRoot.
     20
    1212021-11-19  Matt Woodrow  <matt.woodrow@gmail.com>
    222
  • trunk/Source/WebCore/dom/Document.cpp

    r286061 r286063  
    74817481        if (elements.isEmpty())
    74827482            return;
     7483
    74837484        Style::PseudoClassChangeInvalidation styleInvalidation { *elements.last(), pseudoClassType, Style::InvalidationScope::Descendants };
     7485
     7486        // We need to do descendant invalidation for each shadow tree separately as the style is per-scope.
     7487        Vector<Style::PseudoClassChangeInvalidation> shadowDescendantStyleInvalidations;
     7488        for (auto& element : elements) {
     7489            if (hasShadowRootParent(*element))
     7490                shadowDescendantStyleInvalidations.append({ *element, pseudoClassType, Style::InvalidationScope::Descendants });
     7491        }
     7492
    74847493        for (auto& element : elements)
    74857494            setter(*element);
Note: See TracChangeset for help on using the changeset viewer.