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

Issue 24883002: Uses and returns the fractional width in text eliding (Closed)

Created:
7 years, 2 months ago by jianli
Modified:
7 years, 2 months ago
CC:
chromium-reviews, tfarina, sadrul, ben+watch_chromium.org
Visibility:
Public.

Description

Uses and returns the fractional width in text eliding On Mac, the width is repsented as CGFloat due to possible sub-pixel rendering and extra kerning. We need to return the fractional widt, instead of the integral width. Some tests have been updated with the hack removed. BUG=288987 TEST=new tests plus updating existing tests Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=227905

Patch Set 1 : Patch #

Total comments: 27

Patch Set 2 : Fix per feedbacks #

Patch Set 3 : Fix win bots #

Total comments: 16

Patch Set 4 : More fixes per feedback plus new tests #

Total comments: 10

Patch Set 5 : Sync #

Patch Set 6 : More fixes per feedback #

Total comments: 3

Patch Set 7 : Fix #

Patch Set 8 : Sync #

Patch Set 9 : Fix round-down problems #

Total comments: 4

Patch Set 10 : Update comment per feedback #

Patch Set 11 : Add float version only #

Patch Set 12 : Fix iOS build #

Patch Set 13 : Fix trybots #

Total comments: 6

Patch Set 14 : Fix per feedbacks #

Total comments: 14

Patch Set 15 : Fix per more feedback #

Total comments: 6

Patch Set 16 : Address more feedback #

Patch Set 17 : Sync #

Unified diffs Side-by-side diffs Delta from patch set Stats (+286 lines, -229 lines) Patch
M ui/gfx/canvas.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +17 lines, -0 lines 0 comments Download
M ui/gfx/canvas.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +24 lines, -0 lines 0 comments Download
M ui/gfx/canvas_android.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -6 lines 0 comments Download
M ui/gfx/canvas_skia.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +9 lines, -9 lines 0 comments Download
M ui/gfx/canvas_unittest_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +27 lines, -23 lines 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 2 chunks +8 lines, -0 lines 0 comments Download
M ui/gfx/render_text.cc View 1 1 chunk +5 lines, -0 lines 0 comments Download
M ui/gfx/render_text_mac.h View 2 chunks +2 lines, -1 line 0 comments Download
M ui/gfx/render_text_mac.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M ui/gfx/text_elider.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +10 lines, -10 lines 0 comments Download
M ui/gfx/text_elider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 29 chunks +69 lines, -70 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 19 chunks +85 lines, -108 lines 0 comments Download
M ui/gfx/text_utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -0 lines 0 comments Download
M ui/gfx/text_utils_android.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -0 lines 0 comments Download
M ui/gfx/text_utils_ios.mm View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -1 line 0 comments Download
M ui/gfx/text_utils_skia.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 45 (0 generated)
jianli
msw and asvitkine for text rendering and eliding changes. sky for owner approval for all ...
7 years, 2 months ago (2013-09-26 23:24:59 UTC) #1
msw
Three larger comments/questions: 1) Add a unit test somewhere that actually retrieves a non-integral string ...
7 years, 2 months ago (2013-09-27 21:54:47 UTC) #2
jianli
On Fri, Sep 27, 2013 at 2:54 PM, <msw@chromium.org> wrote: > Three larger comments/questions: > ...
7 years, 2 months ago (2013-09-27 22:08:33 UTC) #3
jianli
https://codereview.chromium.org/24883002/diff/3001/ash/system/user/tray_user.cc File ash/system/user/tray_user.cc (right): https://codereview.chromium.org/24883002/diff/3001/ash/system/user/tray_user.cc#newcode460 ash/system/user/tray_user.cc:460: static_cast<float>(contents_area.width()), On 2013/09/27 21:54:48, msw wrote: > Won't int->float ...
7 years, 2 months ago (2013-10-01 00:32:58 UTC) #4
msw
Everything looks okay except the unnecessary addition of ToCGRect. https://codereview.chromium.org/24883002/diff/3001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/24883002/diff/3001/ui/views/controls/label.cc#newcode254 ui/views/controls/label.cc:254: ...
7 years, 2 months ago (2013-10-01 02:42:47 UTC) #5
msw
Also, you still need to add a unit test that returns a non-integral width, right?
7 years, 2 months ago (2013-10-01 02:43:30 UTC) #6
jianli
My bad. I will add the test. On Mon, Sep 30, 2013 at 7:43 PM, ...
7 years, 2 months ago (2013-10-01 17:10:24 UTC) #7
jianli
New tests added in canvas_unitttest_mac.mm and font_unittest.cc https://codereview.chromium.org/24883002/diff/83001/ui/gfx/canvas.h File ui/gfx/canvas.h (right): https://codereview.chromium.org/24883002/diff/83001/ui/gfx/canvas.h#newcode145 ui/gfx/canvas.h:145: const FontList& ...
7 years, 2 months ago (2013-10-01 18:56:50 UTC) #8
Alexei Svitkine (slow)
Looks good overall, a couple comments about your changes to the mac test. https://codereview.chromium.org/24883002/diff/122001/ui/gfx/canvas_unittest_mac.mm File ...
7 years, 2 months ago (2013-10-01 19:04:55 UTC) #9
msw
LGTM with nits, and Q for Alexei's comment to not inline CanvasMac_SizeStringInt for its one ...
7 years, 2 months ago (2013-10-01 19:14:52 UTC) #10
Alexei Svitkine (slow)
https://codereview.chromium.org/24883002/diff/122001/ui/gfx/canvas_unittest_mac.mm File ui/gfx/canvas_unittest_mac.mm (left): https://codereview.chromium.org/24883002/diff/122001/ui/gfx/canvas_unittest_mac.mm#oldcode23 ui/gfx/canvas_unittest_mac.mm:23: void CanvasMac_SizeStringInt(const base::string16& text, On 2013/10/01 19:14:53, msw wrote: ...
7 years, 2 months ago (2013-10-01 19:19:49 UTC) #11
jianli
https://codereview.chromium.org/24883002/diff/122001/ui/gfx/canvas_unittest_mac.mm File ui/gfx/canvas_unittest_mac.mm (left): https://codereview.chromium.org/24883002/diff/122001/ui/gfx/canvas_unittest_mac.mm#oldcode23 ui/gfx/canvas_unittest_mac.mm:23: void CanvasMac_SizeStringInt(const base::string16& text, On 2013/10/01 19:19:50, Alexei Svitkine ...
7 years, 2 months ago (2013-10-01 21:34:27 UTC) #12
msw
Still LGTM, with one new nit. https://codereview.chromium.org/24883002/diff/162001/ui/gfx/canvas_unittest_mac.mm File ui/gfx/canvas_unittest_mac.mm (right): https://codereview.chromium.org/24883002/diff/162001/ui/gfx/canvas_unittest_mac.mm#newcode23 ui/gfx/canvas_unittest_mac.mm:23: nit: remove blank ...
7 years, 2 months ago (2013-10-01 21:46:44 UTC) #13
sky
https://codereview.chromium.org/24883002/diff/162001/ash/system/user/tray_user.cc File ash/system/user/tray_user.cc (right): https://codereview.chromium.org/24883002/diff/162001/ash/system/user/tray_user.cc#newcode546 ash/system/user/tray_user.cc:546: font.GetStringWidth(text_) + space_width + link_size.width(), Won't this round down? ...
7 years, 2 months ago (2013-10-01 23:53:02 UTC) #14
jianli
https://codereview.chromium.org/24883002/diff/162001/ash/system/user/tray_user.cc File ash/system/user/tray_user.cc (right): https://codereview.chromium.org/24883002/diff/162001/ash/system/user/tray_user.cc#newcode546 ash/system/user/tray_user.cc:546: font.GetStringWidth(text_) + space_width + link_size.width(), On 2013/10/01 23:53:03, sky ...
7 years, 2 months ago (2013-10-02 00:49:20 UTC) #15
sky
My worry is a general worry that any time you expose an API that takes ...
7 years, 2 months ago (2013-10-02 15:58:44 UTC) #16
Alexei Svitkine (slow)
I had originally suggested to keep both the int and add the float APIs and ...
7 years, 2 months ago (2013-10-02 16:01:40 UTC) #17
sky
Doing this seems equally error prone in so far as folks have to be very ...
7 years, 2 months ago (2013-10-02 16:06:22 UTC) #18
Alexei Svitkine (slow)
True. Which is why I didn't push back on this CL not doing the selective ...
7 years, 2 months ago (2013-10-02 16:36:19 UTC) #19
sky
I get why we want fractional metrics. I just want to make sure we round ...
7 years, 2 months ago (2013-10-02 20:16:39 UTC) #20
jianli
All these potential round down changes are in views/ash codebase. We suppose to return and ...
7 years, 2 months ago (2013-10-02 20:25:03 UTC) #21
sky
I don't want a DCHECK like that every where. At some point aura may want ...
7 years, 2 months ago (2013-10-02 20:54:51 UTC) #22
jianli
I have fixed the round-down problems. Could you please review again? Thanks. On Wed, Oct ...
7 years, 2 months ago (2013-10-02 22:25:34 UTC) #23
sky
https://codereview.chromium.org/24883002/diff/214001/chrome/browser/ui/autofill/autofill_popup_controller.h File chrome/browser/ui/autofill/autofill_popup_controller.h (right): https://codereview.chromium.org/24883002/diff/214001/chrome/browser/ui/autofill/autofill_popup_controller.h#newcode66 chrome/browser/ui/autofill/autofill_popup_controller.h:66: virtual void SetPopupBounds(const gfx::RectF& bounds) = 0; Why do ...
7 years, 2 months ago (2013-10-03 14:19:23 UTC) #24
jianli
https://codereview.chromium.org/24883002/diff/214001/chrome/browser/ui/autofill/autofill_popup_controller.h File chrome/browser/ui/autofill/autofill_popup_controller.h (right): https://codereview.chromium.org/24883002/diff/214001/chrome/browser/ui/autofill/autofill_popup_controller.h#newcode66 chrome/browser/ui/autofill/autofill_popup_controller.h:66: virtual void SetPopupBounds(const gfx::RectF& bounds) = 0; On 2013/10/03 ...
7 years, 2 months ago (2013-10-03 18:42:16 UTC) #25
sky
On Thu, Oct 3, 2013 at 11:42 AM, <jianli@chromium.org> wrote: > > https://codereview.chromium.org/24883002/diff/214001/chrome/browser/ui/autofill/autofill_popup_controller.h > File ...
7 years, 2 months ago (2013-10-03 22:11:27 UTC) #26
sky
On 2013/10/03 22:11:27, sky wrote: > On Thu, Oct 3, 2013 at 11:42 AM, <mailto:jianli@chromium.org> ...
7 years, 2 months ago (2013-10-03 22:24:19 UTC) #27
jianli
On Thu, Oct 3, 2013 at 3:24 PM, <sky@chromium.org> wrote: > On 2013/10/03 22:11:27, sky ...
7 years, 2 months ago (2013-10-03 22:54:29 UTC) #28
sky
On Thu, Oct 3, 2013 at 3:54 PM, Jian Li <jianli@chromium.org> wrote: > > > ...
7 years, 2 months ago (2013-10-03 23:40:13 UTC) #29
jianli
I changed to add and use the float version only, per Scott's suggestion. I need ...
7 years, 2 months ago (2013-10-04 22:46:06 UTC) #30
sky
I only poked at a couple of places since it seems you are quite done. ...
7 years, 2 months ago (2013-10-04 23:51:16 UTC) #31
sky
That should be, "aren't quite done". On Fri, Oct 4, 2013 at 4:51 PM, <sky@chromium.org> ...
7 years, 2 months ago (2013-10-05 00:21:38 UTC) #32
jianli
On 2013/10/05 00:21:38, sky wrote: > That should be, "aren't quite done". > > On ...
7 years, 2 months ago (2013-10-07 21:25:12 UTC) #33
Alexei Svitkine (slow)
https://codereview.chromium.org/24883002/diff/274001/ui/gfx/font.h File ui/gfx/font.h (right): https://codereview.chromium.org/24883002/diff/274001/ui/gfx/font.h#newcode84 ui/gfx/font.h:84: float GetStringWidthF(const base::string16& text) const; Is this actually needed? ...
7 years, 2 months ago (2013-10-07 21:43:38 UTC) #34
jianli
https://codereview.chromium.org/24883002/diff/274001/ui/gfx/font.h File ui/gfx/font.h (right): https://codereview.chromium.org/24883002/diff/274001/ui/gfx/font.h#newcode84 ui/gfx/font.h:84: float GetStringWidthF(const base::string16& text) const; On 2013/10/07 21:43:39, Alexei ...
7 years, 2 months ago (2013-10-07 23:18:45 UTC) #35
Alexei Svitkine (slow)
LGTM with some nits! Thanks! https://codereview.chromium.org/24883002/diff/300001/ui/gfx/canvas.cc File ui/gfx/canvas.cc (right): https://codereview.chromium.org/24883002/diff/300001/ui/gfx/canvas.cc#newcode93 ui/gfx/canvas.cc:93: float fractional_width = *width, ...
7 years, 2 months ago (2013-10-07 23:33:27 UTC) #36
jianli
https://codereview.chromium.org/24883002/diff/300001/ui/gfx/canvas.cc File ui/gfx/canvas.cc (right): https://codereview.chromium.org/24883002/diff/300001/ui/gfx/canvas.cc#newcode93 ui/gfx/canvas.cc:93: float fractional_width = *width, factional_height = *height; On 2013/10/07 ...
7 years, 2 months ago (2013-10-08 00:01:18 UTC) #37
sky
https://codereview.chromium.org/24883002/diff/309001/ui/gfx/canvas.h File ui/gfx/canvas.h (right): https://codereview.chromium.org/24883002/diff/309001/ui/gfx/canvas.h#newcode142 ui/gfx/canvas.h:142: // This is same as SizeStringInt except that fractional ...
7 years, 2 months ago (2013-10-08 02:12:55 UTC) #38
jianli
https://codereview.chromium.org/24883002/diff/309001/ui/gfx/canvas.h File ui/gfx/canvas.h (right): https://codereview.chromium.org/24883002/diff/309001/ui/gfx/canvas.h#newcode142 ui/gfx/canvas.h:142: // This is same as SizeStringInt except that fractional ...
7 years, 2 months ago (2013-10-08 18:29:47 UTC) #39
sky
LGTM
7 years, 2 months ago (2013-10-08 21:30:17 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jianli@chromium.org/24883002/349001
7 years, 2 months ago (2013-10-09 22:49:05 UTC) #41
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 2 months ago (2013-10-10 00:15:01 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jianli@chromium.org/24883002/349001
7 years, 2 months ago (2013-10-10 00:17:52 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jianli@chromium.org/24883002/349001
7 years, 2 months ago (2013-10-10 00:39:38 UTC) #44
commit-bot: I haz the power
7 years, 2 months ago (2013-10-10 09:57:26 UTC) #45
Message was sent while issue was closed.
Change committed as 227905

Powered by Google App Engine
This is Rietveld 408576698