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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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("lineForIndex", &WebAXObjectProxy::LineForIndex) | 516 .SetMethod("lineForIndex", &WebAXObjectProxy::LineForIndex) |
517 .SetMethod("boundsForRange", &WebAXObjectProxy::BoundsForRange) | 517 .SetMethod("boundsForRange", &WebAXObjectProxy::BoundsForRange) |
518 .SetMethod("childAtIndex", &WebAXObjectProxy::ChildAtIndex) | 518 .SetMethod("childAtIndex", &WebAXObjectProxy::ChildAtIndex) |
519 .SetMethod("elementAtPoint", &WebAXObjectProxy::ElementAtPoint) | 519 .SetMethod("elementAtPoint", &WebAXObjectProxy::ElementAtPoint) |
520 .SetMethod("tableHeader", &WebAXObjectProxy::TableHeader) | 520 .SetMethod("tableHeader", &WebAXObjectProxy::TableHeader) |
| 521 .SetMethod("rowHeaderAtIndex", &WebAXObjectProxy::RowHeaderAtIndex) |
| 522 .SetMethod("columnHeaderAtIndex", &WebAXObjectProxy::ColumnHeaderAtIndex) |
521 .SetMethod("rowIndexRange", &WebAXObjectProxy::RowIndexRange) | 523 .SetMethod("rowIndexRange", &WebAXObjectProxy::RowIndexRange) |
522 .SetMethod("columnIndexRange", &WebAXObjectProxy::ColumnIndexRange) | 524 .SetMethod("columnIndexRange", &WebAXObjectProxy::ColumnIndexRange) |
523 .SetMethod("cellForColumnAndRow", &WebAXObjectProxy::CellForColumnAndRow) | 525 .SetMethod("cellForColumnAndRow", &WebAXObjectProxy::CellForColumnAndRow) |
524 .SetMethod("titleUIElement", &WebAXObjectProxy::TitleUIElement) | 526 .SetMethod("titleUIElement", &WebAXObjectProxy::TitleUIElement) |
525 .SetMethod("setSelectedTextRange", | 527 .SetMethod("setSelectedTextRange", |
526 &WebAXObjectProxy::SetSelectedTextRange) | 528 &WebAXObjectProxy::SetSelectedTextRange) |
527 .SetMethod("isAttributeSettable", &WebAXObjectProxy::IsAttributeSettable) | 529 .SetMethod("isAttributeSettable", &WebAXObjectProxy::IsAttributeSettable) |
528 .SetMethod("isPressActionSupported", | 530 .SetMethod("isPressActionSupported", |
529 &WebAXObjectProxy::IsPressActionSupported) | 531 &WebAXObjectProxy::IsPressActionSupported) |
530 .SetMethod("isIncrementActionSupported", | 532 .SetMethod("isIncrementActionSupported", |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 | 885 |
884 v8::Handle<v8::Object> WebAXObjectProxy::TableHeader() { | 886 v8::Handle<v8::Object> WebAXObjectProxy::TableHeader() { |
885 accessibility_object_.updateLayoutAndCheckValidity(); | 887 accessibility_object_.updateLayoutAndCheckValidity(); |
886 blink::WebAXObject obj = accessibility_object_.headerContainerObject(); | 888 blink::WebAXObject obj = accessibility_object_.headerContainerObject(); |
887 if (obj.isNull()) | 889 if (obj.isNull()) |
888 return v8::Handle<v8::Object>(); | 890 return v8::Handle<v8::Object>(); |
889 | 891 |
890 return factory_->GetOrCreate(obj); | 892 return factory_->GetOrCreate(obj); |
891 } | 893 } |
892 | 894 |
| 895 v8::Handle<v8::Object> WebAXObjectProxy::RowHeaderAtIndex(unsigned index) { |
| 896 accessibility_object_.updateLayoutAndCheckValidity(); |
| 897 blink::WebVector<blink::WebAXObject> headers; |
| 898 accessibility_object_.rowHeaders(headers); |
| 899 size_t headerCount = headers.size(); |
| 900 if (index >= headerCount) |
| 901 return v8::Handle<v8::Object>(); |
| 902 |
| 903 return factory_->GetOrCreate(headers[index]); |
| 904 } |
| 905 |
| 906 v8::Handle<v8::Object> WebAXObjectProxy::ColumnHeaderAtIndex(unsigned index) { |
| 907 accessibility_object_.updateLayoutAndCheckValidity(); |
| 908 blink::WebVector<blink::WebAXObject> headers; |
| 909 accessibility_object_.columnHeaders(headers); |
| 910 size_t headerCount = headers.size(); |
| 911 if (index >= headerCount) |
| 912 return v8::Handle<v8::Object>(); |
| 913 |
| 914 return factory_->GetOrCreate(headers[index]); |
| 915 } |
| 916 |
893 std::string WebAXObjectProxy::RowIndexRange() { | 917 std::string WebAXObjectProxy::RowIndexRange() { |
894 accessibility_object_.updateLayoutAndCheckValidity(); | 918 accessibility_object_.updateLayoutAndCheckValidity(); |
895 unsigned row_index = accessibility_object_.cellRowIndex(); | 919 unsigned row_index = accessibility_object_.cellRowIndex(); |
896 unsigned row_span = accessibility_object_.cellRowSpan(); | 920 unsigned row_span = accessibility_object_.cellRowSpan(); |
897 return base::StringPrintf("{%d, %d}", row_index, row_span); | 921 return base::StringPrintf("{%d, %d}", row_index, row_span); |
898 } | 922 } |
899 | 923 |
900 std::string WebAXObjectProxy::ColumnIndexRange() { | 924 std::string WebAXObjectProxy::ColumnIndexRange() { |
901 accessibility_object_.updateLayoutAndCheckValidity(); | 925 accessibility_object_.updateLayoutAndCheckValidity(); |
902 unsigned column_index = accessibility_object_.cellColumnIndex(); | 926 unsigned column_index = accessibility_object_.cellColumnIndex(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 v8::Handle<v8::Value> value_handle = gin::CreateHandle( | 1137 v8::Handle<v8::Value> value_handle = gin::CreateHandle( |
1114 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); | 1138 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); |
1115 if (value_handle.IsEmpty()) | 1139 if (value_handle.IsEmpty()) |
1116 return v8::Handle<v8::Object>(); | 1140 return v8::Handle<v8::Object>(); |
1117 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); | 1141 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); |
1118 elements_.Append(handle); | 1142 elements_.Append(handle); |
1119 return handle; | 1143 return handle; |
1120 } | 1144 } |
1121 | 1145 |
1122 } // namespace content | 1146 } // namespace content |
OLD | NEW |