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

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

Issue 544083002: Avoid allocating temporary ranges in connection with text and character iterators. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/editing/PlainTextRange.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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 clear(); 147 clear();
148 } 148 }
149 149
150 void DocumentMarkerController::removeMarkers(Range* range, DocumentMarker::Marke rTypes markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemovePartiallyO verlappingMarker) 150 void DocumentMarkerController::removeMarkers(Range* range, DocumentMarker::Marke rTypes markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemovePartiallyO verlappingMarker)
151 { 151 {
152 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance ()) { 152 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance ()) {
153 if (!possiblyHasMarkers(markerTypes)) 153 if (!possiblyHasMarkers(markerTypes))
154 return; 154 return;
155 ASSERT(!m_markers.isEmpty()); 155 ASSERT(!m_markers.isEmpty());
156 156
157 RefPtrWillBeRawPtr<Range> textPiece = markedText.range(); 157 int startOffset = markedText.startOffset();
158 int startOffset = textPiece->startOffset(); 158 int endOffset = markedText.endOffset();
159 int endOffset = textPiece->endOffset(); 159 removeMarkers(markedText.startContainer(), startOffset, endOffset - star tOffset, markerTypes, shouldRemovePartiallyOverlappingMarker);
160 removeMarkers(textPiece->startContainer(), startOffset, endOffset - star tOffset, markerTypes, shouldRemovePartiallyOverlappingMarker);
161 } 160 }
162 } 161 }
163 162
164 static bool startsFurther(const OwnPtrWillBeMember<RenderedDocumentMarker>& lhv, const DocumentMarker* rhv) 163 static bool startsFurther(const OwnPtrWillBeMember<RenderedDocumentMarker>& lhv, const DocumentMarker* rhv)
165 { 164 {
166 return lhv->startOffset() < rhv->startOffset(); 165 return lhv->startOffset() < rhv->startOffset();
167 } 166 }
168 167
169 static bool startsAfter(const OwnPtrWillBeMember<RenderedDocumentMarker>& marker , size_t startOffset) 168 static bool startsAfter(const OwnPtrWillBeMember<RenderedDocumentMarker>& marker , size_t startOffset)
170 { 169 {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 762
764 } // namespace blink 763 } // namespace blink
765 764
766 #ifndef NDEBUG 765 #ifndef NDEBUG
767 void showDocumentMarkers(const blink::DocumentMarkerController* controller) 766 void showDocumentMarkers(const blink::DocumentMarkerController* controller)
768 { 767 {
769 if (controller) 768 if (controller)
770 controller->showMarkers(); 769 controller->showMarkers();
771 } 770 }
772 #endif 771 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/PlainTextRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698