Index: third_party/WebKit/Source/core/html/HTMLSlotElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp |
index 8fe40abce5dc806bdfebd6c90c9dc9eac8f74458..bc595c4f795228bd77bd902ba25d9c4df6edda74 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp |
@@ -37,18 +37,66 @@ namespace blink { |
using namespace HTMLNames; |
-PassRefPtrWillBeRawPtr<HTMLSlotElement> HTMLSlotElement::create(Document& document) |
+inline HTMLSlotElement::HTMLSlotElement(Document& document) |
+ : HTMLElement(slotTag, document) |
{ |
- return adoptRefWillBeNoop(new HTMLSlotElement(document)); |
} |
-inline HTMLSlotElement::HTMLSlotElement(Document& document) |
- : HTMLElement(slotTag, document) |
+DEFINE_NODE_FACTORY(HTMLSlotElement); |
+ |
+void HTMLSlotElement::appendAssignedNode(Node& node) |
{ |
+ m_assignedNodes.append(&node); |
} |
-HTMLSlotElement::~HTMLSlotElement() |
+void HTMLSlotElement::appendDistributedNode(Node& node) |
{ |
+ m_distributedNodes.append(&node); |
+} |
+ |
+void HTMLSlotElement::appendDistributedNodes(const Vector<RefPtr<Node>>& nodes) |
+{ |
+ m_distributedNodes.appendVector(nodes); |
+} |
+ |
+void HTMLSlotElement::clearDistribution() |
+{ |
+ m_assignedNodes.clear(); |
+ m_distributedNodes.clear(); |
+} |
+ |
+Node* HTMLSlotElement::distributedNodeNextTo(const Node& node) const |
+{ |
+ size_t index = m_distributedNodes.find(&node); |
+ if (index == kNotFound || index + 1 == m_distributedNodes.size()) |
+ return nullptr; |
+ return m_distributedNodes[index + 1].get(); |
+} |
+ |
+Node* HTMLSlotElement::distributedNodePreviousTo(const Node& node) const |
+{ |
+ size_t index = m_distributedNodes.find(&node); |
+ if (index == kNotFound || index == 0) |
+ return nullptr; |
+ return m_distributedNodes[index - 1].get(); |
+} |
+ |
+void HTMLSlotElement::attach(const AttachContext& context) |
+{ |
+ for (size_t i = 0; i < m_distributedNodes.size(); ++i) { |
tkent
2015/12/10 04:23:02
for (auto& node : m_distributedNodes) {
if (no
hayato
2015/12/10 08:11:21
Done.
|
+ if (m_distributedNodes[i]->needsAttach()) |
+ m_distributedNodes[i]->attach(context); |
+ } |
+ |
+ HTMLElement::attach(context); |
+} |
+ |
+void HTMLSlotElement::detach(const AttachContext& context) |
+{ |
+ for (size_t i = 0; i < m_distributedNodes.size(); ++i) |
tkent
2015/12/10 04:23:02
Ditto.
hayato
2015/12/10 08:11:21
Done.
|
+ m_distributedNodes[i]->lazyReattachIfAttached(); |
+ |
+ HTMLElement::detach(context); |
} |
DEFINE_TRACE(HTMLSlotElement) |