| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/accessibility/InspectorAccessibilityAgent.h" | 5 #include "modules/accessibility/InspectorAccessibilityAgent.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/dom/AXObjectCache.h" | 9 #include "core/dom/AXObjectCache.h" |
| 10 #include "core/dom/DOMNodeIds.h" | 10 #include "core/dom/DOMNodeIds.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 CreateBooleanValue(false, AXValueTypeEnum::BooleanOrUndefined))); | 283 CreateBooleanValue(false, AXValueTypeEnum::BooleanOrUndefined))); |
| 284 break; | 284 break; |
| 285 case kExpandedExpanded: | 285 case kExpandedExpanded: |
| 286 properties.addItem(CreateProperty( | 286 properties.addItem(CreateProperty( |
| 287 AXWidgetStatesEnum::Expanded, | 287 AXWidgetStatesEnum::Expanded, |
| 288 CreateBooleanValue(true, AXValueTypeEnum::BooleanOrUndefined))); | 288 CreateBooleanValue(true, AXValueTypeEnum::BooleanOrUndefined))); |
| 289 break; | 289 break; |
| 290 } | 290 } |
| 291 | 291 |
| 292 if (role == kToggleButtonRole) { | 292 if (role == kToggleButtonRole) { |
| 293 if (!ax_object.IsPressed()) { | 293 const AccessibilityButtonState pressed = ax_object.PressedState(); |
| 294 properties.addItem( | 294 const char* pressed_str = |
| 295 CreateProperty(AXWidgetStatesEnum::Pressed, | 295 pressed == kButtonStateOn |
| 296 CreateValue("false", AXValueTypeEnum::Tristate))); | 296 ? "true" |
| 297 } else { | 297 : (pressed == kButtonStateMixed ? "mixed" : "false"); |
| 298 const AtomicString& pressed_attr = | 298 properties.addItem( |
| 299 ax_object.GetAttribute(HTMLNames::aria_pressedAttr); | 299 CreateProperty(AXWidgetStatesEnum::Pressed, |
| 300 if (EqualIgnoringASCIICase(pressed_attr, "mixed")) | 300 CreateValue(pressed_str, AXValueTypeEnum::Tristate))); |
| 301 properties.addItem( | |
| 302 CreateProperty(AXWidgetStatesEnum::Pressed, | |
| 303 CreateValue("mixed", AXValueTypeEnum::Tristate))); | |
| 304 else | |
| 305 properties.addItem( | |
| 306 CreateProperty(AXWidgetStatesEnum::Pressed, | |
| 307 CreateValue("true", AXValueTypeEnum::Tristate))); | |
| 308 } | |
| 309 } | 301 } |
| 310 | 302 |
| 311 if (RoleAllowsSelected(role)) { | 303 if (RoleAllowsSelected(role)) { |
| 312 properties.addItem( | 304 properties.addItem( |
| 313 CreateProperty(AXWidgetStatesEnum::Selected, | 305 CreateProperty(AXWidgetStatesEnum::Selected, |
| 314 CreateBooleanValue(ax_object.IsSelected()))); | 306 CreateBooleanValue(ax_object.IsSelected()))); |
| 315 } | 307 } |
| 316 | 308 |
| 317 if (RoleAllowsModal(role)) { | 309 if (RoleAllowsModal(role)) { |
| 318 properties.addItem(CreateProperty(AXWidgetStatesEnum::Modal, | 310 properties.addItem(CreateProperty(AXWidgetStatesEnum::Modal, |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 731 } |
| 740 } | 732 } |
| 741 | 733 |
| 742 DEFINE_TRACE(InspectorAccessibilityAgent) { | 734 DEFINE_TRACE(InspectorAccessibilityAgent) { |
| 743 visitor->Trace(page_); | 735 visitor->Trace(page_); |
| 744 visitor->Trace(dom_agent_); | 736 visitor->Trace(dom_agent_); |
| 745 InspectorBaseAgent::Trace(visitor); | 737 InspectorBaseAgent::Trace(visitor); |
| 746 } | 738 } |
| 747 | 739 |
| 748 } // namespace blink | 740 } // namespace blink |
| OLD | NEW |