Commit 11cf654c authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[css-flexbox] Remove cross_axis_intrinsic_size

Now that we correctly compute the "intrinsic" cross size (really the
unstretched cross size), we no longer need both versions of the
cross_size. The algorithm only needs the unstretched size, so
repurpose cross_axis_size for that purpose and remove the other one.

The fixes to the intrinsic cross size were made in https://crrev.com/c/1483946 and
https://crrev.com/c/1484582.

Also renames CrossAxisIntrinsicExtentForChild to
CrossAxisUnstretchedExtentForChild to more clearly reflect its purpose.

I removed the TODO in the ng flexbox implementation because the
difference between the two sizes only matters if we avoid a layout,
but we don't do that in NG yet. (The NG cross size is always pre-stretching)

Change-Id: Iec8f4b63b5d897373b8ccc0b1d9e4ee4d19cffbf
Reviewed-on: https://chromium-review.googlesource.com/c/1492832
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarDavid Grogan <dgrogan@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636271}
parent e890c6b4
......@@ -352,8 +352,8 @@ void FlexLine::ComputeLineItemsPosition(LayoutUnit main_axis_offset,
child_cross_axis_margin_box_extent = max_ascent + max_descent;
} else {
child_cross_axis_margin_box_extent = flex_item.cross_axis_intrinsic_size +
flex_item.CrossAxisMarginExtent();
child_cross_axis_margin_box_extent =
flex_item.cross_axis_size + flex_item.CrossAxisMarginExtent();
}
max_child_cross_axis_extent = std::max(max_child_cross_axis_extent,
child_cross_axis_margin_box_extent);
......
......@@ -133,8 +133,8 @@ class FlexItem {
const LayoutUnit main_axis_margin;
LayoutUnit flexed_content_size;
// When set by the caller, this should be the size pre-stretching.
LayoutUnit cross_axis_size;
LayoutUnit cross_axis_intrinsic_size;
LayoutPoint desired_location;
bool frozen;
......
......@@ -534,7 +534,7 @@ LayoutUnit LayoutFlexibleBox::ChildIntrinsicLogicalWidth(
return child.LogicalWidth();
}
LayoutUnit LayoutFlexibleBox::CrossAxisIntrinsicExtentForChild(
LayoutUnit LayoutFlexibleBox::CrossAxisUnstretchedExtentForChild(
const LayoutBox& child) const {
return MainAxisIsInlineAxis(child) ? ChildIntrinsicLogicalHeight(child)
: ChildIntrinsicLogicalWidth(child);
......@@ -1437,9 +1437,7 @@ void LayoutFlexibleBox::LayoutLineItems(FlexLine* current_line,
// to re-check the size so that we place the flex item correctly.
flex_item.flexed_content_size =
MainAxisExtentForChild(*child) - flex_item.main_axis_border_and_padding;
flex_item.cross_axis_size = CrossAxisExtentForChild(*child);
flex_item.cross_axis_intrinsic_size =
CrossAxisIntrinsicExtentForChild(*child);
flex_item.cross_axis_size = CrossAxisUnstretchedExtentForChild(*child);
}
}
......
......@@ -122,7 +122,7 @@ class CORE_EXPORT LayoutFlexibleBox : public LayoutBlock {
bool IsMultiline() const;
Length FlexBasisForChild(const LayoutBox& child) const;
LayoutUnit CrossAxisExtentForChild(const LayoutBox& child) const;
LayoutUnit CrossAxisIntrinsicExtentForChild(const LayoutBox& child) const;
LayoutUnit CrossAxisUnstretchedExtentForChild(const LayoutBox& child) const;
LayoutUnit ChildIntrinsicLogicalHeight(const LayoutBox& child) const;
LayoutUnit ChildIntrinsicLogicalWidth(const LayoutBox& child) const;
LayoutUnit MainAxisExtentForChild(const LayoutBox& child) const;
......
......@@ -252,9 +252,6 @@ scoped_refptr<const NGLayoutResult> NGFlexLayoutAlgorithm::Layout() {
is_horizontal_flow
? flex_item.layout_result->PhysicalFragment()->Size().height
: flex_item.layout_result->PhysicalFragment()->Size().width;
// TODO(dgrogan): Port logic from
// LayoutFlexibleBox::CrossAxisIntrinsicExtentForChild?
flex_item.cross_axis_intrinsic_size = flex_item.cross_axis_size;
}
// cross_axis_offset is updated in each iteration of the loop, for passing
// in to the next iteration.
......
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