Commit dc7ec676 authored by Koji Ishii's avatar Koji Ishii Committed by Chromium LUCI CQ

Remove NGPaintFragment from NGInlineLayoutAlgorithm

Bug: 1154531
Change-Id: Ic596641be8dbab08a140601ab2fae9dd06dbe035
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2589716
Commit-Queue: Koji Ishii <kojii@chromium.org>
Auto-Submit: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836996}
parent e9f27176
......@@ -681,28 +681,15 @@ NGInlineLayoutStateStack::BoxData::CreateBoxFragment(
continue;
}
if (RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
// Propagate any OOF-positioned descendants from any atomic-inlines, etc.
if (child.layout_result) {
box.PropagateChildData(child.layout_result->PhysicalFragment(),
child.rect.offset - rect.offset);
}
// |NGFragmentItems| has a flat list of all descendants, except
// OOF-positioned descendants.
// We still create a |NGPhysicalBoxFragment|, but don't add children to
// it and keep them in the flat list.
continue;
}
// Propagate any OOF-positioned descendants from any atomic-inlines, etc.
if (child.layout_result) {
box.AddChild(child.layout_result->PhysicalFragment(),
child.rect.offset - rect.offset);
child.layout_result.reset();
} else if (child.text_fragment) {
box.AddChild(std::move(child.text_fragment),
child.rect.offset - rect.offset);
box.PropagateChildData(child.layout_result->PhysicalFragment(),
child.rect.offset - rect.offset);
}
// |NGFragmentItems| has a flat list of all descendants, except
// OOF-positioned descendants. We still create a |NGPhysicalBoxFragment|,
// but don't add children to it and keep them in the flat list.
}
// Inline boxes that produce DisplayItemClient should do full paint
......
......@@ -345,12 +345,6 @@ void NGInlineLayoutAlgorithm::CreateLine(
}
}
if (has_logical_text_items &&
!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
line_box->CreateTextFragments(ConstraintSpace().GetWritingMode(),
line_info->ItemsData().text_content);
}
// Negative margins can make the position negative, but the inline size is
// always positive or 0.
inline_size = inline_size.ClampNegativeToZero();
......@@ -395,14 +389,6 @@ void NGInlineLayoutAlgorithm::CreateLine(
// Apply any relative positioned offsets to any boxes (and their children).
box_states_->ApplyRelativePositioning(ConstraintSpace(), line_box);
NGAnnotationMetrics annotation_metrics;
if (Node().HasRuby() &&
!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
annotation_metrics = ComputeAnnotationOverflow(*line_box, line_box_metrics,
-line_box_metrics.ascent,
line_info->LineStyle());
}
// Create box fragments if needed. After this point forward, |line_box| is a
// tree structure.
// The individual children don't move position within the |line_box|, rather
......@@ -431,44 +417,51 @@ void NGInlineLayoutAlgorithm::CreateLine(
// the line box to the line top.
line_box->MoveInBlockDirection(line_box_metrics.ascent);
if (Node().HasRuby() &&
RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
annotation_metrics = ComputeAnnotationOverflow(
LayoutUnit block_offset = line_info->BfcOffset().block_offset;
if (Node().HasRuby()) {
NGAnnotationMetrics annotation_metrics = ComputeAnnotationOverflow(
*line_box, line_box_metrics, LayoutUnit(), line_info->LineStyle());
}
LayoutUnit annotation_overflow_block_start;
LayoutUnit annotation_overflow_block_end;
LayoutUnit annotation_space_block_start;
LayoutUnit annotation_space_block_end;
if (!IsFlippedLinesWritingMode(line_info->LineStyle().GetWritingMode())) {
annotation_overflow_block_start = annotation_metrics.overflow_over;
annotation_overflow_block_end = annotation_metrics.overflow_under;
annotation_space_block_start = annotation_metrics.space_over;
annotation_space_block_end = annotation_metrics.space_under;
} else {
annotation_overflow_block_start = annotation_metrics.overflow_under;
annotation_overflow_block_end = annotation_metrics.overflow_over;
annotation_space_block_start = annotation_metrics.space_under;
annotation_space_block_end = annotation_metrics.space_over;
}
LayoutUnit annotation_overflow_block_start;
LayoutUnit annotation_overflow_block_end;
LayoutUnit annotation_space_block_start;
LayoutUnit annotation_space_block_end;
if (!IsFlippedLinesWritingMode(line_info->LineStyle().GetWritingMode())) {
annotation_overflow_block_start = annotation_metrics.overflow_over;
annotation_overflow_block_end = annotation_metrics.overflow_under;
annotation_space_block_start = annotation_metrics.space_over;
annotation_space_block_end = annotation_metrics.space_under;
} else {
annotation_overflow_block_start = annotation_metrics.overflow_under;
annotation_overflow_block_end = annotation_metrics.overflow_over;
annotation_space_block_start = annotation_metrics.space_under;
annotation_space_block_end = annotation_metrics.space_over;
}
LayoutUnit block_offset_shift = annotation_overflow_block_start;
// If the previous line has block-end annotation overflow and this line has
// block-start annotation space, shift up the block offset of this line.
if (ConstraintSpace().BlockStartAnnotationSpace() < LayoutUnit() &&
annotation_space_block_start) {
const LayoutUnit overflow = -ConstraintSpace().BlockStartAnnotationSpace();
block_offset_shift = -std::min(annotation_space_block_start, overflow);
}
LayoutUnit block_offset_shift = annotation_overflow_block_start;
// If the previous line has block-end annotation overflow and this line has
// block-start annotation space, shift up the block offset of this line.
if (ConstraintSpace().BlockStartAnnotationSpace() < LayoutUnit() &&
annotation_space_block_start) {
const LayoutUnit overflow =
-ConstraintSpace().BlockStartAnnotationSpace();
block_offset_shift = -std::min(annotation_space_block_start, overflow);
}
// If this line has block-start annotation overflow and the previous line has
// block-end annotation space, borrow the block-end space of the previous line
// and shift down the block offset by |overflow - space|.
if (annotation_overflow_block_start &&
ConstraintSpace().BlockStartAnnotationSpace() > LayoutUnit()) {
block_offset_shift = (annotation_overflow_block_start -
ConstraintSpace().BlockStartAnnotationSpace())
.ClampNegativeToZero();
// If this line has block-start annotation overflow and the previous line
// has block-end annotation space, borrow the block-end space of the
// previous line and shift down the block offset by |overflow - space|.
if (annotation_overflow_block_start &&
ConstraintSpace().BlockStartAnnotationSpace() > LayoutUnit()) {
block_offset_shift = (annotation_overflow_block_start -
ConstraintSpace().BlockStartAnnotationSpace())
.ClampNegativeToZero();
}
block_offset += block_offset_shift;
if (annotation_overflow_block_end)
container_builder_.SetAnnotationOverflow(annotation_overflow_block_end);
else if (annotation_space_block_end)
container_builder_.SetBlockEndAnnotationSpace(annotation_space_block_end);
}
if (line_info->UseFirstLineStyle())
......@@ -476,12 +469,7 @@ void NGInlineLayoutAlgorithm::CreateLine(
container_builder_.SetBaseDirection(line_info->BaseDirection());
container_builder_.SetInlineSize(inline_size);
container_builder_.SetMetrics(line_box_metrics);
container_builder_.SetBfcBlockOffset(line_info->BfcOffset().block_offset +
block_offset_shift);
if (annotation_overflow_block_end)
container_builder_.SetAnnotationOverflow(annotation_overflow_block_end);
else if (annotation_space_block_end)
container_builder_.SetBlockEndAnnotationSpace(annotation_space_block_end);
container_builder_.SetBfcBlockOffset(block_offset);
}
void NGInlineLayoutAlgorithm::PlaceControlItem(const NGInlineItem& item,
......@@ -1140,20 +1128,13 @@ scoped_refptr<const NGLayoutResult> NGInlineLayoutAlgorithm::Layout() {
CHECK(is_line_created);
container_builder_.SetExclusionSpace(std::move(exclusion_space));
if (items_builder) {
DCHECK(RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled());
container_builder_.PropagateChildrenData(*line_box);
scoped_refptr<const NGLayoutResult> layout_result =
container_builder_.ToLineBoxFragment();
items_builder->AssociateLogicalLineItems(line_box,
layout_result->PhysicalFragment());
return layout_result;
}
DCHECK(!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled());
container_builder_.AddChildren(*line_box);
container_builder_.MoveOutOfFlowDescendantCandidatesToDescendants();
return container_builder_.ToLineBoxFragment();
DCHECK(items_builder);
container_builder_.PropagateChildrenData(*line_box);
scoped_refptr<const NGLayoutResult> layout_result =
container_builder_.ToLineBoxFragment();
items_builder->AssociateLogicalLineItems(line_box,
layout_result->PhysicalFragment());
return layout_result;
}
// This positions any "leading" floats within the given exclusion space.
......
......@@ -58,10 +58,8 @@ TEST_F(NGInlineLayoutAlgorithmTest, BreakToken) {
block_flow->Style()->GetWritingDirection());
NGFragmentItemsBuilder items_builder(inline_node,
container_builder.GetWritingDirection());
if (RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
container_builder.SetItemsBuilder(&items_builder);
context.SetItemsBuilder(&items_builder);
}
container_builder.SetItemsBuilder(&items_builder);
context.SetItemsBuilder(&items_builder);
scoped_refptr<const NGLayoutResult> layout_result =
inline_node.Layout(constraint_space, nullptr, &context);
const auto& line1 = layout_result->PhysicalFragment();
......
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