Chromium Code Reviews| 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 "components/test_runner/web_ax_object_proxy.h" | 5 #include "components/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("language", &WebAXObjectProxy::Language) | 485 .SetProperty("language", &WebAXObjectProxy::Language) |
| 486 .SetProperty("x", &WebAXObjectProxy::X) | 486 .SetProperty("x", &WebAXObjectProxy::X) |
| 487 .SetProperty("y", &WebAXObjectProxy::Y) | 487 .SetProperty("y", &WebAXObjectProxy::Y) |
| 488 .SetProperty("width", &WebAXObjectProxy::Width) | 488 .SetProperty("width", &WebAXObjectProxy::Width) |
| 489 .SetProperty("height", &WebAXObjectProxy::Height) | 489 .SetProperty("height", &WebAXObjectProxy::Height) |
| 490 .SetProperty("intValue", &WebAXObjectProxy::IntValue) | 490 .SetProperty("intValue", &WebAXObjectProxy::IntValue) |
| 491 .SetProperty("minValue", &WebAXObjectProxy::MinValue) | 491 .SetProperty("minValue", &WebAXObjectProxy::MinValue) |
| 492 .SetProperty("maxValue", &WebAXObjectProxy::MaxValue) | 492 .SetProperty("maxValue", &WebAXObjectProxy::MaxValue) |
| 493 .SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription) | 493 .SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription) |
| 494 .SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount) | 494 .SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount) |
| 495 .SetProperty("selectionAnchorObject", | |
| 496 &WebAXObjectProxy::SelectionAnchorObject) | |
| 497 .SetProperty("selectionAnchorOffset", | |
| 498 &WebAXObjectProxy::SelectionAnchorOffset) | |
| 499 .SetProperty("selectionFocusObject", | |
| 500 &WebAXObjectProxy::SelectionFocusObject) | |
| 501 .SetProperty("selectionFocusOffset", | |
| 502 &WebAXObjectProxy::SelectionFocusOffset) | |
| 495 .SetProperty("selectionStart", &WebAXObjectProxy::SelectionStart) | 503 .SetProperty("selectionStart", &WebAXObjectProxy::SelectionStart) |
| 496 .SetProperty("selectionEnd", &WebAXObjectProxy::SelectionEnd) | 504 .SetProperty("selectionEnd", &WebAXObjectProxy::SelectionEnd) |
| 497 .SetProperty("selectionStartLineNumber", | 505 .SetProperty("selectionStartLineNumber", |
| 498 &WebAXObjectProxy::SelectionStartLineNumber) | 506 &WebAXObjectProxy::SelectionStartLineNumber) |
| 499 .SetProperty("selectionEndLineNumber", | 507 .SetProperty("selectionEndLineNumber", |
| 500 &WebAXObjectProxy::SelectionEndLineNumber) | 508 &WebAXObjectProxy::SelectionEndLineNumber) |
| 501 .SetProperty("isEnabled", &WebAXObjectProxy::IsEnabled) | 509 .SetProperty("isEnabled", &WebAXObjectProxy::IsEnabled) |
| 502 .SetProperty("isRequired", &WebAXObjectProxy::IsRequired) | 510 .SetProperty("isRequired", &WebAXObjectProxy::IsRequired) |
| 503 .SetProperty("isRichlyEditable", &WebAXObjectProxy::IsRichlyEditable) | 511 .SetProperty("isRichlyEditable", &WebAXObjectProxy::IsRichlyEditable) |
| 504 .SetProperty("isFocused", &WebAXObjectProxy::IsFocused) | 512 .SetProperty("isFocused", &WebAXObjectProxy::IsFocused) |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 } | 734 } |
| 727 | 735 |
| 728 int WebAXObjectProxy::ChildrenCount() { | 736 int WebAXObjectProxy::ChildrenCount() { |
| 729 accessibility_object_.updateLayoutAndCheckValidity(); | 737 accessibility_object_.updateLayoutAndCheckValidity(); |
| 730 int count = 1; // Root object always has only one child, the WebView. | 738 int count = 1; // Root object always has only one child, the WebView. |
| 731 if (!IsRoot()) | 739 if (!IsRoot()) |
| 732 count = accessibility_object_.childCount(); | 740 count = accessibility_object_.childCount(); |
| 733 return count; | 741 return count; |
| 734 } | 742 } |
| 735 | 743 |
| 744 v8::Local<v8::Object> WebAXObjectProxy::SelectionAnchorObject() { | |
| 745 accessibility_object_.updateLayoutAndCheckValidity(); | |
| 746 | |
| 747 blink::WebAxObject* anchorObject = nullptr; | |
|
dmazzoni
2015/06/22 19:23:21
Typo: WebAxObject -> WebAXObject
| |
| 748 int anchorOffset = -1; | |
| 749 blink::WebAxObject* focusObject = nullptr; | |
| 750 int focusOffset = -1; | |
| 751 accessibility_object_.selection(anchorObject, &anchorOffset, | |
| 752 focusObject, &focusOffset); | |
| 753 if (anchorObject) | |
| 754 return factory_->GetOrCreate(anchorObject); | |
| 755 | |
| 756 return v8::Local<v8::Object>(); | |
| 757 } | |
| 758 | |
| 759 int WebAXObjectProxy::SelectionAnchorOffset() { | |
| 760 accessibility_object_.updateLayoutAndCheckValidity(); | |
| 761 | |
| 762 blink::WebAxObject* anchorObject = nullptr; | |
| 763 int anchorOffset = -1; | |
| 764 blink::WebAxObject* focusObject = nullptr; | |
| 765 int focusOffset = -1; | |
| 766 accessibility_object_.selection(anchorObject, &anchorOffset, | |
| 767 focusObject, &focusOffset); | |
| 768 if (anchorOffset >= 0) | |
| 769 return anchorOffset; | |
| 770 | |
| 771 return -1; | |
| 772 } | |
| 773 | |
| 774 v8::Local<v8::Object> WebAXObjectProxy::SelectionFocusObject() { | |
| 775 accessibility_object_.updateLayoutAndCheckValidity(); | |
| 776 | |
| 777 blink::WebAxObject* anchorObject = nullptr; | |
| 778 int anchorOffset = -1; | |
| 779 blink::WebAxObject* focusObject = nullptr; | |
| 780 int focusOffset = -1; | |
| 781 accessibility_object_.selection(anchorObject, &anchorOffset, | |
| 782 focusObject, &focusOffset); | |
| 783 if (focusObject) | |
| 784 return factory_->GetOrCreate(focusObject); | |
| 785 | |
| 786 return v8::Local<v8::Object>(); | |
| 787 } | |
| 788 | |
| 789 int WebAXObjectProxy::SelectionFocusOffset() { | |
| 790 accessibility_object_.updateLayoutAndCheckValidity(); | |
| 791 | |
| 792 blink::WebAxObject* anchorObject = nullptr; | |
| 793 int anchorOffset = -1; | |
| 794 blink::WebAxObject* focusObject = nullptr; | |
| 795 int focusOffset = -1; | |
| 796 accessibility_object_.selection(anchorObject, &anchorOffset, | |
| 797 focusObject, &focusOffset); | |
| 798 if (focusOffset >= 0) | |
| 799 return focusOffset; | |
| 800 | |
| 801 return -1; | |
| 802 } | |
| 803 | |
| 736 int WebAXObjectProxy::SelectionStart() { | 804 int WebAXObjectProxy::SelectionStart() { |
| 737 accessibility_object_.updateLayoutAndCheckValidity(); | 805 accessibility_object_.updateLayoutAndCheckValidity(); |
| 738 return accessibility_object_.selectionStart(); | 806 return accessibility_object_.selectionStart(); |
| 739 } | 807 } |
| 740 | 808 |
| 741 int WebAXObjectProxy::SelectionEnd() { | 809 int WebAXObjectProxy::SelectionEnd() { |
| 742 accessibility_object_.updateLayoutAndCheckValidity(); | 810 accessibility_object_.updateLayoutAndCheckValidity(); |
| 743 return accessibility_object_.selectionEnd(); | 811 return accessibility_object_.selectionEnd(); |
| 744 } | 812 } |
| 745 | 813 |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1337 v8::Local<v8::Value> value_handle = gin::CreateHandle( | 1405 v8::Local<v8::Value> value_handle = gin::CreateHandle( |
| 1338 isolate, new WebAXObjectProxy(object, this)).ToV8(); | 1406 isolate, new WebAXObjectProxy(object, this)).ToV8(); |
| 1339 if (value_handle.IsEmpty()) | 1407 if (value_handle.IsEmpty()) |
| 1340 return v8::Local<v8::Object>(); | 1408 return v8::Local<v8::Object>(); |
| 1341 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); | 1409 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); |
| 1342 elements_.Append(handle); | 1410 elements_.Append(handle); |
| 1343 return handle; | 1411 return handle; |
| 1344 } | 1412 } |
| 1345 | 1413 |
| 1346 } // namespace test_runner | 1414 } // namespace test_runner |
| OLD | NEW |