[Cleanup] Cleanup uses of the FileList class
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 16:22:07 +0000 (16:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 16:22:07 +0000 (16:22 +0000)
commit03540168beacd117a010d80723678d338595d97b
tree4489e90d748a13f3a74c7efae7fceb67bbc971b2
parent76eaa1d773402ef16224109480d401389187ba88
[Cleanup] Cleanup uses of the FileList class
https://bugs.webkit.org/show_bug.cgi?id=176800

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

* fileapi/FileList.cpp:
* fileapi/FileList.h:

    Store list of files as Refs, rather than RefPtrs.
    Add direct accessor to the underlying Vector for faster iteration.
    Add file(unsigned) function to allow direct indexing, rather than using
    the DOM exposed item function which always does a length check.

* Modules/entriesapi/HTMLInputElementEntriesAPI.cpp:

    Remove unused RuntimeEnabledFeatures.h #include.
    Use modern for loop and the new direct file vector access.

* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::readFile):
(WebCore::CloneDeserializer::readTerminal):

    Remove unnecessary #includes, adopt auto, and use modern for-loop
    for FileList.

* dom/DataTransfer.cpp:
(WebCore::DataTransfer::files const):
(WebCore::DataTransfer::hasFileOfType):

    Use auto.

(WebCore::DataTransfer::createForInputEvent):

    Use initializer list for the typeToStringMap.

* dom/DataTransferItemList.cpp:
(WebCore::DataTransferItemList::ensureItems const):

    Use auto and modern for-loop for FileList.

* html/FileInputType.cpp:
(WebCore::FileInputType::filesFromFormControlState):
(WebCore::FileInputType::saveFormControlState const):
(WebCore::FileInputType::appendFormData const):
(WebCore::FileInputType::handleDOMActivateEvent):
(WebCore::FileInputType::getTypeSpecificValue):
(WebCore::FileInputType::disabledAttributeChanged):
(WebCore::FileInputType::multipleAttributeChanged):
(WebCore::FileInputType::setFiles):
(WebCore::FileInputType::receiveDroppedFiles):
(WebCore::FileInputType::defaultToolTip const):

    Adopt auto, brace-initialization, and modern for-loops.

* html/FileListCreator.cpp:
(WebCore::appendDirectoryFiles):
(WebCore::FileListCreator::createFileList):

    Update to work in terms of Vector<Ref<File>>.

* html/FormController.h:
(WebCore::FormControlState::FormControlState):

    Re-format existing constructors and add one that takes an r-value
    Vector<String> to allow construction from a pre-created list (used
    in FileInputType::saveFormControlState)

* platform/DragData.h:
* platform/gtk/DragDataGtk.cpp:
(WebCore::DragData::asFilenames const):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::asFilenames const):
* platform/win/DragDataWin.cpp:
(WebCore::DragData::asFilenames const):

    Convert asFilenames to return, rather than take, a Vector<String>.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/entriesapi/HTMLInputElementEntriesAPI.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/dom/DataTransfer.cpp
Source/WebCore/dom/DataTransferItemList.cpp
Source/WebCore/fileapi/FileList.cpp
Source/WebCore/fileapi/FileList.h
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/FileListCreator.cpp
Source/WebCore/html/FormController.h
Source/WebCore/platform/DragData.h
Source/WebCore/platform/gtk/DragDataGtk.cpp
Source/WebCore/platform/mac/DragDataMac.mm
Source/WebCore/platform/win/DragDataWin.cpp