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

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: unbork test Created 7 years, 2 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..3d94222545170cdd12a8ee61bc678c0b8fc9b1e2 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) {
sky 2013/10/03 23:23:11 In general smaller patches are preferable. They ma
noms (inactive) 2013/10/07 21:18:15 Done.
+ const 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());
+}
+
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);
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698