diff --git a/layout/generic/nsTextTransformer.cpp b/layout/generic/nsTextTransformer.cpp index 9205c1e8041..84851c12ac1 100644 --- a/layout/generic/nsTextTransformer.cpp +++ b/layout/generic/nsTextTransformer.cpp @@ -206,6 +206,9 @@ nsTextTransformer::ScanNormalAsciiText_F(PRInt32* aWordLen) if (XP_IS_SPACE(ch)) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (bp == endbp) { PRInt32 oldLength = bp - mTransformBuf.GetBuffer(); nsresult rv = mTransformBuf.GrowBy(1000); @@ -336,6 +339,9 @@ nsTextTransformer::ScanPreData_F(PRInt32* aWordLen) if ((ch == '\t') || (ch == '\n')) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (ch > MAX_UNIBYTE) mHasMultibyte = PR_TRUE; if (bp == endbp) { PRInt32 oldLength = bp - mTransformBuf.GetBuffer(); @@ -371,6 +377,9 @@ nsTextTransformer::ScanPreAsciiData_F(PRInt32* aWordLen) cp--; break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (bp == endbp) { PRInt32 oldLength = bp - mTransformBuf.GetBuffer(); nsresult rv = mTransformBuf.GrowBy(1000); @@ -517,6 +526,9 @@ nsTextTransformer::ScanNormalAsciiText_B(PRInt32* aWordLen) if (XP_IS_SPACE(ch)) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (bp == startbp) { PRInt32 oldLength = mTransformBuf.mBufferLen; nsresult rv = mTransformBuf.GrowBy(1000); @@ -643,6 +655,9 @@ nsTextTransformer::ScanPreData_B(PRInt32* aWordLen) if ((ch == '\t') || (ch == '\n')) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (ch > MAX_UNIBYTE) mHasMultibyte = PR_TRUE; if (bp == startbp) { PRInt32 oldLength = mTransformBuf.mBufferLen; diff --git a/layout/html/base/src/nsTextTransformer.cpp b/layout/html/base/src/nsTextTransformer.cpp index 9205c1e8041..84851c12ac1 100644 --- a/layout/html/base/src/nsTextTransformer.cpp +++ b/layout/html/base/src/nsTextTransformer.cpp @@ -206,6 +206,9 @@ nsTextTransformer::ScanNormalAsciiText_F(PRInt32* aWordLen) if (XP_IS_SPACE(ch)) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (bp == endbp) { PRInt32 oldLength = bp - mTransformBuf.GetBuffer(); nsresult rv = mTransformBuf.GrowBy(1000); @@ -336,6 +339,9 @@ nsTextTransformer::ScanPreData_F(PRInt32* aWordLen) if ((ch == '\t') || (ch == '\n')) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (ch > MAX_UNIBYTE) mHasMultibyte = PR_TRUE; if (bp == endbp) { PRInt32 oldLength = bp - mTransformBuf.GetBuffer(); @@ -371,6 +377,9 @@ nsTextTransformer::ScanPreAsciiData_F(PRInt32* aWordLen) cp--; break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (bp == endbp) { PRInt32 oldLength = bp - mTransformBuf.GetBuffer(); nsresult rv = mTransformBuf.GrowBy(1000); @@ -517,6 +526,9 @@ nsTextTransformer::ScanNormalAsciiText_B(PRInt32* aWordLen) if (XP_IS_SPACE(ch)) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (bp == startbp) { PRInt32 oldLength = mTransformBuf.mBufferLen; nsresult rv = mTransformBuf.GrowBy(1000); @@ -643,6 +655,9 @@ nsTextTransformer::ScanPreData_B(PRInt32* aWordLen) if ((ch == '\t') || (ch == '\n')) { break; } + if (CH_NBSP == ch) { + ch = ' '; + } if (ch > MAX_UNIBYTE) mHasMultibyte = PR_TRUE; if (bp == startbp) { PRInt32 oldLength = mTransformBuf.mBufferLen;