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 "platform/fonts/shaping/RunSegmenter.h" | 5 #include "platform/fonts/shaping/RunSegmenter.h" |
6 | 6 |
7 #include "platform/fonts/ScriptRunIterator.h" | 7 #include "platform/fonts/ScriptRunIterator.h" |
8 #include "platform/fonts/SmallCapsIterator.h" | 8 #include "platform/fonts/SmallCapsIterator.h" |
9 #include "platform/fonts/SymbolsIterator.h" | 9 #include "platform/fonts/SymbolsIterator.h" |
10 #include "platform/fonts/UTF16TextIterator.h" | 10 #include "platform/fonts/UTF16TextIterator.h" |
11 #include "platform/text/Character.h" | 11 #include "platform/text/Character.h" |
12 #include "wtf/Assertions.h" | 12 #include "wtf/Assertions.h" |
| 13 #include "wtf/PtrUtil.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 RunSegmenter::RunSegmenter(const UChar* buffer, unsigned bufferSize, FontOrienta
tion runOrientation) | 17 RunSegmenter::RunSegmenter(const UChar* buffer, unsigned bufferSize, FontOrienta
tion runOrientation) |
17 : m_bufferSize(bufferSize) | 18 : m_bufferSize(bufferSize) |
18 , m_candidateRange({ 0, 0, USCRIPT_INVALID_CODE, OrientationIterator::Orient
ationKeep, FontFallbackPriority::Text }) | 19 , m_candidateRange({ 0, 0, USCRIPT_INVALID_CODE, OrientationIterator::Orient
ationKeep, FontFallbackPriority::Text }) |
19 , m_scriptRunIterator(adoptPtr(new ScriptRunIterator(buffer, bufferSize))) | 20 , m_scriptRunIterator(wrapUnique(new ScriptRunIterator(buffer, bufferSize))) |
20 , m_orientationIterator(runOrientation == FontOrientation::VerticalMixed ? a
doptPtr(new OrientationIterator(buffer, bufferSize, runOrientation)) : nullptr) | 21 , m_orientationIterator(runOrientation == FontOrientation::VerticalMixed ? w
rapUnique(new OrientationIterator(buffer, bufferSize, runOrientation)) : nullptr
) |
21 , m_symbolsIterator(adoptPtr(new SymbolsIterator(buffer, bufferSize))) | 22 , m_symbolsIterator(wrapUnique(new SymbolsIterator(buffer, bufferSize))) |
22 , m_lastSplit(0) | 23 , m_lastSplit(0) |
23 , m_scriptRunIteratorPosition(0) | 24 , m_scriptRunIteratorPosition(0) |
24 , m_orientationIteratorPosition(runOrientation == FontOrientation::VerticalM
ixed ? 0 : m_bufferSize) | 25 , m_orientationIteratorPosition(runOrientation == FontOrientation::VerticalM
ixed ? 0 : m_bufferSize) |
25 , m_symbolsIteratorPosition(0) | 26 , m_symbolsIteratorPosition(0) |
26 , m_atEnd(false) | 27 , m_atEnd(false) |
27 { | 28 { |
28 } | 29 } |
29 | 30 |
30 void RunSegmenter::consumeScriptIteratorPastLastSplit() | 31 void RunSegmenter::consumeScriptIteratorPastLastSplit() |
31 { | 32 { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 m_candidateRange.start = m_candidateRange.end; | 87 m_candidateRange.start = m_candidateRange.end; |
87 m_candidateRange.end = m_lastSplit; | 88 m_candidateRange.end = m_lastSplit; |
88 *nextRange = m_candidateRange; | 89 *nextRange = m_candidateRange; |
89 | 90 |
90 m_atEnd = m_lastSplit == m_bufferSize; | 91 m_atEnd = m_lastSplit == m_bufferSize; |
91 return true; | 92 return true; |
92 } | 93 } |
93 | 94 |
94 | 95 |
95 } // namespace blink | 96 } // namespace blink |
OLD | NEW |