Slot elements should support fallback contents
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 20:36:34 +0000 (20:36 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 20:36:34 +0000 (20:36 +0000)
commit587989a6f6481492c993651cb9eb508ca6313c9c
tree2c3b43fb63262281bdfcf3a0735454c0be2ebb6f
parent6b54a1e3f608381ec352cf830063280d7503abaf
Slot elements should support fallback contents
https://bugs.webkit.org/show_bug.cgi?id=149701

Reviewed by Antti Koivisto.

Source/WebCore:

Following discussions on Github discussions [1] [2], we're adding the default rule of `display: contents`
on slot elements and making slot elements render its children when there are no assigned nodes [3].

Make these changes by attaching renderers on direct-children of slot elements when there are no assigned
nodes during render tree construction. Note `display: contents` will be aded in webkit.org/b/149439.

[1] https://github.com/w3c/webcomponents/issues/317
[2] https://github.com/w3c/webcomponents/issues/308
[3] https://github.com/w3c/webcomponents/issues/308#issuecomment-143655347

Tests: fast/shadow-dom/css-scoping-shadow-slot-fallback.html
       fast/shadow-dom/shadow-layout-after-slot-fallback-changes.html

* style/StyleResolveTree.cpp:
(WebCore::Style::attachSlotAssignees):
(WebCore::Style::detachSlotAssignees):
(WebCore::Style::resolveSlotAssignees):

LayoutTests:

Added tests for fallback contents in slot elements. One of them could be safely submitted to CSS WG,
and the other one is a style recalc test.

* fast/shadow-dom/css-scoping-shadow-slot-fallback-expected.html: Added.
* fast/shadow-dom/css-scoping-shadow-slot-fallback.html: Added.
* fast/shadow-dom/shadow-layout-after-slot-fallback-changes-expected.html: Added.
* fast/shadow-dom/shadow-layout-after-slot-fallback-changes.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190430 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-fallback-expected.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-fallback.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/shadow-layout-after-slot-fallback-changes-expected.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/shadow-layout-after-slot-fallback-changes.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/style/StyleResolveTree.cpp