| 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_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| 11 #include "ui/compositor/paint_context.h" |
| 11 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
| 12 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
| 13 #include "ui/gfx/geometry/safe_integer_conversions.h" | 14 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 14 #include "ui/views/controls/menu/menu_config.h" | 15 #include "ui/views/controls/menu/menu_config.h" |
| 15 #include "ui/views/controls/menu/menu_controller.h" | 16 #include "ui/views/controls/menu/menu_controller.h" |
| 16 #include "ui/views/controls/menu/menu_host.h" | 17 #include "ui/views/controls/menu/menu_host.h" |
| 17 #include "ui/views/controls/menu/menu_item_view.h" | 18 #include "ui/views/controls/menu/menu_item_view.h" |
| 18 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 19 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
| 19 #include "ui/views/widget/root_view.h" | 20 #include "ui/views/widget/root_view.h" |
| 20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // Inherit most of the state from the parent menu item, except the role. | 181 // Inherit most of the state from the parent menu item, except the role. |
| 181 if (GetMenuItem()) | 182 if (GetMenuItem()) |
| 182 GetMenuItem()->GetAccessibleState(state); | 183 GetMenuItem()->GetAccessibleState(state); |
| 183 state->role = ui::AX_ROLE_MENU_LIST_POPUP; | 184 state->role = ui::AX_ROLE_MENU_LIST_POPUP; |
| 184 } | 185 } |
| 185 | 186 |
| 186 ui::TextInputClient* SubmenuView::GetTextInputClient() { | 187 ui::TextInputClient* SubmenuView::GetTextInputClient() { |
| 187 return &prefix_selector_; | 188 return &prefix_selector_; |
| 188 } | 189 } |
| 189 | 190 |
| 190 void SubmenuView::PaintChildren(const PaintContext& context) { | 191 void SubmenuView::PaintChildren(const ui::PaintContext& context) { |
| 191 View::PaintChildren(context); | 192 View::PaintChildren(context); |
| 192 | 193 |
| 193 if (drop_item_ && drop_position_ != MenuDelegate::DROP_ON) | 194 if (drop_item_ && drop_position_ != MenuDelegate::DROP_ON) |
| 194 PaintDropIndicator(context.canvas(), drop_item_, drop_position_); | 195 PaintDropIndicator(context.canvas(), drop_item_, drop_position_); |
| 195 } | 196 } |
| 196 | 197 |
| 197 bool SubmenuView::GetDropFormats( | 198 bool SubmenuView::GetDropFormats( |
| 198 int* formats, | 199 int* formats, |
| 199 std::set<OSExchangeData::CustomFormat>* custom_formats) { | 200 std::set<OSExchangeData::CustomFormat>* custom_formats) { |
| 200 DCHECK(GetMenuItem()->GetMenuController()); | 201 DCHECK(GetMenuItem()->GetMenuController()); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 y = std::max(y, 0); | 502 y = std::max(y, 0); |
| 502 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 503 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
| 503 if (new_vis_bounds != vis_bounds) { | 504 if (new_vis_bounds != vis_bounds) { |
| 504 ScrollRectToVisible(new_vis_bounds); | 505 ScrollRectToVisible(new_vis_bounds); |
| 505 return true; | 506 return true; |
| 506 } | 507 } |
| 507 return false; | 508 return false; |
| 508 } | 509 } |
| 509 | 510 |
| 510 } // namespace views | 511 } // namespace views |
| OLD | NEW |