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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 | 291 |
292 return role_string; | 292 return role_string; |
293 } | 293 } |
294 | 294 |
295 std::string GetTitle(const blink::WebAXObject& object) { | 295 std::string GetTitle(const blink::WebAXObject& object) { |
296 std::string title = object.title().utf8(); | 296 std::string title = object.title().utf8(); |
297 return title.insert(0, "AXTitle: "); | 297 return title.insert(0, "AXTitle: "); |
298 } | 298 } |
299 | 299 |
300 std::string GetOrientation(const blink::WebAXObject& object) { | |
301 if (object.isVertical()) | |
302 return "AXOrientation: AXVerticalOrientation"; | |
303 | |
304 return "AXOrientation: AXHorizontalOrientation"; | |
305 } | |
306 | |
307 std::string GetValueDescription(const blink::WebAXObject& object) { | 300 std::string GetValueDescription(const blink::WebAXObject& object) { |
308 std::string value_description = object.valueDescription().utf8(); | 301 std::string value_description = object.valueDescription().utf8(); |
309 return value_description.insert(0, "AXValueDescription: "); | 302 return value_description.insert(0, "AXValueDescription: "); |
310 } | 303 } |
311 | 304 |
312 std::string GetAttributes(const blink::WebAXObject& object) { | 305 std::string GetAttributes(const blink::WebAXObject& object) { |
313 // FIXME: Concatenate all attributes of the AXObject. | 306 // FIXME: Concatenate all attributes of the AXObject. |
314 std::string attributes(GetTitle(object)); | 307 std::string attributes(GetTitle(object)); |
315 attributes.append("\n"); | 308 attributes.append("\n"); |
316 attributes.append(GetRole(object)); | 309 attributes.append(GetRole(object)); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 return !accessibility_object_.isDetached(); | 762 return !accessibility_object_.isDetached(); |
770 } | 763 } |
771 | 764 |
772 bool WebAXObjectProxy::IsReadOnly() { | 765 bool WebAXObjectProxy::IsReadOnly() { |
773 accessibility_object_.updateLayoutAndCheckValidity(); | 766 accessibility_object_.updateLayoutAndCheckValidity(); |
774 return accessibility_object_.isReadOnly(); | 767 return accessibility_object_.isReadOnly(); |
775 } | 768 } |
776 | 769 |
777 std::string WebAXObjectProxy::Orientation() { | 770 std::string WebAXObjectProxy::Orientation() { |
778 accessibility_object_.updateLayoutAndCheckValidity(); | 771 accessibility_object_.updateLayoutAndCheckValidity(); |
779 return GetOrientation(accessibility_object_); | 772 if (accessibility_object_.orientation() == blink::WebAXOrientationVertical) |
| 773 return "AXOrientation: AXVerticalOrientation"; |
| 774 else if (accessibility_object_.orientation() |
| 775 == blink::WebAXOrientationHorizontal) |
| 776 return "AXOrientation: AXHorizontalOrientation"; |
| 777 |
| 778 return std::string(); |
780 } | 779 } |
781 | 780 |
782 int WebAXObjectProxy::ClickPointX() { | 781 int WebAXObjectProxy::ClickPointX() { |
783 accessibility_object_.updateLayoutAndCheckValidity(); | 782 accessibility_object_.updateLayoutAndCheckValidity(); |
784 return accessibility_object_.clickPoint().x; | 783 return accessibility_object_.clickPoint().x; |
785 } | 784 } |
786 | 785 |
787 int WebAXObjectProxy::ClickPointY() { | 786 int WebAXObjectProxy::ClickPointY() { |
788 accessibility_object_.updateLayoutAndCheckValidity(); | 787 accessibility_object_.updateLayoutAndCheckValidity(); |
789 return accessibility_object_.clickPoint().y; | 788 return accessibility_object_.clickPoint().y; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 v8::Handle<v8::Value> value_handle = gin::CreateHandle( | 1102 v8::Handle<v8::Value> value_handle = gin::CreateHandle( |
1104 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); | 1103 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); |
1105 if (value_handle.IsEmpty()) | 1104 if (value_handle.IsEmpty()) |
1106 return v8::Handle<v8::Object>(); | 1105 return v8::Handle<v8::Object>(); |
1107 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); | 1106 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); |
1108 elements_.Append(handle); | 1107 elements_.Append(handle); |
1109 return handle; | 1108 return handle; |
1110 } | 1109 } |
1111 | 1110 |
1112 } // namespace content | 1111 } // namespace content |
OLD | NEW |