| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (isInShadowTree()) | 61 if (isInShadowTree()) |
| 62 return m_distributedNodes; | 62 return m_distributedNodes; |
| 63 | 63 |
| 64 // A slot is unlikely to be used outside of a shadow tree. | 64 // A slot is unlikely to be used outside of a shadow tree. |
| 65 // We do not need to optimize this case in most cases. | 65 // We do not need to optimize this case in most cases. |
| 66 // TODO(hayato): If this path causes a performance issue, we should move | 66 // TODO(hayato): If this path causes a performance issue, we should move |
| 67 // ShadowRootRaraDate::m_descendantSlots into TreeScopreRareData-ish and | 67 // ShadowRootRaraDate::m_descendantSlots into TreeScopreRareData-ish and |
| 68 // update the distribution code so it considers a document tree too. | 68 // update the distribution code so it considers a document tree too. |
| 69 clearDistribution(); | 69 clearDistribution(); |
| 70 for (Node& child : NodeTraversal::childrenOf(*this)) { | 70 for (Node& child : NodeTraversal::childrenOf(*this)) { |
| 71 if (!child.isSlotAssignable()) |
| 72 continue; |
| 71 if (isHTMLSlotElement(child)) | 73 if (isHTMLSlotElement(child)) |
| 72 m_distributedNodes.appendVector(toHTMLSlotElement(child).getDistribu
tedNodes()); | 74 m_distributedNodes.appendVector(toHTMLSlotElement(child).getDistribu
tedNodes()); |
| 73 else | 75 else |
| 74 m_distributedNodes.append(&child); | 76 m_distributedNodes.append(&child); |
| 75 } | 77 } |
| 76 return m_distributedNodes; | 78 return m_distributedNodes; |
| 77 } | 79 } |
| 78 | 80 |
| 79 void HTMLSlotElement::appendAssignedNode(Node& node) | 81 void HTMLSlotElement::appendAssignedNode(Node& node) |
| 80 { | 82 { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 root->didRemoveSlot(); | 199 root->didRemoveSlot(); |
| 198 | 200 |
| 199 HTMLElement::removedFrom(insertionPoint); | 201 HTMLElement::removedFrom(insertionPoint); |
| 200 } | 202 } |
| 201 | 203 |
| 202 void HTMLSlotElement::updateDistributedNodesWithFallback() | 204 void HTMLSlotElement::updateDistributedNodesWithFallback() |
| 203 { | 205 { |
| 204 if (!m_distributedNodes.isEmpty()) | 206 if (!m_distributedNodes.isEmpty()) |
| 205 return; | 207 return; |
| 206 for (auto& child : NodeTraversal::childrenOf(*this)) { | 208 for (auto& child : NodeTraversal::childrenOf(*this)) { |
| 209 if (!child.isSlotAssignable()) |
| 210 continue; |
| 207 // Insertion points are not supported as slots fallback | 211 // Insertion points are not supported as slots fallback |
| 208 if (isActiveInsertionPoint(child)) | 212 if (isActiveInsertionPoint(child)) |
| 209 continue; | 213 continue; |
| 210 if (isHTMLSlotElement(child)) | 214 if (isHTMLSlotElement(child)) |
| 211 appendDistributedNodesFrom(toHTMLSlotElement(child)); | 215 appendDistributedNodesFrom(toHTMLSlotElement(child)); |
| 212 else | 216 else |
| 213 appendDistributedNode(child); | 217 appendDistributedNode(child); |
| 214 } | 218 } |
| 215 } | 219 } |
| 216 | 220 |
| 217 DEFINE_TRACE(HTMLSlotElement) | 221 DEFINE_TRACE(HTMLSlotElement) |
| 218 { | 222 { |
| 219 #if ENABLE(OILPAN) | 223 #if ENABLE(OILPAN) |
| 220 visitor->trace(m_assignedNodes); | 224 visitor->trace(m_assignedNodes); |
| 221 visitor->trace(m_distributedNodes); | 225 visitor->trace(m_distributedNodes); |
| 222 visitor->trace(m_distributedIndices); | 226 visitor->trace(m_distributedIndices); |
| 223 #endif | 227 #endif |
| 224 HTMLElement::trace(visitor); | 228 HTMLElement::trace(visitor); |
| 225 } | 229 } |
| 226 | 230 |
| 227 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |