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

Issue 1340423006: Improve text elision in TruncateString(). (Closed)

Created:
5 years, 3 months ago by Peter Kasting
Modified:
5 years, 3 months ago
Reviewers:
msw
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Improve text elision in TruncateString(). * When doing word-breaking in the middle of the first word in a string with leading whitespace, we would incorrectly truncate the entire string. * When doing word-breaking in whitespace after a word, we would incorrectly omit that word from the truncated string. This also adds more tests and organizes them a bit more readably. BUG=none TEST=Select up to but not including the 'f' in the string "aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee f". Right-click the selection and look at the "Search Google for..." string. It should include 'e's. Committed: https://crrev.com/fc336926514596ca46b1c1e2973f48c1b6766df1 Cr-Commit-Position: refs/heads/master@{#350310}

Patch Set 1 #

Total comments: 22

Patch Set 2 : Review comments #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -77 lines) Patch
M ui/gfx/text_elider.cc View 1 2 chunks +30 lines, -30 lines 1 comment Download
M ui/gfx/text_elider_unittest.cc View 1 1 chunk +64 lines, -47 lines 2 comments Download

Messages

Total messages: 18 (4 generated)
Peter Kasting
5 years, 3 months ago (2015-09-17 01:16:33 UTC) #2
msw
https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc#newcode759 ui/gfx/text_elider.cc:759: // String fits, return it. unrelated nit: please move ...
5 years, 3 months ago (2015-09-17 18:42:45 UTC) #3
Peter Kasting
https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc#newcode773 ui/gfx/text_elider.cc:773: int32_t index = static_cast<int32_t>(length) - (word_break ? 0 : ...
5 years, 3 months ago (2015-09-17 19:39:03 UTC) #4
msw
https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc#newcode773 ui/gfx/text_elider.cc:773: int32_t index = static_cast<int32_t>(length) - (word_break ? 0 : ...
5 years, 3 months ago (2015-09-17 20:45:10 UTC) #5
Peter Kasting
https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc#newcode773 ui/gfx/text_elider.cc:773: int32_t index = static_cast<int32_t>(length) - (word_break ? 0 : ...
5 years, 3 months ago (2015-09-17 20:58:05 UTC) #6
msw
https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc#newcode773 ui/gfx/text_elider.cc:773: int32_t index = static_cast<int32_t>(length) - (word_break ? 0 : ...
5 years, 3 months ago (2015-09-17 21:06:26 UTC) #7
Peter Kasting
PTAL https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc File ui/gfx/text_elider.cc (right): https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider.cc#newcode759 ui/gfx/text_elider.cc:759: // String fits, return it. On 2015/09/17 18:42:44, ...
5 years, 3 months ago (2015-09-19 02:43:25 UTC) #8
msw
lgtm with an optional nit/idea for followup test changes. https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider_unittest.cc File ui/gfx/text_elider_unittest.cc (right): https://codereview.chromium.org/1340423006/diff/1/ui/gfx/text_elider_unittest.cc#newcode1073 ui/gfx/text_elider_unittest.cc:1073: ...
5 years, 3 months ago (2015-09-21 18:28:10 UTC) #9
Peter Kasting
https://codereview.chromium.org/1340423006/diff/20001/ui/gfx/text_elider_unittest.cc File ui/gfx/text_elider_unittest.cc (right): https://codereview.chromium.org/1340423006/diff/20001/ui/gfx/text_elider_unittest.cc#newcode1101 ui/gfx/text_elider_unittest.cc:1101: UTF16ToWide(TruncateString(str, 12, CHARACTER_BREAK))); On 2015/09/21 18:28:10, msw wrote: > ...
5 years, 3 months ago (2015-09-22 23:10:55 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1340423006/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1340423006/20001
5 years, 3 months ago (2015-09-22 23:12:45 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_ng/builds/44162)
5 years, 3 months ago (2015-09-22 23:39:54 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1340423006/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1340423006/20001
5 years, 3 months ago (2015-09-23 00:11:03 UTC) #16
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 3 months ago (2015-09-23 05:59:38 UTC) #17
commit-bot: I haz the power
5 years, 3 months ago (2015-09-23 06:00:18 UTC) #18
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/fc336926514596ca46b1c1e2973f48c1b6766df1
Cr-Commit-Position: refs/heads/master@{#350310}

Powered by Google App Engine
This is Rietveld 408576698