Move setInnerTextValue from RenderTextControl to HTMLTextFormControlElement
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Aug 2011 05:51:19 +0000 (05:51 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Aug 2011 05:51:19 +0000 (05:51 +0000)
commit1b343a74f8b4048bdf9cc72c34c600fb0491ad40
tree8a088107297928f9dbcf9d98a53424185bc57e96
parent4ba540d6498b243fdae72f2926447c83917e06f5
Move setInnerTextValue from RenderTextControl to HTMLTextFormControlElement
https://bugs.webkit.org/show_bug.cgi?id=67152

Reviewed by Darin Adler.

Moved setInnerTextValue from RenderTextControl to HTMLTextFormControlElement.

Also moved m_lastChangeWasUserEdit from RenderTextControl to HTMLTextFormControlElement
and related inline functions from RenderTextControl to HTMLTextFormControlElement.
Because m_lastChangeWasUserEdit is no longer reset when RenderTextControl is recreated,
added explicit calls to setLastChangeWasNotUserEdit in setValue functions of HTMLInputElement
and HTMLTextAreaElement.

This patch also fixes the bug that lastChangeWasUserEdit() incorrectly returns false
when input or textarea don't have renderer (e.g. invisible).

Unfortunately, there is no way to test this behavioral change from layout tests.

* WebCore.exp.in: Exports lastChangeWasUserEdit in HTMLTextFormControlElement instead of
that of HTMLInputElement and HTMLTextAreaElement.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValue): Explicitly calls setLastChangeWasNotUserEdit.
* html/HTMLInputElement.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setValueCommon): Ditto.
* html/HTMLTextAreaElement.h:
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
(WebCore::HTMLTextFormControlElement::subtreeHasChanged): Sets m_lastChangeWasUserEdit true
as it used to do via respondToChangeByUser.
(WebCore::HTMLTextFormControlElement::lastChangeWasUserEdit): Moved from HTMLInputElement
and HTMLTextAreaElement.
(WebCore::HTMLTextFormControlElement::setInnerTextValue): Moved from RenderTextControl.
* html/HTMLTextFormControlElement.h:
(WebCore::HTMLTextFormControlElement::setLastChangeWasNotUserEdit): Added.
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::RenderTextControl): No longer initializes m_lastChangeWasUserEdit.
* rendering/RenderTextControl.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::updateFromElement): Calls setInnerTextValue.
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::updateFromElement): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94047 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.h
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/RenderTextControlMultiLine.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.cpp