Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Aug 2017 22:14:53 +0000 (22:14 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Aug 2017 22:14:53 +0000 (22:14 +0000)
commit863da8009233d8dc74b6c97b5e854460e304b83b
tree07576b7dcf897728aced30652563708cc32bc235
parent99cb865cbd1bb6aeef48c1e93ac94063cef022de
Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
https://bugs.webkit.org/show_bug.cgi?id=175474
.:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

* Source/cmake/OptionsMac.cmake:
* Source/cmake/OptionsWin.cmake:
* Source/cmake/WebKitFeatures.cmake:
* Source/cmake/tools/vsprops/FeatureDefines.props:
* Source/cmake/tools/vsprops/FeatureDefinesCairo.props:

Source/JavaScriptCore:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

* Configurations/FeatureDefines.xcconfig:
* runtime/CommonIdentifiers.h:

Source/WebCore:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

Replaced the build flag by a runtime flag and added a stub implementation for DataTransferItemList
and DataTransferItem to make it compile. DataTransferItemList is created lazily by DataTransfer.items,
and its lifetime is tied to DataTransfer by forwarding ref and deref.

See https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface

Tests: editing/pasteboard/datatransfer-idl.html

* CMakeLists.txt:
* Configurations/FeatureDefines.xcconfig:
* WebCore.xcodeproj/project.pbxproj:
* dom/DataTransfer.cpp:
(WebCore::DataTransfer::items): Added. Create DataTransferItemList lazily
* dom/DataTransfer.h:
* dom/DataTransfer.idl:
* dom/DataTransferItem.cpp:
(WebCore::DataTransferItem::DataTransferItem): Added a stub implementation.
(WebCore::DataTransferItem::~DataTransferItem): Ditto.
(WebCore::DataTransferItem::getAsString const): Ditto.
(WebCore::DataTransferItem::getAsFile const): Ditto.
* dom/DataTransferItem.h:
(WebCore::DataTransferItemList): Devirtualized functions.
(WebCore::DataTransferItemList::kind const):
(WebCore::DataTransferItemList::type const):
* dom/DataTransferItem.idl:
* dom/DataTransferItemList.cpp: Added.
(WebCore::DataTransferItemList::length const): Added a stub implementation.
(WebCore::DataTransferItemList::item): Ditto.
(WebCore::DataTransferItemList::add): Ditto.
(WebCore::DataTransferItemList::remove): Ditto.
(WebCore::DataTransferItemList::clear): Ditto.
* dom/DataTransferItemList.h:
(WebCore::DataTransferItemList::DataTransferItemList):
(WebCore::DataTransferItemList::~DataTransferItemList): Deleted.
(WebCore::DataTransferItemList::ref): Forwards to DataTransfer's ref.
(WebCore::DataTransferItemList::deref): Ditto.
* dom/DataTransferItemList.idl: Updated to match the latest specification.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setDataTransferItemsEnabled): Added.
(WebCore::RuntimeEnabledFeatures::dataTransferItemsEnabled const): Added.

Source/WebCore/PAL:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

Replaced the build flag by a runtime flag and disabled the feature by default.

* Configurations/FeatureDefines.xcconfig:
* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetDataTransferItemsEnabled): Added to be used by WebKitTestRunner.
(WKPreferencesGetDataTransferItemsEnabled): Ditto.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WebKitLegacy/mac:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

Replaced the build flag by a runtime flag and disabled the feature by default.

* Configurations/FeatureDefines.xcconfig:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Disables dataTransfer.items by default.
(-[WebPreferences dataTransferItemsEnabled]): Added.
(-[WebPreferences setDataTransferItemsEnabled:]): Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WTF:

Reviewed by Wenson Hsieh.

* wtf/FeatureDefines.h:

Tools:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

Enable dataTransfer.items by default in DumpRenderTree and WebKitTestRunner for testing purposes.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

<rdar://problem/33844628>

Reviewed by Wenson Hsieh.

Added a W3C-style IDL test.

* editing/pasteboard/datatransfer-idl.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@220627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
46 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/datatransfer-idl-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/datatransfer-idl.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/WTF/ChangeLog
Source/WTF/wtf/FeatureDefines.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DataTransfer.cpp
Source/WebCore/dom/DataTransfer.h
Source/WebCore/dom/DataTransfer.idl
Source/WebCore/dom/DataTransferItem.cpp
Source/WebCore/dom/DataTransferItem.h
Source/WebCore/dom/DataTransferItem.idl
Source/WebCore/dom/DataTransferItemList.cpp [new file with mode: 0644]
Source/WebCore/dom/DataTransferItemList.h
Source/WebCore/dom/DataTransferItemList.idl
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebKit/ChangeLog
Source/WebKit/Configurations/FeatureDefines.xcconfig
Source/WebKit/Shared/WebPreferencesDefinitions.h
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/cmake/OptionsMac.cmake
Source/cmake/OptionsWin.cmake
Source/cmake/WebKitFeatures.cmake
Source/cmake/tools/vsprops/FeatureDefines.props
Source/cmake/tools/vsprops/FeatureDefinesCairo.props
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig
Tools/WebKitTestRunner/TestController.cpp