Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.cpp

Issue 2086013003: Make sure to lazyReattach a distributed node if it is already attached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSlotElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSlotElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698