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/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
| 6 | 6 |
| 7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 if (!blocking_run_) | 617 if (!blocking_run_) |
| 618 return false; | 618 return false; |
| 619 | 619 |
| 620 if (possible_drag_) { | 620 if (possible_drag_) { |
| 621 if (View::ExceededDragThreshold(event.location() - press_pt_)) | 621 if (View::ExceededDragThreshold(event.location() - press_pt_)) |
| 622 StartDrag(source, press_pt_); | 622 StartDrag(source, press_pt_); |
| 623 return true; | 623 return true; |
| 624 } | 624 } |
| 625 MenuItemView* mouse_menu = NULL; | 625 MenuItemView* mouse_menu = NULL; |
| 626 if (part.type == MenuPart::MENU_ITEM) { | 626 if (part.type == MenuPart::MENU_ITEM) { |
| 627 if (!part.menu) | 627 // If there is no menu target, but a submenu target, then we are interacting |
| 628 part.menu = source->GetMenuItem(); | 628 // with an empty menu item within a submenu. These cannot become selection |
| 629 else | 629 // targets for mouse interaction, so do not attempt to update selection. |
| 630 mouse_menu = part.menu; | 630 if (!(!part.menu && part.submenu)) { |
|
sky
2017/03/28 23:47:00
This is rather unreadable. How about:
if (part.men
jonross
2017/03/29 16:58:24
Done.
| |
| 631 SetSelection(part.menu ? part.menu : state_.item, SELECTION_OPEN_SUBMENU); | 631 if (!part.menu) |
| 632 part.menu = source->GetMenuItem(); | |
| 633 else | |
| 634 mouse_menu = part.menu; | |
| 635 SetSelection(part.menu ? part.menu : state_.item, SELECTION_OPEN_SUBMENU); | |
| 636 } | |
| 632 } else if (part.type == MenuPart::NONE) { | 637 } else if (part.type == MenuPart::NONE) { |
| 633 ShowSiblingMenu(source, event.location()); | 638 ShowSiblingMenu(source, event.location()); |
| 634 } | 639 } |
| 635 UpdateActiveMouseView(source, event, mouse_menu); | 640 UpdateActiveMouseView(source, event, mouse_menu); |
| 636 | 641 |
| 637 return true; | 642 return true; |
| 638 } | 643 } |
| 639 | 644 |
| 640 void MenuController::OnMouseReleased(SubmenuView* source, | 645 void MenuController::OnMouseReleased(SubmenuView* source, |
| 641 const ui::MouseEvent& event) { | 646 const ui::MouseEvent& event) { |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2752 if (hot_button_) | 2757 if (hot_button_) |
| 2753 hot_button_->SetHotTracked(false); | 2758 hot_button_->SetHotTracked(false); |
| 2754 hot_button_ = hot_button; | 2759 hot_button_ = hot_button; |
| 2755 if (hot_button) { | 2760 if (hot_button) { |
| 2756 hot_button->SetHotTracked(true); | 2761 hot_button->SetHotTracked(true); |
| 2757 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); | 2762 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); |
| 2758 } | 2763 } |
| 2759 } | 2764 } |
| 2760 | 2765 |
| 2761 } // namespace views | 2766 } // namespace views |
| OLD | NEW |