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 "SmallCapsIterator.h" | 5 #include "SmallCapsIterator.h" |
6 | 6 |
7 #include "wtf/PtrUtil.h" | |
8 #include <unicode/utypes.h> | 7 #include <unicode/utypes.h> |
9 | 8 |
10 namespace blink { | 9 namespace blink { |
11 | 10 |
12 SmallCapsIterator::SmallCapsIterator(const UChar* buffer, unsigned bufferSize) | 11 SmallCapsIterator::SmallCapsIterator(const UChar* buffer, unsigned bufferSize) |
13 : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))) | 12 : m_utf16Iterator(adoptPtr(new UTF16TextIterator(buffer, bufferSize))) |
14 , m_bufferSize(bufferSize) | 13 , m_bufferSize(bufferSize) |
15 , m_nextUChar32(0) | 14 , m_nextUChar32(0) |
16 , m_atEnd(bufferSize == 0) | 15 , m_atEnd(bufferSize == 0) |
17 , m_currentSmallCapsBehavior(SmallCapsInvalid) | 16 , m_currentSmallCapsBehavior(SmallCapsInvalid) |
18 { | 17 { |
19 } | 18 } |
20 | 19 |
21 bool SmallCapsIterator::consume(unsigned *capsLimit, SmallCapsBehavior* smallCap
sBehavior) | 20 bool SmallCapsIterator::consume(unsigned *capsLimit, SmallCapsBehavior* smallCap
sBehavior) |
22 { | 21 { |
23 if (m_atEnd) | 22 if (m_atEnd) |
(...skipping 18 matching lines...) Expand all Loading... |
42 } | 41 } |
43 m_utf16Iterator->advance(); | 42 m_utf16Iterator->advance(); |
44 } | 43 } |
45 *capsLimit = m_bufferSize; | 44 *capsLimit = m_bufferSize; |
46 *smallCapsBehavior = m_currentSmallCapsBehavior; | 45 *smallCapsBehavior = m_currentSmallCapsBehavior; |
47 m_atEnd = true; | 46 m_atEnd = true; |
48 return true; | 47 return true; |
49 } | 48 } |
50 | 49 |
51 } // namespace blink | 50 } // namespace blink |
OLD | NEW |