|
Lines 129-135
public:
a/Source/WebCore/rendering/line/BreakingContext.h_sec1
|
| 129 |
, m_allowImagesToBreak(!block.document().inQuirksMode() || !block.isTableCell() || !m_blockStyle.logicalWidth().isIntrinsicOrAuto()) |
129 |
, m_allowImagesToBreak(!block.document().inQuirksMode() || !block.isTableCell() || !m_blockStyle.logicalWidth().isIntrinsicOrAuto()) |
| 130 |
, m_atEnd(false) |
130 |
, m_atEnd(false) |
| 131 |
, m_hadUncommittedWidthBeforeCurrent(false) |
131 |
, m_hadUncommittedWidthBeforeCurrent(false) |
| 132 |
, m_lineMidpointState(resolver.midpointState()) |
132 |
, m_lineWhitespaceCollapsingState(resolver.whitespaceCollapsingState()) |
| 133 |
{ |
133 |
{ |
| 134 |
m_lineInfo.setPreviousLineBrokeCleanly(false); |
134 |
m_lineInfo.setPreviousLineBrokeCleanly(false); |
| 135 |
} |
135 |
} |
|
Lines 292-298
private:
a/Source/WebCore/rendering/line/BreakingContext.h_sec2
|
| 292 |
|
292 |
|
| 293 |
bool m_hangsAtEnd { false }; |
293 |
bool m_hangsAtEnd { false }; |
| 294 |
|
294 |
|
| 295 |
LineMidpointState& m_lineMidpointState; |
295 |
LineWhitespaceCollapsingState& m_lineWhitespaceCollapsingState; |
| 296 |
|
296 |
|
| 297 |
TrailingObjects m_trailingObjects; |
297 |
TrailingObjects m_trailingObjects; |
| 298 |
}; |
298 |
}; |
|
Lines 334-342
inline void BreakingContext::increment()
a/Source/WebCore/rendering/line/BreakingContext.h_sec3
|
| 334 |
inline void BreakingContext::handleBR(EClear& clear) |
334 |
inline void BreakingContext::handleBR(EClear& clear) |
| 335 |
{ |
335 |
{ |
| 336 |
if (fitsOnLineOrHangsAtEnd()) { |
336 |
if (fitsOnLineOrHangsAtEnd()) { |
| 337 |
RenderObject* br = m_current.renderer(); |
337 |
RenderObject& br = *m_current.renderer(); |
| 338 |
m_lineBreakHistory.push([&](InlineIterator& modifyMe) { |
338 |
m_lineBreakHistory.push([&](InlineIterator& modifyMe) { |
| 339 |
modifyMe.moveToStartOf(br); |
339 |
modifyMe.moveToStartOf(&br); |
| 340 |
modifyMe.increment(); |
340 |
modifyMe.increment(); |
| 341 |
}); |
341 |
}); |
| 342 |
|
342 |
|
|
Lines 354-365
inline void BreakingContext::handleBR(EClear& clear)
a/Source/WebCore/rendering/line/BreakingContext.h_sec4
|
| 354 |
// need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a |
354 |
// need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a |
| 355 |
// run for this object. |
355 |
// run for this object. |
| 356 |
if (m_ignoringSpaces && m_currentStyle->clear() != CNONE) |
356 |
if (m_ignoringSpaces && m_currentStyle->clear() != CNONE) |
| 357 |
m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(br); |
357 |
m_lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(br); |
| 358 |
// If we were preceded by collapsing space and are in a right-aligned container we need to ensure the space gets |
358 |
// If we were preceded by collapsing space and are in a right-aligned container we need to ensure the space gets |
| 359 |
// collapsed away so that it doesn't push the text out from the container's right-hand edge. |
359 |
// collapsed away so that it doesn't push the text out from the container's right-hand edge. |
| 360 |
// FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results. |
360 |
// FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results. |
| 361 |
else if (m_ignoringSpaces && (m_blockStyle.textAlign() == RIGHT || m_blockStyle.textAlign() == WEBKIT_RIGHT)) |
361 |
else if (m_ignoringSpaces && (m_blockStyle.textAlign() == RIGHT || m_blockStyle.textAlign() == WEBKIT_RIGHT)) |
| 362 |
m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset())); |
362 |
m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset())); |
| 363 |
|
363 |
|
| 364 |
if (!m_lineInfo.isEmpty()) |
364 |
if (!m_lineInfo.isEmpty()) |
| 365 |
clear = m_currentStyle->clear(); |
365 |
clear = m_currentStyle->clear(); |
|
Lines 438-445
inline void BreakingContext::handleOutOfFlowPositioned(Vector<RenderBox*>& posit
a/Source/WebCore/rendering/line/BreakingContext.h_sec5
|
| 438 |
// then start ignoring spaces again. |
438 |
// then start ignoring spaces again. |
| 439 |
if (isInlineType || box.container()->isRenderInline()) { |
439 |
if (isInlineType || box.container()->isRenderInline()) { |
| 440 |
if (m_ignoringSpaces) |
440 |
if (m_ignoringSpaces) |
| 441 |
m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(&box); |
441 |
m_lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(box); |
| 442 |
m_trailingObjects.appendBoxIfNeeded(&box); |
442 |
m_trailingObjects.appendBoxIfNeeded(box); |
| 443 |
} else |
443 |
} else |
| 444 |
positionedObjects.append(&box); |
444 |
positionedObjects.append(&box); |
| 445 |
|
445 |
|
|
Lines 469-475
inline void BreakingContext::handleFloat()
a/Source/WebCore/rendering/line/BreakingContext.h_sec6
|
| 469 |
|
469 |
|
| 470 |
// This is currently just used for list markers and inline flows that have line boxes. Neither should |
470 |
// This is currently just used for list markers and inline flows that have line boxes. Neither should |
| 471 |
// have an effect on whitespace at the start of the line. |
471 |
// have an effect on whitespace at the start of the line. |
| 472 |
inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow& block, RenderObject* o, LineMidpointState& lineMidpointState) |
472 |
inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow& block, RenderObject* o, LineWhitespaceCollapsingState& lineWhitespaceCollapsingState) |
| 473 |
{ |
473 |
{ |
| 474 |
RenderObject* next = bidiNextSkippingEmptyInlines(block, o); |
474 |
RenderObject* next = bidiNextSkippingEmptyInlines(block, o); |
| 475 |
while (next && next->isFloatingOrOutOfFlowPositioned()) |
475 |
while (next && next->isFloatingOrOutOfFlowPositioned()) |
|
Lines 479-485
inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow& block, RenderO
a/Source/WebCore/rendering/line/BreakingContext.h_sec7
|
| 479 |
RenderText& nextText = downcast<RenderText>(*next); |
479 |
RenderText& nextText = downcast<RenderText>(*next); |
| 480 |
UChar nextChar = nextText.characterAt(0); |
480 |
UChar nextChar = nextText.characterAt(0); |
| 481 |
if (nextText.style().isCollapsibleWhiteSpace(nextChar)) { |
481 |
if (nextText.style().isCollapsibleWhiteSpace(nextChar)) { |
| 482 |
lineMidpointState.startIgnoringSpaces(InlineIterator(nullptr, o, 0)); |
482 |
lineWhitespaceCollapsingState.startIgnoringSpaces(InlineIterator(nullptr, o, 0)); |
| 483 |
return true; |
483 |
return true; |
| 484 |
} |
484 |
} |
| 485 |
} |
485 |
} |
|
Lines 506-521
inline void BreakingContext::handleEmptyInline()
a/Source/WebCore/rendering/line/BreakingContext.h_sec8
|
| 506 |
m_lineInfo.setEmpty(false, &m_block, &m_width); |
506 |
m_lineInfo.setEmpty(false, &m_block, &m_width); |
| 507 |
if (m_ignoringSpaces) { |
507 |
if (m_ignoringSpaces) { |
| 508 |
m_trailingObjects.clear(); |
508 |
m_trailingObjects.clear(); |
| 509 |
m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_current.renderer()); |
509 |
m_lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(*m_current.renderer()); |
| 510 |
} else if (m_blockStyle.collapseWhiteSpace() && m_resolver.position().renderer() == m_current.renderer() |
510 |
} else if (m_blockStyle.collapseWhiteSpace() && m_resolver.position().renderer() == m_current.renderer() |
| 511 |
&& shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineMidpointState)) { |
511 |
&& shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineWhitespaceCollapsingState)) { |
| 512 |
// Like with list markers, we start ignoring spaces to make sure that any |
512 |
// Like with list markers, we start ignoring spaces to make sure that any |
| 513 |
// additional spaces we see will be discarded. |
513 |
// additional spaces we see will be discarded. |
| 514 |
m_currentCharacterIsSpace = true; |
514 |
m_currentCharacterIsSpace = true; |
| 515 |
m_currentCharacterIsWS = true; |
515 |
m_currentCharacterIsWS = true; |
| 516 |
m_ignoringSpaces = true; |
516 |
m_ignoringSpaces = true; |
| 517 |
} else |
517 |
} else |
| 518 |
m_trailingObjects.appendBoxIfNeeded(&flowBox); |
518 |
m_trailingObjects.appendBoxIfNeeded(flowBox); |
| 519 |
} |
519 |
} |
| 520 |
|
520 |
|
| 521 |
float inlineWidth = inlineLogicalWidth(m_current.renderer()) + borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox); |
521 |
float inlineWidth = inlineLogicalWidth(m_current.renderer()) + borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox); |
|
Lines 549-555
inline void BreakingContext::handleReplaced()
a/Source/WebCore/rendering/line/BreakingContext.h_sec9
|
| 549 |
m_lineLayoutState.prevFloatBottomFromAnonymousInlineBlock(), m_lineLayoutState.maxFloatBottomFromAnonymousInlineBlock()); |
549 |
m_lineLayoutState.prevFloatBottomFromAnonymousInlineBlock(), m_lineLayoutState.maxFloatBottomFromAnonymousInlineBlock()); |
| 550 |
|
550 |
|
| 551 |
if (m_ignoringSpaces) |
551 |
if (m_ignoringSpaces) |
| 552 |
m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), 0)); |
552 |
m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), 0)); |
| 553 |
|
553 |
|
| 554 |
m_lineInfo.setEmpty(false, &m_block, &m_width); |
554 |
m_lineInfo.setEmpty(false, &m_block, &m_width); |
| 555 |
m_ignoringSpaces = false; |
555 |
m_ignoringSpaces = false; |
|
Lines 561-567
inline void BreakingContext::handleReplaced()
a/Source/WebCore/rendering/line/BreakingContext.h_sec10
|
| 561 |
// item, then this is all moot. |
561 |
// item, then this is all moot. |
| 562 |
LayoutUnit replacedLogicalWidth = m_block.logicalWidthForChild(replacedBox) + m_block.marginStartForChild(replacedBox) + m_block.marginEndForChild(replacedBox) + inlineLogicalWidth(m_current.renderer()); |
562 |
LayoutUnit replacedLogicalWidth = m_block.logicalWidthForChild(replacedBox) + m_block.marginStartForChild(replacedBox) + m_block.marginEndForChild(replacedBox) + inlineLogicalWidth(m_current.renderer()); |
| 563 |
if (is<RenderListMarker>(*m_current.renderer())) { |
563 |
if (is<RenderListMarker>(*m_current.renderer())) { |
| 564 |
if (m_blockStyle.collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineMidpointState)) { |
564 |
if (m_blockStyle.collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineWhitespaceCollapsingState)) { |
| 565 |
// Like with inline flows, we start ignoring spaces to make sure that any |
565 |
// Like with inline flows, we start ignoring spaces to make sure that any |
| 566 |
// additional spaces we see will be discarded. |
566 |
// additional spaces we see will be discarded. |
| 567 |
m_currentCharacterIsSpace = true; |
567 |
m_currentCharacterIsSpace = true; |
|
Lines 642-653
ALWAYS_INLINE float textWidth(RenderText& text, unsigned from, unsigned len, con
a/Source/WebCore/rendering/line/BreakingContext.h_sec11
|
| 642 |
return font.width(run, &fallbackFonts, &glyphOverflow); |
642 |
return font.width(run, &fallbackFonts, &glyphOverflow); |
| 643 |
} |
643 |
} |
| 644 |
|
644 |
|
| 645 |
// Adding a pair of midpoints before a character will split it out into a new line box. |
645 |
// Adding a pair of whitespace collapsing transitions before a character will split it out into a new line box. |
| 646 |
inline void ensureCharacterGetsLineBox(LineMidpointState& lineMidpointState, InlineIterator& textParagraphSeparator) |
646 |
inline void ensureCharacterGetsLineBox(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, InlineIterator& textParagraphSeparator) |
| 647 |
{ |
647 |
{ |
| 648 |
InlineIterator midpoint(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()); |
648 |
InlineIterator transition(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()); |
| 649 |
lineMidpointState.startIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset() - 1)); |
649 |
lineWhitespaceCollapsingState.startIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset() - 1)); |
| 650 |
lineMidpointState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset())); |
650 |
lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset())); |
| 651 |
} |
651 |
} |
| 652 |
|
652 |
|
| 653 |
inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated) |
653 |
inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated) |
|
Lines 887-893
inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
a/Source/WebCore/rendering/line/BreakingContext.h_sec12
|
| 887 |
m_ignoringSpaces = false; |
887 |
m_ignoringSpaces = false; |
| 888 |
wordSpacingForWordMeasurement = 0; |
888 |
wordSpacingForWordMeasurement = 0; |
| 889 |
lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in any of the ignored spaces. |
889 |
lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in any of the ignored spaces. |
| 890 |
m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset())); |
890 |
m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset())); |
| 891 |
stoppedIgnoringSpaces = true; |
891 |
stoppedIgnoringSpaces = true; |
| 892 |
} else { |
892 |
} else { |
| 893 |
// Just keep ignoring these spaces. |
893 |
// Just keep ignoring these spaces. |
|
Lines 948-954
inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
a/Source/WebCore/rendering/line/BreakingContext.h_sec13
|
| 948 |
} |
948 |
} |
| 949 |
if (m_lineBreakHistory.atTextParagraphSeparator()) { |
949 |
if (m_lineBreakHistory.atTextParagraphSeparator()) { |
| 950 |
if (!stoppedIgnoringSpaces && m_current.offset() > 0) |
950 |
if (!stoppedIgnoringSpaces && m_current.offset() > 0) |
| 951 |
ensureCharacterGetsLineBox(m_lineMidpointState, m_current); |
951 |
ensureCharacterGetsLineBox(m_lineWhitespaceCollapsingState, m_current); |
| 952 |
m_lineBreakHistory.increment(); |
952 |
m_lineBreakHistory.increment(); |
| 953 |
m_lineInfo.setPreviousLineBrokeCleanly(true); |
953 |
m_lineInfo.setPreviousLineBrokeCleanly(true); |
| 954 |
wordMeasurement.endOffset = m_lineBreakHistory.offset(); |
954 |
wordMeasurement.endOffset = m_lineBreakHistory.offset(); |
|
Lines 1004-1010
inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
a/Source/WebCore/rendering/line/BreakingContext.h_sec14
|
| 1004 |
|
1004 |
|
| 1005 |
if (c == '\n' && m_preservesNewline) { |
1005 |
if (c == '\n' && m_preservesNewline) { |
| 1006 |
if (!stoppedIgnoringSpaces && m_current.offset()) |
1006 |
if (!stoppedIgnoringSpaces && m_current.offset()) |
| 1007 |
ensureCharacterGetsLineBox(m_lineMidpointState, m_current); |
1007 |
ensureCharacterGetsLineBox(m_lineWhitespaceCollapsingState, m_current); |
| 1008 |
commitLineBreakAtCurrentWidth(*m_current.renderer(), m_current.offset(), m_current.nextBreakablePosition()); |
1008 |
commitLineBreakAtCurrentWidth(*m_current.renderer(), m_current.offset(), m_current.nextBreakablePosition()); |
| 1009 |
m_lineBreakHistory.increment(); |
1009 |
m_lineBreakHistory.increment(); |
| 1010 |
m_lineInfo.setPreviousLineBrokeCleanly(true); |
1010 |
m_lineInfo.setPreviousLineBrokeCleanly(true); |
|
Lines 1039-1048
inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
a/Source/WebCore/rendering/line/BreakingContext.h_sec15
|
| 1039 |
m_ignoringSpaces = true; |
1039 |
m_ignoringSpaces = true; |
| 1040 |
|
1040 |
|
| 1041 |
// We just entered a mode where we are ignoring |
1041 |
// We just entered a mode where we are ignoring |
| 1042 |
// spaces. Create a midpoint to terminate the run |
1042 |
// spaces. Create a transition to terminate the run |
| 1043 |
// before the second space. |
1043 |
// before the second space. |
| 1044 |
m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpaces); |
1044 |
m_lineWhitespaceCollapsingState.startIgnoringSpaces(m_startOfIgnoredSpaces); |
| 1045 |
m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace); |
1045 |
m_trailingObjects.updateWhitespaceCollapsingTransitionsForTrailingBoxes(m_lineWhitespaceCollapsingState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace); |
| 1046 |
} |
1046 |
} |
| 1047 |
} |
1047 |
} |
| 1048 |
} else { |
1048 |
} else { |
|
Lines 1052-1058
inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
a/Source/WebCore/rendering/line/BreakingContext.h_sec16
|
| 1052 |
lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; |
1052 |
lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; |
| 1053 |
wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurements.last().width) ? wordSpacing : 0; |
1053 |
wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurements.last().width) ? wordSpacing : 0; |
| 1054 |
lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in any of the ignored spaces. |
1054 |
lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in any of the ignored spaces. |
| 1055 |
m_lineMidpointState.stopIgnoringSpaces(InlineIterator(nullptr, m_current.renderer(), m_current.offset())); |
1055 |
m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(nullptr, m_current.renderer(), m_current.offset())); |
| 1056 |
} |
1056 |
} |
| 1057 |
if (m_hangsAtEnd && !renderText.isHangableStopOrComma(c)) |
1057 |
if (m_hangsAtEnd && !renderText.isHangableStopOrComma(c)) |
| 1058 |
m_hangsAtEnd = false; |
1058 |
m_hangsAtEnd = false; |
|
Lines 1061-1067
inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
a/Source/WebCore/rendering/line/BreakingContext.h_sec17
|
| 1061 |
if (isSVGText && m_current.offset()) { |
1061 |
if (isSVGText && m_current.offset()) { |
| 1062 |
// Force creation of new InlineBoxes for each absolute positioned character (those that start new text chunks). |
1062 |
// Force creation of new InlineBoxes for each absolute positioned character (those that start new text chunks). |
| 1063 |
if (downcast<RenderSVGInlineText>(renderText).characterStartsNewTextChunk(m_current.offset())) |
1063 |
if (downcast<RenderSVGInlineText>(renderText).characterStartsNewTextChunk(m_current.offset())) |
| 1064 |
ensureCharacterGetsLineBox(m_lineMidpointState, m_current); |
1064 |
ensureCharacterGetsLineBox(m_lineWhitespaceCollapsingState, m_current); |
| 1065 |
} |
1065 |
} |
| 1066 |
|
1066 |
|
| 1067 |
if (m_currentCharacterIsSpace && !previousCharacterIsSpace) { |
1067 |
if (m_currentCharacterIsSpace && !previousCharacterIsSpace) { |
|
Lines 1074-1080
inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
a/Source/WebCore/rendering/line/BreakingContext.h_sec18
|
| 1074 |
m_startOfIgnoredSpaces.setOffset(m_startOfIgnoredSpaces.offset() - 1); |
1074 |
m_startOfIgnoredSpaces.setOffset(m_startOfIgnoredSpaces.offset() - 1); |
| 1075 |
// If there's just a single trailing space start ignoring it now so it collapses away. |
1075 |
// If there's just a single trailing space start ignoring it now so it collapses away. |
| 1076 |
if (m_current.offset() == renderText.textLength() - 1) |
1076 |
if (m_current.offset() == renderText.textLength() - 1) |
| 1077 |
m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpaces); |
1077 |
m_lineWhitespaceCollapsingState.startIgnoringSpaces(m_startOfIgnoredSpaces); |
| 1078 |
} |
1078 |
} |
| 1079 |
} |
1079 |
} |
| 1080 |
|
1080 |
|
|
Lines 1220-1242
inline void BreakingContext::commitAndUpdateLineBreakIfNeeded()
a/Source/WebCore/rendering/line/BreakingContext.h_sec19
|
| 1220 |
} |
1220 |
} |
| 1221 |
} |
1221 |
} |
| 1222 |
|
1222 |
|
| 1223 |
inline TrailingObjects::CollapseFirstSpaceOrNot checkMidpoints(LineMidpointState& lineMidpointState, const InlineIterator& lBreak) |
1223 |
inline TrailingObjects::CollapseFirstSpaceOrNot checkWhitespaceCollapsingTransitions(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, const InlineIterator& lBreak) |
| 1224 |
{ |
1224 |
{ |
| 1225 |
// Check to see if our last midpoint is a start point beyond the line break. If so, |
1225 |
// Check to see if our last transition is a start point beyond the line break. If so, |
| 1226 |
// shave it off the list, and shave off a trailing space if the previous end point doesn't |
1226 |
// shave it off the list, and shave off a trailing space if the previous end point doesn't |
| 1227 |
// preserve whitespace. |
1227 |
// preserve whitespace. |
| 1228 |
if (lBreak.renderer() && lineMidpointState.numMidpoints() && !(lineMidpointState.numMidpoints() % 2)) { |
1228 |
if (lBreak.renderer() && lineWhitespaceCollapsingState.numTransitions() && !(lineWhitespaceCollapsingState.numTransitions() % 2)) { |
| 1229 |
InlineIterator* midpoints = lineMidpointState.midpoints().data(); |
1229 |
const InlineIterator* transitions = lineWhitespaceCollapsingState.transitions().data(); |
| 1230 |
InlineIterator& endpoint = midpoints[lineMidpointState.numMidpoints() - 2]; |
1230 |
const InlineIterator& endpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 2]; |
| 1231 |
const InlineIterator& startpoint = midpoints[lineMidpointState.numMidpoints() - 1]; |
1231 |
const InlineIterator& startpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 1]; |
| 1232 |
InlineIterator currpoint = endpoint; |
1232 |
InlineIterator currpoint = endpoint; |
| 1233 |
while (!currpoint.atEnd() && currpoint != startpoint && currpoint != lBreak) |
1233 |
while (!currpoint.atEnd() && currpoint != startpoint && currpoint != lBreak) |
| 1234 |
currpoint.increment(); |
1234 |
currpoint.increment(); |
| 1235 |
if (currpoint == lBreak) { |
1235 |
if (currpoint == lBreak) { |
| 1236 |
// We hit the line break before the start point. Shave off the start point. |
1236 |
// We hit the line break before the start point. Shave off the start point. |
| 1237 |
lineMidpointState.decrementNumMidpoints(); |
1237 |
lineWhitespaceCollapsingState.decrementNumTransitions(); |
| 1238 |
if (endpoint.renderer()->style().collapseWhiteSpace() && endpoint.renderer()->isText()) { |
1238 |
if (endpoint.renderer()->style().collapseWhiteSpace() && endpoint.renderer()->isText()) { |
| 1239 |
endpoint.fastDecrement(); |
1239 |
lineWhitespaceCollapsingState.decrementTransitionAt(lineWhitespaceCollapsingState.numTransitions() - 1); |
| 1240 |
return TrailingObjects::DoNotCollapseFirstSpace; |
1240 |
return TrailingObjects::DoNotCollapseFirstSpace; |
| 1241 |
} |
1241 |
} |
| 1242 |
} |
1242 |
} |
|
Lines 1269-1278
inline InlineIterator BreakingContext::handleEndOfLine()
a/Source/WebCore/rendering/line/BreakingContext.h_sec20
|
| 1269 |
m_lineBreakHistory.increment(); |
1269 |
m_lineBreakHistory.increment(); |
| 1270 |
} |
1270 |
} |
| 1271 |
|
1271 |
|
| 1272 |
// Sanity check our midpoints. |
1272 |
// Sanity check our whitespace collapsing transitions. |
| 1273 |
TrailingObjects::CollapseFirstSpaceOrNot collapsed = checkMidpoints(m_lineMidpointState, m_lineBreakHistory.current()); |
1273 |
TrailingObjects::CollapseFirstSpaceOrNot collapsed = checkWhitespaceCollapsingTransitions(m_lineWhitespaceCollapsingState, m_lineBreakHistory.current()); |
| 1274 |
|
1274 |
|
| 1275 |
m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, m_lineBreakHistory.current(), collapsed); |
1275 |
m_trailingObjects.updateWhitespaceCollapsingTransitionsForTrailingBoxes(m_lineWhitespaceCollapsingState, m_lineBreakHistory.current(), collapsed); |
| 1276 |
|
1276 |
|
| 1277 |
// We might have made lineBreak an iterator that points past the end |
1277 |
// We might have made lineBreak an iterator that points past the end |
| 1278 |
// of the object. Do this adjustment to make it point to the start |
1278 |
// of the object. Do this adjustment to make it point to the start |