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, 2009, 2010, 2011 Apple Inc. All r ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 | 52 |
53 void LineBreaker::reset() | 53 void LineBreaker::reset() |
54 { | 54 { |
55 m_positionedObjects.clear(); | 55 m_positionedObjects.clear(); |
56 m_hyphenated = false; | 56 m_hyphenated = false; |
57 m_clear = CNONE; | 57 m_clear = CNONE; |
58 } | 58 } |
59 | 59 |
60 InlineIterator LineBreaker::nextLineBreak(InlineBidiResolver& resolver, LineInfo & lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviou sLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements) | 60 InlineIterator LineBreaker::nextLineBreak(InlineBidiResolver& resolver, LineInfo & lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviou sLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements) |
61 { | 61 { |
62 ShapeInsideInfo* shapeInsideInfo = m_block->layoutShapeInsideInfo(); | 62 return nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFromPre viousLine, consecutiveHyphenatedLines, wordMeasurements); |
Zoltan
2014/03/26 21:01:09
You can remove LineBreaker::nextLineBreak, and cal
| |
63 | |
64 if (!shapeInsideInfo || !shapeInsideInfo->lineOverlapsShapeBounds()) | |
65 return nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFro mPreviousLine, consecutiveHyphenatedLines, wordMeasurements); | |
66 | |
67 InlineIterator end = resolver.position(); | |
68 InlineIterator oldEnd = end; | |
69 | |
70 if (!shapeInsideInfo->hasSegments()) { | |
71 end = nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFrom PreviousLine, consecutiveHyphenatedLines, wordMeasurements); | |
72 resolver.setPositionIgnoringNestedIsolates(oldEnd); | |
73 return oldEnd; | |
74 } | |
75 | |
76 const SegmentList& segments = shapeInsideInfo->segments(); | |
77 SegmentRangeList& segmentRanges = shapeInsideInfo->segmentRanges(); | |
78 | |
79 for (unsigned i = 0; i < segments.size() && !end.atEnd(); i++) { | |
80 const InlineIterator segmentStart = resolver.position(); | |
81 end = nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFrom PreviousLine, consecutiveHyphenatedLines, wordMeasurements); | |
82 | |
83 ASSERT(segmentRanges.size() == i); | |
84 if (resolver.position().atEnd()) { | |
85 segmentRanges.append(LineSegmentRange(segmentStart, end)); | |
86 break; | |
87 } | |
88 if (resolver.position() == end) { | |
89 // Nothing fit this segment | |
90 end = segmentStart; | |
91 segmentRanges.append(LineSegmentRange(segmentStart, segmentStart)); | |
92 resolver.setPositionIgnoringNestedIsolates(segmentStart); | |
93 } else { | |
94 // Note that resolver.position is already skipping some of the white space at the beginning of the line, | |
95 // so that's why segmentStart might be different than resolver.posit ion(). | |
96 LineSegmentRange range(resolver.position(), end); | |
97 segmentRanges.append(range); | |
98 resolver.setPosition(end, numberOfIsolateAncestors(end)); | |
99 | |
100 if (lineInfo.previousLineBrokeCleanly()) { | |
101 // If we hit a new line break, just stop adding anything to this line. | |
102 break; | |
103 } | |
104 } | |
105 } | |
106 resolver.setPositionIgnoringNestedIsolates(oldEnd); | |
107 return end; | |
108 } | 63 } |
109 | 64 |
110 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineI nfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPrev iousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurement s) | 65 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineI nfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPrev iousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurement s) |
111 { | 66 { |
112 reset(); | 67 reset(); |
113 | 68 |
114 ASSERT(resolver.position().root() == m_block); | 69 ASSERT(resolver.position().root() == m_block); |
115 | 70 |
116 bool appliedStartWidth = resolver.position().offset() > 0; | 71 bool appliedStartWidth = resolver.position().offset() > 0; |
117 | 72 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 | 110 |
156 context.increment(); | 111 context.increment(); |
157 } | 112 } |
158 | 113 |
159 context.clearLineBreakIfFitsOnLine(); | 114 context.clearLineBreakIfFitsOnLine(); |
160 | 115 |
161 return context.handleEndOfLine(); | 116 return context.handleEndOfLine(); |
162 } | 117 } |
163 | 118 |
164 } | 119 } |
OLD | NEW |