| 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" |
| 34 | 36 |
| 35 namespace blink { | 37 namespace blink { |
| 36 | 38 |
| 37 using namespace HTMLNames; | 39 using namespace HTMLNames; |
| 38 | 40 |
| 39 inline HTMLSlotElement::HTMLSlotElement(Document& document) | 41 inline HTMLSlotElement::HTMLSlotElement(Document& document) |
| 40 : HTMLElement(slotTag, document) | 42 : HTMLElement(slotTag, document) |
| 41 { | 43 { |
| 42 } | 44 } |
| 43 | 45 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 93 } |
| 92 | 94 |
| 93 void HTMLSlotElement::detach(const AttachContext& context) | 95 void HTMLSlotElement::detach(const AttachContext& context) |
| 94 { | 96 { |
| 95 for (auto& node : m_distributedNodes) | 97 for (auto& node : m_distributedNodes) |
| 96 node->lazyReattachIfAttached(); | 98 node->lazyReattachIfAttached(); |
| 97 | 99 |
| 98 HTMLElement::detach(context); | 100 HTMLElement::detach(context); |
| 99 } | 101 } |
| 100 | 102 |
| 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 |
| 101 DEFINE_TRACE(HTMLSlotElement) | 118 DEFINE_TRACE(HTMLSlotElement) |
| 102 { | 119 { |
| 103 visitor->trace(m_assignedNodes); | 120 visitor->trace(m_assignedNodes); |
| 104 visitor->trace(m_distributedNodes); | 121 visitor->trace(m_distributedNodes); |
| 105 HTMLElement::trace(visitor); | 122 HTMLElement::trace(visitor); |
| 106 } | 123 } |
| 107 | 124 |
| 108 } | 125 } |
| OLD | NEW |