summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderText.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderText.cpp')
-rw-r--r--Source/WebCore/rendering/RenderText.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp
index 82b956993..7edad3b06 100644
--- a/Source/WebCore/rendering/RenderText.cpp
+++ b/Source/WebCore/rendering/RenderText.cpp
@@ -727,7 +727,6 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len
float monospaceCharacterWidth = f.spaceWidth();
float w = 0;
bool isSpace;
- bool previousCharWasSpace = true; // FIXME: Preserves historical behavior, but seems wrong for start > 0.
ASSERT(m_text);
StringImpl& text = *m_text.impl();
for (int i = start; i < start + len; i++) {
@@ -737,17 +736,21 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len
w += monospaceCharacterWidth;
isSpace = true;
} else if (c == '\t') {
- w += style()->collapseWhiteSpace() ? monospaceCharacterWidth : f.tabWidth(style()->tabSize(), xPos + w);
- isSpace = true;
+ if (style()->collapseWhiteSpace()) {
+ w += monospaceCharacterWidth;
+ isSpace = true;
+ } else {
+ w += f.tabWidth(style()->tabSize(), xPos + w);
+ isSpace = false;
+ }
} else
isSpace = false;
} else {
w += monospaceCharacterWidth;
isSpace = false;
}
- if (isSpace && !previousCharWasSpace)
+ if (isSpace && i > start)
w += f.wordSpacing();
- previousCharWasSpace = isSpace;
}
return w;
}