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

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

Issue 2416833002: Fix FlatTreeTraversal for a slot in a document tree (Closed)
Patch Set: Created 4 years, 2 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
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 2d4113e136e7c9ab5a5cdfb8ad5d75d4a3e4d083..580e3147f1487f36f1d5e94c1115651970a141ac 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -72,11 +72,8 @@ const HeapVector<Member<Node>> HTMLSlotElement::assignedNodesForBinding(
return m_assignedNodes;
}
-const HeapVector<Member<Node>>& HTMLSlotElement::getDistributedNodes() {
- DCHECK(!needsDistributionRecalc());
- if (isInShadowTree())
- return m_distributedNodes;
-
+void HTMLSlotElement::updateDistributedNodesInDocumentTree() {
+ DCHECK(isInDocumentTree());
// A slot is unlikely to be used outside of a shadow tree.
// We do not need to optimize this case in most cases.
// TODO(hayato): If this path causes a performance issue, we should move
@@ -96,6 +93,13 @@ const HeapVector<Member<Node>>& HTMLSlotElement::getDistributedNodes() {
child = NodeTraversal::nextSkippingChildren(*child, this);
}
}
+}
+
+const HeapVector<Member<Node>>& HTMLSlotElement::getDistributedNodes() {
+ DCHECK(!needsDistributionRecalc());
+ // TODO(hayato): Support a disconnected node tree.
+ if (isInDocumentTree())
+ updateDistributedNodesInDocumentTree();
return m_distributedNodes;
}

Powered by Google App Engine
This is Rietveld 408576698