Commit eb1a2f56 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

IntrinsicSizing: Small clean-up to LayoutReplaced and comments.

This patch is a small clean-up to LayoutReplaced logic which is
overly complicated in light of the fact that intrinsic sizing override
can only take place under size containment.

Also removes an obsolete comment.

R=cbiesinger@chromium.org, ikilpatrick@chromium.org

Bug: 1124771
Change-Id: I22c07b01146ee11e8e7adc8c877d90b161a107f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392741
Commit-Queue: vmpstr <vmpstr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804371}
parent b7d8b543
......@@ -3967,9 +3967,6 @@ static inline const Length& HeightForDocumentElement(const Document& document) {
void LayoutBox::ComputeLogicalHeight(
LogicalExtentComputedValues& computed_values) const {
LayoutUnit height;
// TODO(962979): Implement grid layout with display locking. We need to figure
// out what happens here if IsLayoutGrid() is true and size containment is
// specified while the box is locked.
if (HasOverrideIntrinsicContentLogicalHeight()) {
height = OverrideIntrinsicContentLogicalHeight() +
BorderAndPaddingLogicalHeight() + ScrollbarLogicalHeight();
......
......@@ -163,21 +163,13 @@ void LayoutReplaced::RecalcVisualOverflow() {
void LayoutReplaced::ComputeIntrinsicSizingInfoForReplacedContent(
IntrinsicSizingInfo& intrinsic_sizing_info) const {
// In cases where both size dimensions are overridden, or we apply size
// containment we don't need to compute sizing information, since the final
// result does not depend on it.
// TODO(vmpstr): The only difference between this and calling
// ComputeIntrinsicSizingInfo below is that the latter may use an aspect ratio
// from width and height. See if the two code paths can be unified.
if ((HasOverrideIntrinsicContentLogicalWidth() &&
HasOverrideIntrinsicContentLogicalHeight()) ||
ShouldApplySizeContainment()) {
// In cases where we apply size containment we don't need to compute sizing
// information, since the final result does not depend on it.
if (ShouldApplySizeContainment()) {
// Reset the size in case it was already populated.
intrinsic_sizing_info.size = FloatSize();
// If any of the dimensions are overriden, set those sizes. Note that we
// have to check individual dimensions because we might reach here because
// of size-containment.
// If any of the dimensions are overridden, set those sizes.
if (HasOverrideIntrinsicContentLogicalWidth()) {
intrinsic_sizing_info.size.SetWidth(
OverrideIntrinsicContentLogicalWidth().ToFloat());
......@@ -189,16 +181,12 @@ void LayoutReplaced::ComputeIntrinsicSizingInfoForReplacedContent(
return;
}
ComputeIntrinsicSizingInfo(intrinsic_sizing_info);
// Size overrides only apply if there is size-containment, which is checked
// above.
DCHECK(!HasOverrideIntrinsicContentLogicalWidth());
DCHECK(!HasOverrideIntrinsicContentLogicalHeight());
// The above call to ComputeIntrinsicSizingInfo should have used the override
// if it was set.
DCHECK(!HasOverrideIntrinsicContentLogicalWidth() ||
OverrideIntrinsicContentLogicalWidth() ==
intrinsic_sizing_info.size.Width());
DCHECK(!HasOverrideIntrinsicContentLogicalHeight() ||
OverrideIntrinsicContentLogicalHeight() ==
intrinsic_sizing_info.size.Height());
ComputeIntrinsicSizingInfo(intrinsic_sizing_info);
// Update our intrinsic size to match what was computed, so that
// when we constrain the size, the correct intrinsic size will be
......
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