Commit d7659161 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Fix first-line text-transform workaround when start is not zero

r526281 added a workaround for when text-transform shorten
the string, but did so only for when inline_text_box_.Start()
is zero.

This patch extends the workaround for when inline_text_box_.
Start() is not zero.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ib4536ae5aaf92352e41ef19e53c2046a4c86806c
Bug: 880176, 795498
Reviewed-on: https://chromium-review.googlesource.com/1218202
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590194}
parent e1ea9ee4
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/testharnessreport.js"></script>
<!-- The capitalized form of the text below has only one character, whereas <!-- The capitalized form of the text below has only one character, whereas
the lowercase has two. --> the lowercase has two. -->
<div lang=el>ά</div> <div lang=el> ά</div>
<div id=target></div> <div id=target></div>
<script> <script>
test(function() { test(function() {
......
...@@ -194,13 +194,15 @@ void InlineTextBoxPainter::Paint(const PaintInfo& paint_info, ...@@ -194,13 +194,15 @@ void InlineTextBoxPainter::Paint(const PaintInfo& paint_info,
// capitalizing letters can change the length of the backing string. // capitalizing letters can change the length of the backing string.
// That needs to be taken into account when computing the size of the box // That needs to be taken into account when computing the size of the box
// or its painting. // or its painting.
length = std::min(length, first_line_string.length()); length = std::min(length, first_line_string.length() -
std::min(inline_text_box_.Start(),
first_line_string.length()));
// TODO(szager): Figure out why this CHECK sometimes fails, it shouldn't. // TODO(szager): Figure out why this CHECK sometimes fails, it shouldn't.
CHECK(inline_text_box_.Start() + length <= first_line_string.length()); CHECK_LE(inline_text_box_.Start() + length, first_line_string.length());
} else { } else {
// TODO(szager): Figure out why this CHECK sometimes fails, it shouldn't. // TODO(szager): Figure out why this CHECK sometimes fails, it shouldn't.
CHECK(inline_text_box_.Start() + length <= layout_item_string.length()); CHECK_LE(inline_text_box_.Start() + length, layout_item_string.length());
} }
StringView string = StringView string =
StringView(inline_text_box_.IsFirstLineStyle() ? first_line_string StringView(inline_text_box_.IsFirstLineStyle() ? first_line_string
......
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