OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/submenu_view.h" | 5 #include "ui/views/controls/menu/submenu_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 const gfx::Rect& bounds, | 301 const gfx::Rect& bounds, |
302 bool do_capture) { | 302 bool do_capture) { |
303 if (host_) { | 303 if (host_) { |
304 host_->ShowMenuHost(do_capture); | 304 host_->ShowMenuHost(do_capture); |
305 } else { | 305 } else { |
306 host_ = new MenuHost(this); | 306 host_ = new MenuHost(this); |
307 // Force construction of the scroll view container. | 307 // Force construction of the scroll view container. |
308 GetScrollViewContainer(); | 308 GetScrollViewContainer(); |
309 // Force a layout since our preferred size may not have changed but our | 309 // Force a layout since our preferred size may not have changed but our |
310 // content may have. | 310 // content may have. |
311 InvalidateLayout(); | 311 Layout(); |
312 host_->InitMenuHost(parent, bounds, scroll_view_container_, do_capture); | 312 host_->InitMenuHost(parent, bounds, scroll_view_container_, do_capture); |
313 } | 313 } |
314 | 314 |
315 GetScrollViewContainer()->NotifyAccessibilityEvent( | 315 GetScrollViewContainer()->NotifyAccessibilityEvent( |
316 ui::AccessibilityTypes::EVENT_MENUSTART, | 316 ui::AccessibilityTypes::EVENT_MENUSTART, |
317 true); | 317 true); |
318 NotifyAccessibilityEvent( | 318 NotifyAccessibilityEvent( |
319 ui::AccessibilityTypes::EVENT_MENUPOPUPSTART, | 319 ui::AccessibilityTypes::EVENT_MENUPOPUPSTART, |
320 true); | 320 true); |
321 } | 321 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 y = std::max(y, 0); | 452 y = std::max(y, 0); |
453 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 453 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
454 if (new_vis_bounds != vis_bounds) { | 454 if (new_vis_bounds != vis_bounds) { |
455 ScrollRectToVisible(new_vis_bounds); | 455 ScrollRectToVisible(new_vis_bounds); |
456 return true; | 456 return true; |
457 } | 457 } |
458 return false; | 458 return false; |
459 } | 459 } |
460 | 460 |
461 } // namespace views | 461 } // namespace views |
OLD | NEW |