Index: Source/core/rendering/line/BreakingContextInlineHeaders.h |
diff --git a/Source/core/rendering/line/BreakingContextInlineHeaders.h b/Source/core/rendering/line/BreakingContextInlineHeaders.h |
index cd08486c690ef85c33bf80b0de17f53c53b2343d..0519eae99c8225cd956e365d2e409247a4e7e48c 100644 |
--- a/Source/core/rendering/line/BreakingContextInlineHeaders.h |
+++ b/Source/core/rendering/line/BreakingContextInlineHeaders.h |
@@ -364,7 +364,7 @@ inline void BreakingContext::handleFloat() |
// If it does, position it now, otherwise, position |
// it after moving to next line (in newLine() func) |
// FIXME: Bug 110372: Properly position multiple stacked floats with non-rectangular shape outside. |
- if (m_floatsFitOnLine && m_width.fitsOnLine(m_block->logicalWidthForFloat(floatingObject).toFloat())) { |
+ if (m_floatsFitOnLine && m_width.fitsOnLine(m_block->logicalWidthForFloat(floatingObject).toFloat(), ExcludeWhitespace)) { |
m_block->positionNewFloatOnLine(floatingObject, m_lastFloatFromPreviousLine, m_lineInfo, m_width); |
if (m_lineBreak.object() == m_current.object()) { |
ASSERT(!m_lineBreak.offset()); |
@@ -644,15 +644,19 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool |
wordMeasurement.endOffset = m_current.offset(); |
wordMeasurement.startOffset = lastSpace; |
- float additionalTmpW; |
+ float additionalTempWidth; |
if (wordTrailingSpaceWidth && c == ' ') |
- additionalTmpW = textWidth(renderText, lastSpace, m_current.offset() + 1 - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts) - wordTrailingSpaceWidth; |
+ additionalTempWidth = textWidth(renderText, lastSpace, m_current.offset() + 1 - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts) - wordTrailingSpaceWidth; |
else |
- additionalTmpW = textWidth(renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts); |
+ additionalTempWidth = textWidth(renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts); |
+ |
+ wordMeasurement.width = additionalTempWidth + wordSpacingForWordMeasurement; |
+ additionalTempWidth += lastSpaceWordSpacing; |
+ m_width.addUncommittedWidth(additionalTempWidth); |
+ |
+ if (m_collapseWhiteSpace && previousCharacterIsSpace && m_currentCharacterIsSpace && additionalTempWidth) |
+ m_width.setTrailingWhitespaceWidth(additionalTempWidth); |
- wordMeasurement.width = additionalTmpW + wordSpacingForWordMeasurement; |
- additionalTmpW += lastSpaceWordSpacing; |
- m_width.addUncommittedWidth(additionalTmpW); |
if (!m_appliedStartWidth) { |
m_width.addUncommittedWidth(inlineLogicalWidth(m_current.object(), true, false).toFloat()); |
m_appliedStartWidth = true; |
@@ -703,7 +707,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool |
} |
} else { |
if (!betweenWords || (midWordBreak && !m_autoWrap)) |
- m_width.addUncommittedWidth(-additionalTmpW); |
+ m_width.addUncommittedWidth(-additionalTempWidth); |
if (hyphenWidth) { |
// Subtract the width of the soft hyphen out since we fit on a line. |
m_width.addUncommittedWidth(-hyphenWidth); |
@@ -799,12 +803,18 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool |
wordMeasurement.renderer = renderText; |
// IMPORTANT: current.m_pos is > length here! |
- float additionalTmpW = m_ignoringSpaces ? 0 : textWidth(renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts); |
+ float additionalTempWidth = m_ignoringSpaces ? 0 : textWidth(renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts); |
wordMeasurement.startOffset = lastSpace; |
wordMeasurement.endOffset = m_current.offset(); |
- wordMeasurement.width = m_ignoringSpaces ? 0 : additionalTmpW + wordSpacingForWordMeasurement; |
- additionalTmpW += lastSpaceWordSpacing; |
- m_width.addUncommittedWidth(additionalTmpW + inlineLogicalWidth(m_current.object(), !m_appliedStartWidth, m_includeEndWidth)); |
+ wordMeasurement.width = m_ignoringSpaces ? 0 : additionalTempWidth + wordSpacingForWordMeasurement; |
+ additionalTempWidth += lastSpaceWordSpacing; |
+ |
+ LayoutUnit inlineLogicalTempWidth = inlineLogicalWidth(m_current.object(), !m_appliedStartWidth, m_includeEndWidth); |
+ m_width.addUncommittedWidth(additionalTempWidth + inlineLogicalTempWidth); |
+ |
+ if (m_collapseWhiteSpace && m_currentCharacterIsSpace && additionalTempWidth) |
+ m_width.setTrailingWhitespaceWidth(additionalTempWidth + inlineLogicalTempWidth); |
+ |
m_includeEndWidth = false; |
if (!m_width.fitsOnLine()) { |