| 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 "third_party/skia/include/core/SkPaint.h" | 7 #include "third_party/skia/include/core/SkPaint.h" |
| 8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "ui/accessibility/ax_view_state.h" | 9 #include "ui/accessibility/ax_view_state.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 void MenuScrollViewContainer::GetAccessibleState( | 253 void MenuScrollViewContainer::GetAccessibleState( |
| 254 ui::AXViewState* state) { | 254 ui::AXViewState* state) { |
| 255 // Get the name from the submenu view. | 255 // Get the name from the submenu view. |
| 256 content_view_->GetAccessibleState(state); | 256 content_view_->GetAccessibleState(state); |
| 257 | 257 |
| 258 // Now change the role. | 258 // Now change the role. |
| 259 state->role = ui::AX_ROLE_MENU_BAR; | 259 state->role = ui::AX_ROLE_MENU_BAR; |
| 260 // Some AT (like NVDA) will not process focus events on menu item children | 260 // Some AT (like NVDA) will not process focus events on menu item children |
| 261 // unless a parent claims to be focused. | 261 // unless a parent claims to be focused. |
| 262 state->state = ui::AX_STATE_FOCUSED; | 262 state->AddStateFlag(ui::AX_STATE_FOCUSED); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void MenuScrollViewContainer::OnBoundsChanged( | 265 void MenuScrollViewContainer::OnBoundsChanged( |
| 266 const gfx::Rect& previous_bounds) { | 266 const gfx::Rect& previous_bounds) { |
| 267 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 267 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); |
| 268 scroll_up_button_->SetVisible(content_pref.height() > height()); | 268 scroll_up_button_->SetVisible(content_pref.height() > height()); |
| 269 scroll_down_button_->SetVisible(content_pref.height() > height()); | 269 scroll_down_button_->SetVisible(content_pref.height() > height()); |
| 270 Layout(); | 270 Layout(); |
| 271 } | 271 } |
| 272 | 272 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 case views::MenuItemView::BUBBLE_ABOVE: | 324 case views::MenuItemView::BUBBLE_ABOVE: |
| 325 return BubbleBorder::BOTTOM_CENTER; | 325 return BubbleBorder::BOTTOM_CENTER; |
| 326 case views::MenuItemView::BUBBLE_BELOW: | 326 case views::MenuItemView::BUBBLE_BELOW: |
| 327 return BubbleBorder::TOP_CENTER; | 327 return BubbleBorder::TOP_CENTER; |
| 328 default: | 328 default: |
| 329 return BubbleBorder::NONE; | 329 return BubbleBorder::NONE; |
| 330 } | 330 } |
| 331 } | 331 } |
| 332 | 332 |
| 333 } // namespace views | 333 } // namespace views |
| OLD | NEW |