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

Unified Diff: ui/views/controls/button/menu_button.cc

Issue 24647003: Redesign of the avatar menu button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix RTL button Created 7 years, 3 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
Index: ui/views/controls/button/menu_button.cc
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc
index b2e7037728154d845362e1ef3e0abd9867a00c1a..d3f1d61c096081cd4275bbfbd9719d706e34238f 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -133,24 +133,27 @@ bool MenuButton::Activate() {
return true;
}
+void MenuButton::PaintMenuMarker(gfx::Canvas* canvas) {
+ gfx::Insets insets = GetInsets();
sky 2013/09/26 20:21:39 const
noms (inactive) 2013/10/01 17:42:21 Done.
+
+ // We can not use the views' mirroring infrastructure for mirroring a
+ // MenuButton control (see TextButton::OnPaint() for a detailed explanation
+ // regarding why we can not flip the canvas). Therefore, we need to
+ // manually mirror the position of the down arrow.
+ gfx::Rect arrow_bounds(width() - insets.right() -
sky 2013/09/26 20:21:39 const
noms (inactive) 2013/10/01 17:42:21 I don't think arrow_bounds can be const, as it get
+ menu_marker_->width() - kMenuMarkerPaddingRight,
+ height() / 2 - menu_marker_->height() / 2,
+ menu_marker_->width(),
+ menu_marker_->height());
+ arrow_bounds.set_x(GetMirroredXForRect(arrow_bounds));
+ canvas->DrawImageInt(*menu_marker_, arrow_bounds.x(), arrow_bounds.y());
+}
+
void MenuButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
TextButton::PaintButton(canvas, mode);
- if (show_menu_marker_) {
- gfx::Insets insets = GetInsets();
-
- // We can not use the views' mirroring infrastructure for mirroring a
- // MenuButton control (see TextButton::OnPaint() for a detailed explanation
- // regarding why we can not flip the canvas). Therefore, we need to
- // manually mirror the position of the down arrow.
- gfx::Rect arrow_bounds(width() - insets.right() -
- menu_marker_->width() - kMenuMarkerPaddingRight,
- height() / 2 - menu_marker_->height() / 2,
- menu_marker_->width(),
- menu_marker_->height());
- arrow_bounds.set_x(GetMirroredXForRect(arrow_bounds));
- canvas->DrawImageInt(*menu_marker_, arrow_bounds.x(), arrow_bounds.y());
- }
+ if (show_menu_marker_)
+ PaintMenuMarker(canvas);
}
////////////////////////////////////////////////////////////////////////////////
« ui/views/controls/button/menu_button.h ('K') | « ui/views/controls/button/menu_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698