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

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

Issue 2656693007: [LayoutNG] Return MinAndMaxContentSizes by value, step 1 (Closed)
Patch Set: Created 3 years, 11 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_node.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
index 882d9c389649e74f1ea8a2c141aa35f40e14d37d..d193674292e53ce29fd572d77845e69af93981af 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -95,29 +95,23 @@ NGPhysicalFragment* NGBlockNode::Layout(NGConstraintSpace* constraint_space) {
return fragment_;
}
-MinAndMaxContentSizes NGBlockNode::ComputeMinAndMaxContentSizesSync() {
+MinAndMaxContentSizes NGBlockNode::ComputeMinAndMaxContentSizes() {
MinAndMaxContentSizes sizes;
- while (!ComputeMinAndMaxContentSizes(&sizes))
- continue;
- return sizes;
-}
-
-bool NGBlockNode::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) {
if (!CanUseNewLayout()) {
DCHECK(layout_box_);
// TODO(layout-ng): This could be somewhat optimized by directly calling
// computeIntrinsicLogicalWidths, but that function is currently private.
// Consider doing that if this becomes a performance issue.
LayoutUnit borderAndPadding = layout_box_->borderAndPaddingLogicalWidth();
- sizes->min_content = layout_box_->computeLogicalWidthUsing(
- MainOrPreferredSize, Length(MinContent),
- LayoutUnit(), layout_box_->containingBlock()) -
- borderAndPadding;
- sizes->max_content = layout_box_->computeLogicalWidthUsing(
- MainOrPreferredSize, Length(MaxContent),
- LayoutUnit(), layout_box_->containingBlock()) -
- borderAndPadding;
- return true;
+ sizes.min_content = layout_box_->computeLogicalWidthUsing(
+ MainOrPreferredSize, Length(MinContent),
+ LayoutUnit(), layout_box_->containingBlock()) -
+ borderAndPadding;
+ sizes.max_content = layout_box_->computeLogicalWidthUsing(
+ MainOrPreferredSize, Length(MaxContent),
+ LayoutUnit(), layout_box_->containingBlock()) -
+ borderAndPadding;
+ return sizes;
}
NGConstraintSpace* constraint_space =
@@ -129,8 +123,8 @@ bool NGBlockNode::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) {
// TODO(cbiesinger): For orthogonal children, we need to always synthesize.
NGBlockLayoutAlgorithm minmax_algorithm(
layout_box_, Style(), toNGBlockNode(FirstChild()), constraint_space);
- if (minmax_algorithm.ComputeMinAndMaxContentSizes(sizes))
- return true;
+ if (minmax_algorithm.ComputeMinAndMaxContentSizes(&sizes))
+ return sizes;
// Have to synthesize this value.
NGPhysicalFragment* physical_fragment = Layout(constraint_space);
@@ -138,7 +132,7 @@ bool NGBlockNode::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) {
FromPlatformWritingMode(Style()->getWritingMode()), Style()->direction(),
toNGPhysicalBoxFragment(physical_fragment));
- sizes->min_content = fragment->InlineOverflow();
+ sizes.min_content = fragment->InlineOverflow();
// Now, redo with infinite space for max_content
constraint_space =
@@ -153,8 +147,8 @@ bool NGBlockNode::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) {
fragment = new NGBoxFragment(
FromPlatformWritingMode(Style()->getWritingMode()), Style()->direction(),
toNGPhysicalBoxFragment(physical_fragment));
- sizes->max_content = fragment->InlineOverflow();
- return true;
+ sizes.max_content = fragment->InlineOverflow();
+ return sizes;
}
ComputedStyle* NGBlockNode::MutableStyle() {

Powered by Google App Engine
This is Rietveld 408576698