Remove whitespace from text elision |
||||||||||
Issue description
Text elision can include whitespace, which looks unpolished in my eyes:
ELIDE_TAIL of 800372 - Harmony extension popup... becomes:
"800372 - Harmony ..."
I believe this should be typeset as "800372 - Harmony..."
ELIDE_MIDDLE of "Foo barb baz" could be:
"Foo ... baz"
I believe this should be typeset as "Foo...baz".
Without removing whitespace there's also risk for asymmetry: "Foo... ba" or "Fo ...baz"
Are these controversial, or can we just exclude whitespace from text elision boundaries?
Related question: text_utils.cc's FindValidBoundaryBefore / ..After both check "CharIsMark(" to check for a combining mark character, though the base::string16::substr usage in StringSlicer::CutString either includes or excludes this character as substr(start, len) uses [start, start + len), which includes the mark if it's the first character (start), but excludes it if it's the trailing character.
Also it looks like CutString uses FindValidBoundaryBefore for ELIDE_HEAD but it looks to me like it should be using FindValidBoundaryAfter since BoundaryBefore would potentially (?) expand the bounds of the suffix.
msw@ / tapted@ I'd really like to get your input here. These classes are very new to me.
,
Oct 24
I don't see any obvious problems with removing whitespace. The latter two points sound like possible bugs, any fixes should include specific examples of broken behavior and regression unit tests. Thanks for digging in!
,
Oct 24
Here's what I'm specifically trying to solve. I assume Mac's material menus will need the corresponding problem fixed (so we need both ELIDE_TAIL and ELIDE_MIDDLE "working"). Do I understand correctly that what CharIsMark is checking is essentially for things like "COMBINING ACUTE ACCENT" and skipping past them (in either direction) so that the entire glyph is removed? If so I'll try to find cases that I believe might be broken.
,
Oct 24
Right, that example screenshot is helpful. I believe your understanding of CharIsMark is correct. Hopefully there are tests of that behavior somewhere.
,
Oct 25
,
Oct 25
,
Oct 26
,
Oct 26
,
Nov 15
** UI Mass triage **
,
Dec 11
,
Dec 17
,
Dec 18
,
Dec 21
Please see https://chromium-review.googlesource.com/c/chromium/src/+/1387737 for proposed CL.
,
Jan 9
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e commit 76d8382fb1d1ff05db2be8738276c4e6cafbaf1e Author: Dana Fried <dfried@chromium.org> Date: Wed Jan 09 22:24:30 2019 Trim whitespace during head and tail string elision. All string elision that removes the head or tail of a string will now remove any whitespace adjacent to the elision point as well. Furthermore, eliding the beginning of a string will never result in more unicode codepoints or bytes than was initially requested. Previously, it was possible to end up including a character with combining marks or a character whose codepoint was split by the target number of characters. This does affect filename elision. For example, eliding "foo bar.gif" to the width of 9 characters results in "foo….gif" rather than "foo ….gif", because the filename elision logic elides the tail of the base filename rather than eliding the middle of the full filename. Bug: 897967 Change-Id: I0e5e170b656c185a91de64ef042d01ec3920ceb8 Reviewed-on: https://chromium-review.googlesource.com/c/1387737 Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Michael Wasserman <msw@chromium.org> Commit-Queue: Dana Fried <dfried@chromium.org> Cr-Commit-Position: refs/heads/master@{#621337} [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/ash/public/cpp/app_list/tokenized_string_char_iterator.cc [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/base/i18n/char_iterator.cc [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/base/i18n/char_iterator.h [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/base/i18n/char_iterator_unittest.cc [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/ui/gfx/text_elider.cc [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/ui/gfx/text_elider_unittest.cc [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/ui/gfx/text_utils.cc [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/ui/gfx/text_utils.h [modify] https://crrev.com/76d8382fb1d1ff05db2be8738276c4e6cafbaf1e/ui/gfx/text_utils_unittest.cc
,
Jan 9
|
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by tapted@chromium.org
, Oct 2347.2 KB
47.2 KB View Download
179 KB
179 KB View Download