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

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

Issue 2346403002: [layoutng] Create correct constraint spaces for children (Closed)
Patch Set: Created 4 years, 3 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 e8e441e9c6df3f30ba2eec8463317d67eb9afdec..e46e4ef1f2ca161c013435945f8cc9fbf9359c09 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
@@ -42,14 +42,22 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space,
LayoutUnit inline_size =
computeInlineSizeForFragment(*constraint_space, *style_);
+ LayoutUnit adjusted_inline_size =
+ (inline_size - border_and_padding_.InlineSum()).clampNegativeToZero();
mstensho (USE GERRIT) 2016/09/20 11:30:17 Shouldn't computeInlineSizeForFragment() make sure
cbiesinger 2016/09/20 13:43:37 Good point, done.
// TODO(layout-ng): For quirks mode, should we pass blockSize instead of
// -1?
LayoutUnit block_size = computeBlockSizeForFragment(
- *constraint_space, *style_, LayoutUnit(-1));
+ *constraint_space, *style_, NGSizeIndefinite);
+ LayoutUnit adjusted_block_size(block_size);
+ if (adjusted_block_size != NGSizeIndefinite) {
ikilpatrick 2016/09/20 10:47:10 is a comment here explaining what is going on wort
cbiesinger 2016/09/20 13:43:37 Done.
+ adjusted_block_size =
+ (adjusted_block_size - border_and_padding_.BlockSum())
+ .clampNegativeToZero();
+ }
constraint_space_for_children_ = new NGConstraintSpace(
- *constraint_space, NGLogicalOffset(),
- NGLogicalSize(inline_size - border_and_padding_.InlineSum(),
- block_size - border_and_padding_.BlockSum()));
+ FromPlatformWritingMode(style_->getWritingMode()),
+ FromPlatformDirection(style_->direction()), *constraint_space,
+ NGLogicalSize(adjusted_inline_size, adjusted_block_size));
content_size_ = border_and_padding_.block_start;
builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox);

Powered by Google App Engine
This is Rietveld 408576698