Bug 178584

Summary: Support ::before/::after pseudo elements with display:contents
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, emilio, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 157477    
Attachments:
Description Flags
patch
buildbot: commit-queue-
Archive of layout-test-results from ews100 for mac-elcapitan
none
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
Archive of layout-test-results from ews115 for mac-elcapitan
none
patch
rniwa: review+
patch none

Description Antti Koivisto 2017-10-20 07:41:27 PDT
::before { display:contents; content:'foo' }
Comment 1 Antti Koivisto 2017-10-20 07:55:39 PDT
Created attachment 324398 [details]
patch
Comment 2 Build Bot 2017-10-20 08:44:29 PDT
Comment on attachment 324398 [details]
patch

Attachment 324398 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/4933455

New failing tests:
svg/custom/assert-empty-layout-attributes.svg
svg/text/svg-rtl-text-crash.html
svg/custom/crash-textPath-attributes.html
Comment 3 Build Bot 2017-10-20 08:44:30 PDT
Created attachment 324403 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 4 Build Bot 2017-10-20 09:13:38 PDT
Comment on attachment 324398 [details]
patch

Attachment 324398 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4933517

New failing tests:
svg/custom/assert-empty-layout-attributes.svg
svg/text/svg-rtl-text-crash.html
svg/custom/crash-textPath-attributes.html
Comment 5 Build Bot 2017-10-20 09:13:40 PDT
Created attachment 324405 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.6
Comment 6 Build Bot 2017-10-20 09:36:00 PDT
Comment on attachment 324398 [details]
patch

Attachment 324398 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4933658

New failing tests:
svg/custom/assert-empty-layout-attributes.svg
svg/text/svg-rtl-text-crash.html
svg/custom/crash-textPath-attributes.html
Comment 7 Build Bot 2017-10-20 09:36:01 PDT
Created attachment 324408 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 8 Antti Koivisto 2017-10-20 12:20:29 PDT
Created attachment 324426 [details]
patch
Comment 9 Ryosuke Niwa 2017-10-20 15:35:49 PDT
Comment on attachment 324426 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=324426&action=review

> Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp:117
> +            removeAndDestroyContentRenderers(*pseudoElement);
> +

Could you clarify why this code change is needed in the change log?

> Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp:156
> +        if (pseudoElementRenderer)
> +            renderTreePosition.moveToLastChild();
> +        else
> +            renderTreePosition.computeNextSibling(*pseudoElement);

Could you also describe why code to move to the next sibling is needed in the change log?
Comment 10 Antti Koivisto 2017-10-21 00:38:00 PDT
Added this:

(WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):

In the normal case create a render tree position for the pseudo element renderer and use RenderTreePosition::moveToLastChild to make it a valid position. (The existing RenderTreePosition interface didn't have way to move to positions in anonymous boxes) 

In the case of a non box generating display:contents pseudo element, use the current render tree position instead.

Ensure that pseudo element renderers are destroyed before creating the new ones since in display:contents case they are not descendants of the pseudo renderer and don't get cleared automatically.
Comment 11 Antti Koivisto 2017-10-21 00:40:15 PDT
Created attachment 324496 [details]
patch
Comment 12 WebKit Commit Bot 2017-10-21 01:15:13 PDT
Comment on attachment 324496 [details]
patch

Clearing flags on attachment: 324496

Committed r223810: <https://trac.webkit.org/changeset/223810>
Comment 13 WebKit Commit Bot 2017-10-21 01:15:15 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Radar WebKit Bug Importer 2017-11-13 15:39:22 PST
<rdar://problem/35517782>