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 #ifndef SmallCapsIterator_h | 5 #ifndef SmallCapsIterator_h |
6 #define SmallCapsIterator_h | 6 #define SmallCapsIterator_h |
7 | 7 |
8 #include "platform/fonts/FontOrientation.h" | 8 #include "platform/fonts/FontOrientation.h" |
9 #include "platform/fonts/ScriptRunIterator.h" | 9 #include "platform/fonts/ScriptRunIterator.h" |
10 #include "platform/fonts/UTF16TextIterator.h" | 10 #include "platform/fonts/UTF16TextIterator.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 #include <memory> | |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
17 class PLATFORM_EXPORT SmallCapsIterator { | 16 class PLATFORM_EXPORT SmallCapsIterator { |
18 USING_FAST_MALLOC(SmallCapsIterator); | 17 USING_FAST_MALLOC(SmallCapsIterator); |
19 WTF_MAKE_NONCOPYABLE(SmallCapsIterator); | 18 WTF_MAKE_NONCOPYABLE(SmallCapsIterator); |
20 public: | 19 public: |
21 enum SmallCapsBehavior { | 20 enum SmallCapsBehavior { |
22 SmallCapsSameCase, | 21 SmallCapsSameCase, |
23 SmallCapsUppercaseNeeded, | 22 SmallCapsUppercaseNeeded, |
24 SmallCapsInvalid | 23 SmallCapsInvalid |
25 }; | 24 }; |
26 | 25 |
27 SmallCapsIterator(const UChar* buffer, unsigned bufferSize); | 26 SmallCapsIterator(const UChar* buffer, unsigned bufferSize); |
28 | 27 |
29 bool consume(unsigned* capsLimit, SmallCapsBehavior*); | 28 bool consume(unsigned* capsLimit, SmallCapsBehavior*); |
30 private: | 29 private: |
31 std::unique_ptr<UTF16TextIterator> m_utf16Iterator; | 30 OwnPtr<UTF16TextIterator> m_utf16Iterator; |
32 unsigned m_bufferSize; | 31 unsigned m_bufferSize; |
33 UChar32 m_nextUChar32; | 32 UChar32 m_nextUChar32; |
34 bool m_atEnd; | 33 bool m_atEnd; |
35 | 34 |
36 SmallCapsBehavior m_currentSmallCapsBehavior; | 35 SmallCapsBehavior m_currentSmallCapsBehavior; |
37 SmallCapsBehavior m_previousSmallCapsBehavior; | 36 SmallCapsBehavior m_previousSmallCapsBehavior; |
38 }; | 37 }; |
39 | 38 |
40 } // namespace blink | 39 } // namespace blink |
41 | 40 |
42 #endif | 41 #endif |
OLD | NEW |