Bug 582852 - Optimize large text node editing; r,a=jst

--HG--
extra : rebase_source : 00e87477d9904b7a23469ec9335b519f53b0d211
This commit is contained in:
Ehsan Akhgari 2010-08-05 22:13:07 -04:00
parent 008c15edaf
commit d0e6b3989e

View File

@ -202,13 +202,18 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength)
}
}
// See if we need to store the data in ucs2 or not
PRBool need2 = PR_FALSE;
while (ucp < uend) {
PRUnichar ch = *ucp++;
if (ch >= 256) {
need2 = PR_TRUE;
break;
// We don't attempt to detect if large text nodes can be stored compactly,
// because that wastes too much time.
const PRInt32 LARGE_STRING_THRESHOLD = 10240; // 10KB
PRBool need2 = aLength >= LARGE_STRING_THRESHOLD;
if (!need2) {
// See if we need to store the data in ucs2 or not
while (ucp < uend) {
PRUnichar ch = *ucp++;
if (ch >= 256) {
need2 = PR_TRUE;
break;
}
}
}