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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc

Issue 2519263002: [layout-ng] Convert ng_block_layout_algorithm to yield to the coordinator (Closed)
Patch Set: sync to head Created 4 years 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/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_);
}
}

Powered by Google App Engine
This is Rietveld 408576698