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

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

Issue 18259016: Introduce isHTMLLabelElement and toHTMLLabelElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Took tkent's comment into consideration Created 7 years, 5 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return selectElement->multiple() ? ListBoxRole : PopUpButtonRole; 201 return selectElement->multiple() ? ListBoxRole : PopUpButtonRole;
202 } 202 }
203 if (node()->hasTagName(textareaTag)) 203 if (node()->hasTagName(textareaTag))
204 return TextAreaRole; 204 return TextAreaRole;
205 if (headingLevel()) 205 if (headingLevel())
206 return HeadingRole; 206 return HeadingRole;
207 if (node()->hasTagName(divTag)) 207 if (node()->hasTagName(divTag))
208 return DivRole; 208 return DivRole;
209 if (node()->hasTagName(pTag)) 209 if (node()->hasTagName(pTag))
210 return ParagraphRole; 210 return ParagraphRole;
211 if (node()->hasTagName(labelTag)) 211 if (isHTMLLabelElement(node()))
212 return LabelRole; 212 return LabelRole;
213 if (node()->isFocusable()) 213 if (node()->isFocusable())
214 return GroupRole; 214 return GroupRole;
215 215
216 return UnknownRole; 216 return UnknownRole;
217 } 217 }
218 218
219 AccessibilityRole AccessibilityNodeObject::determineAriaRoleAttribute() const 219 AccessibilityRole AccessibilityNodeObject::determineAriaRoleAttribute() const
220 { 220 {
221 const AtomicString& ariaRole = getAttribute(roleAttr); 221 const AtomicString& ariaRole = getAttribute(roleAttr);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable()) 343 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable())
344 return 0; 344 return 0;
345 345
346 const AtomicString& id = element->getIdAttribute(); 346 const AtomicString& id = element->getIdAttribute();
347 if (!id.isEmpty()) { 347 if (!id.isEmpty()) {
348 if (HTMLLabelElement* label = element->treeScope()->labelElementForId(id )) 348 if (HTMLLabelElement* label = element->treeScope()->labelElementForId(id ))
349 return label; 349 return label;
350 } 350 }
351 351
352 for (Element* parent = element->parentElement(); parent; parent = parent->pa rentElement()) { 352 for (Element* parent = element->parentElement(); parent; parent = parent->pa rentElement()) {
353 if (parent->hasTagName(labelTag)) 353 if (isHTMLLabelElement(parent))
354 return static_cast<HTMLLabelElement*>(parent); 354 return toHTMLLabelElement(parent);
355 } 355 }
356 356
357 return 0; 357 return 0;
358 } 358 }
359 359
360 AccessibilityObject* AccessibilityNodeObject::menuButtonForMenu() const 360 AccessibilityObject* AccessibilityNodeObject::menuButtonForMenu() const
361 { 361 {
362 Element* menuItem = menuItemElementForMenu(); 362 Element* menuItem = menuItemElementForMenu();
363 363
364 if (menuItem) { 364 if (menuItem) {
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 useTextUnderElement = true; 1665 useTextUnderElement = true;
1666 1666
1667 if (useTextUnderElement) { 1667 if (useTextUnderElement) {
1668 String text = textUnderElement(); 1668 String text = textUnderElement();
1669 if (!text.isEmpty()) 1669 if (!text.isEmpty())
1670 textOrder.append(AccessibilityText(text, ChildrenText)); 1670 textOrder.append(AccessibilityText(text, ChildrenText));
1671 } 1671 }
1672 } 1672 }
1673 1673
1674 } // namespace WebCore 1674 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXObjectCache.cpp ('k') | Source/core/accessibility/AccessibilityRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698