| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
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 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2562 buffer.reachedBreak(); | 2562 buffer.reachedBreak(); |
| 2563 goto tryAgain; | 2563 goto tryAgain; |
| 2564 } | 2564 } |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 return matchLength; | 2567 return matchLength; |
| 2568 } | 2568 } |
| 2569 | 2569 |
| 2570 PassRefPtr<Range> findPlainText(const Range* range, const String& target, FindOp
tions options) | 2570 PassRefPtr<Range> findPlainText(const Range* range, const String& target, FindOp
tions options) |
| 2571 { | 2571 { |
| 2572 // CharacterIterator requires renderers to be up-to-date |
| 2573 range->ownerDocument()->updateLayout(); |
| 2574 |
| 2572 // First, find the text. | 2575 // First, find the text. |
| 2573 size_t matchStart; | 2576 size_t matchStart; |
| 2574 size_t matchLength; | 2577 size_t matchLength; |
| 2575 { | 2578 { |
| 2576 CharacterIterator findIterator(range, TextIteratorEntersTextControls); | 2579 CharacterIterator findIterator(range, TextIteratorEntersTextControls); |
| 2577 matchLength = findPlainText(findIterator, target, options, matchStart); | 2580 matchLength = findPlainText(findIterator, target, options, matchStart); |
| 2578 if (!matchLength) | 2581 if (!matchLength) |
| 2579 return collapsedToBoundary(range, !(options & Backwards)); | 2582 return collapsedToBoundary(range, !(options & Backwards)); |
| 2580 } | 2583 } |
| 2581 | 2584 |
| 2582 // Then, find the document position of the start and the end of the text. | 2585 // Then, find the document position of the start and the end of the text. |
| 2583 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls
); | 2586 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls
); |
| 2584 return characterSubrange(computeRangeIterator, matchStart, matchLength); | 2587 return characterSubrange(computeRangeIterator, matchStart, matchLength); |
| 2585 } | 2588 } |
| 2586 | 2589 |
| 2587 } | 2590 } |
| OLD | NEW |