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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 : nullptr), | 28 : nullptr), |
29 m_symbolsIterator(WTF::makeUnique<SymbolsIterator>(buffer, bufferSize)), | 29 m_symbolsIterator(WTF::makeUnique<SymbolsIterator>(buffer, bufferSize)), |
30 m_lastSplit(0), | 30 m_lastSplit(0), |
31 m_scriptRunIteratorPosition(0), | 31 m_scriptRunIteratorPosition(0), |
32 m_orientationIteratorPosition( | 32 m_orientationIteratorPosition( |
33 runOrientation == FontOrientation::VerticalMixed ? 0 : m_bufferSize), | 33 runOrientation == FontOrientation::VerticalMixed ? 0 : m_bufferSize), |
34 m_symbolsIteratorPosition(0), | 34 m_symbolsIteratorPosition(0), |
35 m_atEnd(false) {} | 35 m_atEnd(false) {} |
36 | 36 |
37 void RunSegmenter::consumeScriptIteratorPastLastSplit() { | 37 void RunSegmenter::consumeScriptIteratorPastLastSplit() { |
38 ASSERT(m_scriptRunIterator); | 38 DCHECK(m_scriptRunIterator); |
39 if (m_scriptRunIteratorPosition <= m_lastSplit && | 39 if (m_scriptRunIteratorPosition <= m_lastSplit && |
40 m_scriptRunIteratorPosition < m_bufferSize) { | 40 m_scriptRunIteratorPosition < m_bufferSize) { |
41 while (m_scriptRunIterator->consume(m_scriptRunIteratorPosition, | 41 while (m_scriptRunIterator->consume(m_scriptRunIteratorPosition, |
42 m_candidateRange.script)) { | 42 m_candidateRange.script)) { |
43 if (m_scriptRunIteratorPosition > m_lastSplit) | 43 if (m_scriptRunIteratorPosition > m_lastSplit) |
44 return; | 44 return; |
45 } | 45 } |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 void RunSegmenter::consumeOrientationIteratorPastLastSplit() { | 49 void RunSegmenter::consumeOrientationIteratorPastLastSplit() { |
50 if (m_orientationIterator && m_orientationIteratorPosition <= m_lastSplit && | 50 if (m_orientationIterator && m_orientationIteratorPosition <= m_lastSplit && |
51 m_orientationIteratorPosition < m_bufferSize) { | 51 m_orientationIteratorPosition < m_bufferSize) { |
52 while (m_orientationIterator->consume( | 52 while (m_orientationIterator->consume( |
53 &m_orientationIteratorPosition, &m_candidateRange.renderOrientation)) { | 53 &m_orientationIteratorPosition, &m_candidateRange.renderOrientation)) { |
54 if (m_orientationIteratorPosition > m_lastSplit) | 54 if (m_orientationIteratorPosition > m_lastSplit) |
55 return; | 55 return; |
56 } | 56 } |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 void RunSegmenter::consumeSymbolsIteratorPastLastSplit() { | 60 void RunSegmenter::consumeSymbolsIteratorPastLastSplit() { |
61 ASSERT(m_symbolsIterator); | 61 DCHECK(m_symbolsIterator); |
62 if (m_symbolsIteratorPosition <= m_lastSplit && | 62 if (m_symbolsIteratorPosition <= m_lastSplit && |
63 m_symbolsIteratorPosition < m_bufferSize) { | 63 m_symbolsIteratorPosition < m_bufferSize) { |
64 while (m_symbolsIterator->consume(&m_symbolsIteratorPosition, | 64 while (m_symbolsIterator->consume(&m_symbolsIteratorPosition, |
65 &m_candidateRange.fontFallbackPriority)) { | 65 &m_candidateRange.fontFallbackPriority)) { |
66 if (m_symbolsIteratorPosition > m_lastSplit) | 66 if (m_symbolsIteratorPosition > m_lastSplit) |
67 return; | 67 return; |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
(...skipping 22 matching lines...) Expand all Loading... |
94 | 94 |
95 m_candidateRange.start = m_candidateRange.end; | 95 m_candidateRange.start = m_candidateRange.end; |
96 m_candidateRange.end = m_lastSplit; | 96 m_candidateRange.end = m_lastSplit; |
97 *nextRange = m_candidateRange; | 97 *nextRange = m_candidateRange; |
98 | 98 |
99 m_atEnd = m_lastSplit == m_bufferSize; | 99 m_atEnd = m_lastSplit == m_bufferSize; |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
OLD | NEW |