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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.cpp

Issue 1530643003: Support slot element's fallback content feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/html/HTMLSlotElement.h" 32 #include "core/html/HTMLSlotElement.h"
33 33
34 #include "core/HTMLNames.h" 34 #include "core/HTMLNames.h"
35 #include "core/dom/NodeTraversal.h"
36 #include "core/dom/shadow/InsertionPoint.h"
35 37
36 namespace blink { 38 namespace blink {
37 39
38 using namespace HTMLNames; 40 using namespace HTMLNames;
39 41
40 inline HTMLSlotElement::HTMLSlotElement(Document& document) 42 inline HTMLSlotElement::HTMLSlotElement(Document& document)
41 : HTMLElement(slotTag, document) 43 : HTMLElement(slotTag, document)
42 { 44 {
43 } 45 }
44 46
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 94 }
93 95
94 void HTMLSlotElement::detach(const AttachContext& context) 96 void HTMLSlotElement::detach(const AttachContext& context)
95 { 97 {
96 for (auto& node : m_distributedNodes) 98 for (auto& node : m_distributedNodes)
97 node->lazyReattachIfAttached(); 99 node->lazyReattachIfAttached();
98 100
99 HTMLElement::detach(context); 101 HTMLElement::detach(context);
100 } 102 }
101 103
104 void HTMLSlotElement::updateDistributedNodesWithFallback()
105 {
106 if (!m_distributedNodes.isEmpty())
107 return;
108 for (auto& child : NodeTraversal::childrenOf(*this)) {
109 // Insertion points are not supported as slots fallback
110 if (isActiveInsertionPoint(child))
111 continue;
112 if (isHTMLSlotElement(child))
113 appendDistributedNodes(toHTMLSlotElement(child).getDistributedNodes( ));
114 else
115 appendDistributedNode(child);
116 }
117 }
118
102 DEFINE_TRACE(HTMLSlotElement) 119 DEFINE_TRACE(HTMLSlotElement)
103 { 120 {
104 visitor->trace(m_assignedNodes); 121 visitor->trace(m_assignedNodes);
105 visitor->trace(m_distributedNodes); 122 visitor->trace(m_distributedNodes);
106 HTMLElement::trace(visitor); 123 HTMLElement::trace(visitor);
107 } 124 }
108 125
109 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698