-
Emilio Cobos Álvarez authored
This unfortunately doesn't fix my test-case (because we're replacing the text content all the time and all that), but it's still worth it, since it fixes the case we care about (the parser appending). We could also optimize pure insertions (since in that case we can still figure out what the old text was), but it's probably annoying and not worth the churn. In any case, we cannot optimize anything that resembles any kind of removal, because from there we don't know the old text in any way (and the text nodes like to reuse string buffers and such). We could do two other optimizations to replace / extend this one, in that order: * Pass the buffer and length to CharacterDataWillChange, and use that to get the exact old text and the new one in RestyleManager. That would make the optimization exact. * Pass some sort of Maybe<bool> mWasWhitespace down the CharacterDataChangeInfo which is computed like: HasFlag(NS_CACHED_TEXT_IS_ONLY_WHITESPACE) ? Some(NS_TEXT_IS_ONLY_WHITESPACE) : Nothing() It's not clear to me it's going to be completely worth the churn, so I haven't done those yet, if we see code in the wild which resembles my testcase, we can think of doing it. MozReview-Commit-ID: 2rTWaZti8rv --HG-- extra : rebase_source : 7390b8740801eb7b91700bb2533c43c173ac5db9
a133a50a