DescriptionClamp 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. #
Messages
Total messages: 13 (0 generated)
|