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

Issue 2286813002: [User Menu] Flipped the profile badge to be on the LHS for RTL layouts

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

Description

[User Menu] Flipped the profile badge to be on the LHS for RTL layouts Discussed with bettes@ to decide that the profile badge on RTL layouts should be on the LHS instead. Also fixed the position of the circular mask for profile icon on RTL layouts (see first bug) - the circular mask needs to be bumped to the right on RTL layouts so that it's right-aligned. See comparative screenshots: https://drive.google.com/drive/folders/0B7Fvv7JszRyGN1FKakw4RXE2Vkk?usp=sharing BUG=640907 BUG=615893

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -1 line) Patch
M chrome/browser/ui/views/profiles/profile_chooser_view.cc View 3 chunks +8 lines, -1 line 2 comments Download

Messages

Total messages: 5 (3 generated)
Jane
Hi sky@, this CL fixes the RTL bug in a hopefully better way. I discussed ...
4 years, 3 months ago (2016-08-26 17:45:16 UTC) #4
sky
4 years, 3 months ago (2016-08-26 19:18:27 UTC) #5
https://codereview.chromium.org/2286813002/diff/1/chrome/browser/ui/views/pro...
File chrome/browser/ui/views/profiles/profile_chooser_view.cc (right):

https://codereview.chromium.org/2286813002/diff/1/chrome/browser/ui/views/pro...
chrome/browser/ui/views/profiles/profile_chooser_view.cc:381:
(base::i18n::IsRTL() ? badge_spacing() : 0),
In general we use the various GetMirrored* functions in View to adjust for rtl.
That you're doing something special here typically indicates something may be
wrong. AFAICT circular_mask_ is intended to be around the image drawn by
LabelButton. If that's right, why do you need circular_mask_? Can't you
calculate it when needed directly from the bounds of image()? I'm specifically
suggesting something like this:

void PaintChildren() {
  ...
  gfx::Rect clip_bounds = image()->GetMirroredBounds();
  gfx::Path clip_mask;
  clip_mask.AddCircle(use clip_bounds to calculate circle, shouldn't need to
adjust for rtl as GetMirroredBounds() does that for you);
  ...
?
}

In looking at this code a bit more, I'm also unclear as to why the path is
clipped in both OnPaint and PaintChildren? Don't you only care about
PaintChildren?

https://codereview.chromium.org/2286813002/diff/1/chrome/browser/ui/views/pro...
chrome/browser/ui/views/profiles/profile_chooser_view.cc:435: // For RTL
layouts, left-align the profile badge.
Similar comment here. Generally you calculate the value in ltr, and then
somewhere along the line use one of the GetMirrored* functions.

Powered by Google App Engine
This is Rietveld 408576698