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 "platform/wtf/text/WTFString.h" | 7 #include "platform/wtf/text/WTFString.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 } else { | 36 } else { |
37 caseMappedText = String(buffer, bufferLength).lower(locale); | 37 caseMappedText = String(buffer, bufferLength).lower(locale); |
38 } | 38 } |
39 | 39 |
40 if (caseMappedText.length() != bufferLength) { | 40 if (caseMappedText.length() != bufferLength) { |
41 fillSlowCase(caseMapIntend, locale, buffer, bufferLength, startIndex, | 41 fillSlowCase(caseMapIntend, locale, buffer, bufferLength, startIndex, |
42 numCharacters); | 42 numCharacters); |
43 return; | 43 return; |
44 } | 44 } |
45 | 45 |
46 ASSERT(caseMappedText.length() == bufferLength); | 46 DCHECK_EQ(caseMappedText.length(), bufferLength); |
47 ASSERT(!caseMappedText.is8Bit()); | 47 DCHECK(!caseMappedText.is8Bit()); |
48 hb_buffer_add_utf16(m_harfBuzzBuffer, | 48 hb_buffer_add_utf16(m_harfBuzzBuffer, |
49 toUint16(caseMappedText.characters16()), bufferLength, | 49 toUint16(caseMappedText.characters16()), bufferLength, |
50 startIndex, numCharacters); | 50 startIndex, numCharacters); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 // TODO(drott): crbug.com/623940 Fix lack of context sensitive case mapping | 54 // TODO(drott): crbug.com/623940 Fix lack of context sensitive case mapping |
55 // here. | 55 // here. |
56 void CaseMappingHarfBuzzBufferFiller::fillSlowCase(CaseMapIntend caseMapIntend, | 56 void CaseMappingHarfBuzzBufferFiller::fillSlowCase(CaseMapIntend caseMapIntend, |
57 AtomicString locale, | 57 AtomicString locale, |
(...skipping 26 matching lines...) Expand all 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 |