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

Side by Side Diff: Source/core/dom/DocumentMarkerController.cpp

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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/Document.cpp ('k') | Source/core/dom/DocumentOrderedMap.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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return Vector<DocumentMarker*>(); 432 return Vector<DocumentMarker*>();
433 433
434 Vector<DocumentMarker*> foundMarkers; 434 Vector<DocumentMarker*> foundMarkers;
435 435
436 Node* startContainer = range->startContainer(); 436 Node* startContainer = range->startContainer();
437 ASSERT(startContainer); 437 ASSERT(startContainer);
438 Node* endContainer = range->endContainer(); 438 Node* endContainer = range->endContainer();
439 ASSERT(endContainer); 439 ASSERT(endContainer);
440 440
441 Node* pastLastNode = range->pastLastNode(); 441 Node* pastLastNode = range->pastLastNode();
442 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(node)) { 442 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) {
443 Vector<DocumentMarker*> markers = markersFor(node); 443 Vector<DocumentMarker*> markers = markersFor(node);
444 Vector<DocumentMarker*>::const_iterator end = markers.end(); 444 Vector<DocumentMarker*>::const_iterator end = markers.end();
445 for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) { 445 for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) {
446 DocumentMarker* marker = *it; 446 DocumentMarker* marker = *it;
447 if (!markerTypes.contains(marker->type())) 447 if (!markerTypes.contains(marker->type()))
448 continue; 448 continue;
449 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset())) 449 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset()))
450 continue; 450 continue;
451 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset())) 451 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset()))
452 continue; 452 continue;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 { 637 {
638 if (!possiblyHasMarkers(DocumentMarker::AllMarkers())) 638 if (!possiblyHasMarkers(DocumentMarker::AllMarkers()))
639 return; 639 return;
640 ASSERT(!m_markers.isEmpty()); 640 ASSERT(!m_markers.isEmpty());
641 641
642 Node* startContainer = range->startContainer(); 642 Node* startContainer = range->startContainer();
643 Node* endContainer = range->endContainer(); 643 Node* endContainer = range->endContainer();
644 644
645 Node* pastLastNode = range->pastLastNode(); 645 Node* pastLastNode = range->pastLastNode();
646 646
647 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(node)) { 647 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) {
648 int startOffset = node == startContainer ? range->startOffset() : 0; 648 int startOffset = node == startContainer ? range->startOffset() : 0;
649 int endOffset = node == endContainer ? range->endOffset() : INT_MAX; 649 int endOffset = node == endContainer ? range->endOffset() : INT_MAX;
650 setMarkersActive(node, startOffset, endOffset, active); 650 setMarkersActive(node, startOffset, endOffset, active);
651 } 651 }
652 } 652 }
653 653
654 void DocumentMarkerController::setMarkersActive(Node* node, unsigned startOffset , unsigned endOffset, bool active) 654 void DocumentMarkerController::setMarkersActive(Node* node, unsigned startOffset , unsigned endOffset, bool active)
655 { 655 {
656 MarkerLists* markers = m_markers.get(node); 656 MarkerLists* markers = m_markers.get(node);
657 if (!markers) 657 if (!markers)
(...skipping 24 matching lines...) Expand all
682 if (!possiblyHasMarkers(markerTypes)) 682 if (!possiblyHasMarkers(markerTypes))
683 return false; 683 return false;
684 ASSERT(!m_markers.isEmpty()); 684 ASSERT(!m_markers.isEmpty());
685 685
686 Node* startContainer = range->startContainer(); 686 Node* startContainer = range->startContainer();
687 ASSERT(startContainer); 687 ASSERT(startContainer);
688 Node* endContainer = range->endContainer(); 688 Node* endContainer = range->endContainer();
689 ASSERT(endContainer); 689 ASSERT(endContainer);
690 690
691 Node* pastLastNode = range->pastLastNode(); 691 Node* pastLastNode = range->pastLastNode();
692 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(node)) { 692 for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTrave rsal::next(*node)) {
693 Vector<DocumentMarker*> markers = markersFor(node); 693 Vector<DocumentMarker*> markers = markersFor(node);
694 Vector<DocumentMarker*>::const_iterator end = markers.end(); 694 Vector<DocumentMarker*>::const_iterator end = markers.end();
695 for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) { 695 for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) {
696 DocumentMarker* marker = *it; 696 DocumentMarker* marker = *it;
697 if (!markerTypes.contains(marker->type())) 697 if (!markerTypes.contains(marker->type()))
698 continue; 698 continue;
699 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset())) 699 if (node == startContainer && marker->endOffset() <= static_cast<uns igned>(range->startOffset()))
700 continue; 700 continue;
701 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset())) 701 if (node == endContainer && marker->startOffset() >= static_cast<uns igned>(range->endOffset()))
702 continue; 702 continue;
(...skipping 27 matching lines...) Expand all
730 730
731 } // namespace WebCore 731 } // namespace WebCore
732 732
733 #ifndef NDEBUG 733 #ifndef NDEBUG
734 void showDocumentMarkers(const WebCore::DocumentMarkerController* controller) 734 void showDocumentMarkers(const WebCore::DocumentMarkerController* controller)
735 { 735 {
736 if (controller) 736 if (controller)
737 controller->showMarkers(); 737 controller->showMarkers();
738 } 738 }
739 #endif 739 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/DocumentOrderedMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698