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

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

Issue 2266313002: [layoutng] Create a more correct constraint space for children (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments 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_constraint_space.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 f73475e43a4b7ef73881966f2c7e1e216ec1397f..178dd138478ca0dd7f576c76c9319eded546f6bf 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,12 +23,18 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
const NGConstraintSpace& constraintSpace) {
LayoutUnit inlineSize =
computeInlineSizeForFragment(constraintSpace, *m_style);
+ // TODO(layout-ng): For quirks mode, should we pass blockSize instead of -1?
eae 2016/08/23 16:54:09 Might make sense to have a NGQuirksModeBlockLayout
+ LayoutUnit blockSize =
+ computeBlockSizeForFragment(constraintSpace, *m_style, LayoutUnit(-1));
+ NGConstraintSpace constraint_space_for_children(
+ constraintSpace, NGLogicalSize(inlineSize, blockSize));
HeapVector<Member<const NGFragmentBase>> childFragments;
LayoutUnit contentSize;
for (NGBox box : m_boxIterator) {
- NGBoxMargins childMargins = computeMargins(constraintSpace, *box.style());
- NGFragment* fragment = box.layout(constraintSpace);
+ NGBoxMargins childMargins =
+ computeMargins(constraint_space_for_children, *box.style());
+ NGFragment* fragment = box.layout(constraint_space_for_children);
// TODO(layout-ng): Support auto margins
fragment->setOffset(childMargins.inlineStart,
contentSize + childMargins.blockStart);
@@ -37,7 +43,8 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
childFragments.append(fragment);
}
- LayoutUnit blockSize =
+ // Recompute the block-axis size now that we know our content size.
+ blockSize =
computeBlockSizeForFragment(constraintSpace, *m_style, contentSize);
NGFragment* returnFragment =
new NGFragment(inlineSize, blockSize, inlineSize, blockSize,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698