[webkit-changes]  trunk/WebCore
treat at kde.org
Fri Feb 13 08:57:40 PST 2009
On Friday 13 February 2009 11:20:18 am darin at apple.com wrote:
> darin at apple.com
> 2009-02-13 08:20:16 -0800 (Fri, 13 Feb 2009)
> Log Message
> 2009-02-12 Darin Adler <darin at apple.com>
> Reviewed by Oliver Hunt.
> Speed up document.write a bit.
> * bindings/js/JSHTMLDocumentCustom.cpp:
> (WebCore::documentWrite): Added. Uses SegmentedString to avoid
> conversion from UString to String and to avoid appending strings. Also
> added code to handle newlines efficiently.
> (WebCore::JSHTMLDocument::write): Changed to use documentWrite.
> (WebCore::JSHTMLDocument::writeln): Ditto.
> * dom/Document.cpp:
> (WebCore::Document::prepareToWrite): Added. Refactored the
> initialization part of write into a separate function for use in the
Why does the binding need this separate function? See below...
> + Document* activeDocument =
> asJSDOMWindow(exec->lexicalGlobalObject())->impl()->document(); +
> + if (Tokenizer* tokenizer = document->tokenizer())
> + tokenizer->write(segmentedString, false);
Why do you call write on the tokenizer explicitly here instead of just doing
...which looks equivalent to me and this way you centralize the function where
all document.writes access the actual tokenizer like before.
More information about the webkit-changes