Synchronous rendering when setting form control values slows down JavaScript
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Apr 2010 20:11:18 +0000 (20:11 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Apr 2010 20:11:18 +0000 (20:11 +0000)
commitc940eb0ab4ecf54ce482ebfd264b87a4bfb27674
treef6ab7e09995510899b3a8d149755b50045508d43
parentf91842505823d648a61bc030bb2f1718e3c72f5a
Synchronous rendering when setting form control values slows down JavaScript
https://bugs.webkit.org/show_bug.cgi?id=36967

Reviewed by Sam Weinig.

This patch basically reverts http://trac.webkit.org/changeset/19006.

Dan asked me to investigate why 19006 is no longer needed. I have two answers:

    (1) I was also able to remove the synchronous call to updateFromElement().
    That call was the proximate cause of the crash that 19006 fixed.

    (2) updateFromElement() no longer calls HTMLElement::setInnerText()
    in the way that it used to. (However, it doesn't seem prudent to
    rely on this happy coincidence.)

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValue): Simplified some logic here. Moved
setNeedsValidityCheck() outside of individual 'if' clauses, since they all
called it.

Removed call to updateStyleIfNeeded(), which does rendering synchronously,
since that was the performance problem. (setNeedsStyleRecalc() ensures
that rendering will happen asynchronously.) Also removed comment about
ordering dangers introduced by updateStyleIfNeeded().

Removed call to updateFromElement(), since it's dangerous and also a minor
performance problem. (setNeedsStyleRecalc() ensures that updateFromElement()
will happen asynchronously, too.)

* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setNonDirtyValue): Ditto. Here, I had to
add a call to setNeedsStyleRecalc(), since there wasn't one before.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@56933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLTextAreaElement.cpp