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/menu_scroll_view_container.h" | 5 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
9 #include "third_party/skia/include/core/SkPath.h" | 9 #include "third_party/skia/include/core/SkPath.h" |
10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 NativeTheme::kMenuPopupBackground, NativeTheme::kNormal, bounds, extra); | 256 NativeTheme::kMenuPopupBackground, NativeTheme::kNormal, bounds, extra); |
257 } | 257 } |
258 | 258 |
259 void MenuScrollViewContainer::GetAccessibleState( | 259 void MenuScrollViewContainer::GetAccessibleState( |
260 ui::AXViewState* state) { | 260 ui::AXViewState* state) { |
261 // Get the name from the submenu view. | 261 // Get the name from the submenu view. |
262 content_view_->GetAccessibleState(state); | 262 content_view_->GetAccessibleState(state); |
263 | 263 |
264 // Now change the role. | 264 // Now change the role. |
265 state->role = ui::AX_ROLE_MENU_BAR; | 265 state->role = ui::AX_ROLE_MENU_BAR; |
266 // Some AT (like NVDA) will not process focus events on menu item children | |
267 // unless a parent claims to be focused. | |
268 state->AddStateFlag(ui::AX_STATE_FOCUSED); | |
269 } | 266 } |
270 | 267 |
271 void MenuScrollViewContainer::OnBoundsChanged( | 268 void MenuScrollViewContainer::OnBoundsChanged( |
272 const gfx::Rect& previous_bounds) { | 269 const gfx::Rect& previous_bounds) { |
273 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 270 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); |
274 scroll_up_button_->SetVisible(content_pref.height() > height()); | 271 scroll_up_button_->SetVisible(content_pref.height() > height()); |
275 scroll_down_button_->SetVisible(content_pref.height() > height()); | 272 scroll_down_button_->SetVisible(content_pref.height() > height()); |
276 Layout(); | 273 Layout(); |
277 } | 274 } |
278 | 275 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 case MENU_ANCHOR_BUBBLE_ABOVE: | 319 case MENU_ANCHOR_BUBBLE_ABOVE: |
323 return BubbleBorder::BOTTOM_CENTER; | 320 return BubbleBorder::BOTTOM_CENTER; |
324 case MENU_ANCHOR_BUBBLE_BELOW: | 321 case MENU_ANCHOR_BUBBLE_BELOW: |
325 return BubbleBorder::TOP_CENTER; | 322 return BubbleBorder::TOP_CENTER; |
326 default: | 323 default: |
327 return BubbleBorder::NONE; | 324 return BubbleBorder::NONE; |
328 } | 325 } |
329 } | 326 } |
330 | 327 |
331 } // namespace views | 328 } // namespace views |
OLD | NEW |