Commit e85d5812 authored by David Grogan's avatar David Grogan Committed by Commit Bot

[LayoutNG] Fix coordinates for items in column flexboxes

They need to be transposed from what the underlying flex algorithm
generates.

Bug: 845235
Change-Id: Ib967035798a148bce0e853656598bba366d45b70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1749668
Commit-Queue: David Grogan <dgrogan@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686239}
parent cb14e9a6
......@@ -138,6 +138,7 @@ class FlexItem {
// When set by the caller, this should be the size pre-stretching.
LayoutUnit cross_axis_size;
// The algorithm stores the main axis offset in X and cross axis offset in Y.
LayoutPoint desired_location;
bool frozen;
......
......@@ -495,13 +495,15 @@ void NGFlexLayoutAlgorithm::GiveLinesAndItemsFinalPositionAndSize() {
// TODO(dgrogan): Add an extra pass for kColumnReverse containers like
// legacy does in LayoutColumnReverse.
// AddChild treats location parameter as logical offset from parent rect.
// TODO(dgrogan): Does this need to transpose the location for
// non-horizontal flexboxes, like
// LayoutFlexibleBox::SetFlowAwareLocationForChild does?
container_builder_.AddChild(
flex_item.layout_result->PhysicalFragment(),
{flex_item.desired_location.X(), flex_item.desired_location.Y()});
// flex_item.desired_location stores the main axis offset in X and the
// cross axis offset in Y. But AddChild wants offset from parent
// rectangle, so we have to transpose for columns. AddChild takes care of
// any writing mode differences though.
LayoutPoint location = is_column_
? flex_item.desired_location.TransposedPoint()
: flex_item.desired_location;
container_builder_.AddChild(flex_item.layout_result->PhysicalFragment(),
{location.X(), location.Y()});
}
}
}
......
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