Commit 36413d49 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[FragmentItem] Prepare to remove NGLogicalLineItem::fragment_item for Ruby

This patch changes |ComputeAnnotationOverflow| to not to use
|fragment_item| to compute the block height of ruby runs.

This is needed for crrev.com/c/2216133 to remove
|NGLogicalLineItem::fragment_item|. Its replacement should
be |inline_item|, but this patch doesn't add it because all
ruby runs should have |layout_result| and shouldn't need
|inline_item|.

Bug: 982194, 1069817
Change-Id: I40a0670121499bd212ca95ba3e2680a9b0f292de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217672Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772546}
parent 7890f020
......@@ -448,32 +448,22 @@ NGLineHeightMetrics NGInlineLayoutAlgorithm::ComputeAnnotationOverflow(
line_block_start + line_box_metrics.LineHeight();
LayoutUnit annotation_block_end = line_block_end;
for (const auto& item : line_box_) {
if (!item.HasInFlowFragment())
// Accumulate |AnnotationOverflow| from ruby runs. All ruby run items have
// |layout_result|.
const NGLayoutResult* layout_result = item.layout_result.get();
if (!layout_result)
continue;
if (!item.layout_result)
continue;
const auto* fragment = item.PhysicalFragment();
const scoped_refptr<NGFragmentItem> fragment_item = item.fragment_item;
LayoutUnit block_end;
if (fragment) {
block_end = item.rect.offset.block_offset +
fragment->Size()
.ConvertToLogical(line_style.GetWritingMode())
.block_size;
} else if (fragment_item) {
block_end = item.rect.offset.block_offset +
fragment_item->Size()
.ConvertToLogical(line_style.GetWritingMode())
.block_size;
} else {
continue;
}
LayoutUnit overflow = item.layout_result->AnnotationOverflow();
const LayoutUnit overflow = layout_result->AnnotationOverflow();
if (overflow < LayoutUnit()) {
annotatin_block_start = std::min(
annotatin_block_start, item.rect.offset.block_offset + overflow);
} else if (overflow > LayoutUnit()) {
const LayoutUnit block_end =
item.rect.offset.block_offset +
layout_result->PhysicalFragment()
.Size()
.ConvertToLogical(line_style.GetWritingMode())
.block_size;
annotation_block_end =
std::max(annotation_block_end, block_end + overflow);
}
......
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