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

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

Issue 476273004: Use Traversal<>::firstAncestor() API more in the code base (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/shadow/InsertionPoint.cpp » ('j') | 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 { 344 {
345 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable()) 345 if (!element->isHTMLElement() || !toHTMLElement(element)->isLabelable())
346 return 0; 346 return 0;
347 347
348 const AtomicString& id = element->getIdAttribute(); 348 const AtomicString& id = element->getIdAttribute();
349 if (!id.isEmpty()) { 349 if (!id.isEmpty()) {
350 if (HTMLLabelElement* label = element->treeScope().labelElementForId(id) ) 350 if (HTMLLabelElement* label = element->treeScope().labelElementForId(id) )
351 return label; 351 return label;
352 } 352 }
353 353
354 for (Element* parent = element->parentElement(); parent; parent = parent->pa rentElement()) { 354 return Traversal<HTMLLabelElement>::firstAncestor(*element);
355 if (isHTMLLabelElement(*parent))
356 return toHTMLLabelElement(parent);
357 }
358
359 return 0;
360 } 355 }
361 356
362 AXObject* AXNodeObject::menuButtonForMenu() const 357 AXObject* AXNodeObject::menuButtonForMenu() const
363 { 358 {
364 Element* menuItem = menuItemElementForMenu(); 359 Element* menuItem = menuItemElementForMenu();
365 360
366 if (menuItem) { 361 if (menuItem) {
367 // ARIA just has generic menu items. AppKit needs to know if this is a t op level items like MenuBarButton or MenuBarItem 362 // ARIA just has generic menu items. AppKit needs to know if this is a t op level items like MenuBarButton or MenuBarItem
368 AXObject* menuItemAX = axObjectCache()->getOrCreate(menuItem); 363 AXObject* menuItemAX = axObjectCache()->getOrCreate(menuItem);
369 if (menuItemAX && menuItemAX->isMenuButton()) 364 if (menuItemAX && menuItemAX->isMenuButton())
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 float range = maxValueForRange() - minValueForRange(); 1699 float range = maxValueForRange() - minValueForRange();
1705 float value = valueForRange(); 1700 float value = valueForRange();
1706 1701
1707 value += range * (percentChange / 100); 1702 value += range * (percentChange / 100);
1708 setValue(String::number(value)); 1703 setValue(String::number(value));
1709 1704
1710 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged, tru e); 1705 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged, tru e);
1711 } 1706 }
1712 1707
1713 } // namespace blink 1708 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/shadow/InsertionPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698