OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/accessibility/blink_ax_enum_conversion.h" | 5 #include "content/renderer/accessibility/blink_ax_enum_conversion.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 uint32_t AXStateFromBlink(const blink::WebAXObject& o) { | 11 uint32_t AXStateFromBlink(const blink::WebAXObject& o) { |
12 uint32_t state = 0; | 12 uint32_t state = 0; |
13 if (o.isChecked()) | 13 if (o.isChecked()) |
14 state |= (1 << ui::AX_STATE_CHECKED); | 14 state |= (1 << ui::AX_STATE_CHECKED); |
15 | 15 |
16 blink::WebAXExpanded expanded = o.isExpanded(); | 16 blink::WebAXExpanded expanded = o.isExpanded(); |
17 if (expanded) { | 17 if (expanded) { |
18 if (expanded == blink::WebAXExpandedCollapsed) | 18 if (expanded == blink::WebAXExpandedCollapsed) |
19 state |= (1 << ui::AX_STATE_COLLAPSED); | 19 state |= (1 << ui::AX_STATE_COLLAPSED); |
20 else if (expanded == blink::WebAXExpandedExpanded) | 20 else if (expanded == blink::WebAXExpandedExpanded) |
21 state |= (1 << ui::AX_STATE_EXPANDED); | 21 state |= (1 << ui::AX_STATE_EXPANDED); |
22 } | 22 } |
23 | 23 |
24 if (o.canSetFocusAttribute()) | 24 if (o.canSetFocusAttribute()) |
25 state |= (1 << ui::AX_STATE_FOCUSABLE); | 25 state |= (1 << ui::AX_STATE_FOCUSABLE); |
26 | 26 |
27 if (o.isFocused()) | |
28 state |= (1 << ui::AX_STATE_FOCUSED); | |
29 | |
30 if (o.role() == blink::WebAXRolePopUpButton || | 27 if (o.role() == blink::WebAXRolePopUpButton || |
31 o.ariaHasPopup()) | 28 o.ariaHasPopup()) |
32 state |= (1 << ui::AX_STATE_HASPOPUP); | 29 state |= (1 << ui::AX_STATE_HASPOPUP); |
33 | 30 |
34 if (o.isHovered()) | 31 if (o.isHovered()) |
35 state |= (1 << ui::AX_STATE_HOVERED); | 32 state |= (1 << ui::AX_STATE_HOVERED); |
36 | 33 |
37 if (!o.isVisible()) | 34 if (!o.isVisible()) |
38 state |= (1 << ui::AX_STATE_INVISIBLE); | 35 state |= (1 << ui::AX_STATE_INVISIBLE); |
39 | 36 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 case blink::WebAXDescriptionFromRelatedElement: | 515 case blink::WebAXDescriptionFromRelatedElement: |
519 return ui::AX_DESCRIPTION_FROM_RELATED_ELEMENT; | 516 return ui::AX_DESCRIPTION_FROM_RELATED_ELEMENT; |
520 default: | 517 default: |
521 NOTREACHED(); | 518 NOTREACHED(); |
522 } | 519 } |
523 | 520 |
524 return ui::AX_DESCRIPTION_FROM_UNINITIALIZED; | 521 return ui::AX_DESCRIPTION_FROM_UNINITIALIZED; |
525 } | 522 } |
526 | 523 |
527 } // namespace content. | 524 } // namespace content. |
OLD | NEW |