| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/Node.h" | 37 #include "core/dom/Node.h" |
| 38 #include "core/editing/markers/DocumentMarker.h" | 38 #include "core/editing/markers/DocumentMarker.h" |
| 39 #include "core/exported/WebViewBase.h" | 39 #include "core/exported/WebViewBase.h" |
| 40 #include "core/frame/FrameView.h" | 40 #include "core/frame/FrameView.h" |
| 41 #include "core/frame/VisualViewport.h" | 41 #include "core/frame/VisualViewport.h" |
| 42 #include "core/frame/WebLocalFrameBase.h" | 42 #include "core/frame/WebLocalFrameBase.h" |
| 43 #include "core/input/KeyboardEventManager.h" | 43 #include "core/input/KeyboardEventManager.h" |
| 44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
| 45 #include "core/style/ComputedStyle.h" | 45 #include "core/style/ComputedStyle.h" |
| 46 #include "modules/accessibility/AXObject.h" | |
| 47 #include "modules/accessibility/AXObjectCacheImpl.h" | 46 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 47 #include "modules/accessibility/AXObjectImpl.h" |
| 48 #include "modules/accessibility/AXTable.h" | 48 #include "modules/accessibility/AXTable.h" |
| 49 #include "modules/accessibility/AXTableCell.h" | 49 #include "modules/accessibility/AXTableCell.h" |
| 50 #include "modules/accessibility/AXTableColumn.h" | 50 #include "modules/accessibility/AXTableColumn.h" |
| 51 #include "modules/accessibility/AXTableRow.h" | 51 #include "modules/accessibility/AXTableRow.h" |
| 52 #include "platform/wtf/text/StringBuilder.h" | 52 #include "platform/wtf/text/StringBuilder.h" |
| 53 #include "public/platform/WebFloatRect.h" | 53 #include "public/platform/WebFloatRect.h" |
| 54 #include "public/platform/WebPoint.h" | 54 #include "public/platform/WebPoint.h" |
| 55 #include "public/platform/WebRect.h" | 55 #include "public/platform/WebRect.h" |
| 56 #include "public/platform/WebString.h" | 56 #include "public/platform/WebString.h" |
| 57 #include "public/platform/WebURL.h" | 57 #include "public/platform/WebURL.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 75 value); | 75 value); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void AddStringAttribute(AXStringAttribute attribute, | 78 void AddStringAttribute(AXStringAttribute attribute, |
| 79 const String& value) override { | 79 const String& value) override { |
| 80 attribute_map_.AddStringAttribute( | 80 attribute_map_.AddStringAttribute( |
| 81 static_cast<WebAXStringAttribute>(attribute), value); | 81 static_cast<WebAXStringAttribute>(attribute), value); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void AddObjectAttribute(AXObjectAttribute attribute, | 84 void AddObjectAttribute(AXObjectAttribute attribute, |
| 85 AXObject& value) override { | 85 AXObjectImpl& value) override { |
| 86 attribute_map_.AddObjectAttribute( | 86 attribute_map_.AddObjectAttribute( |
| 87 static_cast<WebAXObjectAttribute>(attribute), WebAXObject(&value)); | 87 static_cast<WebAXObjectAttribute>(attribute), WebAXObject(&value)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void AddObjectVectorAttribute(AXObjectVectorAttribute attribute, | 90 void AddObjectVectorAttribute( |
| 91 HeapVector<Member<AXObject>>& value) override { | 91 AXObjectVectorAttribute attribute, |
| 92 HeapVector<Member<AXObjectImpl>>& value) override { |
| 92 WebVector<WebAXObject> result(value.size()); | 93 WebVector<WebAXObject> result(value.size()); |
| 93 for (size_t i = 0; i < value.size(); i++) | 94 for (size_t i = 0; i < value.size(); i++) |
| 94 result[i] = WebAXObject(value[i]); | 95 result[i] = WebAXObject(value[i]); |
| 95 attribute_map_.AddObjectVectorAttribute( | 96 attribute_map_.AddObjectVectorAttribute( |
| 96 static_cast<WebAXObjectVectorAttribute>(attribute), result); | 97 static_cast<WebAXObjectVectorAttribute>(attribute), result); |
| 97 } | 98 } |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 #if DCHECK_IS_ON() | 101 #if DCHECK_IS_ON() |
| 101 // It's not safe to call some WebAXObject APIs if a layout is pending. | 102 // It's not safe to call some WebAXObject APIs if a layout is pending. |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 if (IsDetached()) | 558 if (IsDetached()) |
| 558 return WebString(); | 559 return WebString(); |
| 559 | 560 |
| 560 return private_->LiveRegionStatus(); | 561 return private_->LiveRegionStatus(); |
| 561 } | 562 } |
| 562 | 563 |
| 563 WebAXObject WebAXObject::LiveRegionRoot() const { | 564 WebAXObject WebAXObject::LiveRegionRoot() const { |
| 564 if (IsDetached()) | 565 if (IsDetached()) |
| 565 return WebAXObject(); | 566 return WebAXObject(); |
| 566 | 567 |
| 567 AXObject* live_region_root = private_->LiveRegionRoot(); | 568 AXObjectImpl* live_region_root = private_->LiveRegionRoot(); |
| 568 if (live_region_root) | 569 if (live_region_root) |
| 569 return WebAXObject(live_region_root); | 570 return WebAXObject(live_region_root); |
| 570 return WebAXObject(); | 571 return WebAXObject(); |
| 571 } | 572 } |
| 572 | 573 |
| 573 bool WebAXObject::ContainerLiveRegionAtomic() const { | 574 bool WebAXObject::ContainerLiveRegionAtomic() const { |
| 574 if (IsDetached()) | 575 if (IsDetached()) |
| 575 return false; | 576 return false; |
| 576 | 577 |
| 577 return private_->ContainerLiveRegionAtomic(); | 578 return private_->ContainerLiveRegionAtomic(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 // that (0, 0) is the top left of the visual viewport. In other words, the | 677 // that (0, 0) is the top left of the visual viewport. In other words, the |
| 677 // point has the VisualViewport scale applied, but not the VisualViewport | 678 // point has the VisualViewport scale applied, but not the VisualViewport |
| 678 // offset. crbug.com/459591. | 679 // offset. crbug.com/459591. |
| 679 WebAXObject WebAXObject::HitTest(const WebPoint& point) const { | 680 WebAXObject WebAXObject::HitTest(const WebPoint& point) const { |
| 680 if (IsDetached()) | 681 if (IsDetached()) |
| 681 return WebAXObject(); | 682 return WebAXObject(); |
| 682 | 683 |
| 683 IntPoint contents_point = | 684 IntPoint contents_point = |
| 684 private_->DocumentFrameView()->SoonToBeRemovedUnscaledViewportToContents( | 685 private_->DocumentFrameView()->SoonToBeRemovedUnscaledViewportToContents( |
| 685 point); | 686 point); |
| 686 AXObject* hit = private_->AccessibilityHitTest(contents_point); | 687 AXObjectImpl* hit = private_->AccessibilityHitTest(contents_point); |
| 687 | 688 |
| 688 if (hit) | 689 if (hit) |
| 689 return WebAXObject(hit); | 690 return WebAXObject(hit); |
| 690 | 691 |
| 691 if (private_->GetBoundsInFrameCoordinates().Contains(contents_point)) | 692 if (private_->GetBoundsInFrameCoordinates().Contains(contents_point)) |
| 692 return *this; | 693 return *this; |
| 693 | 694 |
| 694 return WebAXObject(); | 695 return WebAXObject(); |
| 695 } | 696 } |
| 696 | 697 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 if (CanDecrement()) { | 756 if (CanDecrement()) { |
| 756 private_->Decrement(); | 757 private_->Decrement(); |
| 757 return true; | 758 return true; |
| 758 } | 759 } |
| 759 return false; | 760 return false; |
| 760 } | 761 } |
| 761 | 762 |
| 762 WebAXObject WebAXObject::InPageLinkTarget() const { | 763 WebAXObject WebAXObject::InPageLinkTarget() const { |
| 763 if (IsDetached()) | 764 if (IsDetached()) |
| 764 return WebAXObject(); | 765 return WebAXObject(); |
| 765 AXObject* target = private_->InPageLinkTarget(); | 766 AXObjectImpl* target = private_->InPageLinkTarget(); |
| 766 if (!target) | 767 if (!target) |
| 767 return WebAXObject(); | 768 return WebAXObject(); |
| 768 return WebAXObject(target); | 769 return WebAXObject(target); |
| 769 } | 770 } |
| 770 | 771 |
| 771 WebAXOrientation WebAXObject::Orientation() const { | 772 WebAXOrientation WebAXObject::Orientation() const { |
| 772 if (IsDetached()) | 773 if (IsDetached()) |
| 773 return kWebAXOrientationUndefined; | 774 return kWebAXOrientationUndefined; |
| 774 | 775 |
| 775 return static_cast<WebAXOrientation>(private_->Orientation()); | 776 return static_cast<WebAXOrientation>(private_->Orientation()); |
| 776 } | 777 } |
| 777 | 778 |
| 778 bool WebAXObject::Press() const { | 779 bool WebAXObject::Press() const { |
| 779 if (IsDetached()) | 780 if (IsDetached()) |
| 780 return false; | 781 return false; |
| 781 | 782 |
| 782 return private_->Press(); | 783 return private_->Press(); |
| 783 } | 784 } |
| 784 | 785 |
| 785 WebVector<WebAXObject> WebAXObject::RadioButtonsInGroup() const { | 786 WebVector<WebAXObject> WebAXObject::RadioButtonsInGroup() const { |
| 786 if (IsDetached()) | 787 if (IsDetached()) |
| 787 return WebVector<WebAXObject>(); | 788 return WebVector<WebAXObject>(); |
| 788 | 789 |
| 789 AXObject::AXObjectVector radio_buttons = private_->RadioButtonsInGroup(); | 790 AXObjectImpl::AXObjectVector radio_buttons = private_->RadioButtonsInGroup(); |
| 790 WebVector<WebAXObject> web_radio_buttons(radio_buttons.size()); | 791 WebVector<WebAXObject> web_radio_buttons(radio_buttons.size()); |
| 791 for (size_t i = 0; i < radio_buttons.size(); ++i) | 792 for (size_t i = 0; i < radio_buttons.size(); ++i) |
| 792 web_radio_buttons[i] = WebAXObject(radio_buttons[i]); | 793 web_radio_buttons[i] = WebAXObject(radio_buttons[i]); |
| 793 return web_radio_buttons; | 794 return web_radio_buttons; |
| 794 } | 795 } |
| 795 | 796 |
| 796 WebAXRole WebAXObject::Role() const { | 797 WebAXRole WebAXObject::Role() const { |
| 797 if (IsDetached()) | 798 if (IsDetached()) |
| 798 return kWebAXRoleUnknown; | 799 return kWebAXRoleUnknown; |
| 799 | 800 |
| 800 return static_cast<WebAXRole>(private_->RoleValue()); | 801 return static_cast<WebAXRole>(private_->RoleValue()); |
| 801 } | 802 } |
| 802 | 803 |
| 803 void WebAXObject::Selection(WebAXObject& anchor_object, | 804 void WebAXObject::Selection(WebAXObject& anchor_object, |
| 804 int& anchor_offset, | 805 int& anchor_offset, |
| 805 WebAXTextAffinity& anchor_affinity, | 806 WebAXTextAffinity& anchor_affinity, |
| 806 WebAXObject& focus_object, | 807 WebAXObject& focus_object, |
| 807 int& focus_offset, | 808 int& focus_offset, |
| 808 WebAXTextAffinity& focus_affinity) const { | 809 WebAXTextAffinity& focus_affinity) const { |
| 809 if (IsDetached()) { | 810 if (IsDetached()) { |
| 810 anchor_object = WebAXObject(); | 811 anchor_object = WebAXObject(); |
| 811 anchor_offset = -1; | 812 anchor_offset = -1; |
| 812 anchor_affinity = kWebAXTextAffinityDownstream; | 813 anchor_affinity = kWebAXTextAffinityDownstream; |
| 813 focus_object = WebAXObject(); | 814 focus_object = WebAXObject(); |
| 814 focus_offset = -1; | 815 focus_offset = -1; |
| 815 focus_affinity = kWebAXTextAffinityDownstream; | 816 focus_affinity = kWebAXTextAffinityDownstream; |
| 816 return; | 817 return; |
| 817 } | 818 } |
| 818 | 819 |
| 819 AXObject::AXRange ax_selection = private_->Selection(); | 820 AXObjectImpl::AXRange ax_selection = private_->Selection(); |
| 820 anchor_object = WebAXObject(ax_selection.anchor_object); | 821 anchor_object = WebAXObject(ax_selection.anchor_object); |
| 821 anchor_offset = ax_selection.anchor_offset; | 822 anchor_offset = ax_selection.anchor_offset; |
| 822 anchor_affinity = | 823 anchor_affinity = |
| 823 static_cast<WebAXTextAffinity>(ax_selection.anchor_affinity); | 824 static_cast<WebAXTextAffinity>(ax_selection.anchor_affinity); |
| 824 focus_object = WebAXObject(ax_selection.focus_object); | 825 focus_object = WebAXObject(ax_selection.focus_object); |
| 825 focus_offset = ax_selection.focus_offset; | 826 focus_offset = ax_selection.focus_offset; |
| 826 focus_affinity = static_cast<WebAXTextAffinity>(ax_selection.focus_affinity); | 827 focus_affinity = static_cast<WebAXTextAffinity>(ax_selection.focus_affinity); |
| 827 return; | 828 return; |
| 828 } | 829 } |
| 829 | 830 |
| 830 void WebAXObject::SetSelection(const WebAXObject& anchor_object, | 831 void WebAXObject::SetSelection(const WebAXObject& anchor_object, |
| 831 int anchor_offset, | 832 int anchor_offset, |
| 832 const WebAXObject& focus_object, | 833 const WebAXObject& focus_object, |
| 833 int focus_offset) const { | 834 int focus_offset) const { |
| 834 if (IsDetached()) | 835 if (IsDetached()) |
| 835 return; | 836 return; |
| 836 | 837 |
| 837 AXObject::AXRange ax_selection(anchor_object, anchor_offset, | 838 AXObjectImpl::AXRange ax_selection(anchor_object, anchor_offset, |
| 838 TextAffinity::kUpstream, focus_object, | 839 TextAffinity::kUpstream, focus_object, |
| 839 focus_offset, TextAffinity::kDownstream); | 840 focus_offset, TextAffinity::kDownstream); |
| 840 private_->SetSelection(ax_selection); | 841 private_->SetSelection(ax_selection); |
| 841 return; | 842 return; |
| 842 } | 843 } |
| 843 | 844 |
| 844 unsigned WebAXObject::SelectionEnd() const { | 845 unsigned WebAXObject::SelectionEnd() const { |
| 845 if (IsDetached()) | 846 if (IsDetached()) |
| 846 return 0; | 847 return 0; |
| 847 | 848 |
| 848 AXObject::AXRange ax_selection = private_->SelectionUnderObject(); | 849 AXObjectImpl::AXRange ax_selection = private_->SelectionUnderObject(); |
| 849 if (ax_selection.focus_offset < 0) | 850 if (ax_selection.focus_offset < 0) |
| 850 return 0; | 851 return 0; |
| 851 | 852 |
| 852 return ax_selection.focus_offset; | 853 return ax_selection.focus_offset; |
| 853 } | 854 } |
| 854 | 855 |
| 855 unsigned WebAXObject::SelectionStart() const { | 856 unsigned WebAXObject::SelectionStart() const { |
| 856 if (IsDetached()) | 857 if (IsDetached()) |
| 857 return 0; | 858 return 0; |
| 858 | 859 |
| 859 AXObject::AXRange ax_selection = private_->SelectionUnderObject(); | 860 AXObjectImpl::AXRange ax_selection = private_->SelectionUnderObject(); |
| 860 if (ax_selection.anchor_offset < 0) | 861 if (ax_selection.anchor_offset < 0) |
| 861 return 0; | 862 return 0; |
| 862 | 863 |
| 863 return ax_selection.anchor_offset; | 864 return ax_selection.anchor_offset; |
| 864 } | 865 } |
| 865 | 866 |
| 866 unsigned WebAXObject::SelectionEndLineNumber() const { | 867 unsigned WebAXObject::SelectionEndLineNumber() const { |
| 867 if (IsDetached()) | 868 if (IsDetached()) |
| 868 return 0; | 869 return 0; |
| 869 | 870 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 891 void WebAXObject::SetFocused(bool on) const { | 892 void WebAXObject::SetFocused(bool on) const { |
| 892 if (!IsDetached()) | 893 if (!IsDetached()) |
| 893 private_->SetFocused(on); | 894 private_->SetFocused(on); |
| 894 } | 895 } |
| 895 | 896 |
| 896 void WebAXObject::SetSelectedTextRange(int selection_start, | 897 void WebAXObject::SetSelectedTextRange(int selection_start, |
| 897 int selection_end) const { | 898 int selection_end) const { |
| 898 if (IsDetached()) | 899 if (IsDetached()) |
| 899 return; | 900 return; |
| 900 | 901 |
| 901 private_->SetSelection(AXObject::AXRange(selection_start, selection_end)); | 902 private_->SetSelection(AXObjectImpl::AXRange(selection_start, selection_end)); |
| 902 } | 903 } |
| 903 | 904 |
| 904 void WebAXObject::SetSequentialFocusNavigationStartingPoint() const { | 905 void WebAXObject::SetSequentialFocusNavigationStartingPoint() const { |
| 905 if (IsDetached()) | 906 if (IsDetached()) |
| 906 return; | 907 return; |
| 907 | 908 |
| 908 private_->SetSequentialFocusNavigationStartingPoint(); | 909 private_->SetSequentialFocusNavigationStartingPoint(); |
| 909 } | 910 } |
| 910 | 911 |
| 911 void WebAXObject::SetValue(WebString value) const { | 912 void WebAXObject::SetValue(WebString value) const { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 | 979 |
| 979 return private_->Url(); | 980 return private_->Url(); |
| 980 } | 981 } |
| 981 | 982 |
| 982 WebString WebAXObject::GetName(WebAXNameFrom& out_name_from, | 983 WebString WebAXObject::GetName(WebAXNameFrom& out_name_from, |
| 983 WebVector<WebAXObject>& out_name_objects) const { | 984 WebVector<WebAXObject>& out_name_objects) const { |
| 984 if (IsDetached()) | 985 if (IsDetached()) |
| 985 return WebString(); | 986 return WebString(); |
| 986 | 987 |
| 987 AXNameFrom name_from = kAXNameFromUninitialized; | 988 AXNameFrom name_from = kAXNameFromUninitialized; |
| 988 HeapVector<Member<AXObject>> name_objects; | 989 HeapVector<Member<AXObjectImpl>> name_objects; |
| 989 WebString result = private_->GetName(name_from, &name_objects); | 990 WebString result = private_->GetName(name_from, &name_objects); |
| 990 out_name_from = static_cast<WebAXNameFrom>(name_from); | 991 out_name_from = static_cast<WebAXNameFrom>(name_from); |
| 991 | 992 |
| 992 WebVector<WebAXObject> web_name_objects(name_objects.size()); | 993 WebVector<WebAXObject> web_name_objects(name_objects.size()); |
| 993 for (size_t i = 0; i < name_objects.size(); i++) | 994 for (size_t i = 0; i < name_objects.size(); i++) |
| 994 web_name_objects[i] = WebAXObject(name_objects[i]); | 995 web_name_objects[i] = WebAXObject(name_objects[i]); |
| 995 out_name_objects.Swap(web_name_objects); | 996 out_name_objects.Swap(web_name_objects); |
| 996 | 997 |
| 997 return result; | 998 return result; |
| 998 } | 999 } |
| 999 | 1000 |
| 1000 WebString WebAXObject::GetName() const { | 1001 WebString WebAXObject::GetName() const { |
| 1001 if (IsDetached()) | 1002 if (IsDetached()) |
| 1002 return WebString(); | 1003 return WebString(); |
| 1003 | 1004 |
| 1004 AXNameFrom name_from; | 1005 AXNameFrom name_from; |
| 1005 HeapVector<Member<AXObject>> name_objects; | 1006 HeapVector<Member<AXObjectImpl>> name_objects; |
| 1006 return private_->GetName(name_from, &name_objects); | 1007 return private_->GetName(name_from, &name_objects); |
| 1007 } | 1008 } |
| 1008 | 1009 |
| 1009 WebString WebAXObject::Description( | 1010 WebString WebAXObject::Description( |
| 1010 WebAXNameFrom name_from, | 1011 WebAXNameFrom name_from, |
| 1011 WebAXDescriptionFrom& out_description_from, | 1012 WebAXDescriptionFrom& out_description_from, |
| 1012 WebVector<WebAXObject>& out_description_objects) const { | 1013 WebVector<WebAXObject>& out_description_objects) const { |
| 1013 if (IsDetached()) | 1014 if (IsDetached()) |
| 1014 return WebString(); | 1015 return WebString(); |
| 1015 | 1016 |
| 1016 AXDescriptionFrom description_from = kAXDescriptionFromUninitialized; | 1017 AXDescriptionFrom description_from = kAXDescriptionFromUninitialized; |
| 1017 HeapVector<Member<AXObject>> description_objects; | 1018 HeapVector<Member<AXObjectImpl>> description_objects; |
| 1018 String result = private_->Description(static_cast<AXNameFrom>(name_from), | 1019 String result = private_->Description(static_cast<AXNameFrom>(name_from), |
| 1019 description_from, &description_objects); | 1020 description_from, &description_objects); |
| 1020 out_description_from = static_cast<WebAXDescriptionFrom>(description_from); | 1021 out_description_from = static_cast<WebAXDescriptionFrom>(description_from); |
| 1021 | 1022 |
| 1022 WebVector<WebAXObject> web_description_objects(description_objects.size()); | 1023 WebVector<WebAXObject> web_description_objects(description_objects.size()); |
| 1023 for (size_t i = 0; i < description_objects.size(); i++) | 1024 for (size_t i = 0; i < description_objects.size(); i++) |
| 1024 web_description_objects[i] = WebAXObject(description_objects[i]); | 1025 web_description_objects[i] = WebAXObject(description_objects[i]); |
| 1025 out_description_objects.Swap(web_description_objects); | 1026 out_description_objects.Swap(web_description_objects); |
| 1026 | 1027 |
| 1027 return result; | 1028 return result; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 WebAXObject WebAXObject::CellForColumnAndRow(unsigned column, | 1216 WebAXObject WebAXObject::CellForColumnAndRow(unsigned column, |
| 1216 unsigned row) const { | 1217 unsigned row) const { |
| 1217 if (IsDetached()) | 1218 if (IsDetached()) |
| 1218 return WebAXObject(); | 1219 return WebAXObject(); |
| 1219 | 1220 |
| 1220 if (!private_->IsAXTable()) | 1221 if (!private_->IsAXTable()) |
| 1221 return WebAXObject(); | 1222 return WebAXObject(); |
| 1222 | 1223 |
| 1223 AXTableCell* cell = | 1224 AXTableCell* cell = |
| 1224 ToAXTable(private_.Get())->CellForColumnAndRow(column, row); | 1225 ToAXTable(private_.Get())->CellForColumnAndRow(column, row); |
| 1225 return WebAXObject(static_cast<AXObject*>(cell)); | 1226 return WebAXObject(static_cast<AXObjectImpl*>(cell)); |
| 1226 } | 1227 } |
| 1227 | 1228 |
| 1228 WebAXObject WebAXObject::HeaderContainerObject() const { | 1229 WebAXObject WebAXObject::HeaderContainerObject() const { |
| 1229 if (IsDetached()) | 1230 if (IsDetached()) |
| 1230 return WebAXObject(); | 1231 return WebAXObject(); |
| 1231 | 1232 |
| 1232 if (!private_->IsAXTable()) | 1233 if (!private_->IsAXTable()) |
| 1233 return WebAXObject(); | 1234 return WebAXObject(); |
| 1234 | 1235 |
| 1235 return WebAXObject(ToAXTable(private_.Get())->HeaderContainer()); | 1236 return WebAXObject(ToAXTable(private_.Get())->HeaderContainer()); |
| 1236 } | 1237 } |
| 1237 | 1238 |
| 1238 WebAXObject WebAXObject::RowAtIndex(unsigned row_index) const { | 1239 WebAXObject WebAXObject::RowAtIndex(unsigned row_index) const { |
| 1239 if (IsDetached()) | 1240 if (IsDetached()) |
| 1240 return WebAXObject(); | 1241 return WebAXObject(); |
| 1241 | 1242 |
| 1242 if (!private_->IsAXTable()) | 1243 if (!private_->IsAXTable()) |
| 1243 return WebAXObject(); | 1244 return WebAXObject(); |
| 1244 | 1245 |
| 1245 const AXObject::AXObjectVector& rows = ToAXTable(private_.Get())->Rows(); | 1246 const AXObjectImpl::AXObjectVector& rows = ToAXTable(private_.Get())->Rows(); |
| 1246 if (row_index < rows.size()) | 1247 if (row_index < rows.size()) |
| 1247 return WebAXObject(rows[row_index]); | 1248 return WebAXObject(rows[row_index]); |
| 1248 | 1249 |
| 1249 return WebAXObject(); | 1250 return WebAXObject(); |
| 1250 } | 1251 } |
| 1251 | 1252 |
| 1252 WebAXObject WebAXObject::ColumnAtIndex(unsigned column_index) const { | 1253 WebAXObject WebAXObject::ColumnAtIndex(unsigned column_index) const { |
| 1253 if (IsDetached()) | 1254 if (IsDetached()) |
| 1254 return WebAXObject(); | 1255 return WebAXObject(); |
| 1255 | 1256 |
| 1256 if (!private_->IsAXTable()) | 1257 if (!private_->IsAXTable()) |
| 1257 return WebAXObject(); | 1258 return WebAXObject(); |
| 1258 | 1259 |
| 1259 const AXObject::AXObjectVector& columns = | 1260 const AXObjectImpl::AXObjectVector& columns = |
| 1260 ToAXTable(private_.Get())->Columns(); | 1261 ToAXTable(private_.Get())->Columns(); |
| 1261 if (column_index < columns.size()) | 1262 if (column_index < columns.size()) |
| 1262 return WebAXObject(columns[column_index]); | 1263 return WebAXObject(columns[column_index]); |
| 1263 | 1264 |
| 1264 return WebAXObject(); | 1265 return WebAXObject(); |
| 1265 } | 1266 } |
| 1266 | 1267 |
| 1267 unsigned WebAXObject::RowIndex() const { | 1268 unsigned WebAXObject::RowIndex() const { |
| 1268 if (IsDetached()) | 1269 if (IsDetached()) |
| 1269 return 0; | 1270 return 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1285 } | 1286 } |
| 1286 | 1287 |
| 1287 void WebAXObject::RowHeaders( | 1288 void WebAXObject::RowHeaders( |
| 1288 WebVector<WebAXObject>& row_header_elements) const { | 1289 WebVector<WebAXObject>& row_header_elements) const { |
| 1289 if (IsDetached()) | 1290 if (IsDetached()) |
| 1290 return; | 1291 return; |
| 1291 | 1292 |
| 1292 if (!private_->IsAXTable()) | 1293 if (!private_->IsAXTable()) |
| 1293 return; | 1294 return; |
| 1294 | 1295 |
| 1295 AXObject::AXObjectVector headers; | 1296 AXObjectImpl::AXObjectVector headers; |
| 1296 ToAXTable(private_.Get())->RowHeaders(headers); | 1297 ToAXTable(private_.Get())->RowHeaders(headers); |
| 1297 | 1298 |
| 1298 size_t header_count = headers.size(); | 1299 size_t header_count = headers.size(); |
| 1299 WebVector<WebAXObject> result(header_count); | 1300 WebVector<WebAXObject> result(header_count); |
| 1300 | 1301 |
| 1301 for (size_t i = 0; i < header_count; i++) | 1302 for (size_t i = 0; i < header_count; i++) |
| 1302 result[i] = WebAXObject(headers[i]); | 1303 result[i] = WebAXObject(headers[i]); |
| 1303 | 1304 |
| 1304 row_header_elements.Swap(result); | 1305 row_header_elements.Swap(result); |
| 1305 } | 1306 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1325 } | 1326 } |
| 1326 | 1327 |
| 1327 void WebAXObject::ColumnHeaders( | 1328 void WebAXObject::ColumnHeaders( |
| 1328 WebVector<WebAXObject>& column_header_elements) const { | 1329 WebVector<WebAXObject>& column_header_elements) const { |
| 1329 if (IsDetached()) | 1330 if (IsDetached()) |
| 1330 return; | 1331 return; |
| 1331 | 1332 |
| 1332 if (!private_->IsAXTable()) | 1333 if (!private_->IsAXTable()) |
| 1333 return; | 1334 return; |
| 1334 | 1335 |
| 1335 AXObject::AXObjectVector headers; | 1336 AXObjectImpl::AXObjectVector headers; |
| 1336 ToAXTable(private_.Get())->ColumnHeaders(headers); | 1337 ToAXTable(private_.Get())->ColumnHeaders(headers); |
| 1337 | 1338 |
| 1338 size_t header_count = headers.size(); | 1339 size_t header_count = headers.size(); |
| 1339 WebVector<WebAXObject> result(header_count); | 1340 WebVector<WebAXObject> result(header_count); |
| 1340 | 1341 |
| 1341 for (size_t i = 0; i < header_count; i++) | 1342 for (size_t i = 0; i < header_count; i++) |
| 1342 result[i] = WebAXObject(headers[i]); | 1343 result[i] = WebAXObject(headers[i]); |
| 1343 | 1344 |
| 1344 column_header_elements.Swap(result); | 1345 column_header_elements.Swap(result); |
| 1345 } | 1346 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 return WebAXObject(private_.Get()->PreviousOnLine()); | 1421 return WebAXObject(private_.Get()->PreviousOnLine()); |
| 1421 } | 1422 } |
| 1422 | 1423 |
| 1423 void WebAXObject::Markers(WebVector<WebAXMarkerType>& types, | 1424 void WebAXObject::Markers(WebVector<WebAXMarkerType>& types, |
| 1424 WebVector<int>& starts, | 1425 WebVector<int>& starts, |
| 1425 WebVector<int>& ends) const { | 1426 WebVector<int>& ends) const { |
| 1426 if (IsDetached()) | 1427 if (IsDetached()) |
| 1427 return; | 1428 return; |
| 1428 | 1429 |
| 1429 Vector<DocumentMarker::MarkerType> marker_types; | 1430 Vector<DocumentMarker::MarkerType> marker_types; |
| 1430 Vector<AXObject::AXRange> marker_ranges; | 1431 Vector<AXObjectImpl::AXRange> marker_ranges; |
| 1431 private_->Markers(marker_types, marker_ranges); | 1432 private_->Markers(marker_types, marker_ranges); |
| 1432 DCHECK_EQ(marker_types.size(), marker_ranges.size()); | 1433 DCHECK_EQ(marker_types.size(), marker_ranges.size()); |
| 1433 | 1434 |
| 1434 WebVector<WebAXMarkerType> web_marker_types(marker_types.size()); | 1435 WebVector<WebAXMarkerType> web_marker_types(marker_types.size()); |
| 1435 WebVector<int> start_offsets(marker_ranges.size()); | 1436 WebVector<int> start_offsets(marker_ranges.size()); |
| 1436 WebVector<int> end_offsets(marker_ranges.size()); | 1437 WebVector<int> end_offsets(marker_ranges.size()); |
| 1437 for (size_t i = 0; i < marker_types.size(); ++i) { | 1438 for (size_t i = 0; i < marker_types.size(); ++i) { |
| 1438 web_marker_types[i] = static_cast<WebAXMarkerType>(marker_types[i]); | 1439 web_marker_types[i] = static_cast<WebAXMarkerType>(marker_types[i]); |
| 1439 DCHECK(marker_ranges[i].IsSimple()); | 1440 DCHECK(marker_ranges[i].IsSimple()); |
| 1440 start_offsets[i] = marker_ranges[i].anchor_offset; | 1441 start_offsets[i] = marker_ranges[i].anchor_offset; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1458 for (size_t i = 0; i < vector_size; i++) | 1459 for (size_t i = 0; i < vector_size; i++) |
| 1459 offsets_web_vector[i] = offsets_vector[i]; | 1460 offsets_web_vector[i] = offsets_vector[i]; |
| 1460 offsets.Swap(offsets_web_vector); | 1461 offsets.Swap(offsets_web_vector); |
| 1461 } | 1462 } |
| 1462 | 1463 |
| 1463 void WebAXObject::GetWordBoundaries(WebVector<int>& starts, | 1464 void WebAXObject::GetWordBoundaries(WebVector<int>& starts, |
| 1464 WebVector<int>& ends) const { | 1465 WebVector<int>& ends) const { |
| 1465 if (IsDetached()) | 1466 if (IsDetached()) |
| 1466 return; | 1467 return; |
| 1467 | 1468 |
| 1468 Vector<AXObject::AXRange> word_boundaries; | 1469 Vector<AXObjectImpl::AXRange> word_boundaries; |
| 1469 private_->GetWordBoundaries(word_boundaries); | 1470 private_->GetWordBoundaries(word_boundaries); |
| 1470 | 1471 |
| 1471 WebVector<int> word_start_offsets(word_boundaries.size()); | 1472 WebVector<int> word_start_offsets(word_boundaries.size()); |
| 1472 WebVector<int> word_end_offsets(word_boundaries.size()); | 1473 WebVector<int> word_end_offsets(word_boundaries.size()); |
| 1473 for (size_t i = 0; i < word_boundaries.size(); ++i) { | 1474 for (size_t i = 0; i < word_boundaries.size(); ++i) { |
| 1474 DCHECK(word_boundaries[i].IsSimple()); | 1475 DCHECK(word_boundaries[i].IsSimple()); |
| 1475 word_start_offsets[i] = word_boundaries[i].anchor_offset; | 1476 word_start_offsets[i] = word_boundaries[i].anchor_offset; |
| 1476 word_end_offsets[i] = word_boundaries[i].focus_offset; | 1477 word_end_offsets[i] = word_boundaries[i].focus_offset; |
| 1477 } | 1478 } |
| 1478 | 1479 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 void WebAXObject::GetRelativeBounds(WebAXObject& offset_container, | 1519 void WebAXObject::GetRelativeBounds(WebAXObject& offset_container, |
| 1519 WebFloatRect& bounds_in_container, | 1520 WebFloatRect& bounds_in_container, |
| 1520 SkMatrix44& container_transform) const { | 1521 SkMatrix44& container_transform) const { |
| 1521 if (IsDetached()) | 1522 if (IsDetached()) |
| 1522 return; | 1523 return; |
| 1523 | 1524 |
| 1524 #if DCHECK_IS_ON() | 1525 #if DCHECK_IS_ON() |
| 1525 DCHECK(IsLayoutClean(private_->GetDocument())); | 1526 DCHECK(IsLayoutClean(private_->GetDocument())); |
| 1526 #endif | 1527 #endif |
| 1527 | 1528 |
| 1528 AXObject* container = nullptr; | 1529 AXObjectImpl* container = nullptr; |
| 1529 FloatRect bounds; | 1530 FloatRect bounds; |
| 1530 private_->GetRelativeBounds(&container, bounds, container_transform); | 1531 private_->GetRelativeBounds(&container, bounds, container_transform); |
| 1531 offset_container = WebAXObject(container); | 1532 offset_container = WebAXObject(container); |
| 1532 bounds_in_container = WebFloatRect(bounds); | 1533 bounds_in_container = WebFloatRect(bounds); |
| 1533 } | 1534 } |
| 1534 | 1535 |
| 1535 void WebAXObject::ScrollToMakeVisible() const { | 1536 void WebAXObject::ScrollToMakeVisible() const { |
| 1536 if (!IsDetached()) | 1537 if (!IsDetached()) |
| 1537 private_->ScrollToMakeVisible(); | 1538 private_->ScrollToMakeVisible(); |
| 1538 } | 1539 } |
| 1539 | 1540 |
| 1540 void WebAXObject::ScrollToMakeVisibleWithSubFocus( | 1541 void WebAXObject::ScrollToMakeVisibleWithSubFocus( |
| 1541 const WebRect& subfocus) const { | 1542 const WebRect& subfocus) const { |
| 1542 if (!IsDetached()) | 1543 if (!IsDetached()) |
| 1543 private_->ScrollToMakeVisibleWithSubFocus(subfocus); | 1544 private_->ScrollToMakeVisibleWithSubFocus(subfocus); |
| 1544 } | 1545 } |
| 1545 | 1546 |
| 1546 void WebAXObject::ScrollToGlobalPoint(const WebPoint& point) const { | 1547 void WebAXObject::ScrollToGlobalPoint(const WebPoint& point) const { |
| 1547 if (!IsDetached()) | 1548 if (!IsDetached()) |
| 1548 private_->ScrollToGlobalPoint(point); | 1549 private_->ScrollToGlobalPoint(point); |
| 1549 } | 1550 } |
| 1550 | 1551 |
| 1551 WebAXObject::WebAXObject(AXObject* object) : private_(object) {} | 1552 WebAXObject::WebAXObject(AXObjectImpl* object) : private_(object) {} |
| 1552 | 1553 |
| 1553 WebAXObject& WebAXObject::operator=(AXObject* object) { | 1554 WebAXObject& WebAXObject::operator=(AXObjectImpl* object) { |
| 1554 private_ = object; | 1555 private_ = object; |
| 1555 return *this; | 1556 return *this; |
| 1556 } | 1557 } |
| 1557 | 1558 |
| 1558 WebAXObject::operator AXObject*() const { | 1559 WebAXObject::operator AXObjectImpl*() const { |
| 1559 return private_.Get(); | 1560 return private_.Get(); |
| 1560 } | 1561 } |
| 1561 | 1562 |
| 1562 } // namespace blink | 1563 } // namespace blink |
| OLD | NEW |