| 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 "content/shell/test_runner/web_ax_object_proxy.h" | 5 #include "content/shell/test_runner/web_ax_object_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 .SetProperty("isFocused", &WebAXObjectProxy::IsFocused) | 598 .SetProperty("isFocused", &WebAXObjectProxy::IsFocused) |
| 599 .SetProperty("isFocusable", &WebAXObjectProxy::IsFocusable) | 599 .SetProperty("isFocusable", &WebAXObjectProxy::IsFocusable) |
| 600 .SetProperty("isModal", &WebAXObjectProxy::IsModal) | 600 .SetProperty("isModal", &WebAXObjectProxy::IsModal) |
| 601 .SetProperty("isSelected", &WebAXObjectProxy::IsSelected) | 601 .SetProperty("isSelected", &WebAXObjectProxy::IsSelected) |
| 602 .SetProperty("isSelectable", &WebAXObjectProxy::IsSelectable) | 602 .SetProperty("isSelectable", &WebAXObjectProxy::IsSelectable) |
| 603 .SetProperty("isMultiLine", &WebAXObjectProxy::IsMultiLine) | 603 .SetProperty("isMultiLine", &WebAXObjectProxy::IsMultiLine) |
| 604 .SetProperty("isMultiSelectable", &WebAXObjectProxy::IsMultiSelectable) | 604 .SetProperty("isMultiSelectable", &WebAXObjectProxy::IsMultiSelectable) |
| 605 .SetProperty("isSelectedOptionActive", | 605 .SetProperty("isSelectedOptionActive", |
| 606 &WebAXObjectProxy::IsSelectedOptionActive) | 606 &WebAXObjectProxy::IsSelectedOptionActive) |
| 607 .SetProperty("isExpanded", &WebAXObjectProxy::IsExpanded) | 607 .SetProperty("isExpanded", &WebAXObjectProxy::IsExpanded) |
| 608 .SetProperty("isChecked", &WebAXObjectProxy::IsChecked) | 608 .SetProperty("checkedState", &WebAXObjectProxy::CheckedState) |
| 609 .SetProperty("pressedState", &WebAXObjectProxy::PressedState) |
| 609 .SetProperty("isVisible", &WebAXObjectProxy::IsVisible) | 610 .SetProperty("isVisible", &WebAXObjectProxy::IsVisible) |
| 610 .SetProperty("isOffScreen", &WebAXObjectProxy::IsOffScreen) | 611 .SetProperty("isOffScreen", &WebAXObjectProxy::IsOffScreen) |
| 611 .SetProperty("isCollapsed", &WebAXObjectProxy::IsCollapsed) | 612 .SetProperty("isCollapsed", &WebAXObjectProxy::IsCollapsed) |
| 612 .SetProperty("hasPopup", &WebAXObjectProxy::HasPopup) | 613 .SetProperty("hasPopup", &WebAXObjectProxy::HasPopup) |
| 613 .SetProperty("isValid", &WebAXObjectProxy::IsValid) | 614 .SetProperty("isValid", &WebAXObjectProxy::IsValid) |
| 614 .SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly) | 615 .SetProperty("isReadOnly", &WebAXObjectProxy::IsReadOnly) |
| 615 .SetProperty("backgroundColor", &WebAXObjectProxy::BackgroundColor) | 616 .SetProperty("backgroundColor", &WebAXObjectProxy::BackgroundColor) |
| 616 .SetProperty("color", &WebAXObjectProxy::Color) | 617 .SetProperty("color", &WebAXObjectProxy::Color) |
| 617 .SetProperty("colorValue", &WebAXObjectProxy::ColorValue) | 618 .SetProperty("colorValue", &WebAXObjectProxy::ColorValue) |
| 618 .SetProperty("fontFamily", &WebAXObjectProxy::FontFamily) | 619 .SetProperty("fontFamily", &WebAXObjectProxy::FontFamily) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 629 .SetProperty("hierarchicalLevel", &WebAXObjectProxy::HierarchicalLevel) | 630 .SetProperty("hierarchicalLevel", &WebAXObjectProxy::HierarchicalLevel) |
| 630 .SetProperty("posInSet", &WebAXObjectProxy::PosInSet) | 631 .SetProperty("posInSet", &WebAXObjectProxy::PosInSet) |
| 631 .SetProperty("setSize", &WebAXObjectProxy::SetSize) | 632 .SetProperty("setSize", &WebAXObjectProxy::SetSize) |
| 632 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) | 633 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) |
| 633 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) | 634 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) |
| 634 .SetProperty("rowCount", &WebAXObjectProxy::RowCount) | 635 .SetProperty("rowCount", &WebAXObjectProxy::RowCount) |
| 635 .SetProperty("rowHeadersCount", &WebAXObjectProxy::RowHeadersCount) | 636 .SetProperty("rowHeadersCount", &WebAXObjectProxy::RowHeadersCount) |
| 636 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) | 637 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) |
| 637 .SetProperty("columnHeadersCount", &WebAXObjectProxy::ColumnHeadersCount) | 638 .SetProperty("columnHeadersCount", &WebAXObjectProxy::ColumnHeadersCount) |
| 638 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) | 639 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) |
| 639 .SetProperty("isButtonStateMixed", &WebAXObjectProxy::IsButtonStateMixed) | |
| 640 // | 640 // |
| 641 // NEW bounding rect calculation - high-level interface | 641 // NEW bounding rect calculation - high-level interface |
| 642 // | 642 // |
| 643 .SetProperty("boundsX", &WebAXObjectProxy::BoundsX) | 643 .SetProperty("boundsX", &WebAXObjectProxy::BoundsX) |
| 644 .SetProperty("boundsY", &WebAXObjectProxy::BoundsY) | 644 .SetProperty("boundsY", &WebAXObjectProxy::BoundsY) |
| 645 .SetProperty("boundsWidth", &WebAXObjectProxy::BoundsWidth) | 645 .SetProperty("boundsWidth", &WebAXObjectProxy::BoundsWidth) |
| 646 .SetProperty("boundsHeight", &WebAXObjectProxy::BoundsHeight) | 646 .SetProperty("boundsHeight", &WebAXObjectProxy::BoundsHeight) |
| 647 .SetMethod("allAttributes", &WebAXObjectProxy::AllAttributes) | 647 .SetMethod("allAttributes", &WebAXObjectProxy::AllAttributes) |
| 648 .SetMethod("attributesOfChildren", | 648 .SetMethod("attributesOfChildren", |
| 649 &WebAXObjectProxy::AttributesOfChildren) | 649 &WebAXObjectProxy::AttributesOfChildren) |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 bool WebAXObjectProxy::IsSelectedOptionActive() { | 1030 bool WebAXObjectProxy::IsSelectedOptionActive() { |
| 1031 accessibility_object_.UpdateLayoutAndCheckValidity(); | 1031 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1032 return accessibility_object_.IsSelectedOptionActive(); | 1032 return accessibility_object_.IsSelectedOptionActive(); |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 bool WebAXObjectProxy::IsExpanded() { | 1035 bool WebAXObjectProxy::IsExpanded() { |
| 1036 accessibility_object_.UpdateLayoutAndCheckValidity(); | 1036 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1037 return accessibility_object_.IsExpanded() == blink::kWebAXExpandedExpanded; | 1037 return accessibility_object_.IsExpanded() == blink::kWebAXExpandedExpanded; |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 bool WebAXObjectProxy::IsChecked() { | 1040 std::string WebAXObjectProxy::CheckedState() { |
| 1041 accessibility_object_.UpdateLayoutAndCheckValidity(); | 1041 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1042 return accessibility_object_.CheckedState() != blink::WebAXCheckedFalse; | 1042 switch (accessibility_object_.CheckedState()) { |
| 1043 case blink::WebAXButtonStateOn: |
| 1044 return "true"; |
| 1045 case blink::WebAXButtonStateMixed: |
| 1046 return "mixed"; |
| 1047 default: |
| 1048 return "false"; |
| 1049 } |
| 1050 } |
| 1051 |
| 1052 std::string WebAXObjectProxy::PressedState() { |
| 1053 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1054 switch (accessibility_object_.PressedState()) { |
| 1055 case blink::WebAXButtonStateOn: |
| 1056 return "true"; |
| 1057 case blink::WebAXButtonStateMixed: |
| 1058 return "mixed"; |
| 1059 default: |
| 1060 return "false"; |
| 1061 } |
| 1043 } | 1062 } |
| 1044 | 1063 |
| 1045 bool WebAXObjectProxy::IsCollapsed() { | 1064 bool WebAXObjectProxy::IsCollapsed() { |
| 1046 accessibility_object_.UpdateLayoutAndCheckValidity(); | 1065 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1047 return accessibility_object_.IsExpanded() == blink::kWebAXExpandedCollapsed; | 1066 return accessibility_object_.IsExpanded() == blink::kWebAXExpandedCollapsed; |
| 1048 } | 1067 } |
| 1049 | 1068 |
| 1050 bool WebAXObjectProxy::IsVisible() { | 1069 bool WebAXObjectProxy::IsVisible() { |
| 1051 accessibility_object_.UpdateLayoutAndCheckValidity(); | 1070 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1052 return accessibility_object_.IsVisible(); | 1071 return accessibility_object_.IsVisible(); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 blink::WebVector<blink::WebAXObject> headers; | 1267 blink::WebVector<blink::WebAXObject> headers; |
| 1249 accessibility_object_.ColumnHeaders(headers); | 1268 accessibility_object_.ColumnHeaders(headers); |
| 1250 return static_cast<int32_t>(headers.size()); | 1269 return static_cast<int32_t>(headers.size()); |
| 1251 } | 1270 } |
| 1252 | 1271 |
| 1253 bool WebAXObjectProxy::IsClickable() { | 1272 bool WebAXObjectProxy::IsClickable() { |
| 1254 accessibility_object_.UpdateLayoutAndCheckValidity(); | 1273 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1255 return accessibility_object_.IsClickable(); | 1274 return accessibility_object_.IsClickable(); |
| 1256 } | 1275 } |
| 1257 | 1276 |
| 1258 bool WebAXObjectProxy::IsButtonStateMixed() { | |
| 1259 accessibility_object_.UpdateLayoutAndCheckValidity(); | |
| 1260 return accessibility_object_.CheckedState() == blink::WebAXCheckedMixed; | |
| 1261 } | |
| 1262 | |
| 1263 v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex( | 1277 v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex( |
| 1264 unsigned index) { | 1278 unsigned index) { |
| 1265 accessibility_object_.UpdateLayoutAndCheckValidity(); | 1279 accessibility_object_.UpdateLayoutAndCheckValidity(); |
| 1266 SparseAttributeAdapter attribute_adapter; | 1280 SparseAttributeAdapter attribute_adapter; |
| 1267 accessibility_object_.GetSparseAXAttributes(attribute_adapter); | 1281 accessibility_object_.GetSparseAXAttributes(attribute_adapter); |
| 1268 blink::WebVector<blink::WebAXObject> elements = | 1282 blink::WebVector<blink::WebAXObject> elements = |
| 1269 attribute_adapter.object_vector_attributes | 1283 attribute_adapter.object_vector_attributes |
| 1270 [blink::WebAXObjectVectorAttribute::kAriaControls]; | 1284 [blink::WebAXObjectVectorAttribute::kAriaControls]; |
| 1271 size_t elementCount = elements.size(); | 1285 size_t elementCount = elements.size(); |
| 1272 if (index >= elementCount) | 1286 if (index >= elementCount) |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 v8::Local<v8::Value> value_handle = | 1894 v8::Local<v8::Value> value_handle = |
| 1881 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8(); | 1895 gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8(); |
| 1882 if (value_handle.IsEmpty()) | 1896 if (value_handle.IsEmpty()) |
| 1883 return v8::Local<v8::Object>(); | 1897 return v8::Local<v8::Object>(); |
| 1884 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); | 1898 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); |
| 1885 elements_.Append(handle); | 1899 elements_.Append(handle); |
| 1886 return handle; | 1900 return handle; |
| 1887 } | 1901 } |
| 1888 | 1902 |
| 1889 } // namespace test_runner | 1903 } // namespace test_runner |
| OLD | NEW |