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

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

Issue 192413002: Use new is*Element() helper functions in accessibility code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 m_ariaRole = determineAriaRoleAttribute(); 178 m_ariaRole = determineAriaRoleAttribute();
179 179
180 AccessibilityRole ariaRole = ariaRoleAttribute(); 180 AccessibilityRole ariaRole = ariaRoleAttribute();
181 if (ariaRole != UnknownRole) 181 if (ariaRole != UnknownRole)
182 return ariaRole; 182 return ariaRole;
183 183
184 if (node()->isLink()) 184 if (node()->isLink())
185 return LinkRole; 185 return LinkRole;
186 if (node()->isTextNode()) 186 if (node()->isTextNode())
187 return StaticTextRole; 187 return StaticTextRole;
188 if (node()->hasTagName(buttonTag)) 188 if (isHTMLButtonElement(*node()))
189 return buttonRoleType(); 189 return buttonRoleType();
190 if (isHTMLInputElement(*node())) { 190 if (isHTMLInputElement(*node())) {
191 HTMLInputElement& input = toHTMLInputElement(*node()); 191 HTMLInputElement& input = toHTMLInputElement(*node());
192 if (input.isCheckbox()) 192 if (input.isCheckbox())
193 return CheckBoxRole; 193 return CheckBoxRole;
194 if (input.isRadioButton()) 194 if (input.isRadioButton())
195 return RadioButtonRole; 195 return RadioButtonRole;
196 if (input.isTextButton()) 196 if (input.isTextButton())
197 return buttonRoleType(); 197 return buttonRoleType();
198 if (input.isRangeControl()) 198 if (input.isRangeControl())
199 return SliderRole; 199 return SliderRole;
200 200
201 const AtomicString& type = input.getAttribute(typeAttr); 201 const AtomicString& type = input.getAttribute(typeAttr);
202 if (equalIgnoringCase(type, "color")) 202 if (equalIgnoringCase(type, "color"))
203 return ColorWellRole; 203 return ColorWellRole;
204 204
205 return TextFieldRole; 205 return TextFieldRole;
206 } 206 }
207 if (isHTMLSelectElement(*node())) { 207 if (isHTMLSelectElement(*node())) {
208 HTMLSelectElement& selectElement = toHTMLSelectElement(*node()); 208 HTMLSelectElement& selectElement = toHTMLSelectElement(*node());
209 return selectElement.multiple() ? ListBoxRole : PopUpButtonRole; 209 return selectElement.multiple() ? ListBoxRole : PopUpButtonRole;
210 } 210 }
211 if (isHTMLTextAreaElement(*node())) 211 if (isHTMLTextAreaElement(*node()))
212 return TextAreaRole; 212 return TextAreaRole;
213 if (headingLevel()) 213 if (headingLevel())
214 return HeadingRole; 214 return HeadingRole;
215 if (node()->hasTagName(divTag)) 215 if (isHTMLDivElement(*node()))
216 return DivRole; 216 return DivRole;
217 if (node()->hasTagName(pTag)) 217 if (isHTMLParagraphElement(*node()))
218 return ParagraphRole; 218 return ParagraphRole;
219 if (node()->hasTagName(labelTag)) 219 if (isHTMLLabelElement(*node()))
220 return LabelRole; 220 return LabelRole;
221 if (node()->isElementNode() && toElement(node())->isFocusable()) 221 if (node()->isElementNode() && toElement(node())->isFocusable())
222 return GroupRole; 222 return GroupRole;
223 if (node()->hasTagName(aTag) && isClickable()) 223 if (isHTMLAnchorElement(*node()) && isClickable())
224 return LinkRole; 224 return LinkRole;
225 225
226 return UnknownRole; 226 return UnknownRole;
227 } 227 }
228 228
229 AccessibilityRole AXNodeObject::determineAriaRoleAttribute() const 229 AccessibilityRole AXNodeObject::determineAriaRoleAttribute() const
230 { 230 {
231 const AtomicString& ariaRole = getAttribute(roleAttr); 231 const AtomicString& ariaRole = getAttribute(roleAttr);
232 if (ariaRole.isNull() || ariaRole.isEmpty()) 232 if (ariaRole.isNull() || ariaRole.isEmpty())
233 return UnknownRole; 233 return UnknownRole;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // it's focusable, and existing logic should handle this case already - so i t's not a 315 // it's focusable, and existing logic should handle this case already - so i t's not a
316 // generic focusable element. 316 // generic focusable element.
317 317
318 if (hasContentEditableAttributeSet()) 318 if (hasContentEditableAttributeSet())
319 return false; 319 return false;
320 320
321 // The web area and body element are both focusable, but existing logic hand les these 321 // The web area and body element are both focusable, but existing logic hand les these
322 // cases already, so we don't need to include them here. 322 // cases already, so we don't need to include them here.
323 if (roleValue() == WebAreaRole) 323 if (roleValue() == WebAreaRole)
324 return false; 324 return false;
325 if (node() && node()->hasTagName(bodyTag)) 325 if (isHTMLBodyElement(node()))
326 return false; 326 return false;
327 327
328 // An SVG root is focusable by default, but it's probably not interactive, s o don't 328 // An SVG root is focusable by default, but it's probably not interactive, s o don't
329 // include it. It can still be made accessible by giving it an ARIA role. 329 // include it. It can still be made accessible by giving it an ARIA role.
330 if (roleValue() == SVGRootRole) 330 if (roleValue() == SVGRootRole)
331 return false; 331 return false;
332 332
333 return true; 333 return true;
334 } 334 }
335 335
336 HTMLLabelElement* AXNodeObject::labelForElement(Element* element) const 336 HTMLLabelElement* AXNodeObject::labelForElement(Element* element) const
337 { 337 {
338 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable()) 338 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable())
339 return 0; 339 return 0;
340 340
341 const AtomicString& id = element->getIdAttribute(); 341 const AtomicString& id = element->getIdAttribute();
342 if (!id.isEmpty()) { 342 if (!id.isEmpty()) {
343 if (HTMLLabelElement* label = element->treeScope().labelElementForId(id) ) 343 if (HTMLLabelElement* label = element->treeScope().labelElementForId(id) )
344 return label; 344 return label;
345 } 345 }
346 346
347 for (Element* parent = element->parentElement(); parent; parent = parent->pa rentElement()) { 347 for (Element* parent = element->parentElement(); parent; parent = parent->pa rentElement()) {
348 if (parent->hasTagName(labelTag)) 348 if (isHTMLLabelElement(*parent))
349 return toHTMLLabelElement(parent); 349 return toHTMLLabelElement(parent);
350 } 350 }
351 351
352 return 0; 352 return 0;
353 } 353 }
354 354
355 AXObject* AXNodeObject::menuButtonForMenu() const 355 AXObject* AXNodeObject::menuButtonForMenu() const
356 { 356 {
357 Element* menuItem = menuItemElementForMenu(); 357 Element* menuItem = menuItemElementForMenu();
358 358
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 Node* node = this->node(); 466 Node* node = this->node();
467 if (!node) 467 if (!node)
468 return false; 468 return false;
469 469
470 return ((node->isElementNode() && toElement(node)->isFormControlElement()) 470 return ((node->isElementNode() && toElement(node)->isFormControlElement())
471 || AXObject::isARIAControl(ariaRoleAttribute())); 471 || AXObject::isARIAControl(ariaRoleAttribute()));
472 } 472 }
473 473
474 bool AXNodeObject::isFieldset() const 474 bool AXNodeObject::isFieldset() const
475 { 475 {
476 Node* node = this->node(); 476 return isHTMLFieldSetElement(node());
477 if (!node)
478 return false;
479
480 return node->hasTagName(fieldsetTag);
481 } 477 }
482 478
483 bool AXNodeObject::isHeading() const 479 bool AXNodeObject::isHeading() const
484 { 480 {
485 return roleValue() == HeadingRole; 481 return roleValue() == HeadingRole;
486 } 482 }
487 483
488 bool AXNodeObject::isHovered() const 484 bool AXNodeObject::isHovered() const
489 { 485 {
490 Node* node = this->node(); 486 Node* node = this->node();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 HTMLInputElement* input = toHTMLInputElement(node); 544 HTMLInputElement* input = toHTMLInputElement(node);
549 return input->isCheckbox() || input->isRadioButton(); 545 return input->isCheckbox() || input->isRadioButton();
550 } 546 }
551 547
552 bool AXNodeObject::isNativeImage() const 548 bool AXNodeObject::isNativeImage() const
553 { 549 {
554 Node* node = this->node(); 550 Node* node = this->node();
555 if (!node) 551 if (!node)
556 return false; 552 return false;
557 553
558 if (node->hasTagName(imgTag)) 554 if (isHTMLImageElement(*node))
559 return true; 555 return true;
560 556
561 if (node->hasTagName(appletTag) || node->hasTagName(embedTag) || node->hasTa gName(objectTag)) 557 if (isHTMLAppletElement(*node) || isHTMLEmbedElement(*node) || isHTMLObjectE lement(*node))
562 return true; 558 return true;
563 559
564 if (isHTMLInputElement(*node)) 560 if (isHTMLInputElement(*node))
565 return toHTMLInputElement(*node).isImageButton(); 561 return toHTMLInputElement(*node).isImageButton();
566 562
567 return false; 563 return false;
568 } 564 }
569 565
570 bool AXNodeObject::isNativeTextControl() const 566 bool AXNodeObject::isNativeTextControl() const
571 { 567 {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 return true; 755 return true;
760 756
761 // Any node could be contenteditable, so isReadOnly should be relied upon 757 // Any node could be contenteditable, so isReadOnly should be relied upon
762 // for this information for all elements. 758 // for this information for all elements.
763 return !isReadOnly(); 759 return !isReadOnly();
764 } 760 }
765 761
766 bool AXNodeObject::canvasHasFallbackContent() const 762 bool AXNodeObject::canvasHasFallbackContent() const
767 { 763 {
768 Node* node = this->node(); 764 Node* node = this->node();
769 if (!node || !node->hasTagName(canvasTag)) 765 if (!isHTMLCanvasElement(node))
770 return false; 766 return false;
771 767
772 // If it has any children that are elements, we'll assume it might be fallba ck 768 // If it has any children that are elements, we'll assume it might be fallba ck
773 // content. If it has no children or its only children are not elements 769 // content. If it has no children or its only children are not elements
774 // (e.g. just text nodes), it doesn't have fallback content. 770 // (e.g. just text nodes), it doesn't have fallback content.
775 for (Node* child = node->firstChild(); child; child = child->nextSibling()) { 771 return ElementTraversal::firstChild(*node);
dmazzoni 2014/03/10 15:27:18 This is great
776 if (child->isElementNode())
777 return true;
778 }
779
780 return false;
781 } 772 }
782 773
783 bool AXNodeObject::exposesTitleUIElement() const 774 bool AXNodeObject::exposesTitleUIElement() const
784 { 775 {
785 if (!isControl()) 776 if (!isControl())
786 return false; 777 return false;
787 778
788 // If this control is ignored (because it's invisible), 779 // If this control is ignored (because it's invisible),
789 // then the label needs to be exposed so it can be visible to accessibility. 780 // then the label needs to be exposed so it can be visible to accessibility.
790 if (accessibilityIsIgnored()) 781 if (accessibilityIsIgnored())
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 // If the need to add more children in addition to existing children arises, 1313 // If the need to add more children in addition to existing children arises,
1323 // childrenChanged should have been called, leaving the object with no child ren. 1314 // childrenChanged should have been called, leaving the object with no child ren.
1324 ASSERT(!m_haveChildren); 1315 ASSERT(!m_haveChildren);
1325 1316
1326 if (!m_node) 1317 if (!m_node)
1327 return; 1318 return;
1328 1319
1329 m_haveChildren = true; 1320 m_haveChildren = true;
1330 1321
1331 // The only time we add children from the DOM tree to a node with a renderer is when it's a canvas. 1322 // The only time we add children from the DOM tree to a node with a renderer is when it's a canvas.
1332 if (renderer() && !m_node->hasTagName(canvasTag)) 1323 if (renderer() && !isHTMLCanvasElement(*m_node))
1333 return; 1324 return;
1334 1325
1335 for (Node* child = m_node->firstChild(); child; child = child->nextSibling() ) 1326 for (Node* child = m_node->firstChild(); child; child = child->nextSibling() )
1336 addChild(axObjectCache()->getOrCreate(child)); 1327 addChild(axObjectCache()->getOrCreate(child));
1337 } 1328 }
1338 1329
1339 void AXNodeObject::addChild(AXObject* child) 1330 void AXNodeObject::addChild(AXObject* child)
1340 { 1331 {
1341 insertChild(child, m_children.size()); 1332 insertChild(child, m_children.size());
1342 } 1333 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 Element* AXNodeObject::actionElement() const 1384 Element* AXNodeObject::actionElement() const
1394 { 1385 {
1395 Node* node = this->node(); 1386 Node* node = this->node();
1396 if (!node) 1387 if (!node)
1397 return 0; 1388 return 0;
1398 1389
1399 if (isHTMLInputElement(*node)) { 1390 if (isHTMLInputElement(*node)) {
1400 HTMLInputElement& input = toHTMLInputElement(*node); 1391 HTMLInputElement& input = toHTMLInputElement(*node);
1401 if (!input.isDisabledFormControl() && (isCheckboxOrRadio() || input.isTe xtButton())) 1392 if (!input.isDisabledFormControl() && (isCheckboxOrRadio() || input.isTe xtButton()))
1402 return &input; 1393 return &input;
1403 } else if (node->hasTagName(buttonTag)) { 1394 } else if (isHTMLButtonElement(*node)) {
1404 return toElement(node); 1395 return toElement(node);
1405 } 1396 }
1406 1397
1407 if (isFileUploadButton()) 1398 if (isFileUploadButton())
1408 return toElement(node); 1399 return toElement(node);
1409 1400
1410 if (AXObject::isARIAInput(ariaRoleAttribute())) 1401 if (AXObject::isARIAInput(ariaRoleAttribute()))
1411 return toElement(node); 1402 return toElement(node);
1412 1403
1413 if (isImageButton()) 1404 if (isImageButton())
1414 return toElement(node); 1405 return toElement(node);
1415 1406
1416 if (node->hasTagName(selectTag)) 1407 if (isHTMLSelectElement(*node))
1417 return toElement(node); 1408 return toElement(node);
1418 1409
1419 switch (roleValue()) { 1410 switch (roleValue()) {
1420 case ButtonRole: 1411 case ButtonRole:
1421 case PopUpButtonRole: 1412 case PopUpButtonRole:
1422 case ToggleButtonRole: 1413 case ToggleButtonRole:
1423 case TabRole: 1414 case TabRole:
1424 case MenuItemRole: 1415 case MenuItemRole:
1425 case ListItemRole: 1416 case ListItemRole:
1426 return toElement(node); 1417 return toElement(node);
(...skipping 11 matching lines...) Expand all
1438 { 1429 {
1439 Node* node = this->node(); 1430 Node* node = this->node();
1440 if (!node) 1431 if (!node)
1441 return 0; 1432 return 0;
1442 1433
1443 AXObjectCache* cache = axObjectCache(); 1434 AXObjectCache* cache = axObjectCache();
1444 1435
1445 // search up the DOM tree for an anchor element 1436 // search up the DOM tree for an anchor element
1446 // NOTE: this assumes that any non-image with an anchor is an HTMLAnchorElem ent 1437 // NOTE: this assumes that any non-image with an anchor is an HTMLAnchorElem ent
1447 for ( ; node; node = node->parentNode()) { 1438 for ( ; node; node = node->parentNode()) {
1448 if (node->hasTagName(aTag) || (node->renderer() && cache->getOrCreate(no de->renderer())->isAnchor())) 1439 if (isHTMLAnchorElement(*node) || (node->renderer() && cache->getOrCreat e(node->renderer())->isAnchor()))
1449 return toElement(node); 1440 return toElement(node);
1450 } 1441 }
1451 1442
1452 return 0; 1443 return 0;
1453 } 1444 }
1454 1445
1455 Document* AXNodeObject::document() const 1446 Document* AXNodeObject::document() const
1456 { 1447 {
1457 if (!node()) 1448 if (!node())
1458 return 0; 1449 return 0;
(...skipping 27 matching lines...) Expand all
1486 { 1477 {
1487 if (!node()) 1478 if (!node())
1488 return 0; 1479 return 0;
1489 1480
1490 // the control element should not be considered part of the label 1481 // the control element should not be considered part of the label
1491 if (isControl()) 1482 if (isControl())
1492 return 0; 1483 return 0;
1493 1484
1494 // find if this has a parent that is a label 1485 // find if this has a parent that is a label
1495 for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentN ode()) { 1486 for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentN ode()) {
1496 if (parentNode->hasTagName(labelTag)) 1487 if (isHTMLLabelElement(*parentNode))
1497 return toHTMLLabelElement(parentNode); 1488 return toHTMLLabelElement(parentNode);
1498 } 1489 }
1499 1490
1500 return 0; 1491 return 0;
1501 } 1492 }
1502 1493
1503 void AXNodeObject::setFocused(bool on) 1494 void AXNodeObject::setFocused(bool on)
1504 { 1495 {
1505 if (!canSetFocusAttribute()) 1496 if (!canSetFocusAttribute())
1506 return; 1497 return;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 1615
1625 // Check if the HTML element has an aria-label for the webpage. 1616 // Check if the HTML element has an aria-label for the webpage.
1626 if (Element* documentElement = document->documentElement()) { 1617 if (Element* documentElement = document->documentElement()) {
1627 const AtomicString& ariaLabel = documentElement->getAttribute(aria_label Attr); 1618 const AtomicString& ariaLabel = documentElement->getAttribute(aria_label Attr);
1628 if (!ariaLabel.isEmpty()) 1619 if (!ariaLabel.isEmpty())
1629 return ariaLabel; 1620 return ariaLabel;
1630 } 1621 }
1631 1622
1632 Node* owner = document->ownerElement(); 1623 Node* owner = document->ownerElement();
1633 if (owner) { 1624 if (owner) {
1634 if (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag)) { 1625 if (isHTMLFrameElement(*owner) || isHTMLIFrameElement(*owner)) {
1635 const AtomicString& title = toElement(owner)->getAttribute(titleAttr ); 1626 const AtomicString& title = toElement(owner)->getAttribute(titleAttr );
1636 if (!title.isEmpty()) 1627 if (!title.isEmpty())
1637 return title; 1628 return title;
1638 return toElement(owner)->getNameAttribute(); 1629 return toElement(owner)->getNameAttribute();
1639 } 1630 }
1640 if (owner->isHTMLElement()) 1631 if (owner->isHTMLElement())
1641 return toHTMLElement(owner)->getNameAttribute(); 1632 return toHTMLElement(owner)->getNameAttribute();
1642 } 1633 }
1643 1634
1644 String documentTitle = document->title(); 1635 String documentTitle = document->title();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 break; 1725 break;
1735 } 1726 }
1736 } 1727 }
1737 1728
1738 void AXNodeObject::titleElementText(Vector<AccessibilityText>& textOrder) 1729 void AXNodeObject::titleElementText(Vector<AccessibilityText>& textOrder)
1739 { 1730 {
1740 Node* node = this->node(); 1731 Node* node = this->node();
1741 if (!node) 1732 if (!node)
1742 return; 1733 return;
1743 1734
1744 bool isInputTag = node->hasTagName(inputTag); 1735 if (isHTMLInputElement(*node) || AXObject::isARIAInput(ariaRoleAttribute()) || isControl()) {
1745 if (isInputTag || AXObject::isARIAInput(ariaRoleAttribute()) || isControl()) {
1746 HTMLLabelElement* label = labelForElement(toElement(node)); 1736 HTMLLabelElement* label = labelForElement(toElement(node));
1747 if (label) { 1737 if (label) {
1748 AXObject* labelObject = axObjectCache()->getOrCreate(label); 1738 AXObject* labelObject = axObjectCache()->getOrCreate(label);
1749 textOrder.append(AccessibilityText(label->innerText(), LabelByElemen tText, labelObject)); 1739 textOrder.append(AccessibilityText(label->innerText(), LabelByElemen tText, labelObject));
1750 return; 1740 return;
1751 } 1741 }
1752 } 1742 }
1753 1743
1754 AXObject* titleUIElement = this->titleUIElement(); 1744 AXObject* titleUIElement = this->titleUIElement();
1755 if (titleUIElement) 1745 if (titleUIElement)
1756 textOrder.append(AccessibilityText(String(), LabelByElementText, titleUI Element)); 1746 textOrder.append(AccessibilityText(String(), LabelByElementText, titleUI Element));
1757 } 1747 }
1758 1748
1759 void AXNodeObject::visibleText(Vector<AccessibilityText>& textOrder) const 1749 void AXNodeObject::visibleText(Vector<AccessibilityText>& textOrder) const
1760 { 1750 {
1761 Node* node = this->node(); 1751 Node* node = this->node();
1762 if (!node) 1752 if (!node)
1763 return; 1753 return;
1764 1754
1765 if (isHTMLInputElement(*node)) { 1755 if (isHTMLInputElement(*node)) {
1766 HTMLInputElement& input = toHTMLInputElement(*node); 1756 HTMLInputElement& input = toHTMLInputElement(*node);
1767 if (input.isTextButton()) { 1757 if (input.isTextButton()) {
1768 textOrder.append(AccessibilityText(input.valueWithDefault(), Visible Text)); 1758 textOrder.append(AccessibilityText(input.valueWithDefault(), Visible Text));
1769 return; 1759 return;
1770 } 1760 }
1771 } 1761 }
1772 1762
1773 // If this node isn't rendered, there's no inner text we can extract from a select element. 1763 // If this node isn't rendered, there's no inner text we can extract from a select element.
1774 if (!isAXRenderObject() && node->hasTagName(selectTag)) 1764 if (!isAXRenderObject() && isHTMLSelectElement(*node))
1775 return; 1765 return;
1776 1766
1777 bool useTextUnderElement = false; 1767 bool useTextUnderElement = false;
1778 1768
1779 switch (roleValue()) { 1769 switch (roleValue()) {
1780 case PopUpButtonRole: 1770 case PopUpButtonRole:
1781 // Native popup buttons should not use their button children's text as a title. That value is retrieved through stringValue(). 1771 // Native popup buttons should not use their button children's text as a title. That value is retrieved through stringValue().
1782 if (node->hasTagName(selectTag)) 1772 if (isHTMLSelectElement(*node))
1783 break; 1773 break;
1784 case ButtonRole: 1774 case ButtonRole:
1785 case ToggleButtonRole: 1775 case ToggleButtonRole:
1786 case CheckBoxRole: 1776 case CheckBoxRole:
1787 case ListBoxOptionRole: 1777 case ListBoxOptionRole:
1788 case MenuButtonRole: 1778 case MenuButtonRole:
1789 case MenuItemRole: 1779 case MenuItemRole:
1790 case RadioButtonRole: 1780 case RadioButtonRole:
1791 case TabRole: 1781 case TabRole:
1792 useTextUnderElement = true; 1782 useTextUnderElement = true;
1793 break; 1783 break;
1794 default: 1784 default:
1795 break; 1785 break;
1796 } 1786 }
1797 1787
1798 // If it's focusable but it's not content editable or a known control type, then it will appear to 1788 // If it's focusable but it's not content editable or a known control type, then it will appear to
1799 // the user as a single atomic object, so we should use its text as the defa ult title. 1789 // the user as a single atomic object, so we should use its text as the defa ult title.
1800 if (isHeading() || isLink() || isGenericFocusableElement()) 1790 if (isHeading() || isLink() || isGenericFocusableElement())
1801 useTextUnderElement = true; 1791 useTextUnderElement = true;
1802 1792
1803 if (useTextUnderElement) { 1793 if (useTextUnderElement) {
1804 String text = textUnderElement(); 1794 String text = textUnderElement();
1805 if (!text.isEmpty()) 1795 if (!text.isEmpty())
1806 textOrder.append(AccessibilityText(text, ChildrenText)); 1796 textOrder.append(AccessibilityText(text, ChildrenText));
1807 } 1797 }
1808 } 1798 }
1809 1799
1810 } // namespace WebCore 1800 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698