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

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: . Created 5 years, 6 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
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"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 for (int i = 0, count = 0; i < child_count(); ++i) { 73 for (int i = 0, count = 0; i < child_count(); ++i) {
74 if (child_at(i)->id() == MenuItemView::kMenuItemViewID && 74 if (child_at(i)->id() == MenuItemView::kMenuItemViewID &&
75 count++ == index) { 75 count++ == index) {
76 return static_cast<MenuItemView*>(child_at(i)); 76 return static_cast<MenuItemView*>(child_at(i));
77 } 77 }
78 } 78 }
79 NOTREACHED(); 79 NOTREACHED();
80 return NULL; 80 return NULL;
81 } 81 }
82 82
83 PrefixSelector* SubmenuView::GetPrefixSelector() {
84 return &prefix_selector_;
85 }
86
83 void SubmenuView::ChildPreferredSizeChanged(View* child) { 87 void SubmenuView::ChildPreferredSizeChanged(View* child) {
84 if (!resize_open_menu_) 88 if (!resize_open_menu_)
85 return; 89 return;
86 90
87 MenuItemView *item = GetMenuItem(); 91 MenuItemView *item = GetMenuItem();
88 MenuController* controller = item->GetMenuController(); 92 MenuController* controller = item->GetMenuController();
89 93
90 if (controller) { 94 if (controller) {
91 bool dir; 95 bool dir;
92 gfx::Rect bounds = controller->CalculateMenuBounds(item, false, &dir); 96 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()); 181 return gfx::Size(width, height + insets.height());
178 } 182 }
179 183
180 void SubmenuView::GetAccessibleState(ui::AXViewState* state) { 184 void SubmenuView::GetAccessibleState(ui::AXViewState* state) {
181 // Inherit most of the state from the parent menu item, except the role. 185 // Inherit most of the state from the parent menu item, except the role.
182 if (GetMenuItem()) 186 if (GetMenuItem())
183 GetMenuItem()->GetAccessibleState(state); 187 GetMenuItem()->GetAccessibleState(state);
184 state->role = ui::AX_ROLE_MENU_LIST_POPUP; 188 state->role = ui::AX_ROLE_MENU_LIST_POPUP;
185 } 189 }
186 190
187 ui::TextInputClient* SubmenuView::GetTextInputClient() {
188 return &prefix_selector_;
189 }
190
191 void SubmenuView::PaintChildren(const ui::PaintContext& context) { 191 void SubmenuView::PaintChildren(const ui::PaintContext& context) {
192 View::PaintChildren(context); 192 View::PaintChildren(context);
193 193
194 bool paint_drop_indicator = false; 194 bool paint_drop_indicator = false;
195 if (drop_item_) { 195 if (drop_item_) {
196 switch (drop_position_) { 196 switch (drop_position_) {
197 case MenuDelegate::DROP_NONE: 197 case MenuDelegate::DROP_NONE:
198 case MenuDelegate::DROP_ON: 198 case MenuDelegate::DROP_ON:
199 break; 199 break;
200 case MenuDelegate::DROP_UNKNOWN: 200 case MenuDelegate::DROP_UNKNOWN:
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 y = std::max(y, 0); 509 y = std::max(y, 0);
510 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); 510 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height());
511 if (new_vis_bounds != vis_bounds) { 511 if (new_vis_bounds != vis_bounds) {
512 ScrollRectToVisible(new_vis_bounds); 512 ScrollRectToVisible(new_vis_bounds);
513 return true; 513 return true;
514 } 514 }
515 return false; 515 return false;
516 } 516 }
517 517
518 } // namespace views 518 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698