| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } else { | 306 } else { |
| 307 host_ = new MenuHost(this); | 307 host_ = new MenuHost(this); |
| 308 // Force construction of the scroll view container. | 308 // Force construction of the scroll view container. |
| 309 GetScrollViewContainer(); | 309 GetScrollViewContainer(); |
| 310 // Force a layout since our preferred size may not have changed but our | 310 // Force a layout since our preferred size may not have changed but our |
| 311 // content may have. | 311 // content may have. |
| 312 InvalidateLayout(); | 312 InvalidateLayout(); |
| 313 host_->InitMenuHost(parent, bounds, scroll_view_container_, do_capture); | 313 host_->InitMenuHost(parent, bounds, scroll_view_container_, do_capture); |
| 314 } | 314 } |
| 315 | 315 |
| 316 GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent( | 316 GetScrollViewContainer()->NotifyAccessibilityEvent( |
| 317 GetScrollViewContainer(), | |
| 318 ui::AccessibilityTypes::EVENT_MENUSTART, | 317 ui::AccessibilityTypes::EVENT_MENUSTART, |
| 319 true); | 318 true); |
| 320 GetWidget()->NotifyAccessibilityEvent( | 319 NotifyAccessibilityEvent( |
| 321 this, | |
| 322 ui::AccessibilityTypes::EVENT_MENUPOPUPSTART, | 320 ui::AccessibilityTypes::EVENT_MENUPOPUPSTART, |
| 323 true); | 321 true); |
| 324 } | 322 } |
| 325 | 323 |
| 326 void SubmenuView::Reposition(const gfx::Rect& bounds) { | 324 void SubmenuView::Reposition(const gfx::Rect& bounds) { |
| 327 if (host_) | 325 if (host_) |
| 328 host_->SetMenuHostBounds(bounds); | 326 host_->SetMenuHostBounds(bounds); |
| 329 } | 327 } |
| 330 | 328 |
| 331 void SubmenuView::Close() { | 329 void SubmenuView::Close() { |
| 332 if (host_) { | 330 if (host_) { |
| 333 GetWidget()->NotifyAccessibilityEvent( | 331 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_MENUPOPUPEND, true); |
| 334 this, | 332 GetScrollViewContainer()->NotifyAccessibilityEvent( |
| 335 ui::AccessibilityTypes::EVENT_MENUPOPUPEND, | 333 ui::AccessibilityTypes::EVENT_MENUEND, true); |
| 336 true); | |
| 337 GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent( | |
| 338 GetScrollViewContainer(), | |
| 339 ui::AccessibilityTypes::EVENT_MENUEND, | |
| 340 true); | |
| 341 | 334 |
| 342 host_->DestroyMenuHost(); | 335 host_->DestroyMenuHost(); |
| 343 host_ = NULL; | 336 host_ = NULL; |
| 344 } | 337 } |
| 345 } | 338 } |
| 346 | 339 |
| 347 void SubmenuView::Hide() { | 340 void SubmenuView::Hide() { |
| 348 if (host_) | 341 if (host_) |
| 349 host_->HideMenuHost(); | 342 host_->HideMenuHost(); |
| 350 if (scroll_animator_->is_scrolling()) | 343 if (scroll_animator_->is_scrolling()) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 y = std::max(y, 0); | 453 y = std::max(y, 0); |
| 461 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 454 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
| 462 if (new_vis_bounds != vis_bounds) { | 455 if (new_vis_bounds != vis_bounds) { |
| 463 ScrollRectToVisible(new_vis_bounds); | 456 ScrollRectToVisible(new_vis_bounds); |
| 464 return true; | 457 return true; |
| 465 } | 458 } |
| 466 return false; | 459 return false; |
| 467 } | 460 } |
| 468 | 461 |
| 469 } // namespace views | 462 } // namespace views |
| OLD | NEW |