Rename DataTransferAccessPolicy to match spec and refactor related node
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 21:53:51 +0000 (21:53 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 21:53:51 +0000 (21:53 +0000)
commit437a7795ebf1d76fe9442c2075c883b027d32ad8
treee63f834054c584803904d639c325b373c263c2b4
parentc8058f0ae0b57496f550902278ccfe63a0a7e6cc
Rename DataTransferAccessPolicy to match spec and refactor related node
https://bugs.webkit.org/show_bug.cgi?id=175704

Reviewed by Wenson Hsieh.

Renamed DataTransferAccessPolicy to DataTransfer::StoreMode to match the drag data store mode concept
in the HTML5 specification:
https://html.spec.whatwg.org/multipage/dnd.html#drag-data-store-mode

DataTransfer in addition to those states can be disassociated from the drag data store when it becomes
no longer valid. We also support a special mode which allows only updating the drag image.
These two states, Invalid and DragImageWritable, are added in addition to the three states in the spec.

Also split DragAndDrop type of DataTransfer into DragAndDropData and DragAndDropFiles, and refactored
the related code.

No new tests since there should be no behavioral change.

* WebCore.xcodeproj/project.pbxproj:
* dom/DataTransfer.cpp:
(WebCore::DataTransfer::DataTransfer): No longer takes forFileDrag boolean since it's folded into type.
(WebCore::DataTransfer::createForCopyAndPaste):
(WebCore::DataTransfer::~DataTransfer):
(WebCore::DataTransfer::setAccessPolicy): Deleted.
(WebCore::DataTransfer::canReadTypes const):
(WebCore::DataTransfer::canReadData const):
(WebCore::DataTransfer::canWriteData const):
(WebCore::DataTransfer::createForInputEvent):
(WebCore::DataTransfer::createForDrag):
(WebCore::DataTransfer::createForDrop):
(WebCore::DataTransfer::canSetDragImage const):
* dom/DataTransfer.h:
(WebCore::DataTransfer::makeInvalidForSecurity): Added.
(WebCore::DataTransfer::makeDragImageWritable): Added.
* dom/DataTransferAccessPolicy.h: Removed.
* editing/Editor.cpp:
(WebCore::dispatchClipboardEvent): Moved and renamed from dispatchCPPEvent. Now computes the store mode
inside the function to match the spec: https://w3c.github.io/clipboard-apis/#fire-a-clipboard-event
(WebCore::Editor::canDHTMLCut):
(WebCore::Editor::canDHTMLCopy):
(WebCore::Editor::canDHTMLPaste):
(WebCore::Editor::tryDHTMLCopy):
(WebCore::Editor::tryDHTMLCut):
(WebCore::Editor::tryDHTMLPaste):
(WebCore::Editor::dispatchCPPEvent): Deleted.
* editing/Editor.h:
* page/DragController.cpp:
(WebCore::createDataTransferToUpdateDrag): Extracted to share code.
(WebCore::DragController::dragExited):
(WebCore::DragController::performDragOperation):
(WebCore::DragController::tryDHTMLDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::invalidateDataTransfer):
(WebCore::EventHandler::handleDrag):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DataTransfer.cpp
Source/WebCore/dom/DataTransfer.h
Source/WebCore/dom/DataTransferAccessPolicy.h [deleted file]
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EventHandler.cpp