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

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: 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 f73475e43a4b7ef73881966f2c7e1e216ec1397f..17cd0d8968dd86561232172f5aae72f6da0442dd 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,17 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
const NGConstraintSpace& constraintSpace) {
LayoutUnit inlineSize =
computeInlineSizeForFragment(constraintSpace, *m_style);
+ LayoutUnit blockSize =
+ computeBlockSizeForFragment(constraintSpace, *m_style, LayoutUnit(-1));
ikilpatrick 2016/08/23 00:49:04 Is the -1 correct? Should it be LayoutUnit(0) inst
cbiesinger 2016/08/23 01:06:54 They don't get resolved to zero -- indefinite perc
+ 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 +42,8 @@ NGFragment* NGBlockLayoutAlgorithm::layout(
childFragments.append(fragment);
}
- LayoutUnit blockSize =
+ // Recompute the block-axis size now that we know our content size
ikilpatrick 2016/08/23 00:49:04 grammar-Nit: period and end? (I don't really care
cbiesinger 2016/08/23 01:06:54 Done.
+ blockSize =
computeBlockSizeForFragment(constraintSpace, *m_style, contentSize);
NGFragment* returnFragment =
new NGFragment(inlineSize, blockSize, inlineSize, blockSize,

Powered by Google App Engine
This is Rietveld 408576698