Commit cc0cd844 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

RubyNG: Limit annotation space so that the line secures at least font-size pixels

Before this CL, a line provided larger annotation space, and the space
dedicated to the line could be shorter than its font-size.

Bug: 1069817
Change-Id: If9f85705a3c618854b973960d85598d02b91d7ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2240771Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777328}
parent ff4559a4
...@@ -494,6 +494,16 @@ NGLineHeightMetrics NGInlineLayoutAlgorithm::ComputeAnnotationOverflow( ...@@ -494,6 +494,16 @@ NGLineHeightMetrics NGInlineLayoutAlgorithm::ComputeAnnotationOverflow(
std::max(annotation_block_end, block_end + overflow); std::max(annotation_block_end, block_end + overflow);
} }
} }
// Probably this is an empty line. We should secure font-size space.
const LayoutUnit font_size(line_style.ComputedFontSize());
if (content_block_end - content_block_start < font_size) {
LayoutUnit half_leading = (line_box_metrics.LineHeight() - font_size) / 2;
half_leading = half_leading.ClampNegativeToZero();
content_block_start = line_block_start + half_leading;
content_block_end = line_block_end - half_leading;
}
const LayoutUnit content_or_annotation_block_start = const LayoutUnit content_or_annotation_block_start =
std::min(content_block_start, annotation_block_start); std::min(content_block_start, annotation_block_start);
const LayoutUnit content_or_annotation_block_end = const LayoutUnit content_or_annotation_block_end =
......
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