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

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 2285413002: [User Menu] Flipped the profile badge to be on the LHS for RTL layouts (Closed)
Patch Set: Cleanup unnecessary overload. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
index 3bf5e0739eae6f389b5d0a32cc618fa588114ed9..50f4325e74b7b74ea6297977c168f1f19cd11f03 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -372,12 +372,6 @@ class EditableProfilePhoto : public views::LabelButton {
SetSize(GetPreferredSize());
}
- // Calculate the circular mask that will be used to display the photo.
- circular_mask_.addCircle(
- SkIntToScalar(icon_image_side() / 2),
- SkIntToScalar(icon_image_side() / 2) + badge_spacing(),
- SkIntToScalar(icon_image_side() / 2));
-
if (switches::IsMaterialDesignUserMenu() || !is_editing_allowed) {
SetEnabled(false);
return;
@@ -400,19 +394,17 @@ class EditableProfilePhoto : public views::LabelButton {
AddChildView(photo_overlay_);
}
- void OnPaint(gfx::Canvas* canvas) override {
- canvas->Save();
- // Display the profile picture as a circle.
- canvas->ClipPath(circular_mask_, true);
- views::LabelButton::OnPaint(canvas);
- canvas->Restore();
- }
-
void PaintChildren(const ui::PaintContext& context) override {
{
// Display any children (the "change photo" overlay) as a circle.
ui::ClipRecorder clip_recorder(context);
- clip_recorder.ClipPathWithAntiAliasing(circular_mask_);
+ gfx::Rect clip_bounds = image()->GetMirroredBounds();
+ gfx::Path clip_mask;
+ clip_mask.addCircle(
+ clip_bounds.x() + clip_bounds.width() / 2,
+ clip_bounds.y() + clip_bounds.height() / 2,
+ clip_bounds.width() / 2);
+ clip_recorder.ClipPathWithAntiAliasing(clip_mask);
View::PaintChildren(context);
}
@@ -424,10 +416,11 @@ class EditableProfilePhoto : public views::LabelButton {
int badge_offset =
icon_image_side() + badge_spacing() - GetProfileBadgeSize();
gfx::Vector2d badge_offset_vector = gfx::Vector2d(
- badge_offset,
+ GetMirroredXWithWidthInView(badge_offset, GetProfileBadgeSize()),
badge_offset + (switches::IsMaterialDesignUserMenu()
? views::kRelatedControlSmallVerticalSpacing
: 0));
+
gfx::Point center_point = bounds.CenterPoint() + badge_offset_vector;
// Paint the circular background.
@@ -503,7 +496,6 @@ class EditableProfilePhoto : public views::LabelButton {
}
bool interactive_;
- gfx::Path circular_mask_;
// Image that is shown when hovering over the image button. Can be NULL if
// the photo isn't allowed to be edited (e.g. for guest profiles).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698