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

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

Issue 2237623002: Demo patch that demonstrates simple block layout using Layout NG (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed NGBlockLayoutAlgorithmTest 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 56d0fad1e665d019a98e43b8fa0610599e88193c..cbcefad9e042cc2bdc0332c572a84651d18ec117 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
@@ -15,8 +15,8 @@ namespace blink {
NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm(
PassRefPtr<const ComputedStyle> style,
- NGBox firstChild)
- : m_style(style), m_firstChild(firstChild) {}
+ NGBoxIterator boxIterator)
+ : m_style(style), m_boxIterator(boxIterator) {}
NGFragment* NGBlockLayoutAlgorithm::layout(
const NGConstraintSpace& constraintSpace) {
@@ -24,10 +24,9 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
computeInlineSizeForFragment(constraintSpace, *m_style);
HeapVector<Member<const NGFragmentBase>> childFragments;
-
LayoutUnit contentSize;
- for (NGBox curr = m_firstChild; curr; curr.nextSibling()) {
- NGFragment* fragment = curr.layout(constraintSpace);
+ for (NGBox box : m_boxIterator) {
+ NGFragment* fragment = box.layout(constraintSpace);
// TODO(layout-ng): Take margins into account
fragment->setOffset(LayoutUnit(), contentSize);
contentSize += fragment->blockSize();

Powered by Google App Engine
This is Rietveld 408576698