OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 "core/html/HTMLSlotElement.h" | 31 #include "core/html/HTMLSlotElement.h" |
32 | 32 |
33 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
34 #include "core/dom/NodeTraversal.h" | |
35 #include "core/dom/shadow/InsertionPoint.h" | |
36 | 34 |
37 namespace blink { | 35 namespace blink { |
38 | 36 |
39 using namespace HTMLNames; | 37 using namespace HTMLNames; |
40 | 38 |
41 inline HTMLSlotElement::HTMLSlotElement(Document& document) | 39 inline HTMLSlotElement::HTMLSlotElement(Document& document) |
42 : HTMLElement(slotTag, document) | 40 : HTMLElement(slotTag, document) |
43 { | 41 { |
44 } | 42 } |
45 | 43 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 91 } |
94 | 92 |
95 void HTMLSlotElement::detach(const AttachContext& context) | 93 void HTMLSlotElement::detach(const AttachContext& context) |
96 { | 94 { |
97 for (auto& node : m_distributedNodes) | 95 for (auto& node : m_distributedNodes) |
98 node->lazyReattachIfAttached(); | 96 node->lazyReattachIfAttached(); |
99 | 97 |
100 HTMLElement::detach(context); | 98 HTMLElement::detach(context); |
101 } | 99 } |
102 | 100 |
103 void HTMLSlotElement::updateDistributedNodesWithFallback() | |
104 { | |
105 if (!m_distributedNodes.isEmpty()) | |
106 return; | |
107 for (auto& child : NodeTraversal::childrenOf(*this)) { | |
108 // Insertion points are not supported as slots fallback | |
109 if (isActiveInsertionPoint(child)) | |
110 continue; | |
111 if (isHTMLSlotElement(child)) | |
112 appendDistributedNodes(toHTMLSlotElement(child).getDistributedNodes(
)); | |
113 else | |
114 appendDistributedNode(child); | |
115 } | |
116 } | |
117 | |
118 DEFINE_TRACE(HTMLSlotElement) | 101 DEFINE_TRACE(HTMLSlotElement) |
119 { | 102 { |
120 visitor->trace(m_assignedNodes); | 103 visitor->trace(m_assignedNodes); |
121 visitor->trace(m_distributedNodes); | 104 visitor->trace(m_distributedNodes); |
122 HTMLElement::trace(visitor); | 105 HTMLElement::trace(visitor); |
123 } | 106 } |
124 | 107 |
125 } | 108 } |
OLD | NEW |