| OLD | NEW |
| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 resultEnd.clear(); | 621 resultEnd.clear(); |
| 622 // CharacterIterator requires layoutObjects to be up-to-date. | 622 // CharacterIterator requires layoutObjects to be up-to-date. |
| 623 if (!inputStart.inDocument()) | 623 if (!inputStart.inDocument()) |
| 624 return; | 624 return; |
| 625 ASSERT(inputStart.document() == inputEnd.document()); | 625 ASSERT(inputStart.document() == inputEnd.document()); |
| 626 | 626 |
| 627 // FIXME: Reduce the code duplication with above (but how?). | 627 // FIXME: Reduce the code duplication with above (but how?). |
| 628 size_t matchStart; | 628 size_t matchStart; |
| 629 size_t matchLength; | 629 size_t matchLength; |
| 630 { | 630 { |
| 631 CharacterIterator findIterator(inputStart, inputEnd, iteratorFlagsForFin
dPlainText); | 631 TextIteratorBehaviorFlags behavior = iteratorFlagsForFindPlainText; |
| 632 if (options & FindAPICall) |
| 633 behavior |= TextIteratorForWindowFind; |
| 634 CharacterIterator findIterator(inputStart, inputEnd, behavior); |
| 632 matchLength = findPlainTextInternal(findIterator, target, options, match
Start); | 635 matchLength = findPlainTextInternal(findIterator, target, options, match
Start); |
| 633 if (!matchLength) { | 636 if (!matchLength) { |
| 634 const Position& collapseTo = options & Backwards ? inputStart : inpu
tEnd; | 637 const Position& collapseTo = options & Backwards ? inputStart : inpu
tEnd; |
| 635 resultStart = collapseTo; | 638 resultStart = collapseTo; |
| 636 resultEnd = collapseTo; | 639 resultEnd = collapseTo; |
| 637 return; | 640 return; |
| 638 } | 641 } |
| 639 } | 642 } |
| 640 | 643 |
| 641 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 644 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
| 642 computeRangeIterator.calculateCharacterSubrange(matchStart, matchLength, res
ultStart, resultEnd); | 645 computeRangeIterator.calculateCharacterSubrange(matchStart, matchLength, res
ultStart, resultEnd); |
| 643 } | 646 } |
| 644 | 647 |
| 645 } // namespace blink | 648 } // namespace blink |
| OLD | NEW |