Chromium Code Reviews| 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/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 base::string16 SubmenuView::GetTextForRow(int row) { | 360 base::string16 SubmenuView::GetTextForRow(int row) { |
| 361 return GetMenuItemAt(row)->title(); | 361 return GetMenuItemAt(row)->title(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool SubmenuView::IsShowing() { | 364 bool SubmenuView::IsShowing() { |
| 365 return host_ && host_->IsMenuHostVisible(); | 365 return host_ && host_->IsMenuHostVisible(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void SubmenuView::ShowAt(Widget* parent, | 368 void SubmenuView::ShowAt(Widget* parent, |
| 369 const gfx::Rect& bounds, | 369 const gfx::Rect& bounds, |
| 370 bool do_capture) { | 370 bool do_capture, |
| 371 bool cancel_active_touches) { | |
|
xiyuan
2017/05/12 20:24:57
ditto, get |cancel_active_touches| from MenuContro
| |
| 371 if (host_) { | 372 if (host_) { |
| 372 host_->ShowMenuHost(do_capture); | 373 host_->ShowMenuHost(do_capture, cancel_active_touches); |
| 373 } else { | 374 } else { |
| 374 host_ = new MenuHost(this); | 375 host_ = new MenuHost(this); |
| 375 // Force construction of the scroll view container. | 376 // Force construction of the scroll view container. |
| 376 GetScrollViewContainer(); | 377 GetScrollViewContainer(); |
| 377 // Force a layout since our preferred size may not have changed but our | 378 // Force a layout since our preferred size may not have changed but our |
| 378 // content may have. | 379 // content may have. |
| 379 InvalidateLayout(); | 380 InvalidateLayout(); |
| 380 host_->InitMenuHost(parent, bounds, scroll_view_container_, do_capture); | 381 host_->InitMenuHost(parent, bounds, scroll_view_container_, do_capture, |
| 382 cancel_active_touches); | |
| 381 } | 383 } |
| 382 | 384 |
| 383 GetScrollViewContainer()->NotifyAccessibilityEvent( | 385 GetScrollViewContainer()->NotifyAccessibilityEvent( |
| 384 ui::AX_EVENT_MENU_START, | 386 ui::AX_EVENT_MENU_START, |
| 385 true); | 387 true); |
| 386 NotifyAccessibilityEvent( | 388 NotifyAccessibilityEvent( |
| 387 ui::AX_EVENT_MENU_POPUP_START, | 389 ui::AX_EVENT_MENU_POPUP_START, |
| 388 true); | 390 true); |
| 389 } | 391 } |
| 390 | 392 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 y = std::max(y, 0); | 516 y = std::max(y, 0); |
| 515 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 517 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
| 516 if (new_vis_bounds != vis_bounds) { | 518 if (new_vis_bounds != vis_bounds) { |
| 517 ScrollRectToVisible(new_vis_bounds); | 519 ScrollRectToVisible(new_vis_bounds); |
| 518 return true; | 520 return true; |
| 519 } | 521 } |
| 520 return false; | 522 return false; |
| 521 } | 523 } |
| 522 | 524 |
| 523 } // namespace views | 525 } // namespace views |
| OLD | NEW |