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

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: rebase Created 5 years, 11 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
« no previous file with comments | « Source/core/dom/WeakNodeMap.cpp ('k') | no next file » | 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 * 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 (const auto& marker : markers) {
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 ASSERT(element); 2275 ASSERT(element);
2277 return ClientRect::create(element->boundsInRootViewSpace()); 2276 return ClientRect::create(element->boundsInRootViewSpace());
2278 } 2277 }
2279 2278
2280 String Internals::serializeNavigationMarkup() 2279 String Internals::serializeNavigationMarkup()
2281 { 2280 {
2282 Vector<Document::TransitionElementData> elementData; 2281 Vector<Document::TransitionElementData> elementData;
2283 frame()->document()->getTransitionElementData(elementData); 2282 frame()->document()->getTransitionElementData(elementData);
2284 2283
2285 StringBuilder markup; 2284 StringBuilder markup;
2286 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2285 for (const auto& element : elementData)
2287 for (; iter != elementData.end(); ++iter) 2286 markup.append(element.markup);
2288 markup.append(iter->markup);
2289 2287
2290 return markup.toString(); 2288 return markup.toString();
2291 } 2289 }
2292 2290
2293 Vector<String> Internals::getTransitionElementIds() 2291 Vector<String> Internals::getTransitionElementIds()
2294 { 2292 {
2295 Vector<Document::TransitionElementData> elementData; 2293 Vector<Document::TransitionElementData> elementData;
2296 frame()->document()->getTransitionElementData(elementData); 2294 frame()->document()->getTransitionElementData(elementData);
2297 2295
2298 Vector<String> ids; 2296 Vector<String> ids;
(...skipping 20 matching lines...) Expand all
2319 for (size_t i = 0; i < rects.size(); ++i) 2317 for (size_t i = 0; i < rects.size(); ++i)
2320 quads[i] = FloatRect(rects[i]); 2318 quads[i] = FloatRect(rects[i]);
2321 return ClientRectList::create(quads); 2319 return ClientRectList::create(quads);
2322 } 2320 }
2323 2321
2324 void Internals::hideAllTransitionElements() 2322 void Internals::hideAllTransitionElements()
2325 { 2323 {
2326 Vector<Document::TransitionElementData> elementData; 2324 Vector<Document::TransitionElementData> elementData;
2327 frame()->document()->getTransitionElementData(elementData); 2325 frame()->document()->getTransitionElementData(elementData);
2328 2326
2329 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2327 for (const auto& element : elementData)
2330 for (; iter != elementData.end(); ++iter) 2328 frame()->document()->hideTransitionElements(AtomicString(element.selecto r));
2331 frame()->document()->hideTransitionElements(AtomicString(iter->selector) );
2332 } 2329 }
2333 2330
2334 void Internals::showAllTransitionElements() 2331 void Internals::showAllTransitionElements()
2335 { 2332 {
2336 Vector<Document::TransitionElementData> elementData; 2333 Vector<Document::TransitionElementData> elementData;
2337 frame()->document()->getTransitionElementData(elementData); 2334 frame()->document()->getTransitionElementData(elementData);
2338 2335
2339 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2336 for (const auto& element : elementData)
2340 for (; iter != elementData.end(); ++iter) 2337 frame()->document()->showTransitionElements(AtomicString(element.selecto r));
2341 frame()->document()->showTransitionElements(AtomicString(iter->selector) );
2342 } 2338 }
2343 2339
2344 void Internals::setExitTransitionStylesheetsEnabled(bool enabled) 2340 void Internals::setExitTransitionStylesheetsEnabled(bool enabled)
2345 { 2341 {
2346 frame()->document()->styleEngine()->setExitTransitionStylesheetsEnabled(enab led); 2342 frame()->document()->styleEngine()->setExitTransitionStylesheetsEnabled(enab led);
2347 } 2343 }
2348 2344
2349 void Internals::forcePluginPlaceholder(HTMLElement* element, PassRefPtrWillBeRaw Ptr<DocumentFragment> fragment, ExceptionState& exceptionState) 2345 void Internals::forcePluginPlaceholder(HTMLElement* element, PassRefPtrWillBeRaw Ptr<DocumentFragment> fragment, ExceptionState& exceptionState)
2350 { 2346 {
2351 if (!element->isPluginElement()) { 2347 if (!element->isPluginElement()) {
(...skipping 16 matching lines...) Expand all
2368 { 2364 {
2369 return new InternalsIterator; 2365 return new InternalsIterator;
2370 } 2366 }
2371 2367
2372 void Internals::forceBlinkGCWithoutV8GC() 2368 void Internals::forceBlinkGCWithoutV8GC()
2373 { 2369 {
2374 ThreadState::current()->scheduleGC(); 2370 ThreadState::current()->scheduleGC();
2375 } 2371 }
2376 2372
2377 } // namespace blink 2373 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/WeakNodeMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698