| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2009 Apple 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef SearchBuffer_h | 26 #ifndef SearchBuffer_h |
| 27 #define SearchBuffer_h | 27 #define SearchBuffer_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/editing/EphemeralRange.h" | 30 #include "core/editing/EphemeralRange.h" |
| 31 #include "core/editing/FindOptions.h" | 31 #include "core/editing/FindOptions.h" |
| 32 #include "wtf/Allocator.h" |
| 32 #include "wtf/Vector.h" | 33 #include "wtf/Vector.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 // Buffer that knows how to compare with a search target. | 37 // Buffer that knows how to compare with a search target. |
| 37 // Keeps enough of the previous text to be able to search in the future, but no | 38 // Keeps enough of the previous text to be able to search in the future, but no |
| 38 // more. Non-breaking spaces are always equal to normal spaces. Case folding is | 39 // more. Non-breaking spaces are always equal to normal spaces. Case folding is |
| 39 // also done if the CaseInsensitive option is specified. Matches are further | 40 // also done if the CaseInsensitive option is specified. Matches are further |
| 40 // filtered if the AtWordStarts option is specified, although some matches | 41 // filtered if the AtWordStarts option is specified, although some matches |
| 41 // inside a word are permitted if TreatMedialCapitalAsWordStart is specified as | 42 // inside a word are permitted if TreatMedialCapitalAsWordStart is specified as |
| 42 // well. | 43 // well. |
| 43 class SearchBuffer { | 44 class SearchBuffer { |
| 45 STACK_ALLOCATED(); |
| 44 WTF_MAKE_NONCOPYABLE(SearchBuffer); | 46 WTF_MAKE_NONCOPYABLE(SearchBuffer); |
| 45 public: | 47 public: |
| 46 SearchBuffer(const String& target, FindOptions); | 48 SearchBuffer(const String& target, FindOptions); |
| 47 ~SearchBuffer(); | 49 ~SearchBuffer(); |
| 48 | 50 |
| 49 // Returns number of characters appended; guaranteed to be in the range | 51 // Returns number of characters appended; guaranteed to be in the range |
| 50 // [1, length]. | 52 // [1, length]. |
| 51 template<typename CharType> | 53 template<typename CharType> |
| 52 void append(const CharType*, size_t length); | 54 void append(const CharType*, size_t length); |
| 53 size_t numberOfCharactersJustAppended() const { return m_numberOfCharactersJ
ustAppended; } | 55 size_t numberOfCharactersJustAppended() const { return m_numberOfCharactersJ
ustAppended; } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 80 Vector<UChar> m_normalizedTarget; | 82 Vector<UChar> m_normalizedTarget; |
| 81 mutable Vector<UChar> m_normalizedMatch; | 83 mutable Vector<UChar> m_normalizedMatch; |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 CORE_EXPORT EphemeralRange findPlainText(const EphemeralRange& inputRange, const
String&, FindOptions); | 86 CORE_EXPORT EphemeralRange findPlainText(const EphemeralRange& inputRange, const
String&, FindOptions); |
| 85 CORE_EXPORT EphemeralRangeInComposedTree findPlainText(const EphemeralRangeInCom
posedTree& inputRange, const String&, FindOptions); | 87 CORE_EXPORT EphemeralRangeInComposedTree findPlainText(const EphemeralRangeInCom
posedTree& inputRange, const String&, FindOptions); |
| 86 | 88 |
| 87 } // namespace blink | 89 } // namespace blink |
| 88 | 90 |
| 89 #endif // SearchBuffer_h | 91 #endif // SearchBuffer_h |
| OLD | NEW |