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,48 +497,47 @@ void NGInlineLayoutAlgorithm::PlaceOutOfFlowObjects( ...@@ -497,48 +497,47 @@ 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;
// The static position is at the line-top. Ignore the block_offset. if (!box)
NGLogicalOffset static_offset(child.offset.inline_offset, LayoutUnit()); continue;
// If a block-level box appears in the middle of a line, move the static // The static position is at the line-top. Ignore the block_offset.
// position to where the next block will be placed. NGLogicalOffset static_offset(child.offset.inline_offset, LayoutUnit());
if (!box->StyleRef().IsOriginalDisplayInlineType()) {
LayoutUnit inline_offset = container_builder_.BfcLineOffset() - // If a block-level box appears in the middle of a line, move the static
ConstraintSpace().BfcOffset().line_offset; // position to where the next block will be placed.
if (!box->StyleRef().IsOriginalDisplayInlineType()) {
// Flip the inline_offset if we are in RTL. LayoutUnit inline_offset = container_builder_.BfcLineOffset() -
if (IsRtl(line_direction)) { ConstraintSpace().BfcOffset().line_offset;
LayoutUnit container_inline_size =
ConstraintSpace().AvailableSize().inline_size; // Flip the inline_offset if we are in RTL.
inline_offset = container_inline_size - inline_offset + inline_size; if (IsRtl(line_direction)) {
} LayoutUnit container_inline_size =
ConstraintSpace().AvailableSize().inline_size;
inline_offset += line_info.TextIndent(); inline_offset = container_inline_size - inline_offset + inline_size;
// We need to subtract the line offset, in order to ignore
// floats and text-indent.
static_offset.inline_offset = -inline_offset;
if (child.offset.inline_offset && !line_box_metrics.IsEmpty())
static_offset.block_offset = line_box_metrics.LineHeight();
} else {
// Our child offset is line-relative, but the static offset is
// flow-relative, using the direction we give to
// |AddInlineOutOfFlowChildCandidate|.
if (IsRtl(line_direction)) {
static_offset.inline_offset =
inline_size - static_offset.inline_offset;
}
} }
container_builder_.AddInlineOutOfFlowChildCandidate( inline_offset += line_info.TextIndent();
NGBlockNode(ToLayoutBox(box)), static_offset, line_direction,
child.out_of_flow_containing_box); // We need to subtract the line offset, in order to ignore floats and
// text-indent.
static_offset.inline_offset = -inline_offset;
child.out_of_flow_positioned_box = child.out_of_flow_containing_box = if (child.offset.inline_offset && !line_box_metrics.IsEmpty())
nullptr; static_offset.block_offset = line_box_metrics.LineHeight();
} else if (IsRtl(line_direction)) {
// Our child offset is line-relative, but the static offset is
// flow-relative, using the direction we give to
// |AddInlineOutOfFlowChildCandidate|.
static_offset.inline_offset = inline_size - static_offset.inline_offset;
} }
container_builder_.AddInlineOutOfFlowChildCandidate(
NGBlockNode(ToLayoutBox(box)), static_offset, line_direction,
child.out_of_flow_containing_box);
child.out_of_flow_positioned_box = 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