OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc. All right reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc. All right reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 void stopIgnoringSpaces(const Iterator& midpoint) | 60 void stopIgnoringSpaces(const Iterator& midpoint) |
61 { | 61 { |
62 ASSERT(m_numMidpoints % 2); | 62 ASSERT(m_numMidpoints % 2); |
63 addMidpoint(midpoint); | 63 addMidpoint(midpoint); |
64 } | 64 } |
65 | 65 |
66 // Adding a pair of midpoints before a character will split it out into a ne
w line box. | 66 // Adding a pair of midpoints before a character will split it out into a ne
w line box. |
67 void ensureCharacterGetsLineBox(Iterator& textParagraphSeparator) | 67 void ensureCharacterGetsLineBox(Iterator& textParagraphSeparator) |
68 { | 68 { |
69 startIgnoringSpaces(Iterator(0, textParagraphSeparator.lineLayoutItem(),
textParagraphSeparator.offset() - 1)); | 69 startIgnoringSpaces(Iterator(0, textParagraphSeparator.getLineLayoutItem
(), textParagraphSeparator.offset() - 1)); |
70 stopIgnoringSpaces(Iterator(0, textParagraphSeparator.lineLayoutItem(),
textParagraphSeparator.offset())); | 70 stopIgnoringSpaces(Iterator(0, textParagraphSeparator.getLineLayoutItem(
), textParagraphSeparator.offset())); |
71 } | 71 } |
72 | 72 |
73 void checkMidpoints(Iterator& lBreak) | 73 void checkMidpoints(Iterator& lBreak) |
74 { | 74 { |
75 // Check to see if our last midpoint is a start point beyond the line br
eak. If so, | 75 // Check to see if our last midpoint is a start point beyond the line br
eak. If so, |
76 // shave it off the list, and shave off a trailing space if the previous
end point doesn't | 76 // shave it off the list, and shave off a trailing space if the previous
end point doesn't |
77 // preserve whitespace. | 77 // preserve whitespace. |
78 if (lBreak.lineLayoutItem() && m_numMidpoints && !(m_numMidpoints % 2))
{ | 78 if (lBreak.getLineLayoutItem() && m_numMidpoints && !(m_numMidpoints % 2
)) { |
79 Iterator* midpointsIterator = m_midpoints.data(); | 79 Iterator* midpointsIterator = m_midpoints.data(); |
80 Iterator& endpoint = midpointsIterator[m_numMidpoints - 2]; | 80 Iterator& endpoint = midpointsIterator[m_numMidpoints - 2]; |
81 const Iterator& startpoint = midpointsIterator[m_numMidpoints - 1]; | 81 const Iterator& startpoint = midpointsIterator[m_numMidpoints - 1]; |
82 Iterator currpoint = endpoint; | 82 Iterator currpoint = endpoint; |
83 while (!currpoint.atEnd() && currpoint != startpoint && currpoint !=
lBreak) | 83 while (!currpoint.atEnd() && currpoint != startpoint && currpoint !=
lBreak) |
84 currpoint.increment(); | 84 currpoint.increment(); |
85 if (currpoint == lBreak) { | 85 if (currpoint == lBreak) { |
86 // We hit the line break before the start point. Shave off the s
tart point. | 86 // We hit the line break before the start point. Shave off the s
tart point. |
87 m_numMidpoints--; | 87 m_numMidpoints--; |
88 if (endpoint.lineLayoutItem().style()->collapseWhiteSpace() && e
ndpoint.lineLayoutItem().isText()) | 88 if (endpoint.getLineLayoutItem().style()->collapseWhiteSpace() &
& endpoint.getLineLayoutItem().isText()) |
89 endpoint.setOffset(endpoint.offset() - 1); | 89 endpoint.setOffset(endpoint.offset() - 1); |
90 } | 90 } |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 Vector<Iterator>& midpoints() { return m_midpoints; } | 94 Vector<Iterator>& midpoints() { return m_midpoints; } |
95 const unsigned& numMidpoints() const { return m_numMidpoints; } | 95 const unsigned& numMidpoints() const { return m_numMidpoints; } |
96 const unsigned& currentMidpoint() const { return m_currentMidpoint; } | 96 const unsigned& currentMidpoint() const { return m_currentMidpoint; } |
97 void incrementCurrentMidpoint() { m_currentMidpoint++; } | 97 void incrementCurrentMidpoint() { m_currentMidpoint++; } |
98 const bool& betweenMidpoints() const { return m_betweenMidpoints; } | 98 const bool& betweenMidpoints() const { return m_betweenMidpoints; } |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 | 1128 |
1129 template<class Iterator, class Run, class IsolatedRun> | 1129 template<class Iterator, class Run, class IsolatedRun> |
1130 MidpointState<Iterator> BidiResolver<Iterator, Run, IsolatedRun>::midpointStateF
orIsolatedRun(Run& run) | 1130 MidpointState<Iterator> BidiResolver<Iterator, Run, IsolatedRun>::midpointStateF
orIsolatedRun(Run& run) |
1131 { | 1131 { |
1132 return m_midpointStateForIsolatedRun.take(&run); | 1132 return m_midpointStateForIsolatedRun.take(&run); |
1133 } | 1133 } |
1134 | 1134 |
1135 } // namespace blink | 1135 } // namespace blink |
1136 | 1136 |
1137 #endif // BidiResolver_h | 1137 #endif // BidiResolver_h |
OLD | NEW |