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

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

Issue 2231153003: [layoutng] Make the layout algorithm actually compute and store positions and sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stuff
Patch Set: Add children to fragment 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_fragment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 894b00c4a227a8802d92a137f327495286c620c4..d21d3927d98c5334f4b181dc4381a835d60bcfdf 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
@@ -23,13 +23,23 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
LayoutUnit inlineSize =
computeInlineSizeForFragment(constraintSpace, *m_style);
+ HeapVector<Member<const NGFragmentBase>> childFragments;
+
+ LayoutUnit contentSize;
for (NGBox curr = m_firstChild; curr; curr.nextSibling()) {
- curr.layout(constraintSpace);
+ NGFragment* fragment = curr.layout(constraintSpace);
+ // TODO(layout-ng): Take margins into account
+ fragment->setOffset(LayoutUnit(), contentSize);
+ contentSize += fragment->blockSize();
+ childFragments.append(fragment);
}
LayoutUnit blockSize =
- computeBlockSizeForFragment(constraintSpace, *m_style, LayoutUnit());
- return new NGFragment(inlineSize, blockSize, inlineSize, blockSize);
+ computeBlockSizeForFragment(constraintSpace, *m_style, contentSize);
+ NGFragment* returnFragment =
+ new NGFragment(inlineSize, blockSize, inlineSize, blockSize);
+ returnFragment->swapChildren(childFragments);
+ return returnFragment;
}
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_fragment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698