Commit 2b1ac2c7 authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

Rename is_replaced_with_only_aspect_ratio

This will be used to implement the CSS aspect-ratio property, so the name
will no longer be ideal. Instead, name it
has_aspect_ratio_without_intrinsic_size.

R=atotic@chromium.org

Bug: 1098475
Change-Id: I829b8460c7dae8e519c4adfdebe4fc163df5fd02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2261230
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781992}
parent 1321a707
...@@ -735,19 +735,19 @@ scoped_refptr<const NGLayoutResult> NGOutOfFlowLayoutPart::Layout( ...@@ -735,19 +735,19 @@ scoped_refptr<const NGLayoutResult> NGOutOfFlowLayoutPart::Layout(
base::Optional<LogicalSize> replaced_size; base::Optional<LogicalSize> replaced_size;
base::Optional<LogicalSize> replaced_aspect_ratio; base::Optional<LogicalSize> replaced_aspect_ratio;
bool is_replaced_with_only_aspect_ratio = false; bool has_aspect_ratio_without_intrinsic_size = false;
if (is_replaced) { if (is_replaced) {
ComputeReplacedSize(node, candidate_constraint_space, min_max_sizes, ComputeReplacedSize(node, candidate_constraint_space, min_max_sizes,
&replaced_size, &replaced_aspect_ratio); &replaced_size, &replaced_aspect_ratio);
is_replaced_with_only_aspect_ratio = !replaced_size && has_aspect_ratio_without_intrinsic_size = !replaced_size &&
replaced_aspect_ratio && replaced_aspect_ratio &&
!replaced_aspect_ratio->IsEmpty(); !replaced_aspect_ratio->IsEmpty();
// If we only have aspect ratio, and no replaced size, intrinsic size // If we only have aspect ratio, and no replaced size, intrinsic size
// defaults to 300x150. min_max_sizes gets computed from the intrinsic size. // defaults to 300x150. min_max_sizes gets computed from the intrinsic size.
// We reset the min_max_sizes because spec says that OOF-positioned size // We reset the min_max_sizes because spec says that OOF-positioned size
// should not be constrained by intrinsic size in this case. // should not be constrained by intrinsic size in this case.
// https://www.w3.org/TR/CSS22/visudet.html#inline-replaced-width // https://www.w3.org/TR/CSS22/visudet.html#inline-replaced-width
if (is_replaced_with_only_aspect_ratio) if (has_aspect_ratio_without_intrinsic_size)
min_max_sizes = MinMaxSizes{LayoutUnit(), LayoutUnit::NearlyMax()}; min_max_sizes = MinMaxSizes{LayoutUnit(), LayoutUnit::NearlyMax()};
} else if (should_be_considered_as_replaced) { } else if (should_be_considered_as_replaced) {
replaced_size = replaced_size =
...@@ -766,10 +766,10 @@ scoped_refptr<const NGLayoutResult> NGOutOfFlowLayoutPart::Layout( ...@@ -766,10 +766,10 @@ scoped_refptr<const NGLayoutResult> NGOutOfFlowLayoutPart::Layout(
if (!is_replaced && should_be_considered_as_replaced) if (!is_replaced && should_be_considered_as_replaced)
replaced_size.reset(); replaced_size.reset();
// Replaced elements with only aspect ratio compute their block size from // Elements with only aspect ratio compute their block size from
// inline size and aspect ratio. // inline size and aspect ratio.
// https://www.w3.org/TR/css-sizing-3/#intrinsic-sizes // https://www.w3.org/TR/css-sizing-3/#intrinsic-sizes
if (is_replaced_with_only_aspect_ratio) { if (has_aspect_ratio_without_intrinsic_size) {
replaced_size = LogicalSize( replaced_size = LogicalSize(
node_dimensions.size.inline_size, node_dimensions.size.inline_size,
(replaced_aspect_ratio->block_size * (replaced_aspect_ratio->block_size *
......
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