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

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: 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 | « Source/core/editing/TextIterator.cpp ('k') | Source/core/editing/VisibleUnits.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) 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (!searchRange) 306 if (!searchRange)
307 return; 307 return;
308 308
309 CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetwe enAllVisiblePositions); 309 CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetwe enAllVisiblePositions);
310 bool changed = false; 310 bool changed = false;
311 311
312 for (; charIt.length(); charIt.advance(1)) { 312 for (; charIt.length(); charIt.advance(1)) {
313 UChar c = charIt.characterAt(0); 313 UChar c = charIt.characterAt(0);
314 if ((!isSpaceOrNewline(c) && c != noBreakSpace) || c == '\n') 314 if ((!isSpaceOrNewline(c) && c != noBreakSpace) || c == '\n')
315 break; 315 break;
316 m_end = charIt.range()->endPosition(); 316 m_end = charIt.endPosition();
317 changed = true; 317 changed = true;
318 } 318 }
319 if (changed) 319 if (changed)
320 didChange(); 320 didChange();
321 } 321 }
322 322
323 void VisibleSelection::setBaseAndExtentToDeepEquivalents() 323 void VisibleSelection::setBaseAndExtentToDeepEquivalents()
324 { 324 {
325 // Move the selection to rendered positions, if possible. 325 // Move the selection to rendered positions, if possible.
326 bool baseAndExtentEqual = m_base == m_extent; 326 bool baseAndExtentEqual = m_base == m_extent;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 sel.showTreeForThis(); 866 sel.showTreeForThis();
867 } 867 }
868 868
869 void showTree(const blink::VisibleSelection* sel) 869 void showTree(const blink::VisibleSelection* sel)
870 { 870 {
871 if (sel) 871 if (sel)
872 sel->showTreeForThis(); 872 sel->showTreeForThis();
873 } 873 }
874 874
875 #endif 875 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/TextIterator.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698