| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "SymbolsIterator.h" | 5 #include "SymbolsIterator.h" |
| 6 | 6 |
| 7 #include "wtf/PtrUtil.h" | 7 #include "wtf/PtrUtil.h" |
| 8 #include <unicode/uchar.h> | 8 #include <unicode/uchar.h> |
| 9 #include <unicode/uniset.h> | 9 #include <unicode/uniset.h> |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 using namespace WTF::Unicode; | 13 using namespace WTF::Unicode; |
| 14 | 14 |
| 15 SymbolsIterator::SymbolsIterator(const UChar* buffer, unsigned bufferSize) | 15 SymbolsIterator::SymbolsIterator(const UChar* buffer, unsigned bufferSize) |
| 16 : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))), | 16 : m_utf16Iterator(makeUnique<UTF16TextIterator>(buffer, bufferSize)), |
| 17 m_bufferSize(bufferSize), | 17 m_bufferSize(bufferSize), |
| 18 m_nextChar(0), | 18 m_nextChar(0), |
| 19 m_atEnd(bufferSize == 0), | 19 m_atEnd(bufferSize == 0), |
| 20 m_currentFontFallbackPriority(FontFallbackPriority::Invalid) {} | 20 m_currentFontFallbackPriority(FontFallbackPriority::Invalid) {} |
| 21 | 21 |
| 22 FontFallbackPriority SymbolsIterator::fontFallbackPriorityForCharacter( | 22 FontFallbackPriority SymbolsIterator::fontFallbackPriorityForCharacter( |
| 23 UChar32 codepoint) { | 23 UChar32 codepoint) { |
| 24 // Those should only be Emoji presentation as combinations of two. | 24 // Those should only be Emoji presentation as combinations of two. |
| 25 if (Character::isEmojiKeycapBase(codepoint) || | 25 if (Character::isEmojiKeycapBase(codepoint) || |
| 26 Character::isRegionalIndicator(codepoint)) | 26 Character::isRegionalIndicator(codepoint)) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 *symbolsLimit = m_bufferSize; | 128 *symbolsLimit = m_bufferSize; |
| 129 *fontFallbackPriority = m_currentFontFallbackPriority; | 129 *fontFallbackPriority = m_currentFontFallbackPriority; |
| 130 m_atEnd = true; | 130 m_atEnd = true; |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |