| 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 2af5bde13f26900e0d8b403d1a61251b83c4332c..002d534b85d7fa6c33a3046d7f51abbcc1adc9de 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
|
| @@ -139,11 +139,18 @@ void HTMLSlotElement::appendDistributedNodesFrom(const HTMLSlotElement& other)
|
|
|
| void HTMLSlotElement::clearDistribution()
|
| {
|
| + // TODO(hayato): Figure out when to call lazyReattachDistributedNodesIfNeeded()
|
| m_assignedNodes.clear();
|
| m_distributedNodes.clear();
|
| m_distributedIndices.clear();
|
| }
|
|
|
| +void HTMLSlotElement::saveAndClearDistribution()
|
| +{
|
| + m_oldDistributedNodes.swap(m_distributedNodes);
|
| + clearDistribution();
|
| +}
|
| +
|
| void HTMLSlotElement::dispatchSlotChangeEvent()
|
| {
|
| m_slotchangeEventEnqueued = false;
|
| @@ -291,6 +298,18 @@ void HTMLSlotElement::updateDistributedNodesWithFallback()
|
| }
|
| }
|
|
|
| +void HTMLSlotElement::lazyReattachDistributedNodesIfNeeded()
|
| +{
|
| + // TODO(hayato): Figure out an exact condition where reattach is required
|
| + if (m_oldDistributedNodes != m_distributedNodes) {
|
| + for (auto& node : m_oldDistributedNodes)
|
| + node->lazyReattachIfAttached();
|
| + for (auto& node : m_distributedNodes)
|
| + node->lazyReattachIfAttached();
|
| + }
|
| + m_oldDistributedNodes.clear();
|
| +}
|
| +
|
| void HTMLSlotElement::enqueueSlotChangeEvent()
|
| {
|
| if (!m_slotchangeEventEnqueued) {
|
| @@ -338,6 +357,7 @@ DEFINE_TRACE(HTMLSlotElement)
|
| {
|
| visitor->trace(m_assignedNodes);
|
| visitor->trace(m_distributedNodes);
|
| + visitor->trace(m_oldDistributedNodes);
|
| visitor->trace(m_distributedIndices);
|
| HTMLElement::trace(visitor);
|
| }
|
|
|