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

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: fix assert failures 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc » ('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 e8e441e9c6df3f30ba2eec8463317d67eb9afdec..adcdce50ef26fc89338b861d222ee6f582d3e788 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();
// 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);
+ // Our calculated block-axis size may be indefinite at this point.
+ // If so, just leave the size as NGSizeIndefinite instead of subtracting
+ // borders and padding.
+ if (adjusted_block_size != NGSizeIndefinite)
+ adjusted_block_size -= border_and_padding_.BlockSum();
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);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698