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/renderer/test_runner/web_ax_object_proxy.h" | 5 #include "content/shell/renderer/test_runner/web_ax_object_proxy.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "gin/handle.h" | 8 #include "gin/handle.h" |
9 #include "third_party/WebKit/public/platform/WebPoint.h" | 9 #include "third_party/WebKit/public/platform/WebPoint.h" |
10 #include "third_party/WebKit/public/platform/WebRect.h" | 10 #include "third_party/WebKit/public/platform/WebRect.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 .SetProperty("orientation", &WebAXObjectProxy::Orientation) | 506 .SetProperty("orientation", &WebAXObjectProxy::Orientation) |
507 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) | 507 .SetProperty("clickPointX", &WebAXObjectProxy::ClickPointX) |
508 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) | 508 .SetProperty("clickPointY", &WebAXObjectProxy::ClickPointY) |
509 .SetProperty("rowCount", &WebAXObjectProxy::RowCount) | 509 .SetProperty("rowCount", &WebAXObjectProxy::RowCount) |
510 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) | 510 .SetProperty("columnCount", &WebAXObjectProxy::ColumnCount) |
511 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) | 511 .SetProperty("isClickable", &WebAXObjectProxy::IsClickable) |
512 .SetProperty("isButtonStateMixed", &WebAXObjectProxy::IsButtonStateMixed) | 512 .SetProperty("isButtonStateMixed", &WebAXObjectProxy::IsButtonStateMixed) |
513 .SetMethod("allAttributes", &WebAXObjectProxy::AllAttributes) | 513 .SetMethod("allAttributes", &WebAXObjectProxy::AllAttributes) |
514 .SetMethod("attributesOfChildren", | 514 .SetMethod("attributesOfChildren", |
515 &WebAXObjectProxy::AttributesOfChildren) | 515 &WebAXObjectProxy::AttributesOfChildren) |
516 .SetMethod("ariaControlsElementAtIndex", | |
517 &WebAXObjectProxy::AriaControlsElementAtIndex) | |
518 .SetMethod("ariaFlowToElementAtIndex", | |
519 &WebAXObjectProxy::AriaFlowToElementAtIndex) | |
520 .SetMethod("ariaOwnsElementAtIndex", | |
521 &WebAXObjectProxy::AriaOwnsElementAtIndex) | |
516 .SetMethod("lineForIndex", &WebAXObjectProxy::LineForIndex) | 522 .SetMethod("lineForIndex", &WebAXObjectProxy::LineForIndex) |
517 .SetMethod("boundsForRange", &WebAXObjectProxy::BoundsForRange) | 523 .SetMethod("boundsForRange", &WebAXObjectProxy::BoundsForRange) |
518 .SetMethod("childAtIndex", &WebAXObjectProxy::ChildAtIndex) | 524 .SetMethod("childAtIndex", &WebAXObjectProxy::ChildAtIndex) |
519 .SetMethod("elementAtPoint", &WebAXObjectProxy::ElementAtPoint) | 525 .SetMethod("elementAtPoint", &WebAXObjectProxy::ElementAtPoint) |
520 .SetMethod("tableHeader", &WebAXObjectProxy::TableHeader) | 526 .SetMethod("tableHeader", &WebAXObjectProxy::TableHeader) |
521 .SetMethod("rowIndexRange", &WebAXObjectProxy::RowIndexRange) | 527 .SetMethod("rowIndexRange", &WebAXObjectProxy::RowIndexRange) |
522 .SetMethod("columnIndexRange", &WebAXObjectProxy::ColumnIndexRange) | 528 .SetMethod("columnIndexRange", &WebAXObjectProxy::ColumnIndexRange) |
523 .SetMethod("cellForColumnAndRow", &WebAXObjectProxy::CellForColumnAndRow) | 529 .SetMethod("cellForColumnAndRow", &WebAXObjectProxy::CellForColumnAndRow) |
524 .SetMethod("titleUIElement", &WebAXObjectProxy::TitleUIElement) | 530 .SetMethod("titleUIElement", &WebAXObjectProxy::TitleUIElement) |
525 .SetMethod("setSelectedTextRange", | 531 .SetMethod("setSelectedTextRange", |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 bool WebAXObjectProxy::IsClickable() { | 813 bool WebAXObjectProxy::IsClickable() { |
808 accessibility_object_.updateLayoutAndCheckValidity(); | 814 accessibility_object_.updateLayoutAndCheckValidity(); |
809 return accessibility_object_.isClickable(); | 815 return accessibility_object_.isClickable(); |
810 } | 816 } |
811 | 817 |
812 bool WebAXObjectProxy::IsButtonStateMixed() { | 818 bool WebAXObjectProxy::IsButtonStateMixed() { |
813 accessibility_object_.updateLayoutAndCheckValidity(); | 819 accessibility_object_.updateLayoutAndCheckValidity(); |
814 return accessibility_object_.isButtonStateMixed(); | 820 return accessibility_object_.isButtonStateMixed(); |
815 } | 821 } |
816 | 822 |
823 v8::Handle<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex( | |
824 unsigned index) | |
825 { | |
826 accessibility_object_.updateLayoutAndCheckValidity(); | |
827 blink::WebVector<blink::WebAXObject> elements; | |
828 accessibility_object_.ariaControls(elements); | |
829 size_t elementCount = elements.size(); | |
830 if (index >= elementCount) | |
831 return v8::Handle<v8::Object>(); | |
dmazzoni
2015/01/05 09:12:54
nit: wrong indentation here
| |
832 | |
833 return factory_->GetOrCreate(elements[index]); | |
834 } | |
835 | |
836 v8::Handle<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex( | |
837 unsigned index) | |
838 { | |
839 accessibility_object_.updateLayoutAndCheckValidity(); | |
dmazzoni
2015/01/05 09:12:53
nit: wrong indentation, should be 2 spaces in
| |
840 blink::WebVector<blink::WebAXObject> elements; | |
841 accessibility_object_.ariaFlowTo(elements); | |
842 size_t elementCount = elements.size(); | |
843 if (index >= elementCount) | |
844 return v8::Handle<v8::Object>(); | |
dmazzoni
2015/01/05 09:12:53
same - should be 2
| |
845 | |
846 return factory_->GetOrCreate(elements[index]); | |
847 } | |
848 | |
849 v8::Handle<v8::Object> WebAXObjectProxy::AriaOwnsElementAtIndex(unsigned index) | |
850 { | |
851 accessibility_object_.updateLayoutAndCheckValidity(); | |
852 blink::WebVector<blink::WebAXObject> elements; | |
853 accessibility_object_.ariaOwns(elements); | |
854 size_t elementCount = elements.size(); | |
855 if (index >= elementCount) | |
856 return v8::Handle<v8::Object>(); | |
857 | |
858 return factory_->GetOrCreate(elements[index]); | |
859 } | |
860 | |
817 std::string WebAXObjectProxy::AllAttributes() { | 861 std::string WebAXObjectProxy::AllAttributes() { |
818 accessibility_object_.updateLayoutAndCheckValidity(); | 862 accessibility_object_.updateLayoutAndCheckValidity(); |
819 return GetAttributes(accessibility_object_); | 863 return GetAttributes(accessibility_object_); |
820 } | 864 } |
821 | 865 |
822 std::string WebAXObjectProxy::AttributesOfChildren() { | 866 std::string WebAXObjectProxy::AttributesOfChildren() { |
823 accessibility_object_.updateLayoutAndCheckValidity(); | 867 accessibility_object_.updateLayoutAndCheckValidity(); |
824 AttributesCollector collector; | 868 AttributesCollector collector; |
825 unsigned size = accessibility_object_.childCount(); | 869 unsigned size = accessibility_object_.childCount(); |
826 for (unsigned i = 0; i < size; ++i) | 870 for (unsigned i = 0; i < size; ++i) |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1113 v8::Handle<v8::Value> value_handle = gin::CreateHandle( | 1157 v8::Handle<v8::Value> value_handle = gin::CreateHandle( |
1114 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); | 1158 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); |
1115 if (value_handle.IsEmpty()) | 1159 if (value_handle.IsEmpty()) |
1116 return v8::Handle<v8::Object>(); | 1160 return v8::Handle<v8::Object>(); |
1117 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); | 1161 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); |
1118 elements_.Append(handle); | 1162 elements_.Append(handle); |
1119 return handle; | 1163 return handle; |
1120 } | 1164 } |
1121 | 1165 |
1122 } // namespace content | 1166 } // namespace content |
OLD | NEW |