Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 #include "core/dom/shadow/InsertionPoint.h" | 36 #include "core/dom/shadow/InsertionPoint.h" |
| 37 #include "core/html/AssignedNodesOptions.h" | 37 #include "core/html/AssignedNodesOptions.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 using namespace HTMLNames; | 41 using namespace HTMLNames; |
| 42 | 42 |
| 43 inline HTMLSlotElement::HTMLSlotElement(Document& document) | 43 inline HTMLSlotElement::HTMLSlotElement(Document& document) |
| 44 : HTMLElement(slotTag, document) | 44 : HTMLElement(slotTag, document) |
| 45 { | 45 { |
| 46 setHasCustomStyleCallbacks(); | |
| 46 } | 47 } |
| 47 | 48 |
| 48 DEFINE_NODE_FACTORY(HTMLSlotElement); | 49 DEFINE_NODE_FACTORY(HTMLSlotElement); |
| 49 | 50 |
| 50 const WillBeHeapVector<RefPtrWillBeMember<Node>> HTMLSlotElement::getAssignedNod esForBinding(const AssignedNodesOptions& options) | 51 const WillBeHeapVector<RefPtrWillBeMember<Node>> HTMLSlotElement::getAssignedNod esForBinding(const AssignedNodesOptions& options) |
| 51 { | 52 { |
| 52 updateDistribution(); | 53 updateDistribution(); |
| 53 if (options.hasFlatten() && options.flatten()) | 54 if (options.hasFlatten() && options.flatten()) |
| 54 return getDistributedNodes(); | 55 return getDistributedNodes(); |
| 55 return m_assignedNodes; | 56 return m_assignedNodes; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 | 195 |
| 195 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. | 196 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. |
| 196 clearDistribution(); | 197 clearDistribution(); |
| 197 | 198 |
| 198 if (root == insertionPoint->treeScope().rootNode()) | 199 if (root == insertionPoint->treeScope().rootNode()) |
| 199 root->didRemoveSlot(); | 200 root->didRemoveSlot(); |
| 200 | 201 |
| 201 HTMLElement::removedFrom(insertionPoint); | 202 HTMLElement::removedFrom(insertionPoint); |
| 202 } | 203 } |
| 203 | 204 |
| 205 void HTMLSlotElement::willRecalcStyle(StyleRecalcChange change) | |
| 206 { | |
| 207 if (change < Inherit && styleChangeType() < SubtreeStyleChange) | |
| 208 return; | |
| 209 | |
| 210 for (Node* node : m_distributedNodes) | |
|
kochi
2016/02/19 08:04:56
Hmm, this should have been RefPtrWillBeRawPtr<Node
| |
| 211 node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing: :create(StyleChangeReason::PropagateInheritChangeToDistributedNodes)); | |
| 212 } | |
| 213 | |
| 204 void HTMLSlotElement::updateDistributedNodesWithFallback() | 214 void HTMLSlotElement::updateDistributedNodesWithFallback() |
| 205 { | 215 { |
| 206 if (!m_distributedNodes.isEmpty()) | 216 if (!m_distributedNodes.isEmpty()) |
| 207 return; | 217 return; |
| 208 for (auto& child : NodeTraversal::childrenOf(*this)) { | 218 for (auto& child : NodeTraversal::childrenOf(*this)) { |
| 209 if (!child.isSlotAssignable()) | 219 if (!child.isSlotAssignable()) |
| 210 continue; | 220 continue; |
| 211 // Insertion points are not supported as slots fallback | 221 // Insertion points are not supported as slots fallback |
| 212 if (isActiveInsertionPoint(child)) | 222 if (isActiveInsertionPoint(child)) |
| 213 continue; | 223 continue; |
| 214 if (isHTMLSlotElement(child)) | 224 if (isHTMLSlotElement(child)) |
| 215 appendDistributedNodesFrom(toHTMLSlotElement(child)); | 225 appendDistributedNodesFrom(toHTMLSlotElement(child)); |
| 216 else | 226 else |
| 217 appendDistributedNode(child); | 227 appendDistributedNode(child); |
| 218 } | 228 } |
| 219 } | 229 } |
| 220 | 230 |
| 221 DEFINE_TRACE(HTMLSlotElement) | 231 DEFINE_TRACE(HTMLSlotElement) |
| 222 { | 232 { |
| 223 #if ENABLE(OILPAN) | 233 #if ENABLE(OILPAN) |
| 224 visitor->trace(m_assignedNodes); | 234 visitor->trace(m_assignedNodes); |
| 225 visitor->trace(m_distributedNodes); | 235 visitor->trace(m_distributedNodes); |
| 226 visitor->trace(m_distributedIndices); | 236 visitor->trace(m_distributedIndices); |
| 227 #endif | 237 #endif |
| 228 HTMLElement::trace(visitor); | 238 HTMLElement::trace(visitor); |
| 229 } | 239 } |
| 230 | 240 |
| 231 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |