OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2008 Holger Hans Peter Freyther | 4 * Copyright (C) 2008 Holger Hans Peter Freyther |
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 using namespace WTF; | 26 using namespace WTF; |
27 using namespace Unicode; | 27 using namespace Unicode; |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 UTF16TextIterator::UTF16TextIterator(const UChar* characters, int length) | 31 UTF16TextIterator::UTF16TextIterator(const UChar* characters, int length) |
32 : m_characters(characters), | 32 : m_characters(characters), |
33 m_charactersEnd(characters + length), | 33 m_charactersEnd(characters + length), |
34 m_offset(0), | 34 m_offset(0), |
35 m_endOffset(length), | 35 m_length(length), |
36 m_currentGlyphLength(0) {} | |
37 | |
38 UTF16TextIterator::UTF16TextIterator(const UChar* characters, | |
39 int currentCharacter, | |
40 int endOffset, | |
41 int endCharacter) | |
42 : m_characters(characters), | |
43 m_charactersEnd(characters + (endCharacter - currentCharacter)), | |
44 m_offset(currentCharacter), | |
45 m_endOffset(endOffset), | |
46 m_currentGlyphLength(0) {} | 36 m_currentGlyphLength(0) {} |
47 | 37 |
48 bool UTF16TextIterator::isValidSurrogatePair(UChar32& character) { | 38 bool UTF16TextIterator::isValidSurrogatePair(UChar32& character) { |
49 // If we have a surrogate pair, make sure it starts with the high part. | 39 // If we have a surrogate pair, make sure it starts with the high part. |
50 if (!U16_IS_SURROGATE_LEAD(character)) | 40 if (!U16_IS_SURROGATE_LEAD(character)) |
51 return false; | 41 return false; |
52 | 42 |
53 // Do we have a surrogate pair? If so, determine the full Unicode (32 bit) | 43 // Do we have a surrogate pair? If so, determine the full Unicode (32 bit) |
54 // code point before glyph lookup. | 44 // code point before glyph lookup. |
55 // Make sure we have another character and it's a low surrogate. | 45 // Make sure we have another character and it's a low surrogate. |
(...skipping 14 matching lines...) Expand all Loading... |
70 return true; | 60 return true; |
71 } | 61 } |
72 | 62 |
73 UChar low = m_characters[1]; | 63 UChar low = m_characters[1]; |
74 character = U16_GET_SUPPLEMENTARY(character, low); | 64 character = U16_GET_SUPPLEMENTARY(character, low); |
75 m_currentGlyphLength = 2; | 65 m_currentGlyphLength = 2; |
76 return true; | 66 return true; |
77 } | 67 } |
78 | 68 |
79 } // namespace blink | 69 } // namespace blink |
OLD | NEW |