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 12eec94cb5b617d39bc22179f0aaa73672cff0c4..68aa37076fe74a3706707f3f5cf2b098ed8f92ab 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp |
| @@ -70,17 +70,14 @@ const HeapVector<Member<Node>> HTMLSlotElement::assignedNodesForBinding( |
| const AssignedNodesOptions& options) { |
| UpdateDistribution(); |
| if (options.hasFlatten() && options.flatten()) |
| - return GetDistributedNodesForBinding(); |
| + return GetDistributedNodes(); |
| return assigned_nodes_; |
| } |
| -const HeapVector<Member<Node>> |
| -HTMLSlotElement::GetDistributedNodesForBinding() { |
| - DCHECK(!NeedsDistributionRecalc()); |
|
hayato
2017/05/18 06:58:25
Don't remove DCHECK(). DCHECK() is important and s
kochi
2017/05/18 07:21:49
The only user of GetDistributedNodesForBinding() w
hayato
2017/05/19 04:05:36
Okay. Since it is now private, it can be acceptabl
|
| +const HeapVector<Member<Node>> HTMLSlotElement::GetDistributedNodes() const { |
| if (SupportsDistribution()) |
| return distributed_nodes_; |
| - |
| - // If a slot does not support distribution, its m_distributedNodes should not |
| + // If a slot does not support distribution, its distributed_nodes_ 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. |
| HeapVector<Member<Node>> distributed_nodes; |
| @@ -100,7 +97,8 @@ HTMLSlotElement::GetDistributedNodesForBinding() { |
| return distributed_nodes; |
| } |
| -const HeapVector<Member<Node>>& HTMLSlotElement::GetDistributedNodes() { |
| +const HeapVector<Member<Node>>& |
| +HTMLSlotElement::GetDistributedNodesExcludingFallback() { |
|
hayato
2017/05/18 06:58:25
GetDistributedNodesExcludingFallback doesn't sound
kochi
2017/05/18 07:21:49
Hmm, then |distributed_nodes_| is a misnomer.
I'm
hayato
2017/05/19 04:05:36
We are adding fallback content to distributed_node
kochi
2017/05/19 04:14:21
Ah, sorry. I was misunderstanding.
Let me rework.
|
| DCHECK(!NeedsDistributionRecalc()); |
| DCHECK(SupportsDistribution() || distributed_nodes_.IsEmpty()); |
| return distributed_nodes_; |
| @@ -132,8 +130,12 @@ void HTMLSlotElement::AppendDistributedNode(Node& node) { |
| void HTMLSlotElement::AppendDistributedNodesFrom(const HTMLSlotElement& other) { |
| size_t index = distributed_nodes_.size(); |
| - distributed_nodes_.AppendVector(other.distributed_nodes_); |
| - for (const auto& node : other.distributed_nodes_) |
| + |
| + const HeapVector<Member<Node>>& other_distributed_nodes = |
| + other.GetDistributedNodes(); |
| + distributed_nodes_.AppendVector(other_distributed_nodes); |
| + |
| + for (const auto& node : other_distributed_nodes) |
| distributed_indices_.Set(node.Get(), index++); |
| } |