Chromium Code Reviews| 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++); |
| } |