New issue
Advanced search Search tips

Issue 786840 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocked on:
issue 724880
issue 775404

Blocking:
issue 603386



Sign in to add a comment

TextRunHarfBuzz error, please report" rendering "☎️" on Mac. "fdsfd☎️fds" renders with a gap in it. Selection is not contiguous.

Project Member Reported by tapted@chromium.org, Nov 20 2017

Issue description

Chrome Version       : 64.0.3273.0
OS Version: OS X 10.12.6

Turns out I have bookmark title that triggers the warning that cites  http://crbug.com/724880  now. It's my old pal' the red telephone, from  Issue 775404 

[60849:775:1120/112040.769192:ERROR:render_text_harfbuzz.cc(724)]  TextRunHarfBuzz error, please report at  crbug.com/724880 : range: {6,10}, rtl: 0, level: '', script: 25, font: '.AppleSystemUIFont', glyph_count: 3, pos: 6, glyph_to_char: 0->7, 1->8, 2->9,
[60849:775:1120/112040.769294:INFO:render_text_harfbuzz.cc(1329)] fdsfd☎️fds

Just the red telephone "☎️" is enough to trigger the warning:

[61335:775:1120/112436.145678:ERROR:render_text_harfbuzz.cc(724)]  TextRunHarfBuzz error, please report at  crbug.com/724880 : range: {1,2}, rtl: 0, level: '', script: 1, font: '.AppleSystemUIFont', glyph_count: 0, pos: 1, glyph_to_char:
[61335:775:1120/112436.145718:INFO:render_text_harfbuzz.cc(1329)] ☎️

Pasting "fdsfd☎️fds" into the omnibox on a Views browser can also cause a DCHECK:

[60849:775:1120/112259.167096:FATAL:render_text_harfbuzz.cc(749)] Check failed: cluster_begin_x <= cluster_end_x (29.4219 vs. 20.6855)
0   libbase.dylib                       0x0000000108bcb26e base::debug::StackTrace::StackTrace(unsigned long) + 174
1   libbase.dylib                       0x0000000108bcb32d base::debug::StackTrace::StackTrace(unsigned long) + 29
2   libbase.dylib                       0x0000000108bc95dc base::debug::StackTrace::StackTrace() + 28
3   libbase.dylib                       0x0000000108c62a6f logging::LogMessage::~LogMessage() + 479
4   libbase.dylib                       0x0000000108c603e5 logging::LogMessage::~LogMessage() + 21
5   libgfx.dylib                        0x000000010b2b8a52 gfx::internal::TextRunHarfBuzz::GetGraphemeBounds(gfx::RenderTextHarfBuzz*, unsigned long) const + 994
6   libgfx.dylib                        0x000000010b2b96ea gfx::internal::TextRunHarfBuzz::GetGraphemeSpanForCharRange(gfx::RenderTextHarfBuzz*, gfx::Range const&) const + 826
7   libgfx.dylib                        0x000000010b2bd8ff gfx::RenderTextHarfBuzz::GetCursorSpan(gfx::Range const&) + 735
8   libgfx.dylib                        0x000000010b2f64ef gfx::RenderText::GetCursorBounds(gfx::SelectionModel const&, bool) + 1231
9   libgfx.dylib                        0x000000010b2fc5a1 gfx::RenderText::UpdateCachedBoundsAndOffset() + 113
10  libgfx.dylib                        0x000000010b2fc519 gfx::RenderText::GetUpdatedCursorBounds() + 25
11  libviews.dylib                      0x0000000138bc2858 views::Textfield::UpdateCursorViewPosition() + 56
12  libviews.dylib                      0x0000000138bc206b views::Textfield::UpdateAfterChange(bool, bool) + 155
13  libviews.dylib                      0x0000000138bc1f93 views::Textfield::InsertOrReplaceText(std::__1::basic_string<unsigned short, base::string16_internals::string16_char_traits, std::__1::allocator<unsigned short> > const&) + 259


But just pasting the telephone doesn't cause a DCHECK.


There is related quirky behaviour around selection with this string when the DCHECK is ignored in Release (see attached)

Windows Canary seems fine with this string, and RenderTextMac renders the string OK (but of course can't select it).

So I think it's some combination of RenderTextHarfbuzz splitting the string incorrectly (i.e.  Issue 775404 ), and Harfbuzz+CoreText returning some bogus glyph positioning for the variation selector. Fun.


Diagnosing the warning, it's a failure in the `return false` at:

  Iterator element = std::upper_bound(elements_begin, elements_end, pos);
  if (element == elements_begin) {
    *chars = range;
    *glyphs = Range();
    return false;
  }

The glyph count for the orphaned variation selector is zero. I suppose this run "shouldn't exist", or it should render as tofu instead.

If there _is_ text after it, and something asks for the glyph/cluster for the variation selector, it can't be found.
 
select_all.png
5.3 KB View Download
Screen Shot 2017-11-20 at 11.32.38 am.png
9.9 KB View Download
Project Member

Comment 1 by bugdroid1@chromium.org, Dec 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/410dee5bc18c23e0884df83350fd938b5f7298a0

commit 410dee5bc18c23e0884df83350fd938b5f7298a0
Author: Trent Apted <tapted@chromium.org>
Date: Thu Dec 14 23:03:34 2017

RenderTextHarfbuzz: Allow variation selectors to combine with "unusual" blocks

RenderTextHarfbuzz has always (since r272260) categorised some
unicode blocks as "unusual". Characters from another block will
never appear in a run with characters from an unusual block.

But variation selectors always apply to the preceding glyph. Allow them
to merge with an unusual block.

Bug:  786840 ,  775404 
Change-Id: Id562836b79bbc494e6f44e8492f8b36b704a2838
Reviewed-on: https://chromium-review.googlesource.com/813459
Reviewed-by: Michael Wasserman <msw@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524222}
[modify] https://crrev.com/410dee5bc18c23e0884df83350fd938b5f7298a0/ui/gfx/render_text_harfbuzz.cc
[modify] https://crrev.com/410dee5bc18c23e0884df83350fd938b5f7298a0/ui/gfx/render_text_unittest.cc

Comment 2 by tapted@chromium.org, Dec 14 2017

Status: Fixed (was: Assigned)
This particular repro should be fixed. It's possible some other pathological cases exist for cases where the font glyph properties provided by the system are something nonsensical, or the input string is garbled.

Sign in to add a comment