OLD | NEW |
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 252 |
253 return UnknownRole; | 253 return UnknownRole; |
254 } | 254 } |
255 | 255 |
256 void AccessibilityNodeObject::elementsFromAttribute(Vector<Element*>& elements,
const QualifiedName& attribute) const | 256 void AccessibilityNodeObject::elementsFromAttribute(Vector<Element*>& elements,
const QualifiedName& attribute) const |
257 { | 257 { |
258 Node* node = this->node(); | 258 Node* node = this->node(); |
259 if (!node || !node->isElementNode()) | 259 if (!node || !node->isElementNode()) |
260 return; | 260 return; |
261 | 261 |
262 TreeScope& scope = node->treeScope(); | 262 NonNullPtr<TreeScope> scope = node->treeScope(); |
263 | 263 |
264 String idList = getAttribute(attribute).string(); | 264 String idList = getAttribute(attribute).string(); |
265 if (idList.isEmpty()) | 265 if (idList.isEmpty()) |
266 return; | 266 return; |
267 | 267 |
268 idList.replace('\n', ' '); | 268 idList.replace('\n', ' '); |
269 Vector<String> idVector; | 269 Vector<String> idVector; |
270 idList.split(' ', idVector); | 270 idList.split(' ', idVector); |
271 | 271 |
272 unsigned size = idVector.size(); | 272 unsigned size = idVector.size(); |
273 for (unsigned i = 0; i < size; ++i) { | 273 for (unsigned i = 0; i < size; ++i) { |
274 AtomicString idName(idVector[i]); | 274 AtomicString idName(idVector[i]); |
275 Element* idElement = scope.getElementById(idName); | 275 Element* idElement = scope->getElementById(idName); |
276 if (idElement) | 276 if (idElement) |
277 elements.append(idElement); | 277 elements.append(idElement); |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 // If you call node->rendererIsEditable() since that will return true if an ance
stor is editable. | 281 // If you call node->rendererIsEditable() since that will return true if an ance
stor is editable. |
282 // This only returns true if this is the element that actually has the contentEd
itable attribute set. | 282 // This only returns true if this is the element that actually has the contentEd
itable attribute set. |
283 bool AccessibilityNodeObject::hasContentEditableAttributeSet() const | 283 bool AccessibilityNodeObject::hasContentEditableAttributeSet() const |
284 { | 284 { |
285 if (!hasAttribute(contenteditableAttr)) | 285 if (!hasAttribute(contenteditableAttr)) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 return true; | 334 return true; |
335 } | 335 } |
336 | 336 |
337 HTMLLabelElement* AccessibilityNodeObject::labelForElement(Element* element) con
st | 337 HTMLLabelElement* AccessibilityNodeObject::labelForElement(Element* element) con
st |
338 { | 338 { |
339 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable()) | 339 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable()) |
340 return 0; | 340 return 0; |
341 | 341 |
342 const AtomicString& id = element->getIdAttribute(); | 342 const AtomicString& id = element->getIdAttribute(); |
343 if (!id.isEmpty()) { | 343 if (!id.isEmpty()) { |
344 if (HTMLLabelElement* label = element->treeScope().labelElementForId(id)
) | 344 if (HTMLLabelElement* label = element->treeScope()->labelElementForId(id
)) |
345 return label; | 345 return label; |
346 } | 346 } |
347 | 347 |
348 for (Element* parent = element->parentElement(); parent; parent = parent->pa
rentElement()) { | 348 for (Element* parent = element->parentElement(); parent; parent = parent->pa
rentElement()) { |
349 if (isHTMLLabelElement(parent)) | 349 if (isHTMLLabelElement(parent)) |
350 return toHTMLLabelElement(parent); | 350 return toHTMLLabelElement(parent); |
351 } | 351 } |
352 | 352 |
353 return 0; | 353 return 0; |
354 } | 354 } |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 useTextUnderElement = true; | 1797 useTextUnderElement = true; |
1798 | 1798 |
1799 if (useTextUnderElement) { | 1799 if (useTextUnderElement) { |
1800 String text = textUnderElement(); | 1800 String text = textUnderElement(); |
1801 if (!text.isEmpty()) | 1801 if (!text.isEmpty()) |
1802 textOrder.append(AccessibilityText(text, ChildrenText)); | 1802 textOrder.append(AccessibilityText(text, ChildrenText)); |
1803 } | 1803 } |
1804 } | 1804 } |
1805 | 1805 |
1806 } // namespace WebCore | 1806 } // namespace WebCore |
OLD | NEW |