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(
LayoutUnit min_block_size = ResolveMinBlockLength(
space, style, border_padding, style.LogicalMinHeight(),
child_block_size_or_indefinite, LengthResolvePhase::kLayout);
LengthResolvePhase::kLayout);
LayoutUnit max_block_size = ResolveMaxBlockLength(
space, style, border_padding, style.LogicalMaxHeight(),
child_block_size_or_indefinite, LengthResolvePhase::kLayout);
LengthResolvePhase::kLayout);
bool is_start_dominant;
if (style.GetWritingMode() == WritingMode::kHorizontalTb) {
......
......@@ -879,7 +879,7 @@ LayoutUnit NGColumnLayoutAlgorithm::ConstrainColumnBlockSize(
const ComputedStyle& style = Style();
LayoutUnit max = ResolveMaxBlockLength(
ConstraintSpace(), style, border_padding_, style.LogicalMaxHeight(), size,
ConstraintSpace(), style, border_padding_, style.LogicalMaxHeight(),
LengthResolvePhase::kLayout);
LayoutUnit extent = ResolveMainBlockLength(
ConstraintSpace(), style, border_padding_, style.LogicalHeight(), size,
......
......@@ -453,17 +453,14 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() {
LengthResolvePhase::kLayout);
min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode,
max_property_in_cross_axis, IntrinsicBlockSizeFunc,
LengthResolvePhase::kLayout);
max_property_in_cross_axis, LengthResolvePhase::kLayout);
min_max_sizes_in_cross_axis_direction.min_size = ResolveMinBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode,
min_property_in_cross_axis, IntrinsicBlockSizeFunc,
LengthResolvePhase::kLayout);
min_property_in_cross_axis, LengthResolvePhase::kLayout);
} else {
min_max_sizes_in_main_axis_direction.max_size = ResolveMaxBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode,
max_property_in_main_axis, IntrinsicBlockSizeFunc,
LengthResolvePhase::kLayout);
max_property_in_main_axis, LengthResolvePhase::kLayout);
min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxInlineLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode,
MinMaxSizeFunc, max_property_in_cross_axis,
......@@ -678,7 +675,7 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems() {
} else {
min_max_sizes_in_main_axis_direction.min_size = ResolveMinBlockLength(
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;
DCHECK_GE(min_max_sizes_in_main_axis_direction.min_size, 0);
......
......@@ -286,7 +286,7 @@ MinMaxSize ComputeMinAndMaxContentContribution(
max_length, LengthResolvePhase::kIntrinsic);
} else {
max = ResolveMaxBlockLength(space, style, border_padding, max_length,
content_size, LengthResolvePhase::kIntrinsic);
LengthResolvePhase::kIntrinsic);
}
computed_sizes.Constrain(max);
......@@ -299,7 +299,7 @@ MinMaxSize ComputeMinAndMaxContentContribution(
min_length, LengthResolvePhase::kIntrinsic);
} else {
min = ResolveMinBlockLength(space, style, border_padding, min_length,
content_size, LengthResolvePhase::kIntrinsic);
LengthResolvePhase::kIntrinsic);
}
computed_sizes.Encompass(min);
......@@ -486,7 +486,7 @@ LayoutUnit ComputeBlockSizeForFragmentInternal(
nullptr) {
LayoutUnit min = ResolveMinBlockLength(
constraint_space, style, border_padding, style.LogicalMinHeight(),
content_size, LengthResolvePhase::kLayout,
LengthResolvePhase::kLayout,
opt_percentage_resolution_block_size_for_min_max);
const Length& logical_height = style.LogicalHeight();
// Scrollable percentage-sized children of table cells, in the table
......@@ -518,7 +518,7 @@ LayoutUnit ComputeBlockSizeForFragmentInternal(
LayoutUnit max = ResolveMaxBlockLength(
constraint_space, style, border_padding, style.LogicalMaxHeight(),
content_size, LengthResolvePhase::kLayout,
LengthResolvePhase::kLayout,
opt_percentage_resolution_block_size_for_min_max);
return ConstrainByMinMax(extent, min, max);
......@@ -565,12 +565,12 @@ void ComputeReplacedSize(const NGLayoutInputNode& node,
LayoutUnit inline_max = ResolveMaxInlineLength(
space, style, border_padding, child_min_max_size, style.LogicalMaxWidth(),
LengthResolvePhase::kLayout);
LayoutUnit block_min = ResolveMinBlockLength(
space, style, border_padding, style.LogicalMinHeight(),
border_padding.BlockSum(), LengthResolvePhase::kLayout);
LayoutUnit block_max = ResolveMaxBlockLength(
space, style, border_padding, style.LogicalMaxHeight(), LayoutUnit::Max(),
LengthResolvePhase::kLayout);
LayoutUnit block_min = ResolveMinBlockLength(space, style, border_padding,
style.LogicalMinHeight(),
LengthResolvePhase::kLayout);
LayoutUnit block_max = ResolveMaxBlockLength(space, style, border_padding,
style.LogicalMaxHeight(),
LengthResolvePhase::kLayout);
const Length& inline_length = style.LogicalWidth();
const Length& block_length = style.LogicalHeight();
......
......@@ -199,7 +199,6 @@ inline LayoutUnit ResolveMinBlockLength(
const ComputedStyle& style,
const NGBoxStrut& border_padding,
const Length& length,
LayoutUnit content_size,
LengthResolvePhase phase,
const LayoutUnit* opt_percentage_resolution_block_size_for_min_max =
nullptr) {
......@@ -209,41 +208,16 @@ inline LayoutUnit ResolveMinBlockLength(
return border_padding.BlockSum();
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);
}
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|).
inline LayoutUnit ResolveMaxBlockLength(
const NGConstraintSpace& constraint_space,
const ComputedStyle& style,
const NGBoxStrut& border_padding,
const Length& length,
LayoutUnit content_size,
LengthResolvePhase phase,
const LayoutUnit* opt_percentage_resolution_block_size_for_min_max =
nullptr) {
......@@ -253,34 +227,10 @@ inline LayoutUnit ResolveMaxBlockLength(
return LayoutUnit::Max();
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);
}
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|).
inline LayoutUnit ResolveMainBlockLength(
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