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

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: 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/clipboard/DataObject.cpp ('k') | Source/core/dom/ElementData.cpp » ('j') | 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) 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
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 for (DocumentMarker* marker : markersFor(node)) {
448 DocumentMarkerVector::const_iterator end = markers.end();
449 for (DocumentMarkerVector::const_iterator it = markers.begin(); it != en d; ++it) {
450 DocumentMarker* marker = *it;
451 if (!markerTypes.contains(marker->type())) 448 if (!markerTypes.contains(marker->type()))
452 continue; 449 continue;
453 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset())) 450 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset()))
454 continue; 451 continue;
455 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset())) 452 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset()))
456 continue; 453 continue;
457 foundMarkers.append(marker); 454 foundMarkers.append(marker);
458 } 455 }
459 } 456 }
460 return foundMarkers; 457 return foundMarkers;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 return false; 711 return false;
715 ASSERT(!m_markers.isEmpty()); 712 ASSERT(!m_markers.isEmpty());
716 713
717 Node* startContainer = range->startContainer(); 714 Node* startContainer = range->startContainer();
718 ASSERT(startContainer); 715 ASSERT(startContainer);
719 Node* endContainer = range->endContainer(); 716 Node* endContainer = range->endContainer();
720 ASSERT(endContainer); 717 ASSERT(endContainer);
721 718
722 Node* pastLastNode = range->pastLastNode(); 719 Node* pastLastNode = range->pastLastNode();
723 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) { 720 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) {
724 DocumentMarkerVector markers = markersFor(node); 721 for (const DocumentMarker* marker : markersFor(node)) {
725 DocumentMarkerVector::const_iterator end = markers.end();
726 for (DocumentMarkerVector::const_iterator it = markers.begin(); it != en d; ++it) {
727 DocumentMarker* marker = *it;
728 if (!markerTypes.contains(marker->type())) 722 if (!markerTypes.contains(marker->type()))
729 continue; 723 continue;
730 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset())) 724 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset()))
731 continue; 725 continue;
732 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset())) 726 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset()))
733 continue; 727 continue;
734 return true; 728 return true;
735 } 729 }
736 } 730 }
737 return false; 731 return false;
(...skipping 23 matching lines...) Expand all
761 755
762 } // namespace blink 756 } // namespace blink
763 757
764 #ifndef NDEBUG 758 #ifndef NDEBUG
765 void showDocumentMarkers(const blink::DocumentMarkerController* controller) 759 void showDocumentMarkers(const blink::DocumentMarkerController* controller)
766 { 760 {
767 if (controller) 761 if (controller)
768 controller->showMarkers(); 762 controller->showMarkers();
769 } 763 }
770 #endif 764 #endif
OLDNEW
« no previous file with comments | « Source/core/clipboard/DataObject.cpp ('k') | Source/core/dom/ElementData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698