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

Side by Side Diff: Source/modules/accessibility/AXNodeObject.cpp

Issue 864533002: Fix template angle bracket syntax in modules (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 if (node->isHTMLElement()) { 91 if (node->isHTMLElement()) {
92 const AtomicString& alt = toHTMLElement(node)->getAttribute(altAttr); 92 const AtomicString& alt = toHTMLElement(node)->getAttribute(altAttr);
93 if (!alt.isEmpty()) 93 if (!alt.isEmpty())
94 return alt; 94 return alt;
95 } 95 }
96 96
97 return String(); 97 return String();
98 } 98 }
99 99
100 String AXNodeObject::accessibilityDescriptionForElements(WillBeHeapVector<RawPtr WillBeMember<Element> > &elements) const 100 String AXNodeObject::accessibilityDescriptionForElements(WillBeHeapVector<RawPtr WillBeMember<Element>> &elements) const
101 { 101 {
102 StringBuilder builder; 102 StringBuilder builder;
103 unsigned size = elements.size(); 103 unsigned size = elements.size();
104 for (unsigned i = 0; i < size; ++i) { 104 for (unsigned i = 0; i < size; ++i) {
105 Element* idElement = elements[i]; 105 Element* idElement = elements[i];
106 106
107 builder.append(accessibleNameForNode(idElement)); 107 builder.append(accessibleNameForNode(idElement));
108 for (Node& n : NodeTraversal::descendantsOf(*idElement)) 108 for (Node& n : NodeTraversal::descendantsOf(*idElement))
109 builder.append(accessibleNameForNode(&n)); 109 builder.append(accessibleNameForNode(&n));
110 110
(...skipping 21 matching lines...) Expand all
132 return ariaLabeledBy; 132 return ariaLabeledBy;
133 133
134 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); 134 const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
135 if (!ariaLabel.isEmpty()) 135 if (!ariaLabel.isEmpty())
136 return ariaLabel; 136 return ariaLabel;
137 137
138 return String(); 138 return String();
139 } 139 }
140 140
141 141
142 void AXNodeObject::ariaLabeledByElements(WillBeHeapVector<RawPtrWillBeMember<Ele ment> >& elements) const 142 void AXNodeObject::ariaLabeledByElements(WillBeHeapVector<RawPtrWillBeMember<Ele ment>>& elements) const
143 { 143 {
144 elementsFromAttribute(elements, aria_labeledbyAttr); 144 elementsFromAttribute(elements, aria_labeledbyAttr);
145 if (!elements.size()) 145 if (!elements.size())
146 elementsFromAttribute(elements, aria_labelledbyAttr); 146 elementsFromAttribute(elements, aria_labelledbyAttr);
147 } 147 }
148 148
149 void AXNodeObject::changeValueByStep(bool increase) 149 void AXNodeObject::changeValueByStep(bool increase)
150 { 150 {
151 float step = stepValueForRange(); 151 float step = stepValueForRange();
152 float value = valueForRange(); 152 float value = valueForRange();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 role = TextFieldRole; 311 role = TextFieldRole;
312 312
313 role = remapAriaRoleDueToParent(role); 313 role = remapAriaRoleDueToParent(role);
314 314
315 if (role) 315 if (role)
316 return role; 316 return role;
317 317
318 return UnknownRole; 318 return UnknownRole;
319 } 319 }
320 320
321 void AXNodeObject::elementsFromAttribute(WillBeHeapVector<RawPtrWillBeMember<Ele ment> >& elements, const QualifiedName& attribute) const 321 void AXNodeObject::elementsFromAttribute(WillBeHeapVector<RawPtrWillBeMember<Ele ment>>& elements, const QualifiedName& attribute) const
322 { 322 {
323 Node* node = this->node(); 323 Node* node = this->node();
324 if (!node || !node->isElementNode()) 324 if (!node || !node->isElementNode())
325 return; 325 return;
326 326
327 TreeScope& scope = node->treeScope(); 327 TreeScope& scope = node->treeScope();
328 328
329 String idList = getAttribute(attribute).string(); 329 String idList = getAttribute(attribute).string();
330 if (idList.isEmpty()) 330 if (idList.isEmpty())
331 return; 331 return;
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 staticText = textUnderElement(); 1173 staticText = textUnderElement();
1174 return staticText; 1174 return staticText;
1175 } 1175 }
1176 1176
1177 if (node->isTextNode()) 1177 if (node->isTextNode())
1178 return textUnderElement(); 1178 return textUnderElement();
1179 1179
1180 if (isHTMLSelectElement(*node)) { 1180 if (isHTMLSelectElement(*node)) {
1181 HTMLSelectElement& selectElement = toHTMLSelectElement(*node); 1181 HTMLSelectElement& selectElement = toHTMLSelectElement(*node);
1182 int selectedIndex = selectElement.selectedIndex(); 1182 int selectedIndex = selectElement.selectedIndex();
1183 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& listItems = se lectElement.listItems(); 1183 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = sel ectElement.listItems();
1184 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) { 1184 if (selectedIndex >= 0 && static_cast<size_t>(selectedIndex) < listItems .size()) {
1185 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr); 1185 const AtomicString& overriddenDescription = listItems[selectedIndex] ->fastGetAttribute(aria_labelAttr);
1186 if (!overriddenDescription.isNull()) 1186 if (!overriddenDescription.isNull())
1187 return overriddenDescription; 1187 return overriddenDescription;
1188 } 1188 }
1189 if (!selectElement.multiple()) 1189 if (!selectElement.multiple())
1190 return selectElement.value(); 1190 return selectElement.value();
1191 return String(); 1191 return String();
1192 } 1192 }
1193 1193
(...skipping 15 matching lines...) Expand all
1209 return nullAtom; 1209 return nullAtom;
1210 1210
1211 HTMLInputElement& input = toHTMLInputElement(*node); 1211 HTMLInputElement& input = toHTMLInputElement(*node);
1212 if (input.isTextField()) 1212 if (input.isTextField())
1213 return input.type(); 1213 return input.type();
1214 return nullAtom; 1214 return nullAtom;
1215 } 1215 }
1216 1216
1217 String AXNodeObject::ariaDescribedByAttribute() const 1217 String AXNodeObject::ariaDescribedByAttribute() const
1218 { 1218 {
1219 WillBeHeapVector<RawPtrWillBeMember<Element> > elements; 1219 WillBeHeapVector<RawPtrWillBeMember<Element>> elements;
1220 elementsFromAttribute(elements, aria_describedbyAttr); 1220 elementsFromAttribute(elements, aria_describedbyAttr);
1221 1221
1222 return accessibilityDescriptionForElements(elements); 1222 return accessibilityDescriptionForElements(elements);
1223 } 1223 }
1224 1224
1225 String AXNodeObject::ariaLabeledByAttribute() const 1225 String AXNodeObject::ariaLabeledByAttribute() const
1226 { 1226 {
1227 WillBeHeapVector<RawPtrWillBeMember<Element> > elements; 1227 WillBeHeapVector<RawPtrWillBeMember<Element>> elements;
1228 ariaLabeledByElements(elements); 1228 ariaLabeledByElements(elements);
1229 1229
1230 return accessibilityDescriptionForElements(elements); 1230 return accessibilityDescriptionForElements(elements);
1231 } 1231 }
1232 1232
1233 AccessibilityRole AXNodeObject::ariaRoleAttribute() const 1233 AccessibilityRole AXNodeObject::ariaRoleAttribute() const
1234 { 1234 {
1235 return m_ariaRole; 1235 return m_ariaRole;
1236 } 1236 }
1237 1237
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 const AtomicString& alt = getAttribute(altAttr); 1936 const AtomicString& alt = getAttribute(altAttr);
1937 if (!alt.isNull()) 1937 if (!alt.isNull())
1938 textOrder.append(AccessibilityText(alt, AlternativeText)); 1938 textOrder.append(AccessibilityText(alt, AlternativeText));
1939 } 1939 }
1940 } 1940 }
1941 1941
1942 void AXNodeObject::ariaLabeledByText(Vector<AccessibilityText>& textOrder) const 1942 void AXNodeObject::ariaLabeledByText(Vector<AccessibilityText>& textOrder) const
1943 { 1943 {
1944 String ariaLabeledBy = ariaLabeledByAttribute(); 1944 String ariaLabeledBy = ariaLabeledByAttribute();
1945 if (!ariaLabeledBy.isEmpty()) { 1945 if (!ariaLabeledBy.isEmpty()) {
1946 WillBeHeapVector<RawPtrWillBeMember<Element> > elements; 1946 WillBeHeapVector<RawPtrWillBeMember<Element>> elements;
1947 ariaLabeledByElements(elements); 1947 ariaLabeledByElements(elements);
1948 1948
1949 unsigned length = elements.size(); 1949 unsigned length = elements.size();
1950 for (unsigned k = 0; k < length; k++) { 1950 for (unsigned k = 0; k < length; k++) {
1951 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(elements[k ]); 1951 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(elements[k ]);
1952 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement)); 1952 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement));
1953 } 1953 }
1954 } 1954 }
1955 } 1955 }
1956 1956
1957 void AXNodeObject::changeValueByPercent(float percentChange) 1957 void AXNodeObject::changeValueByPercent(float percentChange)
1958 { 1958 {
1959 float range = maxValueForRange() - minValueForRange(); 1959 float range = maxValueForRange() - minValueForRange();
1960 float value = valueForRange(); 1960 float value = valueForRange();
1961 1961
1962 value += range * (percentChange / 100); 1962 value += range * (percentChange / 100);
1963 setValue(String::number(value)); 1963 setValue(String::number(value));
1964 1964
1965 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); 1965 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true);
1966 } 1966 }
1967 1967
1968 } // namespace blink 1968 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698