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

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

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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/message_box_view.h » ('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_node_data.h"
11 #include "ui/base/ime/input_method.h" 11 #include "ui/base/ime/input_method.h"
12 #include "ui/compositor/paint_recorder.h" 12 #include "ui/compositor/paint_recorder.h"
13 #include "ui/events/event.h" 13 #include "ui/events/event.h"
14 #include "ui/gfx/canvas.h" 14 #include "ui/gfx/canvas.h"
15 #include "ui/gfx/geometry/safe_integer_conversions.h" 15 #include "ui/gfx/geometry/safe_integer_conversions.h"
16 #include "ui/views/controls/menu/menu_config.h" 16 #include "ui/views/controls/menu/menu_config.h"
17 #include "ui/views/controls/menu/menu_controller.h" 17 #include "ui/views/controls/menu/menu_controller.h"
18 #include "ui/views/controls/menu/menu_host.h" 18 #include "ui/views/controls/menu/menu_host.h"
19 #include "ui/views/controls/menu/menu_item_view.h" 19 #include "ui/views/controls/menu/menu_item_view.h"
20 #include "ui/views/controls/menu/menu_scroll_view_container.h" 20 #include "ui/views/controls/menu/menu_scroll_view_container.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 int height = 0; 174 int height = 0;
175 int menu_item_width = width - insets.width(); 175 int menu_item_width = width - insets.width();
176 for (int i = 0; i < child_count(); ++i) { 176 for (int i = 0; i < child_count(); ++i) {
177 const View* child = child_at(i); 177 const View* child = child_at(i);
178 height += child->visible() ? child->GetHeightForWidth(menu_item_width) : 0; 178 height += child->visible() ? child->GetHeightForWidth(menu_item_width) : 0;
179 } 179 }
180 180
181 return gfx::Size(width, height + insets.height()); 181 return gfx::Size(width, height + insets.height());
182 } 182 }
183 183
184 void SubmenuView::GetAccessibleState(ui::AXViewState* state) { 184 void SubmenuView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
185 // Inherit most of the state from the parent menu item, except the role and 185 // Inherit most of the state from the parent menu item, except the role and
186 // the orientation. 186 // the orientation.
187 if (GetMenuItem()) 187 if (GetMenuItem())
188 GetMenuItem()->GetAccessibleState(state); 188 GetMenuItem()->GetAccessibleNodeData(node_data);
189 state->role = ui::AX_ROLE_MENU_LIST_POPUP; 189 node_data->role = ui::AX_ROLE_MENU_LIST_POPUP;
190 // Menus in Chrome are always traversed in a vertical direction. 190 // Menus in Chrome are always traversed in a vertical direction.
191 state->AddStateFlag(ui::AX_STATE_VERTICAL); 191 node_data->AddStateFlag(ui::AX_STATE_VERTICAL);
192 } 192 }
193 193
194 void SubmenuView::PaintChildren(const ui::PaintContext& context) { 194 void SubmenuView::PaintChildren(const ui::PaintContext& context) {
195 View::PaintChildren(context); 195 View::PaintChildren(context);
196 196
197 bool paint_drop_indicator = false; 197 bool paint_drop_indicator = false;
198 if (drop_item_) { 198 if (drop_item_) {
199 switch (drop_position_) { 199 switch (drop_position_) {
200 case MenuDelegate::DROP_NONE: 200 case MenuDelegate::DROP_NONE:
201 case MenuDelegate::DROP_ON: 201 case MenuDelegate::DROP_ON:
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 y = std::max(y, 0); 512 y = std::max(y, 0);
513 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); 513 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height());
514 if (new_vis_bounds != vis_bounds) { 514 if (new_vis_bounds != vis_bounds) {
515 ScrollRectToVisible(new_vis_bounds); 515 ScrollRectToVisible(new_vis_bounds);
516 return true; 516 return true;
517 } 517 }
518 return false; 518 return false;
519 } 519 }
520 520
521 } // namespace views 521 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/submenu_view.h ('k') | ui/views/controls/message_box_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698