| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 &WebAXObjectProxy::UnsetNotificationListener) | 659 &WebAXObjectProxy::UnsetNotificationListener) |
| 660 // | 660 // |
| 661 // NEW accessible name and description accessors | 661 // NEW accessible name and description accessors |
| 662 // | 662 // |
| 663 .SetProperty("name", &WebAXObjectProxy::Name) | 663 .SetProperty("name", &WebAXObjectProxy::Name) |
| 664 .SetProperty("nameFrom", &WebAXObjectProxy::NameFrom) | 664 .SetProperty("nameFrom", &WebAXObjectProxy::NameFrom) |
| 665 .SetMethod("nameElementCount", &WebAXObjectProxy::NameElementCount) | 665 .SetMethod("nameElementCount", &WebAXObjectProxy::NameElementCount) |
| 666 .SetMethod("nameElementAtIndex", &WebAXObjectProxy::NameElementAtIndex) | 666 .SetMethod("nameElementAtIndex", &WebAXObjectProxy::NameElementAtIndex) |
| 667 .SetProperty("description", &WebAXObjectProxy::Description) | 667 .SetProperty("description", &WebAXObjectProxy::Description) |
| 668 .SetProperty("descriptionFrom", &WebAXObjectProxy::DescriptionFrom) | 668 .SetProperty("descriptionFrom", &WebAXObjectProxy::DescriptionFrom) |
| 669 .SetProperty("placeholder", &WebAXObjectProxy::Placeholder) |
| 669 .SetProperty("misspellingsCount", &WebAXObjectProxy::MisspellingsCount) | 670 .SetProperty("misspellingsCount", &WebAXObjectProxy::MisspellingsCount) |
| 670 .SetMethod("descriptionElementCount", | 671 .SetMethod("descriptionElementCount", |
| 671 &WebAXObjectProxy::DescriptionElementCount) | 672 &WebAXObjectProxy::DescriptionElementCount) |
| 672 .SetMethod("descriptionElementAtIndex", | 673 .SetMethod("descriptionElementAtIndex", |
| 673 &WebAXObjectProxy::DescriptionElementAtIndex) | 674 &WebAXObjectProxy::DescriptionElementAtIndex) |
| 674 // | 675 // |
| 675 // NEW bounding rect calculation - low-level interface | 676 // NEW bounding rect calculation - low-level interface |
| 676 // | 677 // |
| 677 .SetMethod("offsetContainer", | 678 .SetMethod("offsetContainer", &WebAXObjectProxy::OffsetContainer) |
| 678 &WebAXObjectProxy::OffsetContainer) | 679 .SetMethod("boundsInContainerX", &WebAXObjectProxy::BoundsInContainerX) |
| 679 .SetMethod("boundsInContainerX", | 680 .SetMethod("boundsInContainerY", &WebAXObjectProxy::BoundsInContainerY) |
| 680 &WebAXObjectProxy::BoundsInContainerX) | |
| 681 .SetMethod("boundsInContainerY", | |
| 682 &WebAXObjectProxy::BoundsInContainerY) | |
| 683 .SetMethod("boundsInContainerWidth", | 681 .SetMethod("boundsInContainerWidth", |
| 684 &WebAXObjectProxy::BoundsInContainerWidth) | 682 &WebAXObjectProxy::BoundsInContainerWidth) |
| 685 .SetMethod("boundsInContainerHeight", | 683 .SetMethod("boundsInContainerHeight", |
| 686 &WebAXObjectProxy::BoundsInContainerHeight) | 684 &WebAXObjectProxy::BoundsInContainerHeight) |
| 687 .SetMethod("hasNonIdentityTransform", | 685 .SetMethod("hasNonIdentityTransform", |
| 688 &WebAXObjectProxy::HasNonIdentityTransform); | 686 &WebAXObjectProxy::HasNonIdentityTransform); |
| 689 } | 687 } |
| 690 | 688 |
| 691 v8::Local<v8::Object> WebAXObjectProxy::GetChildAtIndex(unsigned index) { | 689 v8::Local<v8::Object> WebAXObjectProxy::GetChildAtIndex(unsigned index) { |
| 692 return factory_->GetOrCreate(accessibility_object_.childAt(index)); | 690 return factory_->GetOrCreate(accessibility_object_.childAt(index)); |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 blink::WebVector<blink::WebAXObject> descriptionObjects; | 1543 blink::WebVector<blink::WebAXObject> descriptionObjects; |
| 1546 accessibility_object_.description( | 1544 accessibility_object_.description( |
| 1547 nameFrom, descriptionFrom, descriptionObjects); | 1545 nameFrom, descriptionFrom, descriptionObjects); |
| 1548 switch(descriptionFrom) { | 1546 switch(descriptionFrom) { |
| 1549 case blink::WebAXDescriptionFromUninitialized: | 1547 case blink::WebAXDescriptionFromUninitialized: |
| 1550 return ""; | 1548 return ""; |
| 1551 case blink::WebAXDescriptionFromAttribute: | 1549 case blink::WebAXDescriptionFromAttribute: |
| 1552 return "attribute"; | 1550 return "attribute"; |
| 1553 case blink::WebAXDescriptionFromContents: | 1551 case blink::WebAXDescriptionFromContents: |
| 1554 return "contents"; | 1552 return "contents"; |
| 1555 case blink::WebAXDescriptionFromPlaceholder: | |
| 1556 return "placeholder"; | |
| 1557 case blink::WebAXDescriptionFromRelatedElement: | 1553 case blink::WebAXDescriptionFromRelatedElement: |
| 1558 return "relatedElement"; | 1554 return "relatedElement"; |
| 1559 } | 1555 } |
| 1560 | 1556 |
| 1561 NOTREACHED(); | 1557 NOTREACHED(); |
| 1562 return std::string(); | 1558 return std::string(); |
| 1563 } | 1559 } |
| 1564 | 1560 |
| 1561 std::string WebAXObjectProxy::Placeholder() { |
| 1562 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1563 blink::WebAXNameFrom nameFrom; |
| 1564 blink::WebVector<blink::WebAXObject> nameObjects; |
| 1565 accessibility_object_.name(nameFrom, nameObjects); |
| 1566 return accessibility_object_.placeholder(nameFrom).utf8(); |
| 1567 } |
| 1568 |
| 1565 int WebAXObjectProxy::MisspellingsCount() { | 1569 int WebAXObjectProxy::MisspellingsCount() { |
| 1566 accessibility_object_.updateLayoutAndCheckValidity(); | 1570 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1567 return GetMisspellings(accessibility_object_).size(); | 1571 return GetMisspellings(accessibility_object_).size(); |
| 1568 } | 1572 } |
| 1569 | 1573 |
| 1570 int WebAXObjectProxy::DescriptionElementCount() { | 1574 int WebAXObjectProxy::DescriptionElementCount() { |
| 1571 accessibility_object_.updateLayoutAndCheckValidity(); | 1575 accessibility_object_.updateLayoutAndCheckValidity(); |
| 1572 blink::WebAXNameFrom nameFrom; | 1576 blink::WebAXNameFrom nameFrom; |
| 1573 blink::WebVector<blink::WebAXObject> nameObjects; | 1577 blink::WebVector<blink::WebAXObject> nameObjects; |
| 1574 accessibility_object_.name(nameFrom, nameObjects); | 1578 accessibility_object_.name(nameFrom, nameObjects); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 v8::Local<v8::Value> value_handle = gin::CreateHandle( | 1713 v8::Local<v8::Value> value_handle = gin::CreateHandle( |
| 1710 isolate, new WebAXObjectProxy(object, this)).ToV8(); | 1714 isolate, new WebAXObjectProxy(object, this)).ToV8(); |
| 1711 if (value_handle.IsEmpty()) | 1715 if (value_handle.IsEmpty()) |
| 1712 return v8::Local<v8::Object>(); | 1716 return v8::Local<v8::Object>(); |
| 1713 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); | 1717 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); |
| 1714 elements_.Append(handle); | 1718 elements_.Append(handle); |
| 1715 return handle; | 1719 return handle; |
| 1716 } | 1720 } |
| 1717 | 1721 |
| 1718 } // namespace test_runner | 1722 } // namespace test_runner |
| OLD | NEW |