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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 796913002: Use C++11 range-based loop for core/clipboard, core/dom and core/testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: make auto clear Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 717
718 unsigned Internals::activeMarkerCountForNode(Node* node) 718 unsigned Internals::activeMarkerCountForNode(Node* node)
719 { 719 {
720 ASSERT(node); 720 ASSERT(node);
721 721
722 // Only TextMatch markers can be active. 722 // Only TextMatch markers can be active.
723 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; 723 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch;
724 DocumentMarkerVector markers = node->document().markers().markersFor(node, m arkerType); 724 DocumentMarkerVector markers = node->document().markers().markersFor(node, m arkerType);
725 725
726 unsigned activeMarkerCount = 0; 726 unsigned activeMarkerCount = 0;
727 for (DocumentMarkerVector::iterator iter = markers.begin(); iter != markers. end(); ++iter) { 727 for (auto& marker : markers) {
Julien - ping for review 2015/01/02 09:42:02 const auto&
zhaoze.zhou 2015/01/05 15:17:57 Done.
728 if ((*iter)->activeMatch()) 728 if (marker->activeMatch())
729 activeMarkerCount++; 729 activeMarkerCount++;
730 } 730 }
731 731
732 return activeMarkerCount; 732 return activeMarkerCount;
733 } 733 }
734 734
735 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& exceptionState) 735 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& exceptionState)
736 { 736 {
737 ASSERT(node); 737 ASSERT(node);
738 DocumentMarker::MarkerTypes markerTypes = 0; 738 DocumentMarker::MarkerTypes markerTypes = 0;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1145 }
1146 1146
1147 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even tHandlerClass handlerClass) 1147 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even tHandlerClass handlerClass)
1148 { 1148 {
1149 if (!document.frameHost()) 1149 if (!document.frameHost())
1150 return 0; 1150 return 0;
1151 EventHandlerRegistry* registry = &document.frameHost()->eventHandlerRegistry (); 1151 EventHandlerRegistry* registry = &document.frameHost()->eventHandlerRegistry ();
1152 unsigned count = 0; 1152 unsigned count = 0;
1153 const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass); 1153 const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass);
1154 if (targets) { 1154 if (targets) {
1155 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) 1155 for (const auto& target : *targets)
1156 count += iter->value; 1156 count += target.value;
1157 } 1157 }
1158 return count; 1158 return count;
1159 } 1159 }
1160 1160
1161 unsigned Internals::wheelEventHandlerCount(Document* document) 1161 unsigned Internals::wheelEventHandlerCount(Document* document)
1162 { 1162 {
1163 ASSERT(document); 1163 ASSERT(document);
1164 return eventHandlerCount(*document, EventHandlerRegistry::WheelEvent); 1164 return eventHandlerCount(*document, EventHandlerRegistry::WheelEvent);
1165 } 1165 }
1166 1166
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 return 0; 1675 return 0;
1676 1676
1677 return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, page Height)); 1677 return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, page Height));
1678 } 1678 }
1679 1679
1680 Vector<String> Internals::iconURLs(Document* document, int iconTypesMask) const 1680 Vector<String> Internals::iconURLs(Document* document, int iconTypesMask) const
1681 { 1681 {
1682 Vector<IconURL> iconURLs = document->iconURLs(iconTypesMask); 1682 Vector<IconURL> iconURLs = document->iconURLs(iconTypesMask);
1683 Vector<String> array; 1683 Vector<String> array;
1684 1684
1685 Vector<IconURL>::const_iterator iter(iconURLs.begin()); 1685 for (auto& iconURL : iconURLs)
1686 for (; iter != iconURLs.end(); ++iter) 1686 array.append(iconURL.m_iconURL.string());
1687 array.append(iter->m_iconURL.string());
1688 1687
1689 return array; 1688 return array;
1690 } 1689 }
1691 1690
1692 Vector<String> Internals::shortcutIconURLs(Document* document) const 1691 Vector<String> Internals::shortcutIconURLs(Document* document) const
1693 { 1692 {
1694 return iconURLs(document, Favicon); 1693 return iconURLs(document, Favicon);
1695 } 1694 }
1696 1695
1697 Vector<String> Internals::allIconURLs(Document* document) const 1696 Vector<String> Internals::allIconURLs(Document* document) const
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 ASSERT(element); 2274 ASSERT(element);
2276 return ClientRect::create(element->boundsInRootViewSpace()); 2275 return ClientRect::create(element->boundsInRootViewSpace());
2277 } 2276 }
2278 2277
2279 String Internals::serializeNavigationMarkup() 2278 String Internals::serializeNavigationMarkup()
2280 { 2279 {
2281 Vector<Document::TransitionElementData> elementData; 2280 Vector<Document::TransitionElementData> elementData;
2282 frame()->document()->getTransitionElementData(elementData); 2281 frame()->document()->getTransitionElementData(elementData);
2283 2282
2284 StringBuilder markup; 2283 StringBuilder markup;
2285 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2284 for (const auto& element : elementData)
2286 for (; iter != elementData.end(); ++iter) 2285 markup.append(element.markup);
2287 markup.append(iter->markup);
2288 2286
2289 return markup.toString(); 2287 return markup.toString();
2290 } 2288 }
2291 2289
2292 Vector<String> Internals::getTransitionElementIds() 2290 Vector<String> Internals::getTransitionElementIds()
2293 { 2291 {
2294 Vector<Document::TransitionElementData> elementData; 2292 Vector<Document::TransitionElementData> elementData;
2295 frame()->document()->getTransitionElementData(elementData); 2293 frame()->document()->getTransitionElementData(elementData);
2296 2294
2297 Vector<String> ids; 2295 Vector<String> ids;
(...skipping 20 matching lines...) Expand all
2318 for (size_t i = 0; i < rects.size(); ++i) 2316 for (size_t i = 0; i < rects.size(); ++i)
2319 quads[i] = FloatRect(rects[i]); 2317 quads[i] = FloatRect(rects[i]);
2320 return ClientRectList::create(quads); 2318 return ClientRectList::create(quads);
2321 } 2319 }
2322 2320
2323 void Internals::hideAllTransitionElements() 2321 void Internals::hideAllTransitionElements()
2324 { 2322 {
2325 Vector<Document::TransitionElementData> elementData; 2323 Vector<Document::TransitionElementData> elementData;
2326 frame()->document()->getTransitionElementData(elementData); 2324 frame()->document()->getTransitionElementData(elementData);
2327 2325
2328 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2326 for (const auto& element : elementData)
2329 for (; iter != elementData.end(); ++iter) 2327 frame()->document()->hideTransitionElements(AtomicString(element.selecto r));
2330 frame()->document()->hideTransitionElements(AtomicString(iter->selector) );
2331 } 2328 }
2332 2329
2333 void Internals::showAllTransitionElements() 2330 void Internals::showAllTransitionElements()
2334 { 2331 {
2335 Vector<Document::TransitionElementData> elementData; 2332 Vector<Document::TransitionElementData> elementData;
2336 frame()->document()->getTransitionElementData(elementData); 2333 frame()->document()->getTransitionElementData(elementData);
2337 2334
2338 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2335 for (const auto& element : elementData)
2339 for (; iter != elementData.end(); ++iter) 2336 frame()->document()->showTransitionElements(AtomicString(element.selecto r));
2340 frame()->document()->showTransitionElements(AtomicString(iter->selector) );
2341 } 2337 }
2342 2338
2343 void Internals::setExitTransitionStylesheetsEnabled(bool enabled) 2339 void Internals::setExitTransitionStylesheetsEnabled(bool enabled)
2344 { 2340 {
2345 frame()->document()->styleEngine()->setExitTransitionStylesheetsEnabled(enab led); 2341 frame()->document()->styleEngine()->setExitTransitionStylesheetsEnabled(enab led);
2346 } 2342 }
2347 2343
2348 void Internals::forcePluginPlaceholder(HTMLElement* element, PassRefPtrWillBeRaw Ptr<DocumentFragment> fragment, ExceptionState& exceptionState) 2344 void Internals::forcePluginPlaceholder(HTMLElement* element, PassRefPtrWillBeRaw Ptr<DocumentFragment> fragment, ExceptionState& exceptionState)
2349 { 2345 {
2350 if (!element->isPluginElement()) { 2346 if (!element->isPluginElement()) {
(...skipping 16 matching lines...) Expand all
2367 { 2363 {
2368 return new InternalsIterator; 2364 return new InternalsIterator;
2369 } 2365 }
2370 2366
2371 void Internals::forceBlinkGCWithoutV8GC() 2367 void Internals::forceBlinkGCWithoutV8GC()
2372 { 2368 {
2373 ThreadState::current()->scheduleGC(ThreadState::ForcedGC); 2369 ThreadState::current()->scheduleGC(ThreadState::ForcedGC);
2374 } 2370 }
2375 2371
2376 } // namespace blink 2372 } // namespace blink
OLDNEW
« Source/core/dom/StyleEngine.cpp ('K') | « Source/core/dom/WeakNodeMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698