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

Issue 354963003: Move gfx::ElideText functionality to RenderText. (Closed)

Created:
6 years, 5 months ago by msw
Modified:
6 years, 5 months ago
CC:
chromium-reviews, Anuj, ckocagil, Evan Stade, behdad, jianli
Visibility:
Public.

Description

Move gfx::ElideText functionality to RenderText. This is a prerequisite for http://crrev.com/23228004 (RenderText must elide correctly for direct Label use) Use RenderText in gfx::ElideText on Win, Linux, Mac. (old impl still needed for iOS and Android, for now) Support additional eliding types in RenderText. (matches behavior of gfx::ElideText, see TextEliderTest) (still fixes the directionality of trailing ellipses) (respect head and middle eliding when truncating) Disambiguate gfx::NO_ELIDE from gfx::TRUNCATE. Make the ElideEmail helper a private RenderText function. Disable tests and no-op gfx::ElideText on iOS/Android. Improve ElideTextSurrogatePairs perf: 7561 ms -> 3196 ms. TODO: Fix RenderText::ElideEmail GetStringWidthF calls. TODO: Support eliding filenames, like gfx::ElideFilename. BUG=249938, 327846, 240037, 125348, 338784 R=asvitkine@chromium.org,sky@chromium.org TEST=No observable text eliding behavior changes. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=282433

Patch Set 1 #

Patch Set 2 : Remove RenderText::ElideText. #

Patch Set 3 : Reorder RenderText::Elide impl to match decl. #

Total comments: 2

Patch Set 4 : Disambiguate NO_ELIDE and TRUNCATE, respect elide_behavior_ in RenderText truncation. #

Patch Set 5 : Disable tests and no-op gfx::ElideText on iOS/Android. #

Patch Set 6 : Fix RenderTextPango::GetStringSize, improve eliding performance. #

Patch Set 7 : Improve performance by truncating, similar to Canvas. #

Patch Set 8 : Restore gfx::ElideText impl for other platforms. #

Patch Set 9 : Simplify changes; revert test changes. #

Patch Set 10 : Cleanup, copy comment changes. #

Patch Set 11 : Exclude unreachable code by platform. #

Total comments: 11

Patch Set 12 : Exclude ElideEmail on Mac. #

Patch Set 13 : Return float GetContentWidth; ceil available width; fix #ifdefs. #

Patch Set 14 : Fix the initial width of OmniboxResultView's elided RenderTexts. #

Total comments: 4

Patch Set 15 : Add ELIDE_MIDDLE truncation DCHECK; improve ElideTextSurrogatePairs perf: 7561 ms -> 3196 ms. #

Patch Set 16 : sync and rebase. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+189 lines, -115 lines) Patch
M chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/location_bar/add_to_app_launcher_view.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/location_bar/content_setting_image_view.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/location_bar/origin_chip_view.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_result_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +1 line, -1 line 0 comments Download
M ui/gfx/render_text.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +12 lines, -8 lines 0 comments Download
M ui/gfx/render_text.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 9 chunks +102 lines, -43 lines 0 comments Download
M ui/gfx/render_text_pango.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +9 lines, -0 lines 0 comments Download
M ui/gfx/render_text_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +12 lines, -0 lines 0 comments Download
M ui/gfx/text_constants.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/text_elider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +30 lines, -35 lines 0 comments Download
M ui/gfx/text_elider_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +7 lines, -13 lines 0 comments Download
M ui/views/controls/label.cc View 1 2 3 3 chunks +3 lines, -3 lines 0 comments Download
M ui/views/examples/label_example.cc View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M ui/views/examples/text_example.cc View 1 2 3 3 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
msw
Hey Alexei, please take a look; thanks!
6 years, 5 months ago (2014-06-27 21:49:09 UTC) #1
Alexei Svitkine (slow)
Sorry, I won't be able to get to this till Wednesday next week, since I'm ...
6 years, 5 months ago (2014-06-27 21:50:26 UTC) #2
Alexei Svitkine (slow)
https://codereview.chromium.org/354963003/diff/40001/ui/gfx/render_text.h File ui/gfx/render_text.h (right): https://codereview.chromium.org/354963003/diff/40001/ui/gfx/render_text.h#newcode424 ui/gfx/render_text.h:424: base::string16 Elide(const base::string16& text, It seems more natural to ...
6 years, 5 months ago (2014-06-27 21:54:34 UTC) #3
msw
I addressed your comment and refined some behavior. Scott, please take a look if you ...
6 years, 5 months ago (2014-06-27 23:51:49 UTC) #4
Alexei Svitkine (slow)
https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text.cc#newcode1161 ui/gfx/render_text.cc:1161: // Respect ELIDE_HEAD and ELIDE_MIDDLE preferences during truncation. Can ...
6 years, 5 months ago (2014-07-03 20:12:34 UTC) #5
msw
Please take another look; thanks! https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text.cc#newcode1161 ui/gfx/render_text.cc:1161: // Respect ELIDE_HEAD and ...
6 years, 5 months ago (2014-07-08 19:07:36 UTC) #6
Evan Stade
https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text_pango.cc File ui/gfx/render_text_pango.cc (right): https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text_pango.cc#newcode89 ui/gfx/render_text_pango.cc:89: // while detecting that isn't worthwhile, this handles the ...
6 years, 5 months ago (2014-07-08 21:07:19 UTC) #7
behdad_google
On 2014/07/08 21:07:19, Evan Stade wrote: > https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text_pango.cc > File ui/gfx/render_text_pango.cc (right): > > https://codereview.chromium.org/354963003/diff/220001/ui/gfx/render_text_pango.cc#newcode89 ...
6 years, 5 months ago (2014-07-08 21:22:04 UTC) #8
sky
https://codereview.chromium.org/354963003/diff/320001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): https://codereview.chromium.org/354963003/diff/320001/ui/gfx/render_text.cc#newcode1163 ui/gfx/render_text.cc:1163: iter.setIndex32(text.length() - truncate_length_ + 1); Is it possible for ...
6 years, 5 months ago (2014-07-09 18:19:39 UTC) #9
msw
Comments addressed and I sped up a test; PTAL. https://codereview.chromium.org/354963003/diff/320001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): https://codereview.chromium.org/354963003/diff/320001/ui/gfx/render_text.cc#newcode1163 ui/gfx/render_text.cc:1163: ...
6 years, 5 months ago (2014-07-09 19:16:08 UTC) #10
sky
LGTM
6 years, 5 months ago (2014-07-10 15:05:30 UTC) #11
msw
The CQ bit was checked by msw@chromium.org
6 years, 5 months ago (2014-07-10 16:01:55 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/msw@chromium.org/354963003/340001
6 years, 5 months ago (2014-07-10 16:04:02 UTC) #13
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: chromium_presubmit on tryserver.chromium ...
6 years, 5 months ago (2014-07-10 16:09:05 UTC) #14
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-10 16:14:44 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/chromium_presubmit/builds/79140) ios_rel_device_ninja on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/ios_rel_device_ninja/builds/27441) linux_chromium_chromeos_clang_dbg ...
6 years, 5 months ago (2014-07-10 16:14:45 UTC) #16
msw
The CQ bit was checked by msw@chromium.org
6 years, 5 months ago (2014-07-10 16:55:00 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/msw@chromium.org/354963003/360001
6 years, 5 months ago (2014-07-10 16:57:08 UTC) #18
commit-bot: I haz the power
6 years, 5 months ago (2014-07-10 21:41:02 UTC) #19
Message was sent while issue was closed.
Change committed as 282433

Powered by Google App Engine
This is Rietveld 408576698