Commit 4c7f2916 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

RubyNG: Don't produce annotation overflow for normal text

ComputeAnnotationOverflow() produced annotation overflow values even
without any ruby annotation text because text fragment height can be
taller than line-height. Such annotation overflow values extended line
spacing.

This CL fixes this issue.

Bug: 1069817
Change-Id: I044cf909567b549cec38d1b97de36e6dde836dc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2251139
Commit-Queue: Kent Tamura <tkent@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779662}
parent 5b2910ce
...@@ -291,6 +291,11 @@ NGLineHeightMetrics ComputeAnnotationOverflow( ...@@ -291,6 +291,11 @@ NGLineHeightMetrics ComputeAnnotationOverflow(
if (has_under_emphasis) if (has_under_emphasis)
content_block_end = line_block_end; content_block_end = line_block_end;
// With some fonts, text fragment sizes can exceed line-height.
// We should not handle them as annotation overflow.
content_block_start = std::max(content_block_start, line_block_start);
content_block_end = std::min(content_block_end, line_block_end);
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 =
......
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
.para {
line-height: 1;
font-family: 'Osaka', 'Noto Sans CJK JP';
font-size: 40px;
padding: 0px;
}
</style>
<p id="p1" class="para">
諸行<br>
無常の<br>
<ruby>響きあり</ruby>
</p>
<p id="p2" class="para">
諸行<br>
無常の<br>
響きあり
</p>
<script>
test(() => {
const p1 = document.querySelector('#p1');
const p2 = document.querySelector('#p2');
assert_equals(p1.offsetHeight, p2.offsetHeight);
}, 'RUBY without RT should not affect line height');
</script>
</body>
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