Index: third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc |
index 15adc8a817a2b6298cf841a5af9aee4f68fc6f68..3876200b6611f0e48b91e4b2b8121a4a1fe1a201 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc |
@@ -5,6 +5,7 @@ |
#include "core/layout/ng/ng_layout_coordinator.h" |
#include "core/layout/ng/ng_layout_input_node.h" |
+#include "core/layout/ng/ng_physical_fragment_base.h" |
namespace blink { |
@@ -15,20 +16,28 @@ NGLayoutCoordinator::NGLayoutCoordinator( |
NGLayoutInputNode::AlgorithmForInputNode(input_node, constraint_space)); |
} |
-bool NGLayoutCoordinator::Tick(NGPhysicalFragmentBase** fragment) { |
+bool NGLayoutCoordinator::Tick(NGPhysicalFragmentBase** out_fragment) { |
NGLayoutAlgorithm* child_algorithm; |
// Tick should never be called without a layout algorithm on the stack. |
DCHECK(layout_algorithms_.size()); |
- // TODO(layout-dev): store box from last tick and pass it into Layout here. |
- switch ( |
- layout_algorithms_.back()->Layout(nullptr, fragment, &child_algorithm)) { |
+ NGPhysicalFragmentBase* fragment; |
+ NGPhysicalFragmentBase* in_fragment = fragment_; |
+ fragment_ = nullptr; |
+ |
+ switch (layout_algorithms_.back()->Layout(in_fragment, &fragment, |
+ &child_algorithm)) { |
case kNotFinished: |
return false; |
case kNewFragment: |
layout_algorithms_.pop_back(); |
- return (layout_algorithms_.size() == 0); |
+ if (layout_algorithms_.size() == 0) { |
+ *out_fragment = fragment; |
+ return true; |
+ } |
+ fragment_ = fragment; |
+ return false; |
case kChildAlgorithmRequired: |
layout_algorithms_.append(child_algorithm); |
return false; |
@@ -40,5 +49,6 @@ bool NGLayoutCoordinator::Tick(NGPhysicalFragmentBase** fragment) { |
DEFINE_TRACE(NGLayoutCoordinator) { |
visitor->trace(layout_algorithms_); |
+ visitor->trace(fragment_); |
} |
} |