Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Issue 1530643003: Support slot element's fallback content feature (Closed)

Created:
5 years ago by hayato
Modified:
4 years, 11 months ago
Reviewers:
tkent, kochi
CC:
chromium-reviews, blink-reviews-html_chromium.org, webcomponents-bugzilla_chromium.org, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Support slot element's fallback content feature The spec discussion is: - https://github.com/w3c/webcomponents/issues/317 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. e.g. Suppose we have the following tree of trees, which is borrowed from `v1-slots-fallback2.thml` test: <div id='host'> <template data-mode='open'> <slot name='slot1'> <div id='fallback1'></div> <slot name='slot2'> <div id='fallback2'></div> </slot> </slot> <slot name='slot3'> <slot name='slot4'> <div id='fallback3'></div> </slot> </slot> </template> <div id='child1' slot='slot2'></div> </div> This can be composed into the following composed tree: <div id='host'> <div id='fallback1'></div> <div id='child1'></div> <div id='fallback3'></div> </div> 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. Committed: https://crrev.com/b7c3414768afff35204a6c6b869c47d90d3953e0 Cr-Commit-Position: refs/heads/master@{#367789}

Patch Set 1 #

Patch Set 2 : wip #

Patch Set 3 : wip #

Total comments: 8

Patch Set 4 : addressed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+493 lines, -106 lines) Patch
M third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js View 1 chunk +1 line, -1 line 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html View 1 2 3 1 chunk +42 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-1.html View 1 chunk +16 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-1-expected.html View 1 chunk +5 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-2.html View 1 chunk +21 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-2-expected.html View 1 chunk +6 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-3.html View 1 chunk +30 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-3-expected.html View 1 chunk +8 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-1.html View 1 chunk +39 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-2.html View 1 chunk +55 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-3.html View 1 chunk +85 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-in-v0.html View 1 chunk +19 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-in-v0-expected.html View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ContainerNode.cpp View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Node.h View 1 2 chunks +6 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/Node.cpp View 1 2 3 2 chunks +41 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.h View 1 2 chunks +4 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.cpp View 1 2 3 6 chunks +80 lines, -91 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp View 1 2 3 2 chunks +7 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLSlotElement.h View 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLSlotElement.cpp View 1 2 3 2 chunks +17 lines, -0 lines 0 comments Download

Messages

Total messages: 39 (16 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1530643003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1530643003/1
5 years ago (2015-12-16 10:27:34 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/156975)
5 years ago (2015-12-16 11:22:15 UTC) #4
hayato
wip
5 years ago (2015-12-18 06:01:36 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1530643003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1530643003/20001
5 years ago (2015-12-18 06:02:31 UTC) #7
hayato
wip
5 years ago (2015-12-18 06:14:21 UTC) #9
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1530643003/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1530643003/40001
5 years ago (2015-12-18 06:15:00 UTC) #10
hayato
PTAL
5 years ago (2015-12-18 07:04:49 UTC) #17
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years ago (2015-12-18 07:47:10 UTC) #19
kochi
https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html File third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html (right): https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html#newcode27 third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html:27: const fallback1 = host.shadowRoot.querySelector('#fallback2'); #fallback1 https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html#newcode43 third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html:43: // TODO(hayato): ...
4 years, 11 months ago (2016-01-05 07:44:11 UTC) #20
hayato
On 2016/01/05 07:44:11, kochi wrote: > https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html > File third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html > (right): > > https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html#newcode27 ...
4 years, 11 months ago (2016-01-06 05:38:34 UTC) #21
hayato
addressed
4 years, 11 months ago (2016-01-06 05:43:48 UTC) #23
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1530643003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1530643003/60001
4 years, 11 months ago (2016-01-06 05:43:58 UTC) #24
hayato
https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html File third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html (right): https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html#newcode27 third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html:27: const fallback1 = host.shadowRoot.querySelector('#fallback2'); On 2016/01/05 07:44:11, kochi wrote: ...
4 years, 11 months ago (2016-01-06 05:49:09 UTC) #25
kochi
lgtm https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.cpp File third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.cpp (right): https://codereview.chromium.org/1530643003/diff/40001/third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.cpp#newcode114 third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.cpp:114: if (node.parentNode() && node.parentNode()->isShadowRoot()) { On 2016/01/06 05:49:09, ...
4 years, 11 months ago (2016-01-06 06:21:34 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1530643003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1530643003/60001
4 years, 11 months ago (2016-01-06 06:23:04 UTC) #29
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 11 months ago (2016-01-06 07:10:56 UTC) #31
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/b7c3414768afff35204a6c6b869c47d90d3953e0 Cr-Commit-Position: refs/heads/master@{#367789}
4 years, 11 months ago (2016-01-06 07:11:51 UTC) #33
Noel Gordon
On 2016/01/06 07:11:51, commit-bot: I haz the power wrote: > Patchset 4 (id:??) landed as ...
4 years, 11 months ago (2016-01-06 07:34:37 UTC) #34
hayato
On 2016/01/06 07:34:37, noel gordon wrote: > On 2016/01/06 07:11:51, commit-bot: I haz the power ...
4 years, 11 months ago (2016-01-06 08:05:41 UTC) #35
msramek
On 2016/01/06 08:05:41, hayato wrote: > On 2016/01/06 07:34:37, noel gordon wrote: > > On ...
4 years, 11 months ago (2016-01-06 09:34:39 UTC) #36
msramek
On 2016/01/06 09:34:39, msramek wrote: > On 2016/01/06 08:05:41, hayato wrote: > > On 2016/01/06 ...
4 years, 11 months ago (2016-01-06 09:51:05 UTC) #37
msramek
A revert of this CL (patchset #4 id:60001) has been created in https://codereview.chromium.org/1562743002/ by msramek@chromium.org. ...
4 years, 11 months ago (2016-01-06 09:52:10 UTC) #38
hayato
4 years, 11 months ago (2016-01-06 10:35:52 UTC) #39
Message was sent while issue was closed.
On 2016/01/06 09:52:10, msramek wrote:
> A revert of this CL (patchset #4 id:60001) has been created in
> https://codereview.chromium.org/1562743002/ by mailto:msramek@chromium.org.
> 
> The reason for reverting is: Broken compilation:
> 
> FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc
> "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo
> /showIncludes /FC
>
@obj\third_party\WebKit\Source\core\dom\shadow\webcore_dom.SlotAssignment.obj.rsp
> /c ..\..\third_party\WebKit\Source\core\dom\shadow\SlotAssignment.cpp
>
/Foobj\third_party\WebKit\Source\core\dom\shadow\webcore_dom.SlotAssignment.obj
> /Fdobj\third_party\WebKit\Source\core\webcore_dom.cc.pdb 
>
e:\b\build\slave\webkit_win_oilpan\build\src\third_party\webkit\source\wtf\vector.h(638)
> : error C2338: Cannot put raw pointers to garbage-collected classes into an
> off-heap Vector.  Use HeapVector<Member<T>> instead.
>        
>
e:\b\build\slave\webkit_win_oilpan\build\src\third_party\webkit\source\wtf\vector.h(632)
> : while compiling class template member function
> 'WTF::Vector<blink::HTMLSlotElement
*,0,WTF::PartitionAllocator>::Vector(void)'
>        
>
e:\b\build\slave\webkit_win_oilpan\build\src\third_party\webkit\source\core\dom\shadow\slotassignment.cpp(34)
> : see reference to function template instantiation
> 'WTF::Vector<blink::HTMLSlotElement
*,0,WTF::PartitionAllocator>::Vector(void)'
> being compiled
>        
>
e:\b\build\slave\webkit_win_oilpan\build\src\third_party\webkit\source\core\dom\shadow\slotassignment.cpp(34)
> : see reference to class template instantiation
> 'WTF::Vector<blink::HTMLSlotElement *,0,WTF::PartitionAllocator>' being
compiled
> ninja: build stopped: subcommand failed.
> .

Sorry for the lack of the explanation. I should have mentioned that I can fix
this at prompt.
The fix was landed: https://codereview.chromium.org/1562013002/. I should have
used NOTRY= there. My bad.

Powered by Google App Engine
This is Rietveld 408576698