Changeset 255448 in webkit


Ignore:
Timestamp:
Jan 30, 2020 12:59:52 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Crash in RenderElement::selectionPseudoStyle with detail element set to display: contents
https://bugs.webkit.org/show_bug.cgi?id=206705

Patch by Doug Kelly <Doug Kelly> on 2020-01-30
Reviewed by Zalan Bujtas.

Source/WebCore:

Check the element for a valid renderer before calling getUncachedPseudoStyle(), and if the
element is set to "display: contents", walk up to the parent element until we're at the root
or the element is not set to "display: contents".

Test: fast/css/display-contents-detail-selection.html

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::selectionPseudoStyle const):

LayoutTests:

  • fast/css/display-contents-detail-selection-expected.txt: Added.
  • fast/css/display-contents-detail-selection.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r255441 r255448  
     12020-01-30  Doug Kelly  <dougk@apple.com>
     2
     3        Crash in RenderElement::selectionPseudoStyle with detail element set to display: contents
     4        https://bugs.webkit.org/show_bug.cgi?id=206705
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * fast/css/display-contents-detail-selection-expected.txt: Added.
     9        * fast/css/display-contents-detail-selection.html: Added.
     10
    1112020-01-30  Truitt Savell  <tsavell@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r255439 r255448  
     12020-01-30  Doug Kelly  <dougk@apple.com>
     2
     3        Crash in RenderElement::selectionPseudoStyle with detail element set to display: contents
     4        https://bugs.webkit.org/show_bug.cgi?id=206705
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Check the element for a valid renderer before calling getUncachedPseudoStyle(), and if the
     9        element is set to "display: contents", walk up to the parent element until we're at the root
     10        or the element is not set to "display: contents".
     11
     12        Test: fast/css/display-contents-detail-selection.html
     13
     14        * rendering/RenderElement.cpp:
     15        (WebCore::RenderElement::selectionPseudoStyle const):
     16
    1172020-01-30  Ryan Haddad  <ryanhaddad@apple.com>
    218
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r254187 r255448  
    14141414    if (ShadowRoot* root = element()->containingShadowRoot()) {
    14151415        if (root->mode() == ShadowRootMode::UserAgent) {
    1416             if (Element* shadowHost = element()->shadowHost())
    1417                 return shadowHost->renderer()->getUncachedPseudoStyle({ PseudoId::Selection });
     1416            auto* currentElement = element()->shadowHost();
     1417            // When an element has display: contents, this element doesn't have a renderer
     1418            // and its children will render as children of the parent element.
     1419            while (currentElement && currentElement->hasDisplayContents())
     1420                currentElement = currentElement->parentElement();
     1421            if (currentElement && currentElement->renderer())
     1422                return currentElement->renderer()->getUncachedPseudoStyle({ PseudoId::Selection });
    14181423        }
    14191424    }
Note: See TracChangeset for help on using the changeset viewer.