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