| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 , m_lineInfo(inLineInfo) | 65 , m_lineInfo(inLineInfo) |
| 66 , m_layoutTextInfo(inLayoutTextInfo) | 66 , m_layoutTextInfo(inLayoutTextInfo) |
| 67 , m_lastFloatFromPreviousLine(inLastFloatFromPreviousLine) | 67 , m_lastFloatFromPreviousLine(inLastFloatFromPreviousLine) |
| 68 , m_width(lineWidth) | 68 , m_width(lineWidth) |
| 69 , m_currWS(NORMAL) | 69 , m_currWS(NORMAL) |
| 70 , m_lastWS(NORMAL) | 70 , m_lastWS(NORMAL) |
| 71 , m_preservesNewline(false) | 71 , m_preservesNewline(false) |
| 72 , m_atStart(true) | 72 , m_atStart(true) |
| 73 , m_ignoringSpaces(false) | 73 , m_ignoringSpaces(false) |
| 74 , m_currentCharacterIsSpace(false) | 74 , m_currentCharacterIsSpace(false) |
| 75 , m_currentCharacterShouldCollapseIfPreWap(false) | |
| 76 , m_appliedStartWidth(appliedStartWidth) | 75 , m_appliedStartWidth(appliedStartWidth) |
| 77 , m_includeEndWidth(true) | 76 , m_includeEndWidth(true) |
| 78 , m_autoWrap(false) | 77 , m_autoWrap(false) |
| 79 , m_autoWrapWasEverTrueOnLine(false) | 78 , m_autoWrapWasEverTrueOnLine(false) |
| 80 , m_floatsFitOnLine(true) | 79 , m_floatsFitOnLine(true) |
| 81 , m_collapseWhiteSpace(false) | 80 , m_collapseWhiteSpace(false) |
| 82 , m_startingNewParagraph(m_lineInfo.previousLineBrokeCleanly()) | 81 , m_startingNewParagraph(m_lineInfo.previousLineBrokeCleanly()) |
| 83 , m_allowImagesToBreak(!block.document().inQuirksMode() || !block.isTabl
eCell() || !m_blockStyle->logicalWidth().isIntrinsicOrAuto()) | 82 , m_allowImagesToBreak(!block.document().inQuirksMode() || !block.isTabl
eCell() || !m_blockStyle->logicalWidth().isIntrinsicOrAuto()) |
| 84 , m_atEnd(false) | 83 , m_atEnd(false) |
| 85 , m_lineMidpointState(resolver.midpointState()) | 84 , m_lineMidpointState(resolver.midpointState()) |
| 86 { | 85 { |
| 87 m_lineInfo.setPreviousLineBrokeCleanly(false); | 86 m_lineInfo.setPreviousLineBrokeCleanly(false); |
| 88 } | 87 } |
| 89 | 88 |
| 90 LayoutObject* currentObject() { return m_current.object(); } | 89 LayoutObject* currentObject() { return m_current.object(); } |
| 91 InlineIterator lineBreak() { return m_lineBreak; } | 90 InlineIterator lineBreak() { return m_lineBreak; } |
| 92 bool atEnd() { return m_atEnd; } | 91 bool atEnd() { return m_atEnd; } |
| 93 | 92 |
| 94 void initializeForCurrentObject(); | 93 void initializeForCurrentObject(); |
| 95 | 94 |
| 96 void increment(); | 95 void increment(); |
| 97 | 96 |
| 98 void handleBR(EClear&); | 97 void handleBR(EClear&); |
| 99 void handleOutOfFlowPositioned(Vector<LineLayoutBox>& positionedObjects); | 98 void handleOutOfFlowPositioned(Vector<LineLayoutBox>& positionedObjects); |
| 100 void handleFloat(); | 99 void handleFloat(); |
| 101 void handleEmptyInline(); | 100 void handleEmptyInline(); |
| 102 void handleReplaced(); | 101 void handleReplaced(); |
| 103 bool handleText(WordMeasurements&, bool& hyphenated); | 102 bool handleText(WordMeasurements&, bool& hyphenated); |
| 104 void prepareForNextCharacter(const LineLayoutText&, bool& prohibitBreakInsid
e, bool previousCharacterIsSpace, bool previousCharacterShouldCollapseIfPreWap); | 103 void prepareForNextCharacter(const LineLayoutText&, bool& prohibitBreakInsid
e, bool previousCharacterIsSpace); |
| 105 bool canBreakAtWhitespace(bool breakWords, WordMeasurement&, bool stoppedIgn
oringSpaces, bool& hyphenated, float charWidth, float& hyphenWidth, bool between
Words, bool midWordBreak, bool breakAll, bool previousCharacterIsSpace, float la
stWidthMeasurement, const LineLayoutText&, const Font&, bool applyWordSpacing, f
loat wordSpacing); | 104 bool canBreakAtWhitespace(bool breakWords, WordMeasurement&, bool stoppedIgn
oringSpaces, bool& hyphenated, float charWidth, float& hyphenWidth, bool between
Words, bool midWordBreak, bool breakAll, bool previousCharacterIsSpace, float la
stWidthMeasurement, const LineLayoutText&, const Font&, bool applyWordSpacing, f
loat wordSpacing); |
| 106 bool trailingSpaceExceedsAvailableWidth(bool midWordBreak, const LineLayoutT
ext&, WordMeasurement&, bool applyWordSpacing, bool wordSpacing, const Font&); | 105 bool trailingSpaceExceedsAvailableWidth(bool midWordBreak, const LineLayoutT
ext&, WordMeasurement&, bool applyWordSpacing, bool wordSpacing, const Font&); |
| 107 WordMeasurement& calculateWordWidth(WordMeasurements&, LineLayoutText&, unsi
gned lastSpace, float& lastWidthMeasurement, float wordSpacingForWordMeasurement
, const Font&, float wordTrailingSpaceWidth, UChar); | 106 WordMeasurement& calculateWordWidth(WordMeasurements&, LineLayoutText&, unsi
gned lastSpace, float& lastWidthMeasurement, float wordSpacingForWordMeasurement
, const Font&, float wordTrailingSpaceWidth, UChar); |
| 108 void stopIgnoringSpaces(unsigned& lastSpace); | 107 void stopIgnoringSpaces(unsigned& lastSpace); |
| 109 void commitAndUpdateLineBreakIfNeeded(); | 108 void commitAndUpdateLineBreakIfNeeded(); |
| 110 InlineIterator handleEndOfLine(); | 109 InlineIterator handleEndOfLine(); |
| 111 | 110 |
| 112 void clearLineBreakIfFitsOnLine() | 111 void clearLineBreakIfFitsOnLine() |
| 113 { | 112 { |
| 114 if (m_width.fitsOnLine() || m_lastWS == NOWRAP) | 113 if (m_width.fitsOnLine() || m_lastWS == NOWRAP) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 139 | 138 |
| 140 LineWidth m_width; | 139 LineWidth m_width; |
| 141 | 140 |
| 142 EWhiteSpace m_currWS; | 141 EWhiteSpace m_currWS; |
| 143 EWhiteSpace m_lastWS; | 142 EWhiteSpace m_lastWS; |
| 144 | 143 |
| 145 bool m_preservesNewline; | 144 bool m_preservesNewline; |
| 146 bool m_atStart; | 145 bool m_atStart; |
| 147 bool m_ignoringSpaces; | 146 bool m_ignoringSpaces; |
| 148 bool m_currentCharacterIsSpace; | 147 bool m_currentCharacterIsSpace; |
| 149 bool m_currentCharacterShouldCollapseIfPreWap; | |
| 150 bool m_appliedStartWidth; | 148 bool m_appliedStartWidth; |
| 151 bool m_includeEndWidth; | 149 bool m_includeEndWidth; |
| 152 bool m_autoWrap; | 150 bool m_autoWrap; |
| 153 bool m_autoWrapWasEverTrueOnLine; | 151 bool m_autoWrapWasEverTrueOnLine; |
| 154 bool m_floatsFitOnLine; | 152 bool m_floatsFitOnLine; |
| 155 bool m_collapseWhiteSpace; | 153 bool m_collapseWhiteSpace; |
| 156 bool m_startingNewParagraph; | 154 bool m_startingNewParagraph; |
| 157 bool m_allowImagesToBreak; | 155 bool m_allowImagesToBreak; |
| 158 bool m_atEnd; | 156 bool m_atEnd; |
| 159 | 157 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 m_currWS = m_current.object().isLayoutInline() ? m_currentStyle->whiteSpace(
) : m_current.object().parent().style()->whiteSpace(); | 264 m_currWS = m_current.object().isLayoutInline() ? m_currentStyle->whiteSpace(
) : m_current.object().parent().style()->whiteSpace(); |
| 267 m_lastWS = m_lastObject.isLayoutInline() ? m_lastObject.style()->whiteSpace(
) : m_lastObject.parent().style()->whiteSpace(); | 265 m_lastWS = m_lastObject.isLayoutInline() ? m_lastObject.style()->whiteSpace(
) : m_lastObject.parent().style()->whiteSpace(); |
| 268 | 266 |
| 269 bool isSVGText = m_current.object().isSVGInlineText(); | 267 bool isSVGText = m_current.object().isSVGInlineText(); |
| 270 m_autoWrap = !isSVGText && ComputedStyle::autoWrap(m_currWS); | 268 m_autoWrap = !isSVGText && ComputedStyle::autoWrap(m_currWS); |
| 271 m_autoWrapWasEverTrueOnLine = m_autoWrapWasEverTrueOnLine || m_autoWrap; | 269 m_autoWrapWasEverTrueOnLine = m_autoWrapWasEverTrueOnLine || m_autoWrap; |
| 272 | 270 |
| 273 m_preservesNewline = !isSVGText && ComputedStyle::preserveNewline(m_currWS); | 271 m_preservesNewline = !isSVGText && ComputedStyle::preserveNewline(m_currWS); |
| 274 | 272 |
| 275 m_collapseWhiteSpace = ComputedStyle::collapseWhiteSpace(m_currWS); | 273 m_collapseWhiteSpace = ComputedStyle::collapseWhiteSpace(m_currWS); |
| 274 |
| 275 // Ensure the whitespace in constructions like '<span style="white-space: pr
e-wrap">text <span><span> text</span>' |
| 276 // does not collapse. |
| 277 if (m_collapseWhiteSpace && !ComputedStyle::collapseWhiteSpace(m_lastWS)) |
| 278 m_currentCharacterIsSpace = false; |
| 276 } | 279 } |
| 277 | 280 |
| 278 inline void BreakingContext::increment() | 281 inline void BreakingContext::increment() |
| 279 { | 282 { |
| 280 // Clear out our character space bool, since inline <pre>s don't collapse wh
itespace | |
| 281 // with adjacent inline normal/nowrap spans. | |
| 282 if (!m_collapseWhiteSpace) | |
| 283 m_currentCharacterIsSpace = false; | |
| 284 | |
| 285 m_current.moveToStartOf(m_nextObject); | 283 m_current.moveToStartOf(m_nextObject); |
| 286 | 284 |
| 287 // When the line box tree is created, this position in the line will be snap
ped to | 285 // When the line box tree is created, this position in the line will be snap
ped to |
| 288 // LayoutUnit's, and those measurements will be used by the paint code. Do
the | 286 // LayoutUnit's, and those measurements will be used by the paint code. Do
the |
| 289 // equivalent snapping here, to get consistent line measurements. | 287 // equivalent snapping here, to get consistent line measurements. |
| 290 m_width.snapUncommittedWidth(); | 288 m_width.snapUncommittedWidth(); |
| 291 | 289 |
| 292 m_atStart = false; | 290 m_atStart = false; |
| 293 } | 291 } |
| 294 | 292 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 m_lineInfo.setEmpty(false, m_block, &m_width); | 445 m_lineInfo.setEmpty(false, m_block, &m_width); |
| 448 if (m_ignoringSpaces) { | 446 if (m_ignoringSpaces) { |
| 449 // If we are in a run of ignored spaces then ensure we get a linebox
if lineboxes are eventually | 447 // If we are in a run of ignored spaces then ensure we get a linebox
if lineboxes are eventually |
| 450 // created for the line... | 448 // created for the line... |
| 451 m_trailingObjects.clear(); | 449 m_trailingObjects.clear(); |
| 452 ensureLineBoxInsideIgnoredSpaces(&m_lineMidpointState, m_current.obj
ect()); | 450 ensureLineBoxInsideIgnoredSpaces(&m_lineMidpointState, m_current.obj
ect()); |
| 453 } else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().o
bject() == m_current.object() | 451 } else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().o
bject() == m_current.object() |
| 454 && shouldSkipWhitespaceAfterStartObject(m_block, m_current.object(),
m_lineMidpointState)) { | 452 && shouldSkipWhitespaceAfterStartObject(m_block, m_current.object(),
m_lineMidpointState)) { |
| 455 // If this object is at the start of the line, we need to behave lik
e list markers and | 453 // If this object is at the start of the line, we need to behave lik
e list markers and |
| 456 // start ignoring spaces. | 454 // start ignoring spaces. |
| 457 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; | 455 m_currentCharacterIsSpace = true; |
| 458 m_ignoringSpaces = true; | 456 m_ignoringSpaces = true; |
| 459 } else { | 457 } else { |
| 460 // If we are after a trailing space but aren't ignoring spaces yet t
hen ensure we get a linebox | 458 // If we are after a trailing space but aren't ignoring spaces yet t
hen ensure we get a linebox |
| 461 // if we encounter collapsible whitepace. | 459 // if we encounter collapsible whitepace. |
| 462 m_trailingObjects.appendObjectIfNeeded(m_current.object()); | 460 m_trailingObjects.appendObjectIfNeeded(m_current.object()); |
| 463 } | 461 } |
| 464 } | 462 } |
| 465 | 463 |
| 466 m_width.addUncommittedWidth((inlineLogicalWidthFromAncestorsIfNeeded(m_curre
nt.object()) + borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBo
x)).toFloat()); | 464 m_width.addUncommittedWidth((inlineLogicalWidthFromAncestorsIfNeeded(m_curre
nt.object()) + borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBo
x)).toFloat()); |
| 467 } | 465 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 479 && (!m_current.object().isRubyRun() || toLayoutRubyRun(m_current.object(
))->canBreakBefore(m_layoutTextInfo.m_lineBreakIterator))) { | 477 && (!m_current.object().isRubyRun() || toLayoutRubyRun(m_current.object(
))->canBreakBefore(m_layoutTextInfo.m_lineBreakIterator))) { |
| 480 m_width.commit(); | 478 m_width.commit(); |
| 481 m_lineBreak.moveToStartOf(m_current.object()); | 479 m_lineBreak.moveToStartOf(m_current.object()); |
| 482 } | 480 } |
| 483 | 481 |
| 484 if (m_ignoringSpaces) | 482 if (m_ignoringSpaces) |
| 485 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.objec
t(), 0)); | 483 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.objec
t(), 0)); |
| 486 | 484 |
| 487 m_lineInfo.setEmpty(false, m_block, &m_width); | 485 m_lineInfo.setEmpty(false, m_block, &m_width); |
| 488 m_ignoringSpaces = false; | 486 m_ignoringSpaces = false; |
| 489 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = false
; | 487 m_currentCharacterIsSpace = false; |
| 490 m_trailingObjects.clear(); | 488 m_trailingObjects.clear(); |
| 491 | 489 |
| 492 // Optimize for a common case. If we can't find whitespace after the list | 490 // Optimize for a common case. If we can't find whitespace after the list |
| 493 // item, then this is all moot. | 491 // item, then this is all moot. |
| 494 LayoutUnit replacedLogicalWidth = m_block.logicalWidthForChild(replacedBox)
+ m_block.marginStartForChild(replacedBox) + m_block.marginEndForChild(replacedB
ox) + inlineLogicalWidthFromAncestorsIfNeeded(m_current.object()); | 492 LayoutUnit replacedLogicalWidth = m_block.logicalWidthForChild(replacedBox)
+ m_block.marginStartForChild(replacedBox) + m_block.marginEndForChild(replacedB
ox) + inlineLogicalWidthFromAncestorsIfNeeded(m_current.object()); |
| 495 if (m_current.object().isListMarker()) { | 493 if (m_current.object().isListMarker()) { |
| 496 if (m_blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStart
Object(m_block, m_current.object(), m_lineMidpointState)) { | 494 if (m_blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStart
Object(m_block, m_current.object(), m_lineMidpointState)) { |
| 497 // Like with inline flows, we start ignoring spaces to make sure tha
t any | 495 // Like with inline flows, we start ignoring spaces to make sure tha
t any |
| 498 // additional spaces we see will be discarded. | 496 // additional spaces we see will be discarded. |
| 499 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; | 497 m_currentCharacterIsSpace = true; |
| 500 m_ignoringSpaces = true; | 498 m_ignoringSpaces = true; |
| 501 } | 499 } |
| 502 if (LineLayoutListMarker(m_current.object()).isInside()) | 500 if (LineLayoutListMarker(m_current.object()).isInside()) |
| 503 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); | 501 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); |
| 504 } else { | 502 } else { |
| 505 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); | 503 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); |
| 506 } | 504 } |
| 507 if (m_current.object().isRubyRun()) | 505 if (m_current.object().isRubyRun()) |
| 508 m_width.applyOverhang(LineLayoutRubyRun(m_current.object()), m_lastObjec
t, m_nextObject); | 506 m_width.applyOverhang(LineLayoutRubyRun(m_current.object()), m_lastObjec
t, m_nextObject); |
| 509 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEM
ENT CHARACTER) for replaced element. | 507 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEM
ENT CHARACTER) for replaced element. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // Non-zero only when kerning is enabled, in which case we measure | 604 // Non-zero only when kerning is enabled, in which case we measure |
| 607 // words with their trailing space, then subtract its width. | 605 // words with their trailing space, then subtract its width. |
| 608 float wordTrailingSpaceWidth = (font.fontDescription().typesettingFeatures()
& Kerning) ? | 606 float wordTrailingSpaceWidth = (font.fontDescription().typesettingFeatures()
& Kerning) ? |
| 609 font.width(constructTextRun(font, &spaceCharacter, 1, style, style.direc
tion())) + wordSpacing | 607 font.width(constructTextRun(font, &spaceCharacter, 1, style, style.direc
tion())) + wordSpacing |
| 610 : 0; | 608 : 0; |
| 611 | 609 |
| 612 UChar lastCharacter = m_layoutTextInfo.m_lineBreakIterator.lastCharacter(); | 610 UChar lastCharacter = m_layoutTextInfo.m_lineBreakIterator.lastCharacter(); |
| 613 UChar secondToLastCharacter = m_layoutTextInfo.m_lineBreakIterator.secondToL
astCharacter(); | 611 UChar secondToLastCharacter = m_layoutTextInfo.m_lineBreakIterator.secondToL
astCharacter(); |
| 614 for (; m_current.offset() < layoutText.textLength(); m_current.fastIncrement
InTextNode()) { | 612 for (; m_current.offset() < layoutText.textLength(); m_current.fastIncrement
InTextNode()) { |
| 615 bool previousCharacterIsSpace = m_currentCharacterIsSpace; | 613 bool previousCharacterIsSpace = m_currentCharacterIsSpace; |
| 616 bool previousCharacterShouldCollapseIfPreWap = m_currentCharacterShouldC
ollapseIfPreWap; | |
| 617 UChar c = m_current.current(); | 614 UChar c = m_current.current(); |
| 618 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = c
== spaceCharacter || c == tabulationCharacter || (!m_preservesNewline && (c ==
newlineCharacter)); | 615 m_currentCharacterIsSpace = c == spaceCharacter || c == tabulationCharac
ter || (!m_preservesNewline && (c == newlineCharacter)); |
| 619 | 616 |
| 620 if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace) | 617 if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace) |
| 621 m_lineInfo.setEmpty(false, m_block, &m_width); | 618 m_lineInfo.setEmpty(false, m_block, &m_width); |
| 622 | 619 |
| 623 if (c == softHyphenCharacter && m_autoWrap && !hyphenWidth) { | 620 if (c == softHyphenCharacter && m_autoWrap && !hyphenWidth) { |
| 624 hyphenWidth = layoutText.hyphenWidth(font, textDirectionFromUnicode(
m_resolver.position().direction())); | 621 hyphenWidth = layoutText.hyphenWidth(font, textDirectionFromUnicode(
m_resolver.position().direction())); |
| 625 m_width.addUncommittedWidth(hyphenWidth); | 622 m_width.addUncommittedWidth(hyphenWidth); |
| 626 } | 623 } |
| 627 | 624 |
| 628 bool applyWordSpacing = false; | 625 bool applyWordSpacing = false; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 643 // If we're in the middle of a word or at the start of a new one and can
't break there, then continue to the next character. | 640 // If we're in the middle of a word or at the start of a new one and can
't break there, then continue to the next character. |
| 644 if (!betweenWords && !midWordBreak) { | 641 if (!betweenWords && !midWordBreak) { |
| 645 if (m_ignoringSpaces) { | 642 if (m_ignoringSpaces) { |
| 646 // Stop ignoring spaces and begin at this | 643 // Stop ignoring spaces and begin at this |
| 647 // new point. | 644 // new point. |
| 648 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; | 645 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; |
| 649 wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasure
ments.last().width) ? wordSpacing : 0; | 646 wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasure
ments.last().width) ? wordSpacing : 0; |
| 650 stopIgnoringSpaces(lastSpace); | 647 stopIgnoringSpaces(lastSpace); |
| 651 } | 648 } |
| 652 | 649 |
| 653 prepareForNextCharacter(layoutText, prohibitBreakInside, previousCha
racterIsSpace, previousCharacterShouldCollapseIfPreWap); | 650 prepareForNextCharacter(layoutText, prohibitBreakInside, previousCha
racterIsSpace); |
| 654 m_atStart = false; | 651 m_atStart = false; |
| 655 nextCharacter(c, lastCharacter, secondToLastCharacter); | 652 nextCharacter(c, lastCharacter, secondToLastCharacter); |
| 656 continue; | 653 continue; |
| 657 } | 654 } |
| 658 | 655 |
| 659 // If we're collapsing space and we're at a collapsible space such as a
space or tab, continue to the next character. | 656 // If we're collapsing space and we're at a collapsible space such as a
space or tab, continue to the next character. |
| 660 if (m_ignoringSpaces && m_currentCharacterIsSpace) { | 657 if (m_ignoringSpaces && m_currentCharacterIsSpace) { |
| 661 lastSpaceWordSpacing = 0; | 658 lastSpaceWordSpacing = 0; |
| 662 // Just keep ignoring these spaces. | 659 // Just keep ignoring these spaces. |
| 663 nextCharacter(c, lastCharacter, secondToLastCharacter); | 660 nextCharacter(c, lastCharacter, secondToLastCharacter); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 if (m_currentCharacterIsSpace && previousCharacterIsSpace) { | 740 if (m_currentCharacterIsSpace && previousCharacterIsSpace) { |
| 744 m_ignoringSpaces = true; | 741 m_ignoringSpaces = true; |
| 745 | 742 |
| 746 // We just entered a mode where we are ignoring spaces. Create a
midpoint to terminate the run | 743 // We just entered a mode where we are ignoring spaces. Create a
midpoint to terminate the run |
| 747 // before the second space. | 744 // before the second space. |
| 748 m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpaces); | 745 m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpaces); |
| 749 m_trailingObjects.updateMidpointsForTrailingObjects(m_lineMidpoi
ntState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace); | 746 m_trailingObjects.updateMidpointsForTrailingObjects(m_lineMidpoi
ntState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace); |
| 750 } | 747 } |
| 751 } | 748 } |
| 752 | 749 |
| 753 prepareForNextCharacter(layoutText, prohibitBreakInside, previousCharact
erIsSpace, previousCharacterShouldCollapseIfPreWap); | 750 prepareForNextCharacter(layoutText, prohibitBreakInside, previousCharact
erIsSpace); |
| 754 m_atStart = false; | 751 m_atStart = false; |
| 755 nextCharacter(c, lastCharacter, secondToLastCharacter); | 752 nextCharacter(c, lastCharacter, secondToLastCharacter); |
| 756 } | 753 } |
| 757 | 754 |
| 758 m_layoutTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, secondTo
LastCharacter); | 755 m_layoutTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, secondTo
LastCharacter); |
| 759 | 756 |
| 760 wordMeasurements.grow(wordMeasurements.size() + 1); | 757 wordMeasurements.grow(wordMeasurements.size() + 1); |
| 761 WordMeasurement& wordMeasurement = wordMeasurements.last(); | 758 WordMeasurement& wordMeasurement = wordMeasurements.last(); |
| 762 wordMeasurement.layoutText = layoutText; | 759 wordMeasurement.layoutText = layoutText; |
| 763 | 760 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 787 return true; | 784 return true; |
| 788 } | 785 } |
| 789 if (!hyphenated && m_lineBreak.previousInSameNode() == softHyphenCharact
er) { | 786 if (!hyphenated && m_lineBreak.previousInSameNode() == softHyphenCharact
er) { |
| 790 hyphenated = true; | 787 hyphenated = true; |
| 791 m_atEnd = true; | 788 m_atEnd = true; |
| 792 } | 789 } |
| 793 } | 790 } |
| 794 return false; | 791 return false; |
| 795 } | 792 } |
| 796 | 793 |
| 797 inline void BreakingContext::prepareForNextCharacter(const LineLayoutText& layou
tText, bool& prohibitBreakInside, bool previousCharacterIsSpace, bool previousCh
aracterShouldCollapseIfPreWap) | 794 inline void BreakingContext::prepareForNextCharacter(const LineLayoutText& layou
tText, bool& prohibitBreakInside, bool previousCharacterIsSpace) |
| 798 { | 795 { |
| 799 if (layoutText.isSVGInlineText() && m_current.offset()) { | 796 if (layoutText.isSVGInlineText() && m_current.offset()) { |
| 800 // Force creation of new InlineBoxes for each absolute positioned charac
ter (those that start new text chunks). | 797 // Force creation of new InlineBoxes for each absolute positioned charac
ter (those that start new text chunks). |
| 801 if (LineLayoutSVGInlineText(layoutText).characterStartsNewTextChunk(m_cu
rrent.offset())) | 798 if (LineLayoutSVGInlineText(layoutText).characterStartsNewTextChunk(m_cu
rrent.offset())) |
| 802 m_lineMidpointState.ensureCharacterGetsLineBox(m_current); | 799 m_lineMidpointState.ensureCharacterGetsLineBox(m_current); |
| 803 } | 800 } |
| 804 if (prohibitBreakInside) { | 801 if (prohibitBreakInside) { |
| 805 m_current.setNextBreakablePosition(layoutText.textLength()); | 802 m_current.setNextBreakablePosition(layoutText.textLength()); |
| 806 prohibitBreakInside = false; | 803 prohibitBreakInside = false; |
| 807 } | 804 } |
| 808 if (m_currentCharacterIsSpace && !previousCharacterIsSpace) { | 805 if (m_currentCharacterIsSpace && !previousCharacterIsSpace) { |
| 809 m_startOfIgnoredSpaces.setObject(m_current.object()); | 806 m_startOfIgnoredSpaces.setObject(m_current.object()); |
| 810 m_startOfIgnoredSpaces.setOffset(m_current.offset()); | 807 m_startOfIgnoredSpaces.setOffset(m_current.offset()); |
| 811 } | 808 } |
| 812 if (!m_currentCharacterIsSpace && previousCharacterShouldCollapseIfPreWap) { | 809 if (!m_currentCharacterIsSpace && previousCharacterIsSpace) { |
| 813 if (m_autoWrap && m_currentStyle->breakOnlyAfterWhiteSpace()) | 810 if (m_autoWrap && m_currentStyle->breakOnlyAfterWhiteSpace()) |
| 814 m_lineBreak.moveTo(m_current.object(), m_current.offset(), m_current
.nextBreakablePosition()); | 811 m_lineBreak.moveTo(m_current.object(), m_current.offset(), m_current
.nextBreakablePosition()); |
| 815 } | 812 } |
| 816 if (m_collapseWhiteSpace && m_currentCharacterIsSpace && !m_ignoringSpaces) | 813 if (m_collapseWhiteSpace && m_currentCharacterIsSpace && !m_ignoringSpaces) |
| 817 m_trailingObjects.setTrailingWhitespace(LineLayoutText(m_current.object(
))); | 814 m_trailingObjects.setTrailingWhitespace(LineLayoutText(m_current.object(
))); |
| 818 else if (!m_currentStyle->collapseWhiteSpace() || !m_currentCharacterIsSpace
) | 815 else if (!m_currentStyle->collapseWhiteSpace() || !m_currentCharacterIsSpace
) |
| 819 m_trailingObjects.clear(); | 816 m_trailingObjects.clear(); |
| 820 } | 817 } |
| 821 | 818 |
| 822 | 819 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 | 977 |
| 981 if (style.textIndentType() == TextIndentHanging) | 978 if (style.textIndentType() == TextIndentHanging) |
| 982 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 979 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
| 983 | 980 |
| 984 return shouldIndentText; | 981 return shouldIndentText; |
| 985 } | 982 } |
| 986 | 983 |
| 987 } | 984 } |
| 988 | 985 |
| 989 #endif // BreakingContextInlineHeaders_h | 986 #endif // BreakingContextInlineHeaders_h |
| OLD | NEW |