Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: ui/views/controls/menu/submenu_view.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/menu/submenu_view.h ('k') | ui/views/controls/prefix_selector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/ime/input_method.h"
11 #include "ui/compositor/paint_recorder.h" 12 #include "ui/compositor/paint_recorder.h"
12 #include "ui/events/event.h" 13 #include "ui/events/event.h"
13 #include "ui/gfx/canvas.h" 14 #include "ui/gfx/canvas.h"
14 #include "ui/gfx/geometry/safe_integer_conversions.h" 15 #include "ui/gfx/geometry/safe_integer_conversions.h"
15 #include "ui/views/controls/menu/menu_config.h" 16 #include "ui/views/controls/menu/menu_config.h"
16 #include "ui/views/controls/menu/menu_controller.h" 17 #include "ui/views/controls/menu/menu_controller.h"
17 #include "ui/views/controls/menu/menu_host.h" 18 #include "ui/views/controls/menu/menu_host.h"
18 #include "ui/views/controls/menu/menu_item_view.h" 19 #include "ui/views/controls/menu/menu_item_view.h"
19 #include "ui/views/controls/menu/menu_scroll_view_container.h" 20 #include "ui/views/controls/menu/menu_scroll_view_container.h"
20 #include "ui/views/widget/root_view.h" 21 #include "ui/views/widget/root_view.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 for (int i = 0, count = 0; i < child_count(); ++i) { 74 for (int i = 0, count = 0; i < child_count(); ++i) {
74 if (child_at(i)->id() == MenuItemView::kMenuItemViewID && 75 if (child_at(i)->id() == MenuItemView::kMenuItemViewID &&
75 count++ == index) { 76 count++ == index) {
76 return static_cast<MenuItemView*>(child_at(i)); 77 return static_cast<MenuItemView*>(child_at(i));
77 } 78 }
78 } 79 }
79 NOTREACHED(); 80 NOTREACHED();
80 return NULL; 81 return NULL;
81 } 82 }
82 83
84 PrefixSelector* SubmenuView::GetPrefixSelector() {
85 return &prefix_selector_;
86 }
87
83 void SubmenuView::ChildPreferredSizeChanged(View* child) { 88 void SubmenuView::ChildPreferredSizeChanged(View* child) {
84 if (!resize_open_menu_) 89 if (!resize_open_menu_)
85 return; 90 return;
86 91
87 MenuItemView *item = GetMenuItem(); 92 MenuItemView *item = GetMenuItem();
88 MenuController* controller = item->GetMenuController(); 93 MenuController* controller = item->GetMenuController();
89 94
90 if (controller) { 95 if (controller) {
91 bool dir; 96 bool dir;
92 gfx::Rect bounds = controller->CalculateMenuBounds(item, false, &dir); 97 gfx::Rect bounds = controller->CalculateMenuBounds(item, false, &dir);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return gfx::Size(width, height + insets.height()); 182 return gfx::Size(width, height + insets.height());
178 } 183 }
179 184
180 void SubmenuView::GetAccessibleState(ui::AXViewState* state) { 185 void SubmenuView::GetAccessibleState(ui::AXViewState* state) {
181 // Inherit most of the state from the parent menu item, except the role. 186 // Inherit most of the state from the parent menu item, except the role.
182 if (GetMenuItem()) 187 if (GetMenuItem())
183 GetMenuItem()->GetAccessibleState(state); 188 GetMenuItem()->GetAccessibleState(state);
184 state->role = ui::AX_ROLE_MENU_LIST_POPUP; 189 state->role = ui::AX_ROLE_MENU_LIST_POPUP;
185 } 190 }
186 191
187 ui::TextInputClient* SubmenuView::GetTextInputClient() {
188 return &prefix_selector_;
189 }
190
191 void SubmenuView::PaintChildren(const ui::PaintContext& context) { 192 void SubmenuView::PaintChildren(const ui::PaintContext& context) {
192 View::PaintChildren(context); 193 View::PaintChildren(context);
193 194
194 bool paint_drop_indicator = false; 195 bool paint_drop_indicator = false;
195 if (drop_item_) { 196 if (drop_item_) {
196 switch (drop_position_) { 197 switch (drop_position_) {
197 case MenuDelegate::DROP_NONE: 198 case MenuDelegate::DROP_NONE:
198 case MenuDelegate::DROP_ON: 199 case MenuDelegate::DROP_ON:
199 break; 200 break;
200 case MenuDelegate::DROP_UNKNOWN: 201 case MenuDelegate::DROP_UNKNOWN:
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 y = std::max(y, 0); 510 y = std::max(y, 0);
510 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); 511 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height());
511 if (new_vis_bounds != vis_bounds) { 512 if (new_vis_bounds != vis_bounds) {
512 ScrollRectToVisible(new_vis_bounds); 513 ScrollRectToVisible(new_vis_bounds);
513 return true; 514 return true;
514 } 515 }
515 return false; 516 return false;
516 } 517 }
517 518
518 } // namespace views 519 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/submenu_view.h ('k') | ui/views/controls/prefix_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698