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

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

Issue 2706403008: [LayoutNG] Implement ComputeMinAndMaxContentSizes for inline (Closed)
Patch Set: Cleanup and add a test Created 3 years, 10 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_inline_node.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 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,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_inline_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698