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

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

Issue 1435113003: Make use of new AX name calc in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue with ariaTextAlternative Created 5 years, 1 month 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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 } 985 }
986 986
987 WebURL WebAXObject::url() const 987 WebURL WebAXObject::url() const
988 { 988 {
989 if (isDetached()) 989 if (isDetached())
990 return WebURL(); 990 return WebURL();
991 991
992 return m_private->url(); 992 return m_private->url();
993 } 993 }
994 994
995 WebString WebAXObject::deprecatedAccessibilityDescription() const
996 {
997 if (isDetached())
998 return WebString();
999
1000 ASSERT(isLayoutClean(m_private->document()));
1001
1002 return m_private->deprecatedAccessibilityDescription();
1003 }
1004
1005 bool WebAXObject::deprecatedAriaDescribedby(WebVector<WebAXObject>& describedbyE lements) const
1006 {
1007 if (isDetached())
1008 return false;
1009
1010 AXObject::AXObjectVector describedby;
1011 m_private->deprecatedAriaDescribedbyElements(describedby);
1012
1013 WebVector<WebAXObject> result(describedby.size());
1014 for (size_t i = 0; i < describedby.size(); i++)
1015 result[i] = WebAXObject(describedby[i]);
1016 describedbyElements.swap(result);
1017
1018 return true;
1019 }
1020
1021 bool WebAXObject::deprecatedAriaLabelledby(WebVector<WebAXObject>& labelledbyEle ments) const
1022 {
1023 if (isDetached())
1024 return false;
1025
1026 AXObject::AXObjectVector labelledby;
1027 m_private->deprecatedAriaLabelledbyElements(labelledby);
1028
1029 WebVector<WebAXObject> result(labelledby.size());
1030 for (size_t i = 0; i < labelledby.size(); i++)
1031 result[i] = WebAXObject(labelledby[i]);
1032 labelledbyElements.swap(result);
1033
1034 return true;
1035 }
1036
1037 WebString WebAXObject::deprecatedHelpText() const
1038 {
1039 if (isDetached())
1040 return WebString();
1041
1042 return m_private->deprecatedHelpText();
1043 }
1044
1045 WebString WebAXObject::deprecatedPlaceholder() const
1046 {
1047 if (isDetached())
1048 return WebString();
1049
1050 return WebString(m_private->deprecatedPlaceholder());
1051 }
1052
1053 WebString WebAXObject::deprecatedTitle() const
1054 {
1055 if (isDetached())
1056 return WebString();
1057
1058 ASSERT(isLayoutClean(m_private->document()));
1059
1060 return m_private->deprecatedTitle();
1061 }
1062
1063 WebAXObject WebAXObject::deprecatedTitleUIElement() const
1064 {
1065 if (isDetached())
1066 return WebAXObject();
1067
1068 if (!m_private->deprecatedExposesTitleUIElement())
1069 return WebAXObject();
1070
1071 return WebAXObject(m_private->deprecatedTitleUIElement());
1072 }
1073
1074 WebString WebAXObject::accessibilityDescription() const
1075 {
1076 return deprecatedAccessibilityDescription();
1077 }
1078
1079 bool WebAXObject::ariaDescribedby(WebVector<WebAXObject>& describedbyElements) c onst
1080 {
1081 return deprecatedAriaDescribedby(describedbyElements);
1082 }
1083
1084 bool WebAXObject::ariaLabelledby(WebVector<WebAXObject>& labelledbyElements) con st
1085 {
1086 return deprecatedAriaLabelledby(labelledbyElements);
1087 }
1088
1089 WebString WebAXObject::helpText() const
1090 {
1091 return deprecatedHelpText();
1092 }
1093
1094 WebString WebAXObject::placeholder() const
1095 {
1096 return deprecatedPlaceholder();
1097 }
1098
1099 WebString WebAXObject::title() const
1100 {
1101 return deprecatedTitle();
1102 }
1103
1104 WebAXObject WebAXObject::titleUIElement() const
1105 {
1106 return deprecatedTitleUIElement();
1107 }
1108
1109 WebString WebAXObject::name(WebAXNameFrom& outNameFrom, WebVector<WebAXObject>& outNameObjects) const 995 WebString WebAXObject::name(WebAXNameFrom& outNameFrom, WebVector<WebAXObject>& outNameObjects) const
1110 { 996 {
1111 if (isDetached()) 997 if (isDetached())
1112 return WebString(); 998 return WebString();
1113 999
1114 AXNameFrom nameFrom = AXNameFromAttribute; 1000 AXNameFrom nameFrom = AXNameFromUninitialized;
1115 HeapVector<Member<AXObject>> nameObjects; 1001 HeapVector<Member<AXObject>> nameObjects;
1116 WebString result = m_private->name(nameFrom, &nameObjects); 1002 WebString result = m_private->name(nameFrom, &nameObjects);
1117 outNameFrom = static_cast<WebAXNameFrom>(nameFrom); 1003 outNameFrom = static_cast<WebAXNameFrom>(nameFrom);
1118 1004
1119 WebVector<WebAXObject> webNameObjects(nameObjects.size()); 1005 WebVector<WebAXObject> webNameObjects(nameObjects.size());
1120 for (size_t i = 0; i < nameObjects.size(); i++) 1006 for (size_t i = 0; i < nameObjects.size(); i++)
1121 webNameObjects[i] = WebAXObject(nameObjects[i]); 1007 webNameObjects[i] = WebAXObject(nameObjects[i]);
1122 outNameObjects.swap(webNameObjects); 1008 outNameObjects.swap(webNameObjects);
1123 1009
1124 return result; 1010 return result;
1125 } 1011 }
1126 1012
1013 WebString WebAXObject::name() const
1014 {
1015 if (isDetached())
1016 return WebString();
1017
1018 AXNameFrom nameFrom;
1019 HeapVector<Member<AXObject>> nameObjects;
1020 return m_private->name(nameFrom, &nameObjects);
1021 }
1022
1127 WebString WebAXObject::description(WebAXNameFrom nameFrom, WebAXDescriptionFrom& outDescriptionFrom, WebVector<WebAXObject>& outDescriptionObjects) const 1023 WebString WebAXObject::description(WebAXNameFrom nameFrom, WebAXDescriptionFrom& outDescriptionFrom, WebVector<WebAXObject>& outDescriptionObjects) const
1128 { 1024 {
1129 if (isDetached()) 1025 if (isDetached())
1130 return WebString(); 1026 return WebString();
1131 1027
1132 AXDescriptionFrom descriptionFrom; 1028 AXDescriptionFrom descriptionFrom = AXDescriptionFromUninitialized;
1133 HeapVector<Member<AXObject>> descriptionObjects; 1029 HeapVector<Member<AXObject>> descriptionObjects;
1134 String result = m_private->description(static_cast<AXNameFrom>(nameFrom), de scriptionFrom, &descriptionObjects); 1030 String result = m_private->description(static_cast<AXNameFrom>(nameFrom), de scriptionFrom, &descriptionObjects);
1135 outDescriptionFrom = static_cast<WebAXDescriptionFrom>(descriptionFrom); 1031 outDescriptionFrom = static_cast<WebAXDescriptionFrom>(descriptionFrom);
1136 1032
1137 WebVector<WebAXObject> webDescriptionObjects(descriptionObjects.size()); 1033 WebVector<WebAXObject> webDescriptionObjects(descriptionObjects.size());
1138 for (size_t i = 0; i < descriptionObjects.size(); i++) 1034 for (size_t i = 0; i < descriptionObjects.size(); i++)
1139 webDescriptionObjects[i] = WebAXObject(descriptionObjects[i]); 1035 webDescriptionObjects[i] = WebAXObject(descriptionObjects[i]);
1140 outDescriptionObjects.swap(webDescriptionObjects); 1036 outDescriptionObjects.swap(webDescriptionObjects);
1141 1037
1142 return result; 1038 return result;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 m_private = object; 1517 m_private = object;
1622 return *this; 1518 return *this;
1623 } 1519 }
1624 1520
1625 WebAXObject::operator AXObject*() const 1521 WebAXObject::operator AXObject*() const
1626 { 1522 {
1627 return m_private.get(); 1523 return m_private.get();
1628 } 1524 }
1629 1525
1630 } // namespace blink 1526 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698