Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: third_party/WebKit/Source/web/WebAXObject.cpp

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

Powered by Google App Engine
This is Rietveld 408576698