| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 .SetProperty("minValue", &WebAXObjectProxy::MinValue) | 485 .SetProperty("minValue", &WebAXObjectProxy::MinValue) |
| 486 .SetProperty("maxValue", &WebAXObjectProxy::MaxValue) | 486 .SetProperty("maxValue", &WebAXObjectProxy::MaxValue) |
| 487 .SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription) | 487 .SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription) |
| 488 .SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount) | 488 .SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount) |
| 489 .SetProperty("selectionStart", &WebAXObjectProxy::SelectionStart) | 489 .SetProperty("selectionStart", &WebAXObjectProxy::SelectionStart) |
| 490 .SetProperty("selectionEnd", &WebAXObjectProxy::SelectionEnd) | 490 .SetProperty("selectionEnd", &WebAXObjectProxy::SelectionEnd) |
| 491 .SetProperty("selectionStartLineNumber", | 491 .SetProperty("selectionStartLineNumber", |
| 492 &WebAXObjectProxy::SelectionStartLineNumber) | 492 &WebAXObjectProxy::SelectionStartLineNumber) |
| 493 .SetProperty("selectionEndLineNumber", | 493 .SetProperty("selectionEndLineNumber", |
| 494 &WebAXObjectProxy::SelectionEndLineNumber) | 494 &WebAXObjectProxy::SelectionEndLineNumber) |
| 495 .SetProperty("insertionPointLineNumber", | |
| 496 &WebAXObjectProxy::InsertionPointLineNumber) | |
| 497 .SetProperty("selectedTextRange", &WebAXObjectProxy::SelectedTextRange) | |
| 498 .SetProperty("isEnabled", &WebAXObjectProxy::IsEnabled) | 495 .SetProperty("isEnabled", &WebAXObjectProxy::IsEnabled) |
| 499 .SetProperty("isRequired", &WebAXObjectProxy::IsRequired) | 496 .SetProperty("isRequired", &WebAXObjectProxy::IsRequired) |
| 500 .SetProperty("isFocused", &WebAXObjectProxy::IsFocused) | 497 .SetProperty("isFocused", &WebAXObjectProxy::IsFocused) |
| 501 .SetProperty("isFocusable", &WebAXObjectProxy::IsFocusable) | 498 .SetProperty("isFocusable", &WebAXObjectProxy::IsFocusable) |
| 502 .SetProperty("isSelected", &WebAXObjectProxy::IsSelected) | 499 .SetProperty("isSelected", &WebAXObjectProxy::IsSelected) |
| 503 .SetProperty("isSelectable", &WebAXObjectProxy::IsSelectable) | 500 .SetProperty("isSelectable", &WebAXObjectProxy::IsSelectable) |
| 504 .SetProperty("isMultiSelectable", &WebAXObjectProxy::IsMultiSelectable) | 501 .SetProperty("isMultiSelectable", &WebAXObjectProxy::IsMultiSelectable) |
| 505 .SetProperty("isSelectedOptionActive", | 502 .SetProperty("isSelectedOptionActive", |
| 506 &WebAXObjectProxy::IsSelectedOptionActive) | 503 &WebAXObjectProxy::IsSelectedOptionActive) |
| 507 .SetProperty("isExpanded", &WebAXObjectProxy::IsExpanded) | 504 .SetProperty("isExpanded", &WebAXObjectProxy::IsExpanded) |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 int WebAXObjectProxy::SelectionStartLineNumber() { | 731 int WebAXObjectProxy::SelectionStartLineNumber() { |
| 735 accessibility_object_.updateLayoutAndCheckValidity(); | 732 accessibility_object_.updateLayoutAndCheckValidity(); |
| 736 return accessibility_object_.selectionStartLineNumber(); | 733 return accessibility_object_.selectionStartLineNumber(); |
| 737 } | 734 } |
| 738 | 735 |
| 739 int WebAXObjectProxy::SelectionEndLineNumber() { | 736 int WebAXObjectProxy::SelectionEndLineNumber() { |
| 740 accessibility_object_.updateLayoutAndCheckValidity(); | 737 accessibility_object_.updateLayoutAndCheckValidity(); |
| 741 return accessibility_object_.selectionEndLineNumber(); | 738 return accessibility_object_.selectionEndLineNumber(); |
| 742 } | 739 } |
| 743 | 740 |
| 744 // TODO(nektar): Remove this function after updating tests. | |
| 745 int WebAXObjectProxy::InsertionPointLineNumber() { | |
| 746 accessibility_object_.updateLayoutAndCheckValidity(); | |
| 747 if (!accessibility_object_.isFocused()) | |
| 748 return -1; | |
| 749 return accessibility_object_.selectionEndLineNumber(); | |
| 750 } | |
| 751 | |
| 752 // TODO(nektar): Remove this function after updating tests. | |
| 753 std::string WebAXObjectProxy::SelectedTextRange() { | |
| 754 accessibility_object_.updateLayoutAndCheckValidity(); | |
| 755 unsigned selection_start = accessibility_object_.selectionStart(); | |
| 756 unsigned selection_end = accessibility_object_.selectionEnd(); | |
| 757 return base::StringPrintf("{%d, %d}", | |
| 758 selection_start, selection_end - selection_start); | |
| 759 } | |
| 760 | |
| 761 bool WebAXObjectProxy::IsEnabled() { | 741 bool WebAXObjectProxy::IsEnabled() { |
| 762 accessibility_object_.updateLayoutAndCheckValidity(); | 742 accessibility_object_.updateLayoutAndCheckValidity(); |
| 763 return accessibility_object_.isEnabled(); | 743 return accessibility_object_.isEnabled(); |
| 764 } | 744 } |
| 765 | 745 |
| 766 bool WebAXObjectProxy::IsRequired() { | 746 bool WebAXObjectProxy::IsRequired() { |
| 767 accessibility_object_.updateLayoutAndCheckValidity(); | 747 accessibility_object_.updateLayoutAndCheckValidity(); |
| 768 return accessibility_object_.isRequired(); | 748 return accessibility_object_.isRequired(); |
| 769 } | 749 } |
| 770 | 750 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 v8::Handle<v8::Value> value_handle = gin::CreateHandle( | 1277 v8::Handle<v8::Value> value_handle = gin::CreateHandle( |
| 1298 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); | 1278 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); |
| 1299 if (value_handle.IsEmpty()) | 1279 if (value_handle.IsEmpty()) |
| 1300 return v8::Handle<v8::Object>(); | 1280 return v8::Handle<v8::Object>(); |
| 1301 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); | 1281 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); |
| 1302 elements_.Append(handle); | 1282 elements_.Append(handle); |
| 1303 return handle; | 1283 return handle; |
| 1304 } | 1284 } |
| 1305 | 1285 |
| 1306 } // namespace content | 1286 } // namespace content |
| OLD | NEW |