| 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_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 void SubmenuView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 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()->GetAccessibleNodeData(node_data); | 188 GetMenuItem()->GetAccessibleNodeData(node_data); |
| 189 node_data->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 node_data->AddState(ui::AX_STATE_VERTICAL); | 191 node_data->AddState(ui::AX_STATE_VERTICAL); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void SubmenuView::PaintChildren(const ui::PaintContext& context) { | 194 void SubmenuView::PaintChildren(const PaintInfo& paint_info) { |
| 195 View::PaintChildren(context); | 195 View::PaintChildren(paint_info); |
| 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: |
| 202 break; | 202 break; |
| 203 case MenuDelegate::DROP_UNKNOWN: | 203 case MenuDelegate::DROP_UNKNOWN: |
| 204 case MenuDelegate::DROP_BEFORE: | 204 case MenuDelegate::DROP_BEFORE: |
| 205 case MenuDelegate::DROP_AFTER: | 205 case MenuDelegate::DROP_AFTER: |
| 206 paint_drop_indicator = true; | 206 paint_drop_indicator = true; |
| 207 break; | 207 break; |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 if (paint_drop_indicator) { | 211 if (paint_drop_indicator) { |
| 212 gfx::Rect bounds = CalculateDropIndicatorBounds(drop_item_, drop_position_); | 212 gfx::Rect bounds = CalculateDropIndicatorBounds(drop_item_, drop_position_); |
| 213 ui::PaintRecorder recorder(context, size()); | 213 ui::PaintRecorder recorder(paint_info.context(), size()); |
| 214 recorder.canvas()->FillRect(bounds, kDropIndicatorColor); | 214 recorder.canvas()->FillRect(bounds, kDropIndicatorColor); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool SubmenuView::GetDropFormats( | 218 bool SubmenuView::GetDropFormats( |
| 219 int* formats, | 219 int* formats, |
| 220 std::set<ui::Clipboard::FormatType>* format_types) { | 220 std::set<ui::Clipboard::FormatType>* format_types) { |
| 221 DCHECK(GetMenuItem()->GetMenuController()); | 221 DCHECK(GetMenuItem()->GetMenuController()); |
| 222 return GetMenuItem()->GetMenuController()->GetDropFormats(this, formats, | 222 return GetMenuItem()->GetMenuController()->GetDropFormats(this, formats, |
| 223 format_types); | 223 format_types); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 y = std::max(y, 0); | 514 y = std::max(y, 0); |
| 515 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 515 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
| 516 if (new_vis_bounds != vis_bounds) { | 516 if (new_vis_bounds != vis_bounds) { |
| 517 ScrollRectToVisible(new_vis_bounds); | 517 ScrollRectToVisible(new_vis_bounds); |
| 518 return true; | 518 return true; |
| 519 } | 519 } |
| 520 return false; | 520 return false; |
| 521 } | 521 } |
| 522 | 522 |
| 523 } // namespace views | 523 } // namespace views |
| OLD | NEW |