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

Side by Side Diff: views/controls/button/menu_button.cc

Issue 6462022: It turns out I had the sense of the GetLocalBounds bool wrong everywhere, so ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/button/menu_button.h" 5 #include "views/controls/button/menu_button.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "grit/app_strings.h" 8 #include "grit/app_strings.h"
9 #include "grit/app_resources.h" 9 #include "grit/app_resources.h"
10 #include "ui/base/dragdrop/drag_drop_types.h" 10 #include "ui/base/dragdrop/drag_drop_types.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 bool MenuButton::Activate() { 121 bool MenuButton::Activate() {
122 SetState(BS_PUSHED); 122 SetState(BS_PUSHED);
123 // We need to synchronously paint here because subsequently we enter a 123 // We need to synchronously paint here because subsequently we enter a
124 // menu modal loop which will stop this window from updating and 124 // menu modal loop which will stop this window from updating and
125 // receiving the paint message that should be spawned by SetState until 125 // receiving the paint message that should be spawned by SetState until
126 // after the menu closes. 126 // after the menu closes.
127 PaintNow(); 127 PaintNow();
128 if (menu_delegate_) { 128 if (menu_delegate_) {
129 gfx::Rect lb = GetContentsBounds(); 129 gfx::Rect lb = GetLocalBounds();
130 130
131 // The position of the menu depends on whether or not the locale is 131 // The position of the menu depends on whether or not the locale is
132 // right-to-left. 132 // right-to-left.
133 gfx::Point menu_position(lb.right(), lb.bottom()); 133 gfx::Point menu_position(lb.right(), lb.bottom());
134 if (base::i18n::IsRTL()) 134 if (base::i18n::IsRTL())
135 menu_position.set_x(lb.x()); 135 menu_position.set_x(lb.x());
136 136
137 View::ConvertPointToScreen(this, &menu_position); 137 View::ConvertPointToScreen(this, &menu_position);
138 if (base::i18n::IsRTL()) 138 if (base::i18n::IsRTL())
139 menu_position.Offset(-menu_offset_.x(), menu_offset_.y()); 139 menu_position.Offset(-menu_offset_.x(), menu_offset_.y());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 AccessibilityTypes::State MenuButton::GetAccessibleState() { 267 AccessibilityTypes::State MenuButton::GetAccessibleState() {
268 return AccessibilityTypes::STATE_HASPOPUP; 268 return AccessibilityTypes::STATE_HASPOPUP;
269 } 269 }
270 270
271 std::string MenuButton::GetClassName() const { 271 std::string MenuButton::GetClassName() const {
272 return kViewClassName; 272 return kViewClassName;
273 } 273 }
274 274
275 } // namespace views 275 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698