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

Side by Side Diff: Source/core/accessibility/AccessibilityRenderObject.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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 { 263 {
264 if (!m_renderer) 264 if (!m_renderer)
265 return 0; 265 return 0;
266 266
267 // the control element should not be considered part of the label 267 // the control element should not be considered part of the label
268 if (isControl()) 268 if (isControl())
269 return 0; 269 return 0;
270 270
271 // find if this has a parent that is a label 271 // find if this has a parent that is a label
272 for (Node* parentNode = m_renderer->node(); parentNode; parentNode = parentN ode->parentNode()) { 272 for (Node* parentNode = m_renderer->node(); parentNode; parentNode = parentN ode->parentNode()) {
273 if (parentNode->hasTagName(labelTag)) 273 if (isHTMLLabelElement(parentNode))
274 return static_cast<HTMLLabelElement*>(parentNode); 274 return toHTMLLabelElement(parentNode);
275 } 275 }
276 276
277 return 0; 277 return 0;
278 } 278 }
279 279
280 bool AccessibilityRenderObject::shouldNotifyActiveDescendant() const 280 bool AccessibilityRenderObject::shouldNotifyActiveDescendant() const
281 { 281 {
282 // We want to notify that the combo box has changed its active descendant, 282 // We want to notify that the combo box has changed its active descendant,
283 // but we do not want to change the focus, because focus should remain with the combo box. 283 // but we do not want to change the focus, because focus should remain with the combo box.
284 if (isComboBox()) 284 if (isComboBox())
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // Table sections should be ignored. 397 // Table sections should be ignored.
398 if (m_renderer->isTableSection()) 398 if (m_renderer->isTableSection())
399 return IgnoredRole; 399 return IgnoredRole;
400 400
401 if (m_renderer->isHR()) 401 if (m_renderer->isHR())
402 return HorizontalRuleRole; 402 return HorizontalRuleRole;
403 403
404 if (node && node->hasTagName(pTag)) 404 if (node && node->hasTagName(pTag))
405 return ParagraphRole; 405 return ParagraphRole;
406 406
407 if (node && node->hasTagName(labelTag)) 407 if (node && isHTMLLabelElement(node))
408 return LabelRole; 408 return LabelRole;
409 409
410 if (node && node->hasTagName(divTag)) 410 if (node && node->hasTagName(divTag))
411 return DivRole; 411 return DivRole;
412 412
413 if (node && node->hasTagName(formTag)) 413 if (node && node->hasTagName(formTag))
414 return FormRole; 414 return FormRole;
415 415
416 if (node && node->hasTagName(articleTag)) 416 if (node && node->hasTagName(articleTag))
417 return DocumentArticleRole; 417 return DocumentArticleRole;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 718
719 // all controls are accessible 719 // all controls are accessible
720 if (isControl()) 720 if (isControl())
721 return false; 721 return false;
722 722
723 if (ariaRoleAttribute() != UnknownRole) 723 if (ariaRoleAttribute() != UnknownRole)
724 return false; 724 return false;
725 725
726 // don't ignore labels, because they serve as TitleUIElements 726 // don't ignore labels, because they serve as TitleUIElements
727 Node* node = m_renderer->node(); 727 Node* node = m_renderer->node();
728 if (node && node->hasTagName(labelTag)) 728 if (node && isHTMLLabelElement(node))
729 return false; 729 return false;
730 730
731 // Anything that is content editable should not be ignored. 731 // Anything that is content editable should not be ignored.
732 // However, one cannot just call node->rendererIsEditable() since that will ask if its parents 732 // However, one cannot just call node->rendererIsEditable() since that will ask if its parents
733 // are also editable. Only the top level content editable region should be e xposed. 733 // are also editable. Only the top level content editable region should be e xposed.
734 if (hasContentEditableAttributeSet()) 734 if (hasContentEditableAttributeSet())
735 return false; 735 return false;
736 736
737 // List items play an important role in defining the structure of lists. The y should not be ignored. 737 // List items play an important role in defining the structure of lists. The y should not be ignored.
738 if (roleValue() == ListItemRole) 738 if (roleValue() == ListItemRole)
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 if (label && label->renderer()) { 2511 if (label && label->renderer()) {
2512 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2512 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2513 result.unite(labelRect); 2513 result.unite(labelRect);
2514 } 2514 }
2515 } 2515 }
2516 2516
2517 return result; 2517 return result;
2518 } 2518 }
2519 2519
2520 } // namespace WebCore 2520 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityNodeObject.cpp ('k') | Source/core/dom/DocumentOrderedMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698