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

Side by Side Diff: Source/core/editing/TextIterator.cpp

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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/TextInsertionBaseCommand.h ('k') | Source/core/editing/markup.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, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 if (runStart < runEnd) { 580 if (runStart < runEnd) {
581 // Handle either a single newline character (which becomes a space), 581 // Handle either a single newline character (which becomes a space),
582 // or a run of characters that does not include a newline. 582 // or a run of characters that does not include a newline.
583 // This effectively translates newlines to spaces without copying th e text. 583 // This effectively translates newlines to spaces without copying th e text.
584 if (str[runStart] == '\n') { 584 if (str[runStart] == '\n') {
585 emitCharacter(' ', m_node, 0, runStart, runStart + 1); 585 emitCharacter(' ', m_node, 0, runStart, runStart + 1);
586 m_offset = runStart + 1; 586 m_offset = runStart + 1;
587 } else { 587 } else {
588 size_t subrunEnd = str.find('\n', runStart); 588 size_t subrunEnd = str.find('\n', runStart);
589 if (subrunEnd == notFound || subrunEnd > runEnd) 589 if (subrunEnd == kNotFound || subrunEnd > runEnd)
590 subrunEnd = runEnd; 590 subrunEnd = runEnd;
591 591
592 m_offset = subrunEnd; 592 m_offset = subrunEnd;
593 emitText(m_node, renderer, runStart, subrunEnd); 593 emitText(m_node, renderer, runStart, subrunEnd);
594 } 594 }
595 595
596 // If we are doing a subrun that doesn't go to the end of the text b ox, 596 // If we are doing a subrun that doesn't go to the end of the text b ox,
597 // come back again to finish handling this text box; don't advance t o the next one. 597 // come back again to finish handling this text box; don't advance t o the next one.
598 if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd) 598 if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd)
599 return; 599 return;
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 2314
2315 if (rangeLength != 0 && rangeEnd > docTextPosition) { // rangeEnd is out of bounds 2315 if (rangeLength != 0 && rangeEnd > docTextPosition) { // rangeEnd is out of bounds
2316 resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffse t(), IGNORE_EXCEPTION); 2316 resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffse t(), IGNORE_EXCEPTION);
2317 } 2317 }
2318 2318
2319 return resultRange.release(); 2319 return resultRange.release();
2320 } 2320 }
2321 2321
2322 bool TextIterator::getLocationAndLengthFromRange(Node* scope, const Range* range , size_t& location, size_t& length) 2322 bool TextIterator::getLocationAndLengthFromRange(Node* scope, const Range* range , size_t& location, size_t& length)
2323 { 2323 {
2324 location = notFound; 2324 location = kNotFound;
2325 length = 0; 2325 length = 0;
2326 2326
2327 if (!range->startContainer()) 2327 if (!range->startContainer())
2328 return false; 2328 return false;
2329 2329
2330 // The critical assumption is that this only gets called with ranges that 2330 // The critical assumption is that this only gets called with ranges that
2331 // concentrate on a given area containing the selection root. This is done 2331 // concentrate on a given area containing the selection root. This is done
2332 // because of text fields and textareas. The DOM for those is not 2332 // because of text fields and textareas. The DOM for those is not
2333 // directly in the document DOM, so ensure that the range does not cross a 2333 // directly in the document DOM, so ensure that the range does not cross a
2334 // boundary of one of those. 2334 // boundary of one of those.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 if (!matchLength) 2444 if (!matchLength)
2445 return collapsedToBoundary(range, !(options & Backwards)); 2445 return collapsedToBoundary(range, !(options & Backwards));
2446 } 2446 }
2447 2447
2448 // Then, find the document position of the start and the end of the text. 2448 // Then, find the document position of the start and the end of the text.
2449 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls ); 2449 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls );
2450 return characterSubrange(computeRangeIterator, matchStart, matchLength); 2450 return characterSubrange(computeRangeIterator, matchStart, matchLength);
2451 } 2451 }
2452 2452
2453 } 2453 }
OLDNEW
« no previous file with comments | « Source/core/editing/TextInsertionBaseCommand.h ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698