[Cleanup] Follow up cleanup for DOMFormData implementation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2017 14:53:18 +0000 (14:53 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2017 14:53:18 +0000 (14:53 +0000)
commitc723367cb3b91e28d1b13cbf32972bcee564dad2
tree2f5bff3f561889aa5f20bfbf8e253264195f38d6
parent2c65141bf06f84d1455e58514b840a214f24e48d
[Cleanup] Follow up cleanup for DOMFormData implementation
https://bugs.webkit.org/show_bug.cgi?id=176740

Patch by Sam Weinig <sam@webkit.org> on 2017-09-12
Reviewed by Alex Christensen.

Source/WebCore:

- Merges FormDataList into DOMFormData.
- Streamline / refactor FormData creation from DOMFormData.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/FormDataList.cpp: Removed.
* html/FormDataList.h: Removed.

    Remove FormDataList.

* html/DOMFormData.cpp:
(WebCore::DOMFormData::DOMFormData):
(WebCore::DOMFormData::createFileEntry):
(WebCore::DOMFormData::append):
(WebCore::DOMFormData::set):
(WebCore::DOMFormData::Iterator::next):
* html/DOMFormData.h:
(WebCore::DOMFormData::items const):
(WebCore::DOMFormData::encoding const):

    Merge FormDataList into DOMFormData. FormDataList's additional
    appendData/appendBlob functions have been removed, and their
    functionality inlined into DOMFormData's append functions.

    Adopted makeKeyValuePair in DOMFormData::Iterator::next().

* platform/network/FormData.cpp:
(WebCore::FormData::create):
(WebCore::FormData::createMultiPart):
(WebCore::normalizeStringData):
(WebCore::FormData::appendMultiPartFileValue):
(WebCore::FormData::appendMultiPartStringValue):
(WebCore::FormData::appendMultiPartKeyValuePairItems):
(WebCore::FormData::appendNonMultiPartKeyValuePairItems):
(WebCore::FormData::appendKeyValuePairItems): Deleted.
* platform/network/FormData.h:

    Split-up appendKeyValuePairItems into separate multipart and non-multipart
    functions, as the two edges of the branch didn't share much in common. Further
    split out multipart file and multipart string appending, since they too did not
    share that much in common and makes the code easier to follow.

    String value normalization has been moved entirely here (previously it was a member
    function of FormDataList) as FormData is the only user.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract):

    Update for new FormData create functions which don't need the
    encoding passed explicitly, since it is part of the DOMFormData.

* html/BaseButtonInputType.cpp:
* html/BaseButtonInputType.h:
* html/BaseCheckableInputType.cpp:
* html/BaseCheckableInputType.h:
* html/FileInputType.cpp:
* html/FileInputType.h:
* html/FormAssociatedElement.h:
* html/HTMLButtonElement.cpp:
* html/HTMLButtonElement.h:
* html/HTMLFormControlElement.h:
* html/HTMLInputElement.cpp:
* html/HTMLInputElement.h:
* html/HTMLKeygenElement.cpp:
* html/HTMLKeygenElement.h:
* html/HTMLMeterElement.cpp:
* html/HTMLObjectElement.cpp:
* html/HTMLObjectElement.h:
* html/HTMLSelectElement.cpp:
* html/HTMLSelectElement.h:
* html/HTMLTextAreaElement.cpp:
* html/HTMLTextAreaElement.h:
* html/HiddenInputType.cpp:
* html/HiddenInputType.h:
* html/ImageInputType.cpp:
* html/ImageInputType.h:
* html/InputType.cpp:
* html/InputType.h:
* html/SubmitInputType.cpp:
* html/SubmitInputType.h:
* html/TextFieldInputType.cpp:
* html/TextFieldInputType.h:

    Update to use DOMFormData directly, rather than the FormDataList, which
    has been removed.

* page/csp/ContentSecurityPolicy.cpp:

    Remove unnecessary #include of unused (and now removed) FormDataList.h

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/HashTraits.h:
(WTF::KeyValuePair::KeyValuePair): Deleted.
* wtf/KeyValuePair.h: Added.
(WTF::KeyValuePair::KeyValuePair):
(WTF::makeKeyValuePair):

    Move KeyValuePair to its own header and add a makeKeyValuePair helper.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@221914 268f45cc-cd09-0410-ab3c-d52691b4dbfc
48 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/HashTraits.h
Source/WTF/wtf/KeyValuePair.h [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchBody.cpp
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/BaseButtonInputType.cpp
Source/WebCore/html/BaseButtonInputType.h
Source/WebCore/html/BaseCheckableInputType.cpp
Source/WebCore/html/BaseCheckableInputType.h
Source/WebCore/html/DOMFormData.cpp
Source/WebCore/html/DOMFormData.h
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/FileInputType.h
Source/WebCore/html/FormAssociatedElement.h
Source/WebCore/html/FormDataList.cpp [deleted file]
Source/WebCore/html/FormDataList.h [deleted file]
Source/WebCore/html/HTMLButtonElement.cpp
Source/WebCore/html/HTMLButtonElement.h
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLKeygenElement.cpp
Source/WebCore/html/HTMLKeygenElement.h
Source/WebCore/html/HTMLMeterElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLObjectElement.h
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLSelectElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HiddenInputType.cpp
Source/WebCore/html/HiddenInputType.h
Source/WebCore/html/ImageInputType.cpp
Source/WebCore/html/ImageInputType.h
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/html/SubmitInputType.cpp
Source/WebCore/html/SubmitInputType.h
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/html/TextFieldInputType.h
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/page/csp/ContentSecurityPolicy.cpp
Source/WebCore/platform/network/FormData.cpp
Source/WebCore/platform/network/FormData.h
Source/WebCore/xml/XMLHttpRequest.cpp