Make FormControlState capable to store multiple values
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 05:36:28 +0000 (05:36 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 05:36:28 +0000 (05:36 +0000)
commitfda90a3edd617b924506bf358e1fb76e039b1a04
tree6f902717c61f8d7b83080ee007ffd2a059f42ac7
parent7b76ce18fc0b07e9c6ec04f55bfe70f2330d5cd0
Make FormControlState capable to store multiple values
https://bugs.webkit.org/show_bug.cgi?id=89628

Reviewed by Hajime Morita.

Make FormControlState capable to store multiple values in order to
clean FileInputType.cpp up and prepare to fix Bug 89623.

No new tests. This doesn't change web-exposed behavior, and
fast/forms/file/recover-file-input-in-unposted-form.html covers
major part of this change.

* html/FormController.cpp:
(WebCore::FormControlState::serializeTo): Support for two or more values.
(WebCore::FormControlState::deserialize): ditto.
(WebCore::formStateSignature):
Bump up the version because the state format for <input type=file> is changed.
* html/FormController.h:
 - String m_value -> Vector<String> m_values
 - Add some functions.
 - Remove hasValue() and value().
(WebCore::FormControlState::FormControlState): m_value -> m_values.
(WebCore::FormControlState::valueSize): Added.
(WebCore::FormControlState::operator[]): Added.
(FormControlState): Add append() declaration, etc.
(WebCore::FormControlState::operator=): m_value -> m_values
(WebCore::FormControlState::append): Added.

* html/HTMLFormControlElementWithState.cpp:
(WebCore::HTMLFormControlElementWithState::finishParsingChildren):
Use valueSize() instead of hasValue().
* html/HTMLFormControlElementWithState.h:
(HTMLFormControlElementWithState): Update the comment.

* html/FileInputType.cpp:
(WebCore::FileInputType::saveFormControlState):
Use multiple value capability of FormControlState
(WebCore::FileInputType::restoreFormControlState): ditto.

* html/BaseCheckableInputType.cpp:
(WebCore::BaseCheckableInputType::restoreFormControlState): Use [0] instead of value().
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::restoreFormControlState): ditto.
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::restoreFormControlState): ditto.
* html/HiddenInputType.cpp:
(WebCore::HiddenInputType::restoreFormControlState): ditto.
* html/InputType.cpp:
(WebCore::InputType::restoreFormControlState): ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/BaseCheckableInputType.cpp
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/FormController.cpp
Source/WebCore/html/FormController.h
Source/WebCore/html/HTMLFormControlElementWithState.cpp
Source/WebCore/html/HTMLFormControlElementWithState.h
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HiddenInputType.cpp
Source/WebCore/html/InputType.cpp