| 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 * Copyright (C) 2013 Adobe Systems Incorporated. | 5 * Copyright (C) 2013 Adobe Systems Incorporated. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 : m_resolver(resolver) | 50 : m_resolver(resolver) |
| 51 , m_current(resolver.position()) | 51 , m_current(resolver.position()) |
| 52 , m_lineBreak(resolver.position()) | 52 , m_lineBreak(resolver.position()) |
| 53 , m_block(block) | 53 , m_block(block) |
| 54 , m_lastObject(m_current.object()) | 54 , m_lastObject(m_current.object()) |
| 55 , m_nextObject(0) | 55 , m_nextObject(0) |
| 56 , m_currentStyle(0) | 56 , m_currentStyle(0) |
| 57 , m_blockStyle(block->style()) | 57 , m_blockStyle(block->style()) |
| 58 , m_lineInfo(inLineInfo) | 58 , m_lineInfo(inLineInfo) |
| 59 , m_renderTextInfo(inRenderTextInfo) | 59 , m_renderTextInfo(inRenderTextInfo) |
| 60 , m_lastFloatFromPreviousLine(inLastFloatFromPreviousLine) | |
| 61 , m_width(lineWidth) | 60 , m_width(lineWidth) |
| 62 , m_currWS(NORMAL) | 61 , m_currWS(NORMAL) |
| 63 , m_lastWS(NORMAL) | 62 , m_lastWS(NORMAL) |
| 64 , m_preservesNewline(false) | 63 , m_preservesNewline(false) |
| 65 , m_atStart(true) | 64 , m_atStart(true) |
| 66 , m_ignoringSpaces(false) | 65 , m_ignoringSpaces(false) |
| 67 , m_currentCharacterIsSpace(false) | 66 , m_currentCharacterIsSpace(false) |
| 68 , m_currentCharacterShouldCollapseIfPreWap(false) | 67 , m_currentCharacterShouldCollapseIfPreWap(false) |
| 69 , m_appliedStartWidth(appliedStartWidth) | 68 , m_appliedStartWidth(appliedStartWidth) |
| 70 , m_includeEndWidth(true) | 69 , m_includeEndWidth(true) |
| 71 , m_autoWrap(false) | 70 , m_autoWrap(false) |
| 72 , m_autoWrapWasEverTrueOnLine(false) | 71 , m_autoWrapWasEverTrueOnLine(false) |
| 73 , m_floatsFitOnLine(true) | |
| 74 , m_collapseWhiteSpace(false) | 72 , m_collapseWhiteSpace(false) |
| 75 , m_startingNewParagraph(m_lineInfo.previousLineBrokeCleanly()) | 73 , m_startingNewParagraph(m_lineInfo.previousLineBrokeCleanly()) |
| 76 , m_atEnd(false) | 74 , m_atEnd(false) |
| 77 , m_lineMidpointState(resolver.midpointState()) | 75 , m_lineMidpointState(resolver.midpointState()) |
| 78 { | 76 { |
| 79 m_lineInfo.setPreviousLineBrokeCleanly(false); | 77 m_lineInfo.setPreviousLineBrokeCleanly(false); |
| 80 } | 78 } |
| 81 | 79 |
| 82 RenderObject* currentObject() { return m_current.object(); } | 80 RenderObject* currentObject() { return m_current.object(); } |
| 83 InlineIterator lineBreak() { return m_lineBreak; } | 81 InlineIterator lineBreak() { return m_lineBreak; } |
| 84 bool atEnd() { return m_atEnd; } | 82 bool atEnd() { return m_atEnd; } |
| 85 | 83 |
| 86 void initializeForCurrentObject(); | 84 void initializeForCurrentObject(); |
| 87 | 85 |
| 88 void increment(); | 86 void increment(); |
| 89 | 87 |
| 90 void handleBR(EClear&); | 88 void handleBR(EClear&); |
| 91 void handleOutOfFlowPositioned(Vector<RenderBox*>& positionedObjects); | 89 void handleOutOfFlowPositioned(Vector<RenderBox*>& positionedObjects); |
| 92 void handleFloat(); | |
| 93 void handleEmptyInline(); | 90 void handleEmptyInline(); |
| 94 void handleReplaced(); | 91 void handleReplaced(); |
| 95 bool handleText(WordMeasurements&, bool& hyphenated); | 92 bool handleText(WordMeasurements&, bool& hyphenated); |
| 96 void commitAndUpdateLineBreakIfNeeded(); | 93 void commitAndUpdateLineBreakIfNeeded(); |
| 97 InlineIterator handleEndOfLine(); | 94 InlineIterator handleEndOfLine(); |
| 98 | 95 |
| 99 void clearLineBreakIfFitsOnLine() | 96 void clearLineBreakIfFitsOnLine() |
| 100 { | 97 { |
| 101 if (m_width.fitsOnLine() || m_lastWS == NOWRAP) | 98 if (m_width.fitsOnLine() || m_lastWS == NOWRAP) |
| 102 m_lineBreak.clear(); | 99 m_lineBreak.clear(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 115 RenderObject* m_lastObject; | 112 RenderObject* m_lastObject; |
| 116 RenderObject* m_nextObject; | 113 RenderObject* m_nextObject; |
| 117 | 114 |
| 118 RenderStyle* m_currentStyle; | 115 RenderStyle* m_currentStyle; |
| 119 RenderStyle* m_blockStyle; | 116 RenderStyle* m_blockStyle; |
| 120 | 117 |
| 121 LineInfo& m_lineInfo; | 118 LineInfo& m_lineInfo; |
| 122 | 119 |
| 123 RenderTextInfo& m_renderTextInfo; | 120 RenderTextInfo& m_renderTextInfo; |
| 124 | 121 |
| 125 FloatingObject* m_lastFloatFromPreviousLine; | |
| 126 | |
| 127 LineWidth m_width; | 122 LineWidth m_width; |
| 128 | 123 |
| 129 EWhiteSpace m_currWS; | 124 EWhiteSpace m_currWS; |
| 130 EWhiteSpace m_lastWS; | 125 EWhiteSpace m_lastWS; |
| 131 | 126 |
| 132 bool m_preservesNewline; | 127 bool m_preservesNewline; |
| 133 bool m_atStart; | 128 bool m_atStart; |
| 134 bool m_ignoringSpaces; | 129 bool m_ignoringSpaces; |
| 135 bool m_currentCharacterIsSpace; | 130 bool m_currentCharacterIsSpace; |
| 136 bool m_currentCharacterShouldCollapseIfPreWap; | 131 bool m_currentCharacterShouldCollapseIfPreWap; |
| 137 bool m_appliedStartWidth; | 132 bool m_appliedStartWidth; |
| 138 bool m_includeEndWidth; | 133 bool m_includeEndWidth; |
| 139 bool m_autoWrap; | 134 bool m_autoWrap; |
| 140 bool m_autoWrapWasEverTrueOnLine; | 135 bool m_autoWrapWasEverTrueOnLine; |
| 141 bool m_floatsFitOnLine; | |
| 142 bool m_collapseWhiteSpace; | 136 bool m_collapseWhiteSpace; |
| 143 bool m_startingNewParagraph; | 137 bool m_startingNewParagraph; |
| 144 bool m_atEnd; | 138 bool m_atEnd; |
| 145 | 139 |
| 146 LineMidpointState& m_lineMidpointState; | 140 LineMidpointState& m_lineMidpointState; |
| 147 | 141 |
| 148 TrailingObjects m_trailingObjects; | 142 TrailingObjects m_trailingObjects; |
| 149 }; | 143 }; |
| 150 | 144 |
| 151 inline bool shouldCollapseWhiteSpace(const RenderStyle* style, const LineInfo& l
ineInfo, WhitespacePosition whitespacePosition) | 145 inline bool shouldCollapseWhiteSpace(const RenderStyle* style, const LineInfo& l
ineInfo, WhitespacePosition whitespacePosition) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // elements quite right. In other words, we need to build this function's work i
nto the normal line | 213 // elements quite right. In other words, we need to build this function's work i
nto the normal line |
| 220 // object iteration process. | 214 // object iteration process. |
| 221 // NB. this function will insert any floating elements that would otherwise | 215 // NB. this function will insert any floating elements that would otherwise |
| 222 // be skipped but it will not position them. | 216 // be skipped but it will not position them. |
| 223 inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, co
nst LineInfo& lineInfo) | 217 inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, co
nst LineInfo& lineInfo) |
| 224 { | 218 { |
| 225 while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhi
tespace)) { | 219 while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhi
tespace)) { |
| 226 RenderObject* object = iterator.object(); | 220 RenderObject* object = iterator.object(); |
| 227 if (object->isOutOfFlowPositioned()) | 221 if (object->isOutOfFlowPositioned()) |
| 228 setStaticPositions(m_block, toRenderBox(object)); | 222 setStaticPositions(m_block, toRenderBox(object)); |
| 229 else if (object->isFloating()) | |
| 230 m_block->insertFloatingObject(toRenderBox(object)); | |
| 231 iterator.increment(); | 223 iterator.increment(); |
| 232 } | 224 } |
| 233 } | 225 } |
| 234 | 226 |
| 235 inline void BreakingContext::initializeForCurrentObject() | 227 inline void BreakingContext::initializeForCurrentObject() |
| 236 { | 228 { |
| 237 m_currentStyle = m_current.object()->style(); | 229 m_currentStyle = m_current.object()->style(); |
| 238 m_nextObject = bidiNextSkippingEmptyInlines(m_block, m_current.object()); | 230 m_nextObject = bidiNextSkippingEmptyInlines(m_block, m_current.object()); |
| 239 if (m_nextObject && m_nextObject->parent() && !m_nextObject->parent()->isDes
cendantOf(m_current.object()->parent())) | 231 if (m_nextObject && m_nextObject->parent() && !m_nextObject->parent()->isDes
cendantOf(m_current.object()->parent())) |
| 240 m_includeEndWidth = true; | 232 m_includeEndWidth = true; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box); | 341 m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box); |
| 350 m_trailingObjects.appendObjectIfNeeded(box); | 342 m_trailingObjects.appendObjectIfNeeded(box); |
| 351 } else { | 343 } else { |
| 352 positionedObjects.append(box); | 344 positionedObjects.append(box); |
| 353 } | 345 } |
| 354 m_width.addUncommittedWidth(inlineLogicalWidth(box).toFloat()); | 346 m_width.addUncommittedWidth(inlineLogicalWidth(box).toFloat()); |
| 355 // Reset prior line break context characters. | 347 // Reset prior line break context characters. |
| 356 m_renderTextInfo.m_lineBreakIterator.resetPriorContext(); | 348 m_renderTextInfo.m_lineBreakIterator.resetPriorContext(); |
| 357 } | 349 } |
| 358 | 350 |
| 359 inline void BreakingContext::handleFloat() | |
| 360 { | |
| 361 RenderBox* floatBox = toRenderBox(m_current.object()); | |
| 362 FloatingObject* floatingObject = m_block->insertFloatingObject(floatBox); | |
| 363 // check if it fits in the current line. | |
| 364 // If it does, position it now, otherwise, position | |
| 365 // it after moving to next line (in newLine() func) | |
| 366 // FIXME: Bug 110372: Properly position multiple stacked floats with non-rec
tangular shape outside. | |
| 367 if (m_floatsFitOnLine && m_width.fitsOnLine(m_block->logicalWidthForFloat(fl
oatingObject).toFloat(), ExcludeWhitespace)) { | |
| 368 m_block->positionNewFloatOnLine(floatingObject, m_lastFloatFromPreviousL
ine, m_lineInfo, m_width); | |
| 369 if (m_lineBreak.object() == m_current.object()) { | |
| 370 ASSERT(!m_lineBreak.offset()); | |
| 371 m_lineBreak.increment(); | |
| 372 } | |
| 373 } else { | |
| 374 m_floatsFitOnLine = false; | |
| 375 } | |
| 376 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEM
ENT CHARACTER) for floating element. | |
| 377 m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter
); | |
| 378 } | |
| 379 | |
| 380 // This is currently just used for list markers and inline flows that have line
boxes. Neither should | 351 // This is currently just used for list markers and inline flows that have line
boxes. Neither should |
| 381 // have an effect on whitespace at the start of the line. | 352 // have an effect on whitespace at the start of the line. |
| 382 inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow* block, RenderO
bject* o, LineMidpointState& lineMidpointState) | 353 inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow* block, RenderO
bject* o, LineMidpointState& lineMidpointState) |
| 383 { | 354 { |
| 384 RenderObject* next = bidiNextSkippingEmptyInlines(block, o); | 355 RenderObject* next = bidiNextSkippingEmptyInlines(block, o); |
| 385 while (next && next->isFloatingOrOutOfFlowPositioned()) | 356 while (next && next->isFloatingOrOutOfFlowPositioned()) |
| 386 next = bidiNextSkippingEmptyInlines(block, next); | 357 next = bidiNextSkippingEmptyInlines(block, next); |
| 387 | 358 |
| 388 if (next && next->isText() && toRenderText(next)->textLength() > 0) { | 359 if (next && next->isText() && toRenderText(next)->textLength() > 0) { |
| 389 RenderText* nextText = toRenderText(next); | 360 RenderText* nextText = toRenderText(next); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 837 |
| 867 if (style->textIndentType() == TextIndentHanging) | 838 if (style->textIndentType() == TextIndentHanging) |
| 868 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 839 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
| 869 | 840 |
| 870 return shouldIndentText; | 841 return shouldIndentText; |
| 871 } | 842 } |
| 872 | 843 |
| 873 } | 844 } |
| 874 | 845 |
| 875 #endif // BreakingContextInlineHeaders_h | 846 #endif // BreakingContextInlineHeaders_h |
| OLD | NEW |