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

Side by Side Diff: Source/core/editing/VisibleSelection.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: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (!searchRange) 296 if (!searchRange)
297 return; 297 return;
298 298
299 CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetwe enAllVisiblePositions); 299 CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetwe enAllVisiblePositions);
300 bool changed = false; 300 bool changed = false;
301 301
302 for (; charIt.length(); charIt.advance(1)) { 302 for (; charIt.length(); charIt.advance(1)) {
303 UChar c = charIt.characterAt(0); 303 UChar c = charIt.characterAt(0);
304 if ((!isSpaceOrNewline(c) && c != noBreakSpace) || c == '\n') 304 if ((!isSpaceOrNewline(c) && c != noBreakSpace) || c == '\n')
305 break; 305 break;
306 m_end = charIt.range()->endPosition(); 306 m_end = charIt.endPosition();
307 changed = true; 307 changed = true;
308 } 308 }
309 if (changed) 309 if (changed)
310 didChange(); 310 didChange();
311 } 311 }
312 312
313 void VisibleSelection::setBaseAndExtentToDeepEquivalents() 313 void VisibleSelection::setBaseAndExtentToDeepEquivalents()
314 { 314 {
315 // Move the selection to rendered positions, if possible. 315 // Move the selection to rendered positions, if possible.
316 bool baseAndExtentEqual = m_base == m_extent; 316 bool baseAndExtentEqual = m_base == m_extent;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 sel.showTreeForThis(); 856 sel.showTreeForThis();
857 } 857 }
858 858
859 void showTree(const blink::VisibleSelection* sel) 859 void showTree(const blink::VisibleSelection* sel)
860 { 860 {
861 if (sel) 861 if (sel)
862 sel->showTreeForThis(); 862 sel->showTreeForThis();
863 } 863 }
864 864
865 #endif 865 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698