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

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

Issue 200473005: Use ElementTraversal API in siblingWithAriaRole() to simplify the 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 return 0; 365 return 0;
366 } 366 }
367 367
368 static Element* siblingWithAriaRole(String role, Node* node) 368 static Element* siblingWithAriaRole(String role, Node* node)
369 { 369 {
370 Node* parent = node->parentNode(); 370 Node* parent = node->parentNode();
371 if (!parent) 371 if (!parent)
372 return 0; 372 return 0;
373 373
374 for (Node* sibling = parent->firstChild(); sibling; sibling = sibling->nextS ibling()) { 374 for (Element* sibling = ElementTraversal::firstChild(*parent); sibling; sibl ing = ElementTraversal::nextSibling(*sibling)) {
375 if (sibling->isElementNode()) { 375 const AtomicString& siblingAriaRole = sibling->getAttribute(roleAttr);
376 const AtomicString& siblingAriaRole = toElement(sibling)->getAttribu te(roleAttr); 376 if (equalIgnoringCase(siblingAriaRole, role))
377 if (equalIgnoringCase(siblingAriaRole, role)) 377 return sibling;
378 return toElement(sibling);
379 }
380 } 378 }
381 379
382 return 0; 380 return 0;
383 } 381 }
384 382
385 Element* AXNodeObject::menuItemElementForMenu() const 383 Element* AXNodeObject::menuItemElementForMenu() const
386 { 384 {
387 if (ariaRoleAttribute() != MenuRole) 385 if (ariaRoleAttribute() != MenuRole)
388 return 0; 386 return 0;
389 387
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 useTextUnderElement = true; 1789 useTextUnderElement = true;
1792 1790
1793 if (useTextUnderElement) { 1791 if (useTextUnderElement) {
1794 String text = textUnderElement(); 1792 String text = textUnderElement();
1795 if (!text.isEmpty()) 1793 if (!text.isEmpty())
1796 textOrder.append(AccessibilityText(text, ChildrenText)); 1794 textOrder.append(AccessibilityText(text, ChildrenText));
1797 } 1795 }
1798 } 1796 }
1799 1797
1800 } // namespace WebCore 1798 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698