| 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(); | |
| 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 } | |
| 109 | |
| 110 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineI
nfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPrev
iousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurement
s) | |
| 111 { | |
| 112 reset(); | 62 reset(); |
| 113 | 63 |
| 114 ASSERT(resolver.position().root() == m_block); | 64 ASSERT(resolver.position().root() == m_block); |
| 115 | 65 |
| 116 bool appliedStartWidth = resolver.position().offset() > 0; | 66 bool appliedStartWidth = resolver.position().offset() > 0; |
| 117 | 67 |
| 118 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.is
FirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style())); | 68 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.is
FirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style())); |
| 119 | 69 |
| 120 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width); | 70 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width); |
| 121 | 71 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 105 |
| 156 context.increment(); | 106 context.increment(); |
| 157 } | 107 } |
| 158 | 108 |
| 159 context.clearLineBreakIfFitsOnLine(); | 109 context.clearLineBreakIfFitsOnLine(); |
| 160 | 110 |
| 161 return context.handleEndOfLine(); | 111 return context.handleEndOfLine(); |
| 162 } | 112 } |
| 163 | 113 |
| 164 } | 114 } |
| OLD | NEW |