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 9a7fda32cb16d0d61cead49b2d3a0d93e6de72c5..b9bfa78fc64b39cccf7d6a09f90f890f8c7a2619 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 |
@@ -323,18 +323,20 @@ NGBlockLayoutAlgorithm::ComputeMinAndMaxContentSizes() const { |
// TODO: handle floats & orthogonal children. |
for (NGLayoutInputNode* node = node_->FirstChild(); node; |
node = node->NextSibling()) { |
- Optional<MinAndMaxContentSizes> child_minmax; |
+ MinAndMaxContentSizes child_sizes; |
if (node->Type() == NGLayoutInputNode::kLegacyInline) { |
- // TODO(kojii): Implement when there are inline children. |
- return child_minmax; |
- } |
- NGBlockNode* block_child = toNGBlockNode(node); |
- if (NeedMinAndMaxContentSizesForContentContribution(block_child->Style())) { |
- child_minmax = block_child->ComputeMinAndMaxContentSizes(); |
- } |
+ child_sizes = toNGInlineNode(node)->ComputeMinAndMaxContentSizes(); |
+ } else { |
+ Optional<MinAndMaxContentSizes> child_minmax; |
+ NGBlockNode* block_child = toNGBlockNode(node); |
+ if (NeedMinAndMaxContentSizesForContentContribution( |
+ block_child->Style())) { |
+ child_minmax = block_child->ComputeMinAndMaxContentSizes(); |
+ } |
- MinAndMaxContentSizes child_sizes = |
- ComputeMinAndMaxContentContribution(block_child->Style(), child_minmax); |
+ child_sizes = ComputeMinAndMaxContentContribution(block_child->Style(), |
+ child_minmax); |
+ } |
sizes.min_content = std::max(sizes.min_content, child_sizes.min_content); |
cbiesinger
2017/02/23 19:07:01
This assumes you can linebreak between two inlines
kojii
2017/02/24 01:55:49
At this point, |child_sizes| contains values from
|
sizes.max_content = std::max(sizes.max_content, child_sizes.max_content); |
cbiesinger
2017/02/23 19:07:01
This is not correct for inline. For inline, you ba
kojii
2017/02/24 01:55:49
Yeah, the code in |NGInlineNode::ComputeMinAndMaxC
|
@@ -512,6 +514,9 @@ void NGBlockLayoutAlgorithm::LayoutInlineChildren(NGInlineNode* current_child) { |
// inline/block. We need to detect the case and setup appropriately; e.g., |
// constraint space, margin collapsing, next siblings, etc. |
NGLineBuilder line_builder(current_child, space_for_current_child_); |
+ // TODO(kojii): Need to determine when to invalidate PrepareLayout() more |
+ // efficiently than "everytime". |
+ current_child->InvalidatePrepareLayout(); |
current_child->LayoutInline(space_for_current_child_, &line_builder); |
// TODO(kojii): The wrapper fragment should not be needed. |
NGFragmentBuilder wrapper_fragment_builder(NGPhysicalFragment::kFragmentBox, |