Commit 8fea8342 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Fix ShapeResult::EnsureGrapheme when there are no RunInfo

Unlike normal layout cases, hit-testing, canvas, etc. may call
ShapeResult functions with 0-length text. In this case,
ShapeResult has no RunInfo.

It is also possible that there are no glyphs for the given
text, but in normal code path, HarfBuzzShaper should still
generate a run without glyphs.

Bug: 868893
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ia86f4627c74122c915986858bc974fc2e18d3b3d
Reviewed-on: https://chromium-review.googlesource.com/1155275Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579472}
parent e1acc275
......@@ -115,6 +115,11 @@ unsigned ShapeResult::RunInfo::NumGraphemes(unsigned start,
void ShapeResult::EnsureGraphemes(const StringView& text) const {
DCHECK_EQ(NumCharacters(), text.length());
// Hit-testing, canvas, etc. may still call this function for 0-length text,
// or glyphs may be missing at all.
if (runs_.IsEmpty())
return;
bool is_computed = !runs_.front()->graphemes_.IsEmpty();
#if DCHECK_IS_ON()
for (const auto& run : runs_)
......
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