Support ::before/::after pseudo elements on elements with display:contents
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Oct 2017 08:29:03 +0000 (08:29 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Oct 2017 08:29:03 +0000 (08:29 +0000)
commit4779186b4a937f87d6e5ff9693cc2cc08d6e9b32
tree9f05c21bb391c6ca72960b49fc7b79fd6d4d81e0
parentfd805cf3d18386bf00f2d8b65e380d4047eadbb6
Support ::before/::after pseudo elements on elements with display:contents
https://bugs.webkit.org/show_bug.cgi?id=178513

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* web-platform-tests/cssom/getComputedStyle-pseudo-expected.txt:

Source/WebCore:

Add support for

    div { display:contents }
    div::after { content:'foo' }

That is support non-box generating elements with generated content.

* style/RenderTreePosition.cpp:
(WebCore::RenderTreePosition::nextSiblingRenderer const):

    Implement full pseudo-inclusive traversal starting from any element (including pseudo)
    to locate the next rendering sibling. In case of display:content this may need to look
    into descendants.

* style/RenderTreeUpdater.cpp:
(WebCore::textRendererIsNeeded):

    RenderTreePosition::nextSiblingRenderer can no longer be called with a node that already has a renderer.
    Maintain the existing behavior.

* style/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
(WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):

    Don't require for host to have a renderer.

* style/RenderTreeUpdaterGeneratedContent.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolvePseudoStyle):

LayoutTests:

* TestExpectations: Enable imported/w3c/web-platform-tests/css/css-display-3/display-contents-before-after-001.html

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223748 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/cssom/getComputedStyle-pseudo-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/style/RenderTreePosition.cpp
Source/WebCore/style/RenderTreeUpdater.cpp
Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp
Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h
Source/WebCore/style/StyleTreeResolver.cpp