Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Issue 17745005: Clamp RenderTextWin layout length to 10,000 code points. (Closed)

Created:
7 years, 6 months ago by msw
Modified:
7 years, 5 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Clamp RenderTextWin layout length to 10,000 code points. Add RenderText::truncate_length_ and setter to clamp layout text length. Avoid system limitations and performance degradation on Win/Uniscribe. This does not impact underlying text data, only what's shown on screen. Truncate text_ to layout_text_ in UpdateLayoutText() and append ellipsis. Only reveal obscured characters within the layout text range. Ensure the run and glyph limits are actually tried in their loops. Add unit tests for reasonable truncation behavior. Bail if layout fails, this will leave text un-rendered instead of crashing. Clamp run length to avoid exceeding the glyph limit later on. Clamp layout indices in conversion, fix run index bounds checks. TODO(followup): Truncate text on Linux/Pango as needed. TODO(followup): Increase supported text length and run counts. TODO(followup): UMA text lengths, run counts, failures, and truncations. BUG=235854, 236406, 248960, 131660 TEST=Paste more than 10k characters on Win to see ellipsis and no crashes. (note that omnibox specific codepaths will cause additional performance degradation in that field). No crash on Windows with Search by Image extension use (tried various sizes 16x16 -> 96x96 -> 1900x1200 -> 3840x2160). Normal text behavior with <10k code points, and no behavior change on ChromeOS/Linux_Aura. R=asvitkine@chromium.org,oshima@chromium.org,sky@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=209286

Patch Set 1 #

Patch Set 2 : Improve text clamping code. #

Patch Set 3 : Refine text truncation, guesses and limits. #

Patch Set 4 : Fix obscured truncation, use custom code to truncate characters, not words. #

Patch Set 5 : Refinements; add tests. #

Patch Set 6 : Remove unused variable. #

Patch Set 7 : Reduce the minimum run count to Uniscribe's min. #

Total comments: 14

Patch Set 8 : Address comments. #

Patch Set 9 : Restore the 10,000 run limit. #

Patch Set 10 : Fix the test StringPrintf unsigned int placeholder. #

Patch Set 11 : Fix the test StringPrintf unsigned long placeholder. #

Patch Set 12 : Resolve string formatting; you just can't please some compilers. #

Total comments: 8

Patch Set 13 : Adjust ellipsis const, restore initial run guess of 100. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+239 lines, -105 lines) Patch
M ui/base/text/text_elider.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M ui/base/text/text_elider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +8 lines, -16 lines 0 comments Download
M ui/gfx/render_text.h View 1 2 3 4 5 chunks +18 lines, -7 lines 0 comments Download
M ui/gfx/render_text.cc View 1 2 3 4 5 6 7 8 chunks +38 lines, -25 lines 0 comments Download
M ui/gfx/render_text_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +130 lines, -14 lines 0 comments Download
M ui/gfx/render_text_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +44 lines, -43 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
msw
Hey Alexei, Oshima, and Scott, please take a look; thanks! There's room for followup work, ...
7 years, 5 months ago (2013-06-27 18:23:10 UTC) #1
Alexei Svitkine (slow)
https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text.cc#newcode967 ui/gfx/render_text.cc:967: static const char16 kEllipsis[] = { 0x2026, 0 }; ...
7 years, 5 months ago (2013-06-27 20:13:45 UTC) #2
oshima
i'm not familiar with this code (esp. win), so I'll leave this to alexei. Just ...
7 years, 5 months ago (2013-06-27 21:24:50 UTC) #3
msw
Comments addressed, please take another look; thanks! https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text.cc#newcode967 ui/gfx/render_text.cc:967: static const ...
7 years, 5 months ago (2013-06-27 21:51:19 UTC) #4
Alexei Svitkine (slow)
https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc (right): https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text_win.cc#newcode503 ui/gfx/render_text_win.cc:503: const size_t run_limit = script_items.max_size() / (run_size * 10); ...
7 years, 5 months ago (2013-06-27 22:17:46 UTC) #5
msw
Please take another look; thanks! https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc (right): https://codereview.chromium.org/17745005/diff/25001/ui/gfx/render_text_win.cc#newcode503 ui/gfx/render_text_win.cc:503: const size_t run_limit = ...
7 years, 5 months ago (2013-06-27 22:35:44 UTC) #6
Alexei Svitkine (slow)
https://codereview.chromium.org/17745005/diff/56001/ui/base/text/text_elider.cc File ui/base/text/text_elider.cc (right): https://codereview.chromium.org/17745005/diff/56001/ui/base/text/text_elider.cc#newcode36 ui/base/text/text_elider.cc:36: const char16 kEllipsisUTF16 = 0x2026; Consider making it: const ...
7 years, 5 months ago (2013-06-28 15:37:02 UTC) #7
msw
Comments addressed. Please take another look and check the CQ bit if this CL meets ...
7 years, 5 months ago (2013-06-28 16:31:23 UTC) #8
Alexei Svitkine (slow)
lgtm
7 years, 5 months ago (2013-06-28 16:42:18 UTC) #9
sky
LGTM
7 years, 5 months ago (2013-06-28 17:07:59 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/msw@chromium.org/17745005/62001
7 years, 5 months ago (2013-06-28 17:38:08 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/msw@chromium.org/17745005/62001
7 years, 5 months ago (2013-06-29 06:18:07 UTC) #12
commit-bot: I haz the power
7 years, 5 months ago (2013-06-29 13:02:51 UTC) #13
Message was sent while issue was closed.
Change committed as 209286

Powered by Google App Engine
This is Rietveld 408576698