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); |
} |
//////////////////////////////////////////////////////////////////////////////// |