| 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 // | 590 // |
| 591 .SetProperty("name", &WebAXObjectProxy::Name) | 591 .SetProperty("name", &WebAXObjectProxy::Name) |
| 592 .SetProperty("nameFrom", &WebAXObjectProxy::NameFrom) | 592 .SetProperty("nameFrom", &WebAXObjectProxy::NameFrom) |
| 593 .SetMethod("nameElementCount", &WebAXObjectProxy::NameElementCount) | 593 .SetMethod("nameElementCount", &WebAXObjectProxy::NameElementCount) |
| 594 .SetMethod("nameElementAtIndex", &WebAXObjectProxy::NameElementAtIndex); | 594 .SetMethod("nameElementAtIndex", &WebAXObjectProxy::NameElementAtIndex); |
| 595 // TODO(dmazzoni): add "description", etc. once LayoutTests have | 595 // TODO(dmazzoni): add "description", etc. once LayoutTests have |
| 596 // been updated to call deprecatedDescription instead. | 596 // been updated to call deprecatedDescription instead. |
| 597 | 597 |
| 598 } | 598 } |
| 599 | 599 |
| 600 v8::Handle<v8::Object> WebAXObjectProxy::GetChildAtIndex(unsigned index) { | 600 v8::Local<v8::Object> WebAXObjectProxy::GetChildAtIndex(unsigned index) { |
| 601 return factory_->GetOrCreate(accessibility_object_.childAt(index)); | 601 return factory_->GetOrCreate(accessibility_object_.childAt(index)); |
| 602 } | 602 } |
| 603 | 603 |
| 604 bool WebAXObjectProxy::IsRoot() const { | 604 bool WebAXObjectProxy::IsRoot() const { |
| 605 return false; | 605 return false; |
| 606 } | 606 } |
| 607 | 607 |
| 608 bool WebAXObjectProxy::IsEqualToObject(const blink::WebAXObject& other) { | 608 bool WebAXObjectProxy::IsEqualToObject(const blink::WebAXObject& other) { |
| 609 return accessibility_object_.equals(other); | 609 return accessibility_object_.equals(other); |
| 610 } | 610 } |
| 611 | 611 |
| 612 void WebAXObjectProxy::NotificationReceived( | 612 void WebAXObjectProxy::NotificationReceived( |
| 613 blink::WebFrame* frame, | 613 blink::WebFrame* frame, |
| 614 const std::string& notification_name) { | 614 const std::string& notification_name) { |
| 615 if (notification_callback_.IsEmpty()) | 615 if (notification_callback_.IsEmpty()) |
| 616 return; | 616 return; |
| 617 | 617 |
| 618 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); | 618 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
| 619 if (context.IsEmpty()) | 619 if (context.IsEmpty()) |
| 620 return; | 620 return; |
| 621 | 621 |
| 622 v8::Isolate* isolate = blink::mainThreadIsolate(); | 622 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 623 | 623 |
| 624 v8::Handle<v8::Value> argv[] = { | 624 v8::Local<v8::Value> argv[] = { |
| 625 v8::String::NewFromUtf8(isolate, notification_name.data(), | 625 v8::String::NewFromUtf8(isolate, notification_name.data(), |
| 626 v8::String::kNormalString, | 626 v8::String::kNormalString, |
| 627 notification_name.size()), | 627 notification_name.size()), |
| 628 }; | 628 }; |
| 629 frame->callFunctionEvenIfScriptDisabled( | 629 frame->callFunctionEvenIfScriptDisabled( |
| 630 v8::Local<v8::Function>::New(isolate, notification_callback_), | 630 v8::Local<v8::Function>::New(isolate, notification_callback_), |
| 631 context->Global(), | 631 context->Global(), |
| 632 arraysize(argv), | 632 arraysize(argv), |
| 633 argv); | 633 argv); |
| 634 } | 634 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 bool WebAXObjectProxy::IsClickable() { | 879 bool WebAXObjectProxy::IsClickable() { |
| 880 accessibility_object_.updateLayoutAndCheckValidity(); | 880 accessibility_object_.updateLayoutAndCheckValidity(); |
| 881 return accessibility_object_.isClickable(); | 881 return accessibility_object_.isClickable(); |
| 882 } | 882 } |
| 883 | 883 |
| 884 bool WebAXObjectProxy::IsButtonStateMixed() { | 884 bool WebAXObjectProxy::IsButtonStateMixed() { |
| 885 accessibility_object_.updateLayoutAndCheckValidity(); | 885 accessibility_object_.updateLayoutAndCheckValidity(); |
| 886 return accessibility_object_.isButtonStateMixed(); | 886 return accessibility_object_.isButtonStateMixed(); |
| 887 } | 887 } |
| 888 | 888 |
| 889 v8::Handle<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex( | 889 v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex( |
| 890 unsigned index) | 890 unsigned index) |
| 891 { | 891 { |
| 892 accessibility_object_.updateLayoutAndCheckValidity(); | 892 accessibility_object_.updateLayoutAndCheckValidity(); |
| 893 blink::WebVector<blink::WebAXObject> elements; | 893 blink::WebVector<blink::WebAXObject> elements; |
| 894 accessibility_object_.ariaControls(elements); | 894 accessibility_object_.ariaControls(elements); |
| 895 size_t elementCount = elements.size(); | 895 size_t elementCount = elements.size(); |
| 896 if (index >= elementCount) | 896 if (index >= elementCount) |
| 897 return v8::Handle<v8::Object>(); | 897 return v8::Local<v8::Object>(); |
| 898 | 898 |
| 899 return factory_->GetOrCreate(elements[index]); | 899 return factory_->GetOrCreate(elements[index]); |
| 900 } | 900 } |
| 901 | 901 |
| 902 v8::Handle<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex( | 902 v8::Local<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex( |
| 903 unsigned index) | 903 unsigned index) |
| 904 { | 904 { |
| 905 accessibility_object_.updateLayoutAndCheckValidity(); | 905 accessibility_object_.updateLayoutAndCheckValidity(); |
| 906 blink::WebVector<blink::WebAXObject> elements; | 906 blink::WebVector<blink::WebAXObject> elements; |
| 907 accessibility_object_.ariaFlowTo(elements); | 907 accessibility_object_.ariaFlowTo(elements); |
| 908 size_t elementCount = elements.size(); | 908 size_t elementCount = elements.size(); |
| 909 if (index >= elementCount) | 909 if (index >= elementCount) |
| 910 return v8::Handle<v8::Object>(); | 910 return v8::Local<v8::Object>(); |
| 911 | 911 |
| 912 return factory_->GetOrCreate(elements[index]); | 912 return factory_->GetOrCreate(elements[index]); |
| 913 } | 913 } |
| 914 | 914 |
| 915 v8::Handle<v8::Object> WebAXObjectProxy::AriaOwnsElementAtIndex(unsigned index) | 915 v8::Local<v8::Object> WebAXObjectProxy::AriaOwnsElementAtIndex(unsigned index) |
| 916 { | 916 { |
| 917 accessibility_object_.updateLayoutAndCheckValidity(); | 917 accessibility_object_.updateLayoutAndCheckValidity(); |
| 918 blink::WebVector<blink::WebAXObject> elements; | 918 blink::WebVector<blink::WebAXObject> elements; |
| 919 accessibility_object_.ariaOwns(elements); | 919 accessibility_object_.ariaOwns(elements); |
| 920 size_t elementCount = elements.size(); | 920 size_t elementCount = elements.size(); |
| 921 if (index >= elementCount) | 921 if (index >= elementCount) |
| 922 return v8::Handle<v8::Object>(); | 922 return v8::Local<v8::Object>(); |
| 923 | 923 |
| 924 return factory_->GetOrCreate(elements[index]); | 924 return factory_->GetOrCreate(elements[index]); |
| 925 } | 925 } |
| 926 | 926 |
| 927 std::string WebAXObjectProxy::AllAttributes() { | 927 std::string WebAXObjectProxy::AllAttributes() { |
| 928 accessibility_object_.updateLayoutAndCheckValidity(); | 928 accessibility_object_.updateLayoutAndCheckValidity(); |
| 929 return GetAttributes(accessibility_object_); | 929 return GetAttributes(accessibility_object_); |
| 930 } | 930 } |
| 931 | 931 |
| 932 std::string WebAXObjectProxy::AttributesOfChildren() { | 932 std::string WebAXObjectProxy::AttributesOfChildren() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 bounds.x = std::min(bounds.x, next.x); | 969 bounds.x = std::min(bounds.x, next.x); |
| 970 bounds.y = std::min(bounds.y, next.y); | 970 bounds.y = std::min(bounds.y, next.y); |
| 971 bounds.width = right - bounds.x; | 971 bounds.width = right - bounds.x; |
| 972 bounds.height = bottom - bounds.y; | 972 bounds.height = bottom - bounds.y; |
| 973 } | 973 } |
| 974 | 974 |
| 975 return base::StringPrintf("{x: %d, y: %d, width: %d, height: %d}", | 975 return base::StringPrintf("{x: %d, y: %d, width: %d, height: %d}", |
| 976 bounds.x, bounds.y, bounds.width, bounds.height); | 976 bounds.x, bounds.y, bounds.width, bounds.height); |
| 977 } | 977 } |
| 978 | 978 |
| 979 v8::Handle<v8::Object> WebAXObjectProxy::ChildAtIndex(int index) { | 979 v8::Local<v8::Object> WebAXObjectProxy::ChildAtIndex(int index) { |
| 980 accessibility_object_.updateLayoutAndCheckValidity(); | 980 accessibility_object_.updateLayoutAndCheckValidity(); |
| 981 return GetChildAtIndex(index); | 981 return GetChildAtIndex(index); |
| 982 } | 982 } |
| 983 | 983 |
| 984 v8::Handle<v8::Object> WebAXObjectProxy::ElementAtPoint(int x, int y) { | 984 v8::Local<v8::Object> WebAXObjectProxy::ElementAtPoint(int x, int y) { |
| 985 accessibility_object_.updateLayoutAndCheckValidity(); | 985 accessibility_object_.updateLayoutAndCheckValidity(); |
| 986 blink::WebPoint point(x, y); | 986 blink::WebPoint point(x, y); |
| 987 blink::WebAXObject obj = accessibility_object_.hitTest(point); | 987 blink::WebAXObject obj = accessibility_object_.hitTest(point); |
| 988 if (obj.isNull()) | 988 if (obj.isNull()) |
| 989 return v8::Handle<v8::Object>(); | 989 return v8::Local<v8::Object>(); |
| 990 | 990 |
| 991 return factory_->GetOrCreate(obj); | 991 return factory_->GetOrCreate(obj); |
| 992 } | 992 } |
| 993 | 993 |
| 994 v8::Handle<v8::Object> WebAXObjectProxy::TableHeader() { | 994 v8::Local<v8::Object> WebAXObjectProxy::TableHeader() { |
| 995 accessibility_object_.updateLayoutAndCheckValidity(); | 995 accessibility_object_.updateLayoutAndCheckValidity(); |
| 996 blink::WebAXObject obj = accessibility_object_.headerContainerObject(); | 996 blink::WebAXObject obj = accessibility_object_.headerContainerObject(); |
| 997 if (obj.isNull()) | 997 if (obj.isNull()) |
| 998 return v8::Handle<v8::Object>(); | 998 return v8::Local<v8::Object>(); |
| 999 | 999 |
| 1000 return factory_->GetOrCreate(obj); | 1000 return factory_->GetOrCreate(obj); |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 v8::Handle<v8::Object> WebAXObjectProxy::RowHeaderAtIndex(unsigned index) { | 1003 v8::Local<v8::Object> WebAXObjectProxy::RowHeaderAtIndex(unsigned index) { |
| 1004 accessibility_object_.updateLayoutAndCheckValidity(); | 1004 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1005 blink::WebVector<blink::WebAXObject> headers; | 1005 blink::WebVector<blink::WebAXObject> headers; |
| 1006 accessibility_object_.rowHeaders(headers); | 1006 accessibility_object_.rowHeaders(headers); |
| 1007 size_t headerCount = headers.size(); | 1007 size_t headerCount = headers.size(); |
| 1008 if (index >= headerCount) | 1008 if (index >= headerCount) |
| 1009 return v8::Handle<v8::Object>(); | 1009 return v8::Local<v8::Object>(); |
| 1010 | 1010 |
| 1011 return factory_->GetOrCreate(headers[index]); | 1011 return factory_->GetOrCreate(headers[index]); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 v8::Handle<v8::Object> WebAXObjectProxy::ColumnHeaderAtIndex(unsigned index) { | 1014 v8::Local<v8::Object> WebAXObjectProxy::ColumnHeaderAtIndex(unsigned index) { |
| 1015 accessibility_object_.updateLayoutAndCheckValidity(); | 1015 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1016 blink::WebVector<blink::WebAXObject> headers; | 1016 blink::WebVector<blink::WebAXObject> headers; |
| 1017 accessibility_object_.columnHeaders(headers); | 1017 accessibility_object_.columnHeaders(headers); |
| 1018 size_t headerCount = headers.size(); | 1018 size_t headerCount = headers.size(); |
| 1019 if (index >= headerCount) | 1019 if (index >= headerCount) |
| 1020 return v8::Handle<v8::Object>(); | 1020 return v8::Local<v8::Object>(); |
| 1021 | 1021 |
| 1022 return factory_->GetOrCreate(headers[index]); | 1022 return factory_->GetOrCreate(headers[index]); |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 std::string WebAXObjectProxy::RowIndexRange() { | 1025 std::string WebAXObjectProxy::RowIndexRange() { |
| 1026 accessibility_object_.updateLayoutAndCheckValidity(); | 1026 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1027 unsigned row_index = accessibility_object_.cellRowIndex(); | 1027 unsigned row_index = accessibility_object_.cellRowIndex(); |
| 1028 unsigned row_span = accessibility_object_.cellRowSpan(); | 1028 unsigned row_span = accessibility_object_.cellRowSpan(); |
| 1029 return base::StringPrintf("{%d, %d}", row_index, row_span); | 1029 return base::StringPrintf("{%d, %d}", row_index, row_span); |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 std::string WebAXObjectProxy::ColumnIndexRange() { | 1032 std::string WebAXObjectProxy::ColumnIndexRange() { |
| 1033 accessibility_object_.updateLayoutAndCheckValidity(); | 1033 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1034 unsigned column_index = accessibility_object_.cellColumnIndex(); | 1034 unsigned column_index = accessibility_object_.cellColumnIndex(); |
| 1035 unsigned column_span = accessibility_object_.cellColumnSpan(); | 1035 unsigned column_span = accessibility_object_.cellColumnSpan(); |
| 1036 return base::StringPrintf("{%d, %d}", column_index, column_span); | 1036 return base::StringPrintf("{%d, %d}", column_index, column_span); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 v8::Handle<v8::Object> WebAXObjectProxy::CellForColumnAndRow( | 1039 v8::Local<v8::Object> WebAXObjectProxy::CellForColumnAndRow( |
| 1040 int column, int row) { | 1040 int column, int row) { |
| 1041 accessibility_object_.updateLayoutAndCheckValidity(); | 1041 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1042 blink::WebAXObject obj = | 1042 blink::WebAXObject obj = |
| 1043 accessibility_object_.cellForColumnAndRow(column, row); | 1043 accessibility_object_.cellForColumnAndRow(column, row); |
| 1044 if (obj.isNull()) | 1044 if (obj.isNull()) |
| 1045 return v8::Handle<v8::Object>(); | 1045 return v8::Local<v8::Object>(); |
| 1046 | 1046 |
| 1047 return factory_->GetOrCreate(obj); | 1047 return factory_->GetOrCreate(obj); |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 v8::Handle<v8::Object> WebAXObjectProxy::DeprecatedTitleUIElement() { | 1050 v8::Local<v8::Object> WebAXObjectProxy::DeprecatedTitleUIElement() { |
| 1051 accessibility_object_.updateLayoutAndCheckValidity(); | 1051 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1052 blink::WebAXObject obj = accessibility_object_.deprecatedTitleUIElement(); | 1052 blink::WebAXObject obj = accessibility_object_.deprecatedTitleUIElement(); |
| 1053 if (obj.isNull()) | 1053 if (obj.isNull()) |
| 1054 return v8::Handle<v8::Object>(); | 1054 return v8::Local<v8::Object>(); |
| 1055 | 1055 |
| 1056 return factory_->GetOrCreate(obj); | 1056 return factory_->GetOrCreate(obj); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 void WebAXObjectProxy::SetSelectedTextRange(int selection_start, | 1059 void WebAXObjectProxy::SetSelectedTextRange(int selection_start, |
| 1060 int length) { | 1060 int length) { |
| 1061 accessibility_object_.updateLayoutAndCheckValidity(); | 1061 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1062 accessibility_object_.setSelectedTextRange(selection_start, | 1062 accessibility_object_.setSelectedTextRange(selection_start, |
| 1063 selection_start + length); | 1063 selection_start + length); |
| 1064 } | 1064 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1079 bool WebAXObjectProxy::IsIncrementActionSupported() { | 1079 bool WebAXObjectProxy::IsIncrementActionSupported() { |
| 1080 accessibility_object_.updateLayoutAndCheckValidity(); | 1080 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1081 return accessibility_object_.canIncrement(); | 1081 return accessibility_object_.canIncrement(); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 bool WebAXObjectProxy::IsDecrementActionSupported() { | 1084 bool WebAXObjectProxy::IsDecrementActionSupported() { |
| 1085 accessibility_object_.updateLayoutAndCheckValidity(); | 1085 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1086 return accessibility_object_.canDecrement(); | 1086 return accessibility_object_.canDecrement(); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 v8::Handle<v8::Object> WebAXObjectProxy::ParentElement() { | 1089 v8::Local<v8::Object> WebAXObjectProxy::ParentElement() { |
| 1090 accessibility_object_.updateLayoutAndCheckValidity(); | 1090 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1091 blink::WebAXObject parent_object = accessibility_object_.parentObject(); | 1091 blink::WebAXObject parent_object = accessibility_object_.parentObject(); |
| 1092 while (parent_object.accessibilityIsIgnored()) | 1092 while (parent_object.accessibilityIsIgnored()) |
| 1093 parent_object = parent_object.parentObject(); | 1093 parent_object = parent_object.parentObject(); |
| 1094 return factory_->GetOrCreate(parent_object); | 1094 return factory_->GetOrCreate(parent_object); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 void WebAXObjectProxy::Increment() { | 1097 void WebAXObjectProxy::Increment() { |
| 1098 accessibility_object_.updateLayoutAndCheckValidity(); | 1098 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1099 accessibility_object_.increment(); | 1099 accessibility_object_.increment(); |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 void WebAXObjectProxy::Decrement() { | 1102 void WebAXObjectProxy::Decrement() { |
| 1103 accessibility_object_.updateLayoutAndCheckValidity(); | 1103 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1104 accessibility_object_.decrement(); | 1104 accessibility_object_.decrement(); |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 void WebAXObjectProxy::ShowMenu() { | 1107 void WebAXObjectProxy::ShowMenu() { |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 void WebAXObjectProxy::Press() { | 1110 void WebAXObjectProxy::Press() { |
| 1111 accessibility_object_.updateLayoutAndCheckValidity(); | 1111 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1112 accessibility_object_.press(); | 1112 accessibility_object_.press(); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 bool WebAXObjectProxy::IsEqual(v8::Handle<v8::Object> proxy) { | 1115 bool WebAXObjectProxy::IsEqual(v8::Local<v8::Object> proxy) { |
| 1116 WebAXObjectProxy* unwrapped_proxy = NULL; | 1116 WebAXObjectProxy* unwrapped_proxy = NULL; |
| 1117 if (!gin::ConvertFromV8(blink::mainThreadIsolate(), proxy, &unwrapped_proxy)) | 1117 if (!gin::ConvertFromV8(blink::mainThreadIsolate(), proxy, &unwrapped_proxy)) |
| 1118 return false; | 1118 return false; |
| 1119 return unwrapped_proxy->IsEqualToObject(accessibility_object_); | 1119 return unwrapped_proxy->IsEqualToObject(accessibility_object_); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 void WebAXObjectProxy::SetNotificationListener( | 1122 void WebAXObjectProxy::SetNotificationListener( |
| 1123 v8::Handle<v8::Function> callback) { | 1123 v8::Local<v8::Function> callback) { |
| 1124 v8::Isolate* isolate = blink::mainThreadIsolate(); | 1124 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 1125 notification_callback_.Reset(isolate, callback); | 1125 notification_callback_.Reset(isolate, callback); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 void WebAXObjectProxy::UnsetNotificationListener() { | 1128 void WebAXObjectProxy::UnsetNotificationListener() { |
| 1129 notification_callback_.Reset(); | 1129 notification_callback_.Reset(); |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 void WebAXObjectProxy::TakeFocus() { | 1132 void WebAXObjectProxy::TakeFocus() { |
| 1133 accessibility_object_.updateLayoutAndCheckValidity(); | 1133 accessibility_object_.updateLayoutAndCheckValidity(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 int WebAXObjectProxy::NameElementCount() { | 1202 int WebAXObjectProxy::NameElementCount() { |
| 1203 accessibility_object_.updateLayoutAndCheckValidity(); | 1203 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1204 blink::WebAXNameFrom nameFrom; | 1204 blink::WebAXNameFrom nameFrom; |
| 1205 blink::WebVector<blink::WebAXObject> nameObjects; | 1205 blink::WebVector<blink::WebAXObject> nameObjects; |
| 1206 accessibility_object_.name(nameFrom, nameObjects); | 1206 accessibility_object_.name(nameFrom, nameObjects); |
| 1207 return static_cast<int>(nameObjects.size()); | 1207 return static_cast<int>(nameObjects.size()); |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 v8::Handle<v8::Object> WebAXObjectProxy::NameElementAtIndex(unsigned index) { | 1210 v8::Local<v8::Object> WebAXObjectProxy::NameElementAtIndex(unsigned index) { |
| 1211 accessibility_object_.updateLayoutAndCheckValidity(); | 1211 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1212 blink::WebAXNameFrom nameFrom; | 1212 blink::WebAXNameFrom nameFrom; |
| 1213 blink::WebVector<blink::WebAXObject> nameObjects; | 1213 blink::WebVector<blink::WebAXObject> nameObjects; |
| 1214 accessibility_object_.name(nameFrom, nameObjects); | 1214 accessibility_object_.name(nameFrom, nameObjects); |
| 1215 if (index >= nameObjects.size()) | 1215 if (index >= nameObjects.size()) |
| 1216 return v8::Handle<v8::Object>(); | 1216 return v8::Local<v8::Object>(); |
| 1217 return factory_->GetOrCreate(nameObjects[index]); | 1217 return factory_->GetOrCreate(nameObjects[index]); |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 RootWebAXObjectProxy::RootWebAXObjectProxy( | 1220 RootWebAXObjectProxy::RootWebAXObjectProxy( |
| 1221 const blink::WebAXObject &object, Factory *factory) | 1221 const blink::WebAXObject &object, Factory *factory) |
| 1222 : WebAXObjectProxy(object, factory) { | 1222 : WebAXObjectProxy(object, factory) { |
| 1223 } | 1223 } |
| 1224 | 1224 |
| 1225 v8::Handle<v8::Object> RootWebAXObjectProxy::GetChildAtIndex(unsigned index) { | 1225 v8::Local<v8::Object> RootWebAXObjectProxy::GetChildAtIndex(unsigned index) { |
| 1226 if (index) | 1226 if (index) |
| 1227 return v8::Handle<v8::Object>(); | 1227 return v8::Local<v8::Object>(); |
| 1228 | 1228 |
| 1229 return factory()->GetOrCreate(accessibility_object()); | 1229 return factory()->GetOrCreate(accessibility_object()); |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 bool RootWebAXObjectProxy::IsRoot() const { | 1232 bool RootWebAXObjectProxy::IsRoot() const { |
| 1233 return true; | 1233 return true; |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 WebAXObjectProxyList::WebAXObjectProxyList() | 1236 WebAXObjectProxyList::WebAXObjectProxyList() |
| 1237 : elements_(blink::mainThreadIsolate()) { | 1237 : elements_(blink::mainThreadIsolate()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1249 WebAXObjectProxy* unwrapped_object = NULL; | 1249 WebAXObjectProxy* unwrapped_object = NULL; |
| 1250 bool result = gin::ConvertFromV8(isolate, elements_.Get(i), | 1250 bool result = gin::ConvertFromV8(isolate, elements_.Get(i), |
| 1251 &unwrapped_object); | 1251 &unwrapped_object); |
| 1252 DCHECK(result); | 1252 DCHECK(result); |
| 1253 DCHECK(unwrapped_object); | 1253 DCHECK(unwrapped_object); |
| 1254 unwrapped_object->Reset(); | 1254 unwrapped_object->Reset(); |
| 1255 } | 1255 } |
| 1256 elements_.Clear(); | 1256 elements_.Clear(); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 v8::Handle<v8::Object> WebAXObjectProxyList::GetOrCreate( | 1259 v8::Local<v8::Object> WebAXObjectProxyList::GetOrCreate( |
| 1260 const blink::WebAXObject& object) { | 1260 const blink::WebAXObject& object) { |
| 1261 if (object.isNull()) | 1261 if (object.isNull()) |
| 1262 return v8::Handle<v8::Object>(); | 1262 return v8::Local<v8::Object>(); |
| 1263 | 1263 |
| 1264 v8::Isolate* isolate = blink::mainThreadIsolate(); | 1264 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 1265 | 1265 |
| 1266 size_t elementCount = elements_.Size(); | 1266 size_t elementCount = elements_.Size(); |
| 1267 for (size_t i = 0; i < elementCount; i++) { | 1267 for (size_t i = 0; i < elementCount; i++) { |
| 1268 WebAXObjectProxy* unwrapped_object = NULL; | 1268 WebAXObjectProxy* unwrapped_object = NULL; |
| 1269 bool result = gin::ConvertFromV8(isolate, elements_.Get(i), | 1269 bool result = gin::ConvertFromV8(isolate, elements_.Get(i), |
| 1270 &unwrapped_object); | 1270 &unwrapped_object); |
| 1271 DCHECK(result); | 1271 DCHECK(result); |
| 1272 DCHECK(unwrapped_object); | 1272 DCHECK(unwrapped_object); |
| 1273 if (unwrapped_object->IsEqualToObject(object)) | 1273 if (unwrapped_object->IsEqualToObject(object)) |
| 1274 return elements_.Get(i); | 1274 return elements_.Get(i); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 v8::Handle<v8::Value> value_handle = gin::CreateHandle( | 1277 v8::Local<v8::Value> value_handle = gin::CreateHandle( |
| 1278 isolate, new WebAXObjectProxy(object, this)).ToV8(); | 1278 isolate, new WebAXObjectProxy(object, this)).ToV8(); |
| 1279 if (value_handle.IsEmpty()) | 1279 if (value_handle.IsEmpty()) |
| 1280 return v8::Handle<v8::Object>(); | 1280 return v8::Local<v8::Object>(); |
| 1281 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); | 1281 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); |
| 1282 elements_.Append(handle); | 1282 elements_.Append(handle); |
| 1283 return handle; | 1283 return handle; |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 } // namespace content | 1286 } // namespace content |
| OLD | NEW |