Support slot element's fallback content feature
The spec discussion is:
The relevant algorithm sections in the Shadow DOM spec are:
- Distributed nodes algorithm: http://w3c.github.io/webcomponents/spec/shadow/#distributed-nodes-algorithm
- Composition algorithm: http://w3c.github.io/webcomponents/spec/shadow/#composition-algorithm
Now, if a slot does not have any assigned node, its child nodes are used as fallback contents.
This fallback ability will *chain* recursively. That means we can use *another* slot as a slot's fallback contents.
That gives us a great flexibility to compose a composed tree.
Suppose we have the following tree of trees, which is borrowed from `v1-slots-fallback2.thml` test:
<div id='child1' slot='slot2'></div>
This can be composed into the following composed tree:
The following feature is not yet supported:
- A slot API, HTMLSlotElement::getDistributedNodes does not work in a document tree nor v0 shadow tree
I'll support this as separate patches. This requires non-trivial changes to the distribution code.
Review URL: https://codereview.chromium.org/1530643003
22 files changed