| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> | 2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> |
| 3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #define TextBreakIterator_h | 23 #define TextBreakIterator_h |
| 24 | 24 |
| 25 #include "platform/PlatformExport.h" | 25 #include "platform/PlatformExport.h" |
| 26 #include "wtf/text/AtomicString.h" | 26 #include "wtf/text/AtomicString.h" |
| 27 #include "wtf/text/Unicode.h" | 27 #include "wtf/text/Unicode.h" |
| 28 | 28 |
| 29 #include <unicode/brkiter.h> | 29 #include <unicode/brkiter.h> |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 struct ClusterData { |
| 34 ClusterData(unsigned numGraphemes, unsigned numCharacters) |
| 35 : graphemes(numGraphemes) |
| 36 , characters(numCharacters) |
| 37 { } |
| 38 unsigned graphemes; |
| 39 unsigned characters; |
| 40 }; |
| 41 |
| 33 typedef icu::BreakIterator TextBreakIterator; | 42 typedef icu::BreakIterator TextBreakIterator; |
| 34 | 43 |
| 35 // Note: The returned iterator is good only until you get another iterator, with
the exception of acquireLineBreakIterator. | 44 // Note: The returned iterator is good only until you get another iterator, with
the exception of acquireLineBreakIterator. |
| 36 | 45 |
| 37 // This is similar to character break iterator in most cases, but is subject to | 46 // This is similar to character break iterator in most cases, but is subject to |
| 38 // platform UI conventions. One notable example where this can be different | 47 // platform UI conventions. One notable example where this can be different |
| 39 // from character break iterator is Thai prepend characters, see bug 24342. | 48 // from character break iterator is Thai prepend characters, see bug 24342. |
| 40 // Use this for insertion point and selection manipulations. | 49 // Use this for insertion point and selection manipulations. |
| 41 PLATFORM_EXPORT TextBreakIterator* cursorMovementIterator(const UChar*, int leng
th); | 50 PLATFORM_EXPORT TextBreakIterator* cursorMovementIterator(const UChar*, int leng
th); |
| 42 | 51 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 unsigned m_length; | 257 unsigned m_length; |
| 249 | 258 |
| 250 // For 16 bit strings, we use a TextBreakIterator. | 259 // For 16 bit strings, we use a TextBreakIterator. |
| 251 TextBreakIterator* m_iterator; | 260 TextBreakIterator* m_iterator; |
| 252 }; | 261 }; |
| 253 | 262 |
| 254 // Counts the number of grapheme clusters. A surrogate pair or a sequence | 263 // Counts the number of grapheme clusters. A surrogate pair or a sequence |
| 255 // of a non-combining character and following combining characters is | 264 // of a non-combining character and following combining characters is |
| 256 // counted as 1 grapheme cluster. | 265 // counted as 1 grapheme cluster. |
| 257 PLATFORM_EXPORT unsigned numGraphemeClusters(const String&); | 266 PLATFORM_EXPORT unsigned numGraphemeClusters(const String&); |
| 267 // Counts the number of graphemes and characters. |
| 268 PLATFORM_EXPORT ClusterData countCharactersAndGraphemesInCluster(const UChar* no
rmalizedBuffer, unsigned normalizedBufferLength, uint16_t startIndex, uint16_t e
ndIndex); |
| 258 | 269 |
| 259 } | 270 } |
| 260 | 271 |
| 261 #endif | 272 #endif |
| OLD | NEW |