| 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 415 } |
| 416 | 416 |
| 417 return matchLength; | 417 return matchLength; |
| 418 } | 418 } |
| 419 | 419 |
| 420 static const TextIteratorBehaviorFlags iteratorFlagsForFindPlainText = TextItera
torEntersTextControls | TextIteratorEntersOpenShadowRoots | TextIteratorDoesNotB
reakAtReplacedElement | TextIteratorCollapseTrailingSpace; | 420 static const TextIteratorBehaviorFlags iteratorFlagsForFindPlainText = TextItera
torEntersTextControls | TextIteratorEntersOpenShadowRoots | TextIteratorDoesNotB
reakAtReplacedElement | TextIteratorCollapseTrailingSpace; |
| 421 | 421 |
| 422 template <typename Strategy> | 422 template <typename Strategy> |
| 423 static EphemeralRangeTemplate<Strategy> findPlainTextAlgorithm(const EphemeralRa
ngeTemplate<Strategy>& inputRange, const String& target, FindOptions options) | 423 static EphemeralRangeTemplate<Strategy> findPlainTextAlgorithm(const EphemeralRa
ngeTemplate<Strategy>& inputRange, const String& target, FindOptions options) |
| 424 { | 424 { |
| 425 // CharacterIterator requires layoutObjects to be up-to-date. | 425 // CharacterIterator requires layoutObjects to be up to date. |
| 426 if (!inputRange.startPosition().inShadowIncludingDocument()) | 426 if (!inputRange.startPosition().inShadowIncludingDocument()) |
| 427 return EphemeralRangeTemplate<Strategy>(); | 427 return EphemeralRangeTemplate<Strategy>(); |
| 428 DCHECK_EQ(inputRange.startPosition().document(), inputRange.endPosition().do
cument()); | 428 DCHECK_EQ(inputRange.startPosition().document(), inputRange.endPosition().do
cument()); |
| 429 | 429 |
| 430 // FIXME: Reduce the code duplication with above (but how?). | 430 // FIXME: Reduce the code duplication with above (but how?). |
| 431 size_t matchStart; | 431 size_t matchStart; |
| 432 size_t matchLength; | 432 size_t matchLength; |
| 433 { | 433 { |
| 434 TextIteratorBehaviorFlags behavior = iteratorFlagsForFindPlainText; | 434 TextIteratorBehaviorFlags behavior = iteratorFlagsForFindPlainText; |
| 435 if (options & FindAPICall) | 435 if (options & FindAPICall) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 454 { | 454 { |
| 455 return findPlainTextAlgorithm<EditingStrategy>(inputRange, target, options); | 455 return findPlainTextAlgorithm<EditingStrategy>(inputRange, target, options); |
| 456 } | 456 } |
| 457 | 457 |
| 458 EphemeralRangeInFlatTree findPlainText(const EphemeralRangeInFlatTree& inputRang
e, const String& target, FindOptions options) | 458 EphemeralRangeInFlatTree findPlainText(const EphemeralRangeInFlatTree& inputRang
e, const String& target, FindOptions options) |
| 459 { | 459 { |
| 460 return findPlainTextAlgorithm<EditingInFlatTreeStrategy>(inputRange, target,
options); | 460 return findPlainTextAlgorithm<EditingInFlatTreeStrategy>(inputRange, target,
options); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace blink | 463 } // namespace blink |
| OLD | NEW |