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

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: remove unused variable 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 697
698 unsigned Internals::activeMarkerCountForNode(Node* node) 698 unsigned Internals::activeMarkerCountForNode(Node* node)
699 { 699 {
700 ASSERT(node); 700 ASSERT(node);
701 701
702 // Only TextMatch markers can be active. 702 // Only TextMatch markers can be active.
703 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; 703 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch;
704 DocumentMarkerVector markers = node->document().markers().markersFor(node, m arkerType); 704 DocumentMarkerVector markers = node->document().markers().markersFor(node, m arkerType);
705 705
706 unsigned activeMarkerCount = 0; 706 unsigned activeMarkerCount = 0;
707 for (DocumentMarkerVector::iterator iter = markers.begin(); iter != markers. end(); ++iter) { 707 for (auto iter : markers) {
708 if ((*iter)->activeMatch()) 708 if (iter->activeMatch())
709 activeMarkerCount++; 709 activeMarkerCount++;
710 } 710 }
711 711
712 return activeMarkerCount; 712 return activeMarkerCount;
713 } 713 }
714 714
715 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& exceptionState) 715 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& exceptionState)
716 { 716 {
717 ASSERT(node); 717 ASSERT(node);
718 DocumentMarker::MarkerTypes markerTypes = 0; 718 DocumentMarker::MarkerTypes markerTypes = 0;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } 1125 }
1126 1126
1127 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even tHandlerClass handlerClass) 1127 static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::Even tHandlerClass handlerClass)
1128 { 1128 {
1129 if (!document.frameHost()) 1129 if (!document.frameHost())
1130 return 0; 1130 return 0;
1131 EventHandlerRegistry* registry = &document.frameHost()->eventHandlerRegistry (); 1131 EventHandlerRegistry* registry = &document.frameHost()->eventHandlerRegistry ();
1132 unsigned count = 0; 1132 unsigned count = 0;
1133 const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass); 1133 const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass);
1134 if (targets) { 1134 if (targets) {
1135 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) 1135 for (const auto& iter : *targets)
1136 count += iter->value; 1136 count += iter.value;
1137 } 1137 }
1138 return count; 1138 return count;
1139 } 1139 }
1140 1140
1141 unsigned Internals::wheelEventHandlerCount(Document* document) 1141 unsigned Internals::wheelEventHandlerCount(Document* document)
1142 { 1142 {
1143 ASSERT(document); 1143 ASSERT(document);
1144 return eventHandlerCount(*document, EventHandlerRegistry::WheelEvent); 1144 return eventHandlerCount(*document, EventHandlerRegistry::WheelEvent);
1145 } 1145 }
1146 1146
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 return 0; 1655 return 0;
1656 1656
1657 return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, page Height)); 1657 return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, page Height));
1658 } 1658 }
1659 1659
1660 Vector<String> Internals::iconURLs(Document* document, int iconTypesMask) const 1660 Vector<String> Internals::iconURLs(Document* document, int iconTypesMask) const
1661 { 1661 {
1662 Vector<IconURL> iconURLs = document->iconURLs(iconTypesMask); 1662 Vector<IconURL> iconURLs = document->iconURLs(iconTypesMask);
1663 Vector<String> array; 1663 Vector<String> array;
1664 1664
1665 Vector<IconURL>::const_iterator iter(iconURLs.begin()); 1665 for (auto iter : iconURLs)
1666 for (; iter != iconURLs.end(); ++iter) 1666 array.append(iter.m_iconURL.string());
1667 array.append(iter->m_iconURL.string());
1668 1667
1669 return array; 1668 return array;
1670 } 1669 }
1671 1670
1672 Vector<String> Internals::shortcutIconURLs(Document* document) const 1671 Vector<String> Internals::shortcutIconURLs(Document* document) const
1673 { 1672 {
1674 return iconURLs(document, Favicon); 1673 return iconURLs(document, Favicon);
1675 } 1674 }
1676 1675
1677 Vector<String> Internals::allIconURLs(Document* document) const 1676 Vector<String> Internals::allIconURLs(Document* document) const
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 ASSERT(element); 2254 ASSERT(element);
2256 return ClientRect::create(element->boundsInRootViewSpace()); 2255 return ClientRect::create(element->boundsInRootViewSpace());
2257 } 2256 }
2258 2257
2259 String Internals::serializeNavigationMarkup() 2258 String Internals::serializeNavigationMarkup()
2260 { 2259 {
2261 Vector<Document::TransitionElementData> elementData; 2260 Vector<Document::TransitionElementData> elementData;
2262 frame()->document()->getTransitionElementData(elementData); 2261 frame()->document()->getTransitionElementData(elementData);
2263 2262
2264 StringBuilder markup; 2263 StringBuilder markup;
2265 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2264 for (auto iter : elementData)
2266 for (; iter != elementData.end(); ++iter) 2265 markup.append(iter.markup);
2267 markup.append(iter->markup);
2268 2266
2269 return markup.toString(); 2267 return markup.toString();
2270 } 2268 }
2271 2269
2272 Vector<String> Internals::getTransitionElementIds() 2270 Vector<String> Internals::getTransitionElementIds()
2273 { 2271 {
2274 Vector<Document::TransitionElementData> elementData; 2272 Vector<Document::TransitionElementData> elementData;
2275 frame()->document()->getTransitionElementData(elementData); 2273 frame()->document()->getTransitionElementData(elementData);
2276 2274
2277 Vector<String> ids; 2275 Vector<String> ids;
(...skipping 20 matching lines...) Expand all
2298 for (size_t i = 0; i < rects.size(); ++i) 2296 for (size_t i = 0; i < rects.size(); ++i)
2299 quads[i] = FloatRect(rects[i]); 2297 quads[i] = FloatRect(rects[i]);
2300 return ClientRectList::create(quads); 2298 return ClientRectList::create(quads);
2301 } 2299 }
2302 2300
2303 void Internals::hideAllTransitionElements() 2301 void Internals::hideAllTransitionElements()
2304 { 2302 {
2305 Vector<Document::TransitionElementData> elementData; 2303 Vector<Document::TransitionElementData> elementData;
2306 frame()->document()->getTransitionElementData(elementData); 2304 frame()->document()->getTransitionElementData(elementData);
2307 2305
2308 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2306 for (auto iter : elementData)
2309 for (; iter != elementData.end(); ++iter) 2307 frame()->document()->hideTransitionElements(AtomicString(iter.selector)) ;
2310 frame()->document()->hideTransitionElements(AtomicString(iter->selector) );
2311 } 2308 }
2312 2309
2313 void Internals::showAllTransitionElements() 2310 void Internals::showAllTransitionElements()
2314 { 2311 {
2315 Vector<Document::TransitionElementData> elementData; 2312 Vector<Document::TransitionElementData> elementData;
2316 frame()->document()->getTransitionElementData(elementData); 2313 frame()->document()->getTransitionElementData(elementData);
2317 2314
2318 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2315 for (auto iter : elementData)
2319 for (; iter != elementData.end(); ++iter) 2316 frame()->document()->showTransitionElements(AtomicString(iter.selector)) ;
2320 frame()->document()->showTransitionElements(AtomicString(iter->selector) );
2321 } 2317 }
2322 2318
2323 void Internals::setExitTransitionStylesheetsEnabled(bool enabled) 2319 void Internals::setExitTransitionStylesheetsEnabled(bool enabled)
2324 { 2320 {
2325 frame()->document()->styleEngine()->setExitTransitionStylesheetsEnabled(enab led); 2321 frame()->document()->styleEngine()->setExitTransitionStylesheetsEnabled(enab led);
2326 } 2322 }
2327 2323
2328 void Internals::forcePluginPlaceholder(HTMLElement* element, PassRefPtrWillBeRaw Ptr<DocumentFragment> fragment, ExceptionState& exceptionState) 2324 void Internals::forcePluginPlaceholder(HTMLElement* element, PassRefPtrWillBeRaw Ptr<DocumentFragment> fragment, ExceptionState& exceptionState)
2329 { 2325 {
2330 if (!element->isPluginElement()) { 2326 if (!element->isPluginElement()) {
(...skipping 16 matching lines...) Expand all
2347 { 2343 {
2348 return new InternalsIterator; 2344 return new InternalsIterator;
2349 } 2345 }
2350 2346
2351 void Internals::forceBlinkGCWithoutV8GC() 2347 void Internals::forceBlinkGCWithoutV8GC()
2352 { 2348 {
2353 ThreadState::current()->scheduleGC(ThreadState::ForcedGC); 2349 ThreadState::current()->scheduleGC(ThreadState::ForcedGC);
2354 } 2350 }
2355 2351
2356 } // namespace blink 2352 } // namespace blink
OLDNEW
« Source/core/clipboard/DataObject.cpp ('K') | « Source/core/paint/GridPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698