Commit 4f053eae authored by David Grogan's avatar David Grogan Committed by Commit Bot

LayoutNG: Remove content_size parameter from Resolve{Min,Max}BlockLength

All the cases that needed content_size were short-circuited when
https://chromium-review.googlesource.com/c/chromium/src/+/1599691 made
{min,max}-height: {min,max,fit}-content behave as auto.

Change-Id: Icafee2c35598d92c95703c3eb16e0d43eecde48d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2069506Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: David Grogan <dgrogan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744280}
parent 09e26995
...@@ -473,10 +473,10 @@ void ComputeFullAbsoluteWithChildBlockSize( ...@@ -473,10 +473,10 @@ void ComputeFullAbsoluteWithChildBlockSize(
LayoutUnit min_block_size = ResolveMinBlockLength( LayoutUnit min_block_size = ResolveMinBlockLength(
space, style, border_padding, style.LogicalMinHeight(), space, style, border_padding, style.LogicalMinHeight(),
child_block_size_or_indefinite, LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
LayoutUnit max_block_size = ResolveMaxBlockLength( LayoutUnit max_block_size = ResolveMaxBlockLength(
space, style, border_padding, style.LogicalMaxHeight(), space, style, border_padding, style.LogicalMaxHeight(),
child_block_size_or_indefinite, LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
bool is_start_dominant; bool is_start_dominant;
if (style.GetWritingMode() == WritingMode::kHorizontalTb) { if (style.GetWritingMode() == WritingMode::kHorizontalTb) {
......
...@@ -879,7 +879,7 @@ LayoutUnit NGColumnLayoutAlgorithm::ConstrainColumnBlockSize( ...@@ -879,7 +879,7 @@ LayoutUnit NGColumnLayoutAlgorithm::ConstrainColumnBlockSize(
const ComputedStyle& style = Style(); const ComputedStyle& style = Style();
LayoutUnit max = ResolveMaxBlockLength( LayoutUnit max = ResolveMaxBlockLength(
ConstraintSpace(), style, border_padding_, style.LogicalMaxHeight(), size, ConstraintSpace(), style, border_padding_, style.LogicalMaxHeight(),
LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
LayoutUnit extent = ResolveMainBlockLength( LayoutUnit extent = ResolveMainBlockLength(
ConstraintSpace(), style, border_padding_, style.LogicalHeight(), size, ConstraintSpace(), style, border_padding_, style.LogicalHeight(), size,
......
...@@ -453,17 +453,14 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() { ...@@ -453,17 +453,14 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() {
LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxBlockLength( min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode, flex_basis_space, child_style, border_padding_in_child_writing_mode,
max_property_in_cross_axis, IntrinsicBlockSizeFunc, max_property_in_cross_axis, LengthResolvePhase::kLayout);
LengthResolvePhase::kLayout);
min_max_sizes_in_cross_axis_direction.min_size = ResolveMinBlockLength( min_max_sizes_in_cross_axis_direction.min_size = ResolveMinBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode, flex_basis_space, child_style, border_padding_in_child_writing_mode,
min_property_in_cross_axis, IntrinsicBlockSizeFunc, min_property_in_cross_axis, LengthResolvePhase::kLayout);
LengthResolvePhase::kLayout);
} else { } else {
min_max_sizes_in_main_axis_direction.max_size = ResolveMaxBlockLength( min_max_sizes_in_main_axis_direction.max_size = ResolveMaxBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode, flex_basis_space, child_style, border_padding_in_child_writing_mode,
max_property_in_main_axis, IntrinsicBlockSizeFunc, max_property_in_main_axis, LengthResolvePhase::kLayout);
LengthResolvePhase::kLayout);
min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxInlineLength( min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxInlineLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode, flex_basis_space, child_style, border_padding_in_child_writing_mode,
MinMaxSizeFunc, max_property_in_cross_axis, MinMaxSizeFunc, max_property_in_cross_axis,
...@@ -678,7 +675,7 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() { ...@@ -678,7 +675,7 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() {
} else { } else {
min_max_sizes_in_main_axis_direction.min_size = ResolveMinBlockLength( min_max_sizes_in_main_axis_direction.min_size = ResolveMinBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode, flex_basis_space, child_style, border_padding_in_child_writing_mode,
min, IntrinsicBlockSizeFunc, LengthResolvePhase::kLayout); min, LengthResolvePhase::kLayout);
} }
min_max_sizes_in_main_axis_direction -= main_axis_border_padding; min_max_sizes_in_main_axis_direction -= main_axis_border_padding;
DCHECK_GE(min_max_sizes_in_main_axis_direction.min_size, 0); DCHECK_GE(min_max_sizes_in_main_axis_direction.min_size, 0);
......
...@@ -286,7 +286,7 @@ MinMaxSize ComputeMinAndMaxContentContribution( ...@@ -286,7 +286,7 @@ MinMaxSize ComputeMinAndMaxContentContribution(
max_length, LengthResolvePhase::kIntrinsic); max_length, LengthResolvePhase::kIntrinsic);
} else { } else {
max = ResolveMaxBlockLength(space, style, border_padding, max_length, max = ResolveMaxBlockLength(space, style, border_padding, max_length,
content_size, LengthResolvePhase::kIntrinsic); LengthResolvePhase::kIntrinsic);
} }
computed_sizes.Constrain(max); computed_sizes.Constrain(max);
...@@ -299,7 +299,7 @@ MinMaxSize ComputeMinAndMaxContentContribution( ...@@ -299,7 +299,7 @@ MinMaxSize ComputeMinAndMaxContentContribution(
min_length, LengthResolvePhase::kIntrinsic); min_length, LengthResolvePhase::kIntrinsic);
} else { } else {
min = ResolveMinBlockLength(space, style, border_padding, min_length, min = ResolveMinBlockLength(space, style, border_padding, min_length,
content_size, LengthResolvePhase::kIntrinsic); LengthResolvePhase::kIntrinsic);
} }
computed_sizes.Encompass(min); computed_sizes.Encompass(min);
...@@ -486,7 +486,7 @@ LayoutUnit ComputeBlockSizeForFragmentInternal( ...@@ -486,7 +486,7 @@ LayoutUnit ComputeBlockSizeForFragmentInternal(
nullptr) { nullptr) {
LayoutUnit min = ResolveMinBlockLength( LayoutUnit min = ResolveMinBlockLength(
constraint_space, style, border_padding, style.LogicalMinHeight(), constraint_space, style, border_padding, style.LogicalMinHeight(),
content_size, LengthResolvePhase::kLayout, LengthResolvePhase::kLayout,
opt_percentage_resolution_block_size_for_min_max); opt_percentage_resolution_block_size_for_min_max);
const Length& logical_height = style.LogicalHeight(); const Length& logical_height = style.LogicalHeight();
// Scrollable percentage-sized children of table cells, in the table // Scrollable percentage-sized children of table cells, in the table
...@@ -518,7 +518,7 @@ LayoutUnit ComputeBlockSizeForFragmentInternal( ...@@ -518,7 +518,7 @@ LayoutUnit ComputeBlockSizeForFragmentInternal(
LayoutUnit max = ResolveMaxBlockLength( LayoutUnit max = ResolveMaxBlockLength(
constraint_space, style, border_padding, style.LogicalMaxHeight(), constraint_space, style, border_padding, style.LogicalMaxHeight(),
content_size, LengthResolvePhase::kLayout, LengthResolvePhase::kLayout,
opt_percentage_resolution_block_size_for_min_max); opt_percentage_resolution_block_size_for_min_max);
return ConstrainByMinMax(extent, min, max); return ConstrainByMinMax(extent, min, max);
...@@ -565,12 +565,12 @@ void ComputeReplacedSize(const NGLayoutInputNode& node, ...@@ -565,12 +565,12 @@ void ComputeReplacedSize(const NGLayoutInputNode& node,
LayoutUnit inline_max = ResolveMaxInlineLength( LayoutUnit inline_max = ResolveMaxInlineLength(
space, style, border_padding, child_min_max_size, style.LogicalMaxWidth(), space, style, border_padding, child_min_max_size, style.LogicalMaxWidth(),
LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
LayoutUnit block_min = ResolveMinBlockLength( LayoutUnit block_min = ResolveMinBlockLength(space, style, border_padding,
space, style, border_padding, style.LogicalMinHeight(), style.LogicalMinHeight(),
border_padding.BlockSum(), LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
LayoutUnit block_max = ResolveMaxBlockLength( LayoutUnit block_max = ResolveMaxBlockLength(space, style, border_padding,
space, style, border_padding, style.LogicalMaxHeight(), LayoutUnit::Max(), style.LogicalMaxHeight(),
LengthResolvePhase::kLayout); LengthResolvePhase::kLayout);
const Length& inline_length = style.LogicalWidth(); const Length& inline_length = style.LogicalWidth();
const Length& block_length = style.LogicalHeight(); const Length& block_length = style.LogicalHeight();
......
...@@ -199,7 +199,6 @@ inline LayoutUnit ResolveMinBlockLength( ...@@ -199,7 +199,6 @@ inline LayoutUnit ResolveMinBlockLength(
const ComputedStyle& style, const ComputedStyle& style,
const NGBoxStrut& border_padding, const NGBoxStrut& border_padding,
const Length& length, const Length& length,
LayoutUnit content_size,
LengthResolvePhase phase, LengthResolvePhase phase,
const LayoutUnit* opt_percentage_resolution_block_size_for_min_max = const LayoutUnit* opt_percentage_resolution_block_size_for_min_max =
nullptr) { nullptr) {
...@@ -209,41 +208,16 @@ inline LayoutUnit ResolveMinBlockLength( ...@@ -209,41 +208,16 @@ inline LayoutUnit ResolveMinBlockLength(
return border_padding.BlockSum(); return border_padding.BlockSum();
return ResolveBlockLengthInternal( return ResolveBlockLengthInternal(
constraint_space, style, border_padding, length, content_size, phase, constraint_space, style, border_padding, length, kIndefiniteSize, phase,
opt_percentage_resolution_block_size_for_min_max); opt_percentage_resolution_block_size_for_min_max);
} }
template <typename IntrinsicBlockSizeFunc>
inline LayoutUnit ResolveMinBlockLength(
const NGConstraintSpace& constraint_space,
const ComputedStyle& style,
const NGBoxStrut& border_padding,
const Length& length,
const IntrinsicBlockSizeFunc& intrinsic_block_size_func,
LengthResolvePhase phase,
const LayoutUnit* opt_percentage_resolution_block_size_for_min_max =
nullptr) {
if (LIKELY(BlockLengthUnresolvable(
constraint_space, length, phase,
opt_percentage_resolution_block_size_for_min_max)))
return border_padding.BlockSum();
LayoutUnit intrinsic_block_size = kIndefiniteSize;
if (length.IsIntrinsicOrAuto())
intrinsic_block_size = intrinsic_block_size_func();
return ResolveBlockLengthInternal(
constraint_space, style, border_padding, length, intrinsic_block_size,
phase, opt_percentage_resolution_block_size_for_min_max);
}
// Used for resolving max block lengths, (|ComputedStyle::MaxLogicalHeight|). // Used for resolving max block lengths, (|ComputedStyle::MaxLogicalHeight|).
inline LayoutUnit ResolveMaxBlockLength( inline LayoutUnit ResolveMaxBlockLength(
const NGConstraintSpace& constraint_space, const NGConstraintSpace& constraint_space,
const ComputedStyle& style, const ComputedStyle& style,
const NGBoxStrut& border_padding, const NGBoxStrut& border_padding,
const Length& length, const Length& length,
LayoutUnit content_size,
LengthResolvePhase phase, LengthResolvePhase phase,
const LayoutUnit* opt_percentage_resolution_block_size_for_min_max = const LayoutUnit* opt_percentage_resolution_block_size_for_min_max =
nullptr) { nullptr) {
...@@ -253,34 +227,10 @@ inline LayoutUnit ResolveMaxBlockLength( ...@@ -253,34 +227,10 @@ inline LayoutUnit ResolveMaxBlockLength(
return LayoutUnit::Max(); return LayoutUnit::Max();
return ResolveBlockLengthInternal( return ResolveBlockLengthInternal(
constraint_space, style, border_padding, length, content_size, phase, constraint_space, style, border_padding, length, kIndefiniteSize, phase,
opt_percentage_resolution_block_size_for_min_max); opt_percentage_resolution_block_size_for_min_max);
} }
template <typename IntrinsicBlockSizeFunc>
inline LayoutUnit ResolveMaxBlockLength(
const NGConstraintSpace& constraint_space,
const ComputedStyle& style,
const NGBoxStrut& border_padding,
const Length& length,
const IntrinsicBlockSizeFunc& intrinsic_block_size_func,
LengthResolvePhase phase,
const LayoutUnit* opt_percentage_resolution_block_size_for_min_max =
nullptr) {
if (LIKELY(BlockLengthUnresolvable(
constraint_space, length, phase,
opt_percentage_resolution_block_size_for_min_max)))
return LayoutUnit::Max();
LayoutUnit intrinsic_block_size = kIndefiniteSize;
if (length.IsIntrinsicOrAuto())
intrinsic_block_size = intrinsic_block_size_func();
return ResolveBlockLengthInternal(
constraint_space, style, border_padding, length, intrinsic_block_size,
phase, opt_percentage_resolution_block_size_for_min_max);
}
// Used for resolving main block lengths, (|ComputedStyle::LogicalHeight|). // Used for resolving main block lengths, (|ComputedStyle::LogicalHeight|).
inline LayoutUnit ResolveMainBlockLength( inline LayoutUnit ResolveMainBlockLength(
const NGConstraintSpace& constraint_space, const NGConstraintSpace& constraint_space,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment