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

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

Issue 2907133002: Move WebAXObject.cpp to core/ (WIP) (Closed)
Patch Set: Created 3 years, 6 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 if (IsDetached()) 559 if (IsDetached())
561 return WebString(); 560 return WebString();
562 561
563 return private_->LiveRegionStatus(); 562 return private_->LiveRegionStatus();
564 } 563 }
565 564
566 WebAXObject WebAXObject::LiveRegionRoot() const { 565 WebAXObject WebAXObject::LiveRegionRoot() const {
567 if (IsDetached()) 566 if (IsDetached())
568 return WebAXObject(); 567 return WebAXObject();
569 568
570 AXObjectImpl* live_region_root = private_->LiveRegionRoot(); 569 AXObject* live_region_root = private_->LiveRegionRoot();
571 if (live_region_root) 570 if (live_region_root)
572 return WebAXObject(live_region_root); 571 return WebAXObject(live_region_root);
573 return WebAXObject(); 572 return WebAXObject();
574 } 573 }
575 574
576 bool WebAXObject::ContainerLiveRegionAtomic() const { 575 bool WebAXObject::ContainerLiveRegionAtomic() const {
577 if (IsDetached()) 576 if (IsDetached())
578 return false; 577 return false;
579 578
580 return private_->ContainerLiveRegionAtomic(); 579 return private_->ContainerLiveRegionAtomic();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 // that (0, 0) is the top left of the visual viewport. In other words, the 678 // that (0, 0) is the top left of the visual viewport. In other words, the
680 // point has the VisualViewport scale applied, but not the VisualViewport 679 // point has the VisualViewport scale applied, but not the VisualViewport
681 // offset. crbug.com/459591. 680 // offset. crbug.com/459591.
682 WebAXObject WebAXObject::HitTest(const WebPoint& point) const { 681 WebAXObject WebAXObject::HitTest(const WebPoint& point) const {
683 if (IsDetached()) 682 if (IsDetached())
684 return WebAXObject(); 683 return WebAXObject();
685 684
686 IntPoint contents_point = 685 IntPoint contents_point =
687 private_->DocumentFrameView()->SoonToBeRemovedUnscaledViewportToContents( 686 private_->DocumentFrameView()->SoonToBeRemovedUnscaledViewportToContents(
688 point); 687 point);
689 AXObjectImpl* hit = private_->AccessibilityHitTest(contents_point); 688 AXObject* hit = private_->AccessibilityHitTest(contents_point);
690 689
691 if (hit) 690 if (hit)
692 return WebAXObject(hit); 691 return WebAXObject(hit);
693 692
694 if (private_->GetBoundsInFrameCoordinates().Contains(contents_point)) 693 if (private_->GetBoundsInFrameCoordinates().Contains(contents_point))
695 return *this; 694 return *this;
696 695
697 return WebAXObject(); 696 return WebAXObject();
698 } 697 }
699 698
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 if (CanDecrement()) { 757 if (CanDecrement()) {
759 private_->Decrement(); 758 private_->Decrement();
760 return true; 759 return true;
761 } 760 }
762 return false; 761 return false;
763 } 762 }
764 763
765 WebAXObject WebAXObject::InPageLinkTarget() const { 764 WebAXObject WebAXObject::InPageLinkTarget() const {
766 if (IsDetached()) 765 if (IsDetached())
767 return WebAXObject(); 766 return WebAXObject();
768 AXObjectImpl* target = private_->InPageLinkTarget(); 767 AXObject* target = private_->InPageLinkTarget();
769 if (!target) 768 if (!target)
770 return WebAXObject(); 769 return WebAXObject();
771 return WebAXObject(target); 770 return WebAXObject(target);
772 } 771 }
773 772
774 WebAXOrientation WebAXObject::Orientation() const { 773 WebAXOrientation WebAXObject::Orientation() const {
775 if (IsDetached()) 774 if (IsDetached())
776 return kWebAXOrientationUndefined; 775 return kWebAXOrientationUndefined;
777 776
778 return static_cast<WebAXOrientation>(private_->Orientation()); 777 return static_cast<WebAXOrientation>(private_->Orientation());
779 } 778 }
780 779
781 bool WebAXObject::Press() const { 780 bool WebAXObject::Press() const {
782 if (IsDetached()) 781 if (IsDetached())
783 return false; 782 return false;
784 783
785 return private_->Press(); 784 return private_->Press();
786 } 785 }
787 786
788 WebVector<WebAXObject> WebAXObject::RadioButtonsInGroup() const { 787 WebVector<WebAXObject> WebAXObject::RadioButtonsInGroup() const {
789 if (IsDetached()) 788 if (IsDetached())
790 return WebVector<WebAXObject>(); 789 return WebVector<WebAXObject>();
791 790
792 AXObjectImpl::AXObjectVector radio_buttons = private_->RadioButtonsInGroup(); 791 AXObject::AXObjectVector radio_buttons = private_->RadioButtonsInGroup();
793 WebVector<WebAXObject> web_radio_buttons(radio_buttons.size()); 792 WebVector<WebAXObject> web_radio_buttons(radio_buttons.size());
794 for (size_t i = 0; i < radio_buttons.size(); ++i) 793 for (size_t i = 0; i < radio_buttons.size(); ++i)
795 web_radio_buttons[i] = WebAXObject(radio_buttons[i]); 794 web_radio_buttons[i] = WebAXObject(radio_buttons[i]);
796 return web_radio_buttons; 795 return web_radio_buttons;
797 } 796 }
798 797
799 WebAXRole WebAXObject::Role() const { 798 WebAXRole WebAXObject::Role() const {
800 if (IsDetached()) 799 if (IsDetached())
801 return kWebAXRoleUnknown; 800 return kWebAXRoleUnknown;
802 801
803 return static_cast<WebAXRole>(private_->RoleValue()); 802 return static_cast<WebAXRole>(private_->RoleValue());
804 } 803 }
805 804
806 void WebAXObject::Selection(WebAXObject& anchor_object, 805 void WebAXObject::Selection(WebAXObject& anchor_object,
807 int& anchor_offset, 806 int& anchor_offset,
808 WebAXTextAffinity& anchor_affinity, 807 WebAXTextAffinity& anchor_affinity,
809 WebAXObject& focus_object, 808 WebAXObject& focus_object,
810 int& focus_offset, 809 int& focus_offset,
811 WebAXTextAffinity& focus_affinity) const { 810 WebAXTextAffinity& focus_affinity) const {
812 if (IsDetached()) { 811 if (IsDetached()) {
813 anchor_object = WebAXObject(); 812 anchor_object = WebAXObject();
814 anchor_offset = -1; 813 anchor_offset = -1;
815 anchor_affinity = kWebAXTextAffinityDownstream; 814 anchor_affinity = kWebAXTextAffinityDownstream;
816 focus_object = WebAXObject(); 815 focus_object = WebAXObject();
817 focus_offset = -1; 816 focus_offset = -1;
818 focus_affinity = kWebAXTextAffinityDownstream; 817 focus_affinity = kWebAXTextAffinityDownstream;
819 return; 818 return;
820 } 819 }
821 820
822 AXObjectImpl::AXRange ax_selection = private_->Selection(); 821 AXObject::AXRange ax_selection = private_->Selection();
823 anchor_object = WebAXObject(ax_selection.anchor_object); 822 anchor_object = WebAXObject(ax_selection.anchor_object);
824 anchor_offset = ax_selection.anchor_offset; 823 anchor_offset = ax_selection.anchor_offset;
825 anchor_affinity = 824 anchor_affinity =
826 static_cast<WebAXTextAffinity>(ax_selection.anchor_affinity); 825 static_cast<WebAXTextAffinity>(ax_selection.anchor_affinity);
827 focus_object = WebAXObject(ax_selection.focus_object); 826 focus_object = WebAXObject(ax_selection.focus_object);
828 focus_offset = ax_selection.focus_offset; 827 focus_offset = ax_selection.focus_offset;
829 focus_affinity = static_cast<WebAXTextAffinity>(ax_selection.focus_affinity); 828 focus_affinity = static_cast<WebAXTextAffinity>(ax_selection.focus_affinity);
830 return; 829 return;
831 } 830 }
832 831
833 void WebAXObject::SetSelection(const WebAXObject& anchor_object, 832 void WebAXObject::SetSelection(const WebAXObject& anchor_object,
834 int anchor_offset, 833 int anchor_offset,
835 const WebAXObject& focus_object, 834 const WebAXObject& focus_object,
836 int focus_offset) const { 835 int focus_offset) const {
837 if (IsDetached()) 836 if (IsDetached())
838 return; 837 return;
839 838
840 AXObjectImpl::AXRange ax_selection(anchor_object, anchor_offset, 839 AXObject::AXRange ax_selection(anchor_object, anchor_offset,
841 TextAffinity::kUpstream, focus_object, 840 TextAffinity::kUpstream, focus_object,
842 focus_offset, TextAffinity::kDownstream); 841 focus_offset, TextAffinity::kDownstream);
843 private_->SetSelection(ax_selection); 842 private_->SetSelection(ax_selection);
844 return; 843 return;
845 } 844 }
846 845
847 unsigned WebAXObject::SelectionEnd() const { 846 unsigned WebAXObject::SelectionEnd() const {
848 if (IsDetached()) 847 if (IsDetached())
849 return 0; 848 return 0;
850 849
851 AXObjectImpl::AXRange ax_selection = private_->SelectionUnderObject(); 850 AXObject::AXRange ax_selection = private_->SelectionUnderObject();
852 if (ax_selection.focus_offset < 0) 851 if (ax_selection.focus_offset < 0)
853 return 0; 852 return 0;
854 853
855 return ax_selection.focus_offset; 854 return ax_selection.focus_offset;
856 } 855 }
857 856
858 unsigned WebAXObject::SelectionStart() const { 857 unsigned WebAXObject::SelectionStart() const {
859 if (IsDetached()) 858 if (IsDetached())
860 return 0; 859 return 0;
861 860
862 AXObjectImpl::AXRange ax_selection = private_->SelectionUnderObject(); 861 AXObject::AXRange ax_selection = private_->SelectionUnderObject();
863 if (ax_selection.anchor_offset < 0) 862 if (ax_selection.anchor_offset < 0)
864 return 0; 863 return 0;
865 864
866 return ax_selection.anchor_offset; 865 return ax_selection.anchor_offset;
867 } 866 }
868 867
869 unsigned WebAXObject::SelectionEndLineNumber() const { 868 unsigned WebAXObject::SelectionEndLineNumber() const {
870 if (IsDetached()) 869 if (IsDetached())
871 return 0; 870 return 0;
872 871
(...skipping 21 matching lines...) Expand all
894 void WebAXObject::SetFocused(bool on) const { 893 void WebAXObject::SetFocused(bool on) const {
895 if (!IsDetached()) 894 if (!IsDetached())
896 private_->SetFocused(on); 895 private_->SetFocused(on);
897 } 896 }
898 897
899 void WebAXObject::SetSelectedTextRange(int selection_start, 898 void WebAXObject::SetSelectedTextRange(int selection_start,
900 int selection_end) const { 899 int selection_end) const {
901 if (IsDetached()) 900 if (IsDetached())
902 return; 901 return;
903 902
904 private_->SetSelection(AXObjectImpl::AXRange(selection_start, selection_end)); 903 private_->SetSelection(AXObject::AXRange(selection_start, selection_end));
905 } 904 }
906 905
907 void WebAXObject::SetSequentialFocusNavigationStartingPoint() const { 906 void WebAXObject::SetSequentialFocusNavigationStartingPoint() const {
908 if (IsDetached()) 907 if (IsDetached())
909 return; 908 return;
910 909
911 private_->SetSequentialFocusNavigationStartingPoint(); 910 private_->SetSequentialFocusNavigationStartingPoint();
912 } 911 }
913 912
914 void WebAXObject::SetValue(WebString value) const { 913 void WebAXObject::SetValue(WebString value) const {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 980
982 return private_->Url(); 981 return private_->Url();
983 } 982 }
984 983
985 WebString WebAXObject::GetName(WebAXNameFrom& out_name_from, 984 WebString WebAXObject::GetName(WebAXNameFrom& out_name_from,
986 WebVector<WebAXObject>& out_name_objects) const { 985 WebVector<WebAXObject>& out_name_objects) const {
987 if (IsDetached()) 986 if (IsDetached())
988 return WebString(); 987 return WebString();
989 988
990 AXNameFrom name_from = kAXNameFromUninitialized; 989 AXNameFrom name_from = kAXNameFromUninitialized;
991 HeapVector<Member<AXObjectImpl>> name_objects; 990 HeapVector<Member<AXObject>> name_objects;
992 WebString result = private_->GetName(name_from, &name_objects); 991 WebString result = private_->GetName(name_from, &name_objects);
993 out_name_from = static_cast<WebAXNameFrom>(name_from); 992 out_name_from = static_cast<WebAXNameFrom>(name_from);
994 993
995 WebVector<WebAXObject> web_name_objects(name_objects.size()); 994 WebVector<WebAXObject> web_name_objects(name_objects.size());
996 for (size_t i = 0; i < name_objects.size(); i++) 995 for (size_t i = 0; i < name_objects.size(); i++)
997 web_name_objects[i] = WebAXObject(name_objects[i]); 996 web_name_objects[i] = WebAXObject(name_objects[i]);
998 out_name_objects.Swap(web_name_objects); 997 out_name_objects.Swap(web_name_objects);
999 998
1000 return result; 999 return result;
1001 } 1000 }
1002 1001
1003 WebString WebAXObject::GetName() const { 1002 WebString WebAXObject::GetName() const {
1004 if (IsDetached()) 1003 if (IsDetached())
1005 return WebString(); 1004 return WebString();
1006 1005
1007 AXNameFrom name_from; 1006 AXNameFrom name_from;
1008 HeapVector<Member<AXObjectImpl>> name_objects; 1007 HeapVector<Member<AXObject>> name_objects;
1009 return private_->GetName(name_from, &name_objects); 1008 return private_->GetName(name_from, &name_objects);
1010 } 1009 }
1011 1010
1012 WebString WebAXObject::Description( 1011 WebString WebAXObject::Description(
1013 WebAXNameFrom name_from, 1012 WebAXNameFrom name_from,
1014 WebAXDescriptionFrom& out_description_from, 1013 WebAXDescriptionFrom& out_description_from,
1015 WebVector<WebAXObject>& out_description_objects) const { 1014 WebVector<WebAXObject>& out_description_objects) const {
1016 if (IsDetached()) 1015 if (IsDetached())
1017 return WebString(); 1016 return WebString();
1018 1017
1019 AXDescriptionFrom description_from = kAXDescriptionFromUninitialized; 1018 AXDescriptionFrom description_from = kAXDescriptionFromUninitialized;
1020 HeapVector<Member<AXObjectImpl>> description_objects; 1019 HeapVector<Member<AXObject>> description_objects;
1021 String result = private_->Description(static_cast<AXNameFrom>(name_from), 1020 String result = private_->Description(static_cast<AXNameFrom>(name_from),
1022 description_from, &description_objects); 1021 description_from, &description_objects);
1023 out_description_from = static_cast<WebAXDescriptionFrom>(description_from); 1022 out_description_from = static_cast<WebAXDescriptionFrom>(description_from);
1024 1023
1025 WebVector<WebAXObject> web_description_objects(description_objects.size()); 1024 WebVector<WebAXObject> web_description_objects(description_objects.size());
1026 for (size_t i = 0; i < description_objects.size(); i++) 1025 for (size_t i = 0; i < description_objects.size(); i++)
1027 web_description_objects[i] = WebAXObject(description_objects[i]); 1026 web_description_objects[i] = WebAXObject(description_objects[i]);
1028 out_description_objects.Swap(web_description_objects); 1027 out_description_objects.Swap(web_description_objects);
1029 1028
1030 return result; 1029 return result;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 return WebAXObject(ToAXTable(private_.Get())->HeaderContainer()); 1237 return WebAXObject(ToAXTable(private_.Get())->HeaderContainer());
1239 } 1238 }
1240 1239
1241 WebAXObject WebAXObject::RowAtIndex(unsigned row_index) const { 1240 WebAXObject WebAXObject::RowAtIndex(unsigned row_index) const {
1242 if (IsDetached()) 1241 if (IsDetached())
1243 return WebAXObject(); 1242 return WebAXObject();
1244 1243
1245 if (!private_->IsAXTable()) 1244 if (!private_->IsAXTable())
1246 return WebAXObject(); 1245 return WebAXObject();
1247 1246
1248 const AXObjectImpl::AXObjectVector& rows = ToAXTable(private_.Get())->Rows(); 1247 const AXObject::AXObjectVector& rows = ToAXTable(private_.Get())->Rows();
1249 if (row_index < rows.size()) 1248 if (row_index < rows.size())
1250 return WebAXObject(rows[row_index]); 1249 return WebAXObject(rows[row_index]);
1251 1250
1252 return WebAXObject(); 1251 return WebAXObject();
1253 } 1252 }
1254 1253
1255 WebAXObject WebAXObject::ColumnAtIndex(unsigned column_index) const { 1254 WebAXObject WebAXObject::ColumnAtIndex(unsigned column_index) const {
1256 if (IsDetached()) 1255 if (IsDetached())
1257 return WebAXObject(); 1256 return WebAXObject();
1258 1257
1259 if (!private_->IsAXTable()) 1258 if (!private_->IsAXTable())
1260 return WebAXObject(); 1259 return WebAXObject();
1261 1260
1262 const AXObjectImpl::AXObjectVector& columns = 1261 const AXObject::AXObjectVector& columns =
1263 ToAXTable(private_.Get())->Columns(); 1262 ToAXTable(private_.Get())->Columns();
1264 if (column_index < columns.size()) 1263 if (column_index < columns.size())
1265 return WebAXObject(columns[column_index]); 1264 return WebAXObject(columns[column_index]);
1266 1265
1267 return WebAXObject(); 1266 return WebAXObject();
1268 } 1267 }
1269 1268
1270 unsigned WebAXObject::RowIndex() const { 1269 unsigned WebAXObject::RowIndex() const {
1271 if (IsDetached()) 1270 if (IsDetached())
1272 return 0; 1271 return 0;
(...skipping 15 matching lines...) Expand all
1288 } 1287 }
1289 1288
1290 void WebAXObject::RowHeaders( 1289 void WebAXObject::RowHeaders(
1291 WebVector<WebAXObject>& row_header_elements) const { 1290 WebVector<WebAXObject>& row_header_elements) const {
1292 if (IsDetached()) 1291 if (IsDetached())
1293 return; 1292 return;
1294 1293
1295 if (!private_->IsAXTable()) 1294 if (!private_->IsAXTable())
1296 return; 1295 return;
1297 1296
1298 AXObjectImpl::AXObjectVector headers; 1297 AXObject::AXObjectVector headers;
1299 ToAXTable(private_.Get())->RowHeaders(headers); 1298 ToAXTable(private_.Get())->RowHeaders(headers);
1300 1299
1301 size_t header_count = headers.size(); 1300 size_t header_count = headers.size();
1302 WebVector<WebAXObject> result(header_count); 1301 WebVector<WebAXObject> result(header_count);
1303 1302
1304 for (size_t i = 0; i < header_count; i++) 1303 for (size_t i = 0; i < header_count; i++)
1305 result[i] = WebAXObject(headers[i]); 1304 result[i] = WebAXObject(headers[i]);
1306 1305
1307 row_header_elements.Swap(result); 1306 row_header_elements.Swap(result);
1308 } 1307 }
(...skipping 19 matching lines...) Expand all
1328 } 1327 }
1329 1328
1330 void WebAXObject::ColumnHeaders( 1329 void WebAXObject::ColumnHeaders(
1331 WebVector<WebAXObject>& column_header_elements) const { 1330 WebVector<WebAXObject>& column_header_elements) const {
1332 if (IsDetached()) 1331 if (IsDetached())
1333 return; 1332 return;
1334 1333
1335 if (!private_->IsAXTable()) 1334 if (!private_->IsAXTable())
1336 return; 1335 return;
1337 1336
1338 AXObjectImpl::AXObjectVector headers; 1337 AXObject::AXObjectVector headers;
1339 ToAXTable(private_.Get())->ColumnHeaders(headers); 1338 ToAXTable(private_.Get())->ColumnHeaders(headers);
1340 1339
1341 size_t header_count = headers.size(); 1340 size_t header_count = headers.size();
1342 WebVector<WebAXObject> result(header_count); 1341 WebVector<WebAXObject> result(header_count);
1343 1342
1344 for (size_t i = 0; i < header_count; i++) 1343 for (size_t i = 0; i < header_count; i++)
1345 result[i] = WebAXObject(headers[i]); 1344 result[i] = WebAXObject(headers[i]);
1346 1345
1347 column_header_elements.Swap(result); 1346 column_header_elements.Swap(result);
1348 } 1347 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 return WebAXObject(private_.Get()->PreviousOnLine()); 1422 return WebAXObject(private_.Get()->PreviousOnLine());
1424 } 1423 }
1425 1424
1426 void WebAXObject::Markers(WebVector<WebAXMarkerType>& types, 1425 void WebAXObject::Markers(WebVector<WebAXMarkerType>& types,
1427 WebVector<int>& starts, 1426 WebVector<int>& starts,
1428 WebVector<int>& ends) const { 1427 WebVector<int>& ends) const {
1429 if (IsDetached()) 1428 if (IsDetached())
1430 return; 1429 return;
1431 1430
1432 Vector<DocumentMarker::MarkerType> marker_types; 1431 Vector<DocumentMarker::MarkerType> marker_types;
1433 Vector<AXObjectImpl::AXRange> marker_ranges; 1432 Vector<AXObject::AXRange> marker_ranges;
1434 private_->Markers(marker_types, marker_ranges); 1433 private_->Markers(marker_types, marker_ranges);
1435 DCHECK_EQ(marker_types.size(), marker_ranges.size()); 1434 DCHECK_EQ(marker_types.size(), marker_ranges.size());
1436 1435
1437 WebVector<WebAXMarkerType> web_marker_types(marker_types.size()); 1436 WebVector<WebAXMarkerType> web_marker_types(marker_types.size());
1438 WebVector<int> start_offsets(marker_ranges.size()); 1437 WebVector<int> start_offsets(marker_ranges.size());
1439 WebVector<int> end_offsets(marker_ranges.size()); 1438 WebVector<int> end_offsets(marker_ranges.size());
1440 for (size_t i = 0; i < marker_types.size(); ++i) { 1439 for (size_t i = 0; i < marker_types.size(); ++i) {
1441 web_marker_types[i] = static_cast<WebAXMarkerType>(marker_types[i]); 1440 web_marker_types[i] = static_cast<WebAXMarkerType>(marker_types[i]);
1442 DCHECK(marker_ranges[i].IsSimple()); 1441 DCHECK(marker_ranges[i].IsSimple());
1443 start_offsets[i] = marker_ranges[i].anchor_offset; 1442 start_offsets[i] = marker_ranges[i].anchor_offset;
(...skipping 17 matching lines...) Expand all
1461 for (size_t i = 0; i < vector_size; i++) 1460 for (size_t i = 0; i < vector_size; i++)
1462 offsets_web_vector[i] = offsets_vector[i]; 1461 offsets_web_vector[i] = offsets_vector[i];
1463 offsets.Swap(offsets_web_vector); 1462 offsets.Swap(offsets_web_vector);
1464 } 1463 }
1465 1464
1466 void WebAXObject::GetWordBoundaries(WebVector<int>& starts, 1465 void WebAXObject::GetWordBoundaries(WebVector<int>& starts,
1467 WebVector<int>& ends) const { 1466 WebVector<int>& ends) const {
1468 if (IsDetached()) 1467 if (IsDetached())
1469 return; 1468 return;
1470 1469
1471 Vector<AXObjectImpl::AXRange> word_boundaries; 1470 Vector<AXObject::AXRange> word_boundaries;
1472 private_->GetWordBoundaries(word_boundaries); 1471 private_->GetWordBoundaries(word_boundaries);
1473 1472
1474 WebVector<int> word_start_offsets(word_boundaries.size()); 1473 WebVector<int> word_start_offsets(word_boundaries.size());
1475 WebVector<int> word_end_offsets(word_boundaries.size()); 1474 WebVector<int> word_end_offsets(word_boundaries.size());
1476 for (size_t i = 0; i < word_boundaries.size(); ++i) { 1475 for (size_t i = 0; i < word_boundaries.size(); ++i) {
1477 DCHECK(word_boundaries[i].IsSimple()); 1476 DCHECK(word_boundaries[i].IsSimple());
1478 word_start_offsets[i] = word_boundaries[i].anchor_offset; 1477 word_start_offsets[i] = word_boundaries[i].anchor_offset;
1479 word_end_offsets[i] = word_boundaries[i].focus_offset; 1478 word_end_offsets[i] = word_boundaries[i].focus_offset;
1480 } 1479 }
1481 1480
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 const WebRect& subfocus) const { 1543 const WebRect& subfocus) const {
1545 if (!IsDetached()) 1544 if (!IsDetached())
1546 private_->ScrollToMakeVisibleWithSubFocus(subfocus); 1545 private_->ScrollToMakeVisibleWithSubFocus(subfocus);
1547 } 1546 }
1548 1547
1549 void WebAXObject::ScrollToGlobalPoint(const WebPoint& point) const { 1548 void WebAXObject::ScrollToGlobalPoint(const WebPoint& point) const {
1550 if (!IsDetached()) 1549 if (!IsDetached())
1551 private_->ScrollToGlobalPoint(point); 1550 private_->ScrollToGlobalPoint(point);
1552 } 1551 }
1553 1552
1554 WebAXObject::WebAXObject(AXObjectImpl* object) : private_(object) {} 1553 WebAXObject::WebAXObject(AXObject* object) : private_(object) {}
1555 1554
1556 WebAXObject& WebAXObject::operator=(AXObjectImpl* object) { 1555 WebAXObject& WebAXObject::operator=(AXObject* object) {
1557 private_ = object; 1556 private_ = object;
1558 return *this; 1557 return *this;
1559 } 1558 }
1560 1559
1561 WebAXObject::operator AXObjectImpl*() const { 1560 WebAXObject::operator AXObject*() const {
1562 return private_.Get(); 1561 return private_.Get();
1563 } 1562 }
1564 1563
1565 } // namespace blink 1564 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698