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

Side by Side Diff: Source/core/dom/TreeScope.cpp

Issue 642973003: Introduce typed Node/Element iterators for range-based for loops of C++11. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename `from` to `fromNext`. Make some parameters const references. Created 6 years, 2 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 return false; 518 return false;
519 } 519 }
520 520
521 Element* TreeScope::getElementByAccessKey(const String& key) const 521 Element* TreeScope::getElementByAccessKey(const String& key) const
522 { 522 {
523 if (key.isEmpty()) 523 if (key.isEmpty())
524 return 0; 524 return 0;
525 Element* result = 0; 525 Element* result = 0;
526 Node& root = rootNode(); 526 Node& root = rootNode();
527 for (Element* element = ElementTraversal::firstWithin(root); element; elemen t = ElementTraversal::next(*element, &root)) { 527 for (Element& element : ElementTraversal::descendantsOf(root)) {
528 if (equalIgnoringCase(element->fastGetAttribute(accesskeyAttr), key)) 528 if (equalIgnoringCase(element.fastGetAttribute(accesskeyAttr), key))
529 result = element; 529 result = &element;
530 for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) { 530 for (ShadowRoot* shadowRoot = element.youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
531 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key)) 531 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key))
532 result = shadowResult; 532 result = shadowResult;
533 } 533 }
534 } 534 }
535 return result; 535 return result;
536 } 536 }
537 537
538 void TreeScope::setNeedsStyleRecalcForViewportUnits() 538 void TreeScope::setNeedsStyleRecalcForViewportUnits()
539 { 539 {
540 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::nextIncludingPseudo(*element)) { 540 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::nextIncludingPseudo(*element)) {
(...skipping 12 matching lines...) Expand all
553 visitor->trace(m_parentTreeScope); 553 visitor->trace(m_parentTreeScope);
554 visitor->trace(m_idTargetObserverRegistry); 554 visitor->trace(m_idTargetObserverRegistry);
555 visitor->trace(m_selection); 555 visitor->trace(m_selection);
556 visitor->trace(m_elementsById); 556 visitor->trace(m_elementsById);
557 visitor->trace(m_imageMapsByName); 557 visitor->trace(m_imageMapsByName);
558 visitor->trace(m_labelsByForAttribute); 558 visitor->trace(m_labelsByForAttribute);
559 visitor->trace(m_scopedStyleResolver); 559 visitor->trace(m_scopedStyleResolver);
560 } 560 }
561 561
562 } // namespace blink 562 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698