mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 582852 - Optimize large text node editing; r,a=jst
--HG-- extra : rebase_source : 00e87477d9904b7a23469ec9335b519f53b0d211
This commit is contained in:
parent
008c15edaf
commit
d0e6b3989e
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user