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

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

Issue 2842263004: Fix assignedNodes({flatten:true}) to return fallback content in document tree (Closed)
Patch Set: Remove failure expected.txt. Created 3 years, 7 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 e0edd169f36c12e64323efbbc0a80edeaf7b26ee..cf08b7963980a811f61b1929372886e52b3d4cd3 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -79,7 +79,11 @@ HTMLSlotElement::GetDistributedNodesForBinding() {
DCHECK(!NeedsDistributionRecalc());
if (SupportsDistribution())
return distributed_nodes_;
+ return GetDistributedNodesOfSlotInDocument();
+}
+const HeapVector<Member<Node>>
+HTMLSlotElement::GetDistributedNodesOfSlotInDocument() const {
// If a slot does not support distribution, its m_distributedNodes should not
// be used. Instead, calculate distribution manually here. This happens only
// in a slot in non-shadow trees, so its assigned nodes are always empty.
@@ -132,7 +136,14 @@ void HTMLSlotElement::AppendDistributedNode(Node& node) {
void HTMLSlotElement::AppendDistributedNodesFrom(const HTMLSlotElement& other) {
size_t index = distributed_nodes_.size();
- distributed_nodes_.AppendVector(other.distributed_nodes_);
+
+ if (other.SupportsDistribution()) {
hayato 2017/05/12 03:19:09 Could you avoid if else here? It looks a functiona
kochi 2017/05/12 07:26:33 I see, having inconsistent distributed_nodes_ and
kochi 2017/05/12 07:53:14 Hmm, this function is called when resolving distri
+ distributed_nodes_.AppendVector(other.distributed_nodes_);
+ } else {
+ distributed_nodes_.AppendVector(
+ other.GetDistributedNodesOfSlotInDocument());
+ }
+
for (const auto& node : other.distributed_nodes_)
distributed_indices_.Set(node.Get(), index++);
}

Powered by Google App Engine
This is Rietveld 408576698