OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "CaseMappingHarfBuzzBufferFiller.h" | 5 #include "CaseMappingHarfBuzzBufferFiller.h" |
6 | 6 |
7 #include "wtf/text/WTFString.h" | 7 #include "platform/wtf/text/WTFString.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 static const uint16_t* toUint16(const UChar* src) { | 11 static const uint16_t* toUint16(const UChar* src) { |
12 // FIXME: This relies on undefined behavior however it works on the | 12 // FIXME: This relies on undefined behavior however it works on the |
13 // current versions of all compilers we care about and avoids making | 13 // current versions of all compilers we care about and avoids making |
14 // a copy of the string. | 14 // a copy of the string. |
15 static_assert(sizeof(UChar) == sizeof(uint16_t), | 15 static_assert(sizeof(UChar) == sizeof(uint16_t), |
16 "UChar should be the same size as uint16_t"); | 16 "UChar should be the same size as uint16_t"); |
17 return reinterpret_cast<const uint16_t*>(src); | 17 return reinterpret_cast<const uint16_t*>(src); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 charIndex = newCharIndex; | 85 charIndex = newCharIndex; |
86 } | 86 } |
87 | 87 |
88 // Record post-context | 88 // Record post-context |
89 hb_buffer_add_utf16(m_harfBuzzBuffer, toUint16(buffer), bufferLength, | 89 hb_buffer_add_utf16(m_harfBuzzBuffer, toUint16(buffer), bufferLength, |
90 startIndex + numCharacters, 0); | 90 startIndex + numCharacters, 0); |
91 } | 91 } |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
OLD | NEW |