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

Side by Side Diff: Source/core/dom/DocumentMarkerController.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 DocumentMarkerVector foundMarkers; 438 DocumentMarkerVector foundMarkers;
439 439
440 Node* startContainer = range->startContainer(); 440 Node* startContainer = range->startContainer();
441 ASSERT(startContainer); 441 ASSERT(startContainer);
442 Node* endContainer = range->endContainer(); 442 Node* endContainer = range->endContainer();
443 ASSERT(endContainer); 443 ASSERT(endContainer);
444 444
445 Node* pastLastNode = range->pastLastNode(); 445 Node* pastLastNode = range->pastLastNode();
446 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) { 446 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) {
447 DocumentMarkerVector markers = markersFor(node); 447 DocumentMarkerVector markers = markersFor(node);
448 DocumentMarkerVector::const_iterator end = markers.end(); 448 for (const auto& it : markers) {
449 for (DocumentMarkerVector::const_iterator it = markers.begin(); it != en d; ++it) { 449 DocumentMarker* marker = it;
450 DocumentMarker* marker = *it;
451 if (!markerTypes.contains(marker->type())) 450 if (!markerTypes.contains(marker->type()))
452 continue; 451 continue;
453 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset())) 452 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset()))
454 continue; 453 continue;
455 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset())) 454 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset()))
456 continue; 455 continue;
457 foundMarkers.append(marker); 456 foundMarkers.append(marker);
458 } 457 }
459 } 458 }
460 return foundMarkers; 459 return foundMarkers;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 ASSERT(!m_markers.isEmpty()); 714 ASSERT(!m_markers.isEmpty());
716 715
717 Node* startContainer = range->startContainer(); 716 Node* startContainer = range->startContainer();
718 ASSERT(startContainer); 717 ASSERT(startContainer);
719 Node* endContainer = range->endContainer(); 718 Node* endContainer = range->endContainer();
720 ASSERT(endContainer); 719 ASSERT(endContainer);
721 720
722 Node* pastLastNode = range->pastLastNode(); 721 Node* pastLastNode = range->pastLastNode();
723 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) { 722 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) {
724 DocumentMarkerVector markers = markersFor(node); 723 DocumentMarkerVector markers = markersFor(node);
725 DocumentMarkerVector::const_iterator end = markers.end(); 724 for (const auto& it : markers) {
726 for (DocumentMarkerVector::const_iterator it = markers.begin(); it != en d; ++it) { 725 DocumentMarker* marker = it;
727 DocumentMarker* marker = *it;
728 if (!markerTypes.contains(marker->type())) 726 if (!markerTypes.contains(marker->type()))
729 continue; 727 continue;
730 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset())) 728 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset()))
731 continue; 729 continue;
732 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset())) 730 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset()))
733 continue; 731 continue;
734 return true; 732 return true;
735 } 733 }
736 } 734 }
737 return false; 735 return false;
(...skipping 23 matching lines...) Expand all
761 759
762 } // namespace blink 760 } // namespace blink
763 761
764 #ifndef NDEBUG 762 #ifndef NDEBUG
765 void showDocumentMarkers(const blink::DocumentMarkerController* controller) 763 void showDocumentMarkers(const blink::DocumentMarkerController* controller)
766 { 764 {
767 if (controller) 765 if (controller)
768 controller->showMarkers(); 766 controller->showMarkers();
769 } 767 }
770 #endif 768 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698