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

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: Fix editing failures 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 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 1460
1461 HTMLLabelElement* AXNodeObject::labelElementContainer() const 1461 HTMLLabelElement* AXNodeObject::labelElementContainer() const
1462 { 1462 {
1463 if (!node()) 1463 if (!node())
1464 return 0; 1464 return 0;
1465 1465
1466 // the control element should not be considered part of the label 1466 // the control element should not be considered part of the label
1467 if (isControl()) 1467 if (isControl())
1468 return 0; 1468 return 0;
1469 1469
1470 // find if this has a parent that is a label 1470 // find if this has a ancestor that is a label
1471 for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentN ode()) { 1471 if (isHTMLLabelElement(*node()))
1472 if (isHTMLLabelElement(*parentNode)) 1472 return toHTMLLabelElement(node());
1473 return toHTMLLabelElement(parentNode); 1473 return Traversal<HTMLLabelElement>::firstAncestor(*node());
1474 }
1475
1476 return 0;
1477 } 1474 }
1478 1475
1479 void AXNodeObject::setFocused(bool on) 1476 void AXNodeObject::setFocused(bool on)
1480 { 1477 {
1481 if (!canSetFocusAttribute()) 1478 if (!canSetFocusAttribute())
1482 return; 1479 return;
1483 1480
1484 Document* document = this->document(); 1481 Document* document = this->document();
1485 if (!on) { 1482 if (!on) {
1486 document->setFocusedElement(nullptr); 1483 document->setFocusedElement(nullptr);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 float range = maxValueForRange() - minValueForRange(); 1669 float range = maxValueForRange() - minValueForRange();
1673 float value = valueForRange(); 1670 float value = valueForRange();
1674 1671
1675 value += range * (percentChange / 100); 1672 value += range * (percentChange / 100);
1676 setValue(String::number(value)); 1673 setValue(String::number(value));
1677 1674
1678 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged, tru e); 1675 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged, tru e);
1679 } 1676 }
1680 1677
1681 } // namespace WebCore 1678 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ElementTraversal.h » ('j') | Source/core/editing/FrameSelection.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698