Commit 85a5c945 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Cleanup: de-nest PlaceOutOfFLowObjects.

There should be no behaviour change.

Change-Id: I32389eb3b05a6935e320fa3d871d27c3eead2c73
Reviewed-on: https://chromium-review.googlesource.com/c/1353948Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611839}
parent eacb6ed3
...@@ -497,7 +497,10 @@ void NGInlineLayoutAlgorithm::PlaceOutOfFlowObjects( ...@@ -497,7 +497,10 @@ void NGInlineLayoutAlgorithm::PlaceOutOfFlowObjects(
TextDirection line_direction = line_info.BaseDirection(); TextDirection line_direction = line_info.BaseDirection();
for (NGLineBoxFragmentBuilder::Child& child : line_box_) { for (NGLineBoxFragmentBuilder::Child& child : line_box_) {
if (LayoutObject* box = child.out_of_flow_positioned_box) { LayoutObject* box = child.out_of_flow_positioned_box;
if (!box)
continue;
// The static position is at the line-top. Ignore the block_offset. // The static position is at the line-top. Ignore the block_offset.
NGLogicalOffset static_offset(child.offset.inline_offset, LayoutUnit()); NGLogicalOffset static_offset(child.offset.inline_offset, LayoutUnit());
...@@ -516,29 +519,25 @@ void NGInlineLayoutAlgorithm::PlaceOutOfFlowObjects( ...@@ -516,29 +519,25 @@ void NGInlineLayoutAlgorithm::PlaceOutOfFlowObjects(
inline_offset += line_info.TextIndent(); inline_offset += line_info.TextIndent();
// We need to subtract the line offset, in order to ignore // We need to subtract the line offset, in order to ignore floats and
// floats and text-indent. // text-indent.
static_offset.inline_offset = -inline_offset; static_offset.inline_offset = -inline_offset;
if (child.offset.inline_offset && !line_box_metrics.IsEmpty()) if (child.offset.inline_offset && !line_box_metrics.IsEmpty())
static_offset.block_offset = line_box_metrics.LineHeight(); static_offset.block_offset = line_box_metrics.LineHeight();
} else { } else if (IsRtl(line_direction)) {
// Our child offset is line-relative, but the static offset is // Our child offset is line-relative, but the static offset is
// flow-relative, using the direction we give to // flow-relative, using the direction we give to
// |AddInlineOutOfFlowChildCandidate|. // |AddInlineOutOfFlowChildCandidate|.
if (IsRtl(line_direction)) { static_offset.inline_offset = inline_size - static_offset.inline_offset;
static_offset.inline_offset =
inline_size - static_offset.inline_offset;
}
} }
container_builder_.AddInlineOutOfFlowChildCandidate( container_builder_.AddInlineOutOfFlowChildCandidate(
NGBlockNode(ToLayoutBox(box)), static_offset, line_direction, NGBlockNode(ToLayoutBox(box)), static_offset, line_direction,
child.out_of_flow_containing_box); child.out_of_flow_containing_box);
child.out_of_flow_positioned_box = child.out_of_flow_containing_box = child.out_of_flow_positioned_box = nullptr;
nullptr; child.out_of_flow_containing_box = nullptr;
}
} }
} }
......
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