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

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

Issue 201293002: Add Traversal<*Element>::firstAncestor() API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Slight clean up 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 | Source/core/dom/ElementTraversal.h » ('j') | Source/core/dom/ElementTraversal.h » ('J')
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 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 1473
1474 HTMLLabelElement* AXNodeObject::labelElementContainer() const 1474 HTMLLabelElement* AXNodeObject::labelElementContainer() const
1475 { 1475 {
1476 if (!node()) 1476 if (!node())
1477 return 0; 1477 return 0;
1478 1478
1479 // the control element should not be considered part of the label 1479 // the control element should not be considered part of the label
1480 if (isControl()) 1480 if (isControl())
1481 return 0; 1481 return 0;
1482 1482
1483 // find if this has a parent that is a label 1483 // find if this has a ancestor that is a label
1484 for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentN ode()) { 1484 return isHTMLLabelElement(*node()) ? toHTMLLabelElement(node()) : Traversal< HTMLLabelElement>::firstAncestor(*node());
esprehn 2014/03/21 07:58:33 Can we use if statements here? I don't think all t
Inactive 2014/03/21 14:37:24 Done.
1485 if (isHTMLLabelElement(*parentNode))
1486 return toHTMLLabelElement(parentNode);
1487 }
1488
1489 return 0;
1490 } 1485 }
1491 1486
1492 void AXNodeObject::setFocused(bool on) 1487 void AXNodeObject::setFocused(bool on)
1493 { 1488 {
1494 if (!canSetFocusAttribute()) 1489 if (!canSetFocusAttribute())
1495 return; 1490 return;
1496 1491
1497 Document* document = this->document(); 1492 Document* document = this->document();
1498 if (!on) { 1493 if (!on) {
1499 document->setFocusedElement(nullptr); 1494 document->setFocusedElement(nullptr);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 useTextUnderElement = true; 1784 useTextUnderElement = true;
1790 1785
1791 if (useTextUnderElement) { 1786 if (useTextUnderElement) {
1792 String text = textUnderElement(); 1787 String text = textUnderElement();
1793 if (!text.isEmpty()) 1788 if (!text.isEmpty())
1794 textOrder.append(AccessibilityText(text, ChildrenText)); 1789 textOrder.append(AccessibilityText(text, ChildrenText));
1795 } 1790 }
1796 } 1791 }
1797 1792
1798 } // namespace WebCore 1793 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ElementTraversal.h » ('j') | Source/core/dom/ElementTraversal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698