Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
index 5e3fbe4ea3f4c0ceeab9f5c6990403c3fa625b02..05f612fe4ddd7d63d691f5fa132388e7ee929180 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
@@ -17,15 +17,15 @@ namespace blink { |
NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm( |
PassRefPtr<const ComputedStyle> style, |
NGBoxIterator box_iterator) |
- : m_style(style), m_boxIterator(box_iterator) {} |
+ : style_(style), box_iterator_(box_iterator) {} |
-NGFragment* NGBlockLayoutAlgorithm::layout( |
- const NGConstraintSpace* constraint_space) { |
+bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space, |
+ NGFragment** out) { |
LayoutUnit inline_size = |
- computeInlineSizeForFragment(*constraint_space, *m_style); |
+ computeInlineSizeForFragment(*constraint_space, *style_); |
// TODO(layout-ng): For quirks mode, should we pass blockSize instead of -1? |
LayoutUnit block_size = |
- computeBlockSizeForFragment(*constraint_space, *m_style, LayoutUnit(-1)); |
+ computeBlockSizeForFragment(*constraint_space, *style_, LayoutUnit(-1)); |
NGConstraintSpace* constraint_space_for_children = new NGConstraintSpace( |
*constraint_space, NGLogicalSize(inline_size, block_size)); |
@@ -33,10 +33,13 @@ NGFragment* NGBlockLayoutAlgorithm::layout( |
builder.SetInlineSize(inline_size).SetBlockSize(block_size); |
LayoutUnit content_size; |
- for (NGBox box : m_boxIterator) { |
+ for (NGBox box : box_iterator_) { |
NGBoxStrut child_margins = |
computeMargins(*constraint_space_for_children, *box.style()); |
- NGFragment* fragment = box.layout(constraint_space_for_children); |
+ NGFragment* fragment; |
+ // TODO(layout-ng): Actually make this async |
+ while (!box.Layout(constraint_space_for_children, &fragment)) |
+ ; |
// TODO(layout-ng): Support auto margins |
fragment->SetOffset(child_margins.inline_start, |
content_size + child_margins.block_start); |
@@ -47,14 +50,15 @@ NGFragment* NGBlockLayoutAlgorithm::layout( |
// Recompute the block-axis size now that we know our content size. |
block_size = |
- computeBlockSizeForFragment(*constraint_space, *m_style, content_size); |
+ computeBlockSizeForFragment(*constraint_space, *style_, content_size); |
// TODO(layout-ng): Compute correct inline overflow (block overflow should be |
// correct) |
builder.SetBlockSize(block_size) |
.SetInlineOverflow(inline_size) |
.SetBlockOverflow(content_size); |
- return builder.ToFragment(); |
+ *out = builder.ToFragment(); |
+ return true; |
} |
} // namespace blink |