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

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

Issue 2267383003: [LayoutNG] Introduces NGPhysicalConstraintSpace and makes NGConstraintSpace a "view". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: .. Created 4 years, 4 months 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_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 d42e6ff49ff608c1235f5b3071c0349d8787ed60..45952059a4058b5d1026759a0578755b85f5220e 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
@@ -21,14 +21,14 @@ NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm(
: m_style(style), m_boxIterator(box_iterator) {}
NGFragment* NGBlockLayoutAlgorithm::layout(
- const NGConstraintSpace& constraint_space) {
+ const NGConstraintSpace* constraint_space) {
LayoutUnit inline_size =
- computeInlineSizeForFragment(constraint_space, *m_style);
+ computeInlineSizeForFragment(*constraint_space, *m_style);
// TODO(layout-ng): For quirks mode, should we pass blockSize instead of -1?
LayoutUnit block_size =
- computeBlockSizeForFragment(constraint_space, *m_style, LayoutUnit(-1));
- NGConstraintSpace constraint_space_for_children(
- constraint_space, NGLogicalSize(inline_size, block_size));
+ computeBlockSizeForFragment(*constraint_space, *m_style, LayoutUnit(-1));
+ NGConstraintSpace* constraint_space_for_children = new NGConstraintSpace(
+ *constraint_space, NGLogicalSize(inline_size, block_size));
NGFragmentBuilder builder(NGFragmentBase::FragmentBox);
builder.SetInlineSize(inline_size).SetBlockSize(block_size);
@@ -36,7 +36,7 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
LayoutUnit content_size;
for (NGBox box : m_boxIterator) {
NGBoxMargins child_margins =
- computeMargins(constraint_space_for_children, *box.style());
+ computeMargins(*constraint_space_for_children, *box.style());
NGFragment* fragment = box.layout(constraint_space_for_children);
// TODO(layout-ng): Support auto margins
fragment->SetOffset(child_margins.inline_start,
@@ -48,7 +48,8 @@ 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, *m_style, content_size);
+
// TODO(layout-ng): Compute correct inline overflow (block overflow should be
// correct)
builder.SetBlockSize(block_size)

Powered by Google App Engine
This is Rietveld 408576698