Changeset 207841 in webkit


Ignore:
Timestamp:
Oct 25, 2016 1:23:10 PM (7 years ago)
Author:
Wenson Hsieh
Message:

Support InputEvent.dataTransfer for the InputEvent spec
https://bugs.webkit.org/show_bug.cgi?id=163213
<rdar://problem/28700407>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Adds support for the dataTransfer attribute of InputEvent, which contains both HTML and plain text
representations of inserted content corresponding to input types "insertFromPaste", "insertFromDrop" and
"insertReplacementText". The specification calls for the data transfer's drag data item list to contain this
information via two entries with type strings "text/html" and "text/plain". However, WebKit does not yet support
the DataTransfer.items -- in lieu of this, we will provide this information for now via getData("text/plain")
and getData("text/html"), respectively.

To support this attribute, we need a special type of DataTransfer which is readonly and returns canned data
given a type string. To implement this, we introduce StaticPasteboard, a type of Pasteboard which is initialized
with a map of type string to data. When asked for its data via getData, the StaticPasteboard searches its map
for the requested type and returns the result, if any.

An editing command may now create a new DataTransfer via DataTransfer::createForInputEvent from HTML and
plaintext strings, and then vend this information to its dispatched input events by overriding
CompositeEditCommand::inputEventDataTransfer.

Some further work will be needed to ensure that all information exposed via this DataTransfer does not contain
hidden content. To do this, we should create a new Document, "paste" the contents of our copied HTML string into
it, then simulate selecting the content and generating markup from the selection to create a sanitized
DocumentFragment corresponding to the original copied HTML. This will be addressed in a future patch.

Tests: fast/events/input-events-paste-rich-datatransfer.html

fast/events/input-events-spell-checking-datatransfer.html

  • PlatformEfl.cmake:
  • PlatformGTK.cmake:
  • PlatformWin.cmake:

Add StaticPasteboard.cpp.

  • WebCore.xcodeproj/project.pbxproj:
  • dom/DataTransfer.cpp:

(WebCore::DataTransfer::DataTransfer):
(WebCore::DataTransfer::createForInputEvent):

Initializes a new DataTransfer for the purposes of input events. This takes a HTML and plain text
representations of the data being inserted and creates a new readonly DataTransfer backed by a StaticPasteboard
that only knows how to map the "text/plain" data type to the given plaintext string and "text/html" to the
given HTML text.

  • dom/DataTransfer.h:
  • dom/InputEvent.cpp:

(WebCore::InputEvent::create):
(WebCore::InputEvent::InputEvent):
(WebCore::InputEvent::dataTransfer):

  • dom/InputEvent.h:
  • dom/InputEvent.idl:

Add the InputEvent.dataTransfer attribute.

  • dom/Node.cpp:
  • editing/CompositeEditCommand.cpp:

(WebCore::CompositeEditCommand::inputEventDataTransfer):

Add a new hook for CompositeEditCommands to vend a DataTransfer for the purposes of input events. By default,
this is null.

  • editing/CompositeEditCommand.h:
  • editing/Editor.cpp:

(WebCore::dispatchBeforeInputEvent):
(WebCore::dispatchInputEvent):
(WebCore::dispatchBeforeInputEvents):
(WebCore::dispatchInputEvents):
(WebCore::Editor::willApplyEditing):
(WebCore::Editor::appliedEditing):

  • editing/ReplaceRangeWithTextCommand.cpp:

(WebCore::ReplaceRangeWithTextCommand::willApplyCommand):
(WebCore::ReplaceRangeWithTextCommand::doApply):
(WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer):

  • editing/ReplaceRangeWithTextCommand.h:
  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::willApplyCommand):

Initialize the ReplacementFragment here before applying the command, adjusting the DocumentFragment to be
inserted in the process.

(WebCore::ReplaceSelectionCommand::doApply):
(WebCore::ReplaceSelectionCommand::inputEventDataTransfer):
(WebCore::ReplaceSelectionCommand::ensureReplacementFragment):

Returns the ReplacementFragment used to apply the command, initializing it if necessary and stripping extraneous
nodes off of the document fragment in the process. Since ReplaceSelectionCommand may be used as a top-level
editing command or a child of another CompositeEditCommand such as the ReplaceRangeWithTextCommand, the
ReplacementFragment may be initialized either in willApplyCommand or in doApply.

  • editing/ReplaceSelectionCommand.h:
  • editing/SpellingCorrectionCommand.cpp:

(WebCore::SpellingCorrectionCommand::willApplyCommand):
(WebCore::SpellingCorrectionCommand::doApply):
(WebCore::SpellingCorrectionCommand::inputEventDataTransfer):

  • editing/SpellingCorrectionCommand.h:

Using the replacement text fragment, create and return a DataTransfer for input events.

  • platform/Pasteboard.h:
  • platform/StaticPasteboard.cpp: Added.

(WebCore::StaticPasteboard::create):
(WebCore::StaticPasteboard::StaticPasteboard):
(WebCore::StaticPasteboard::hasData):
(WebCore::StaticPasteboard::types):
(WebCore::StaticPasteboard::readString):

  • platform/StaticPasteboard.h: Copied from Source/WebCore/dom/InputEvent.cpp.
  • platform/efl/PasteboardEfl.cpp:

(WebCore::Pasteboard::writeMarkup):
(WebCore::Pasteboard::write):
(WebCore::Pasteboard::read):

  • platform/gtk/PasteboardGtk.cpp:

(WebCore::Pasteboard::writeMarkup):

  • platform/ios/PasteboardIOS.mm:

(WebCore::Pasteboard::writeMarkup):

  • platform/mac/PasteboardMac.mm:

(WebCore::Pasteboard::Pasteboard):
(WebCore::Pasteboard::writeMarkup):

  • platform/win/PasteboardWin.cpp:

(WebCore::Pasteboard::write):
(WebCore::Pasteboard::read):

To account for virtual methods on Pasteboard, add implementations for methods that were previously defined but
unimplemented on these platforms.

LayoutTests:

Adds 2 new layout tests verifying that input events dispatched as a result of pasting or spell checking contain
DataTransfers that have rich and plain text representations of the contents being inserted.

  • fast/events/input-events-fired-when-typing-expected.txt:
  • fast/events/input-events-fired-when-typing.html:
  • fast/events/input-events-paste-rich-datatransfer-expected.txt: Added.
  • fast/events/input-events-paste-rich-datatransfer.html: Added.
  • fast/events/input-events-spell-checking-datatransfer-expected.txt: Added.
  • fast/events/input-events-spell-checking-datatransfer.html: Added.
  • platform/ios-simulator/TestExpectations:
Location:
trunk
Files:
5 added
30 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207840 r207841  
     12016-10-25  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Support InputEvent.dataTransfer for the InputEvent spec
     4        https://bugs.webkit.org/show_bug.cgi?id=163213
     5        <rdar://problem/28700407>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Adds 2 new layout tests verifying that input events dispatched as a result of pasting or spell checking contain
     10        DataTransfers that have rich and plain text representations of the contents being inserted.
     11
     12        * fast/events/input-events-fired-when-typing-expected.txt:
     13        * fast/events/input-events-fired-when-typing.html:
     14        * fast/events/input-events-paste-rich-datatransfer-expected.txt: Added.
     15        * fast/events/input-events-paste-rich-datatransfer.html: Added.
     16        * fast/events/input-events-spell-checking-datatransfer-expected.txt: Added.
     17        * fast/events/input-events-spell-checking-datatransfer.html: Added.
     18        * platform/ios-simulator/TestExpectations:
     19
    1202016-10-25  Andy Estes  <aestes@apple.com>
    221
  • trunk/LayoutTests/fast/events/input-events-fired-when-typing-expected.txt

    r207670 r207841  
    55PASS event.__lookupGetter__('inputType') is defined.
    66PASS event.__lookupGetter__('data') is defined.
     7PASS event.__lookupGetter__('dataTransfer') is defined.
    78PASS event.getTargetRanges is defined.
    89PASS event.target.id is expectedTargetID
     
    1314PASS event.__lookupGetter__('inputType') is defined.
    1415PASS event.__lookupGetter__('data') is defined.
     16PASS event.__lookupGetter__('dataTransfer') is defined.
    1517PASS event.getTargetRanges is defined.
    1618PASS event.target.id is expectedTargetID
     
    2123PASS event.__lookupGetter__('inputType') is defined.
    2224PASS event.__lookupGetter__('data') is defined.
     25PASS event.__lookupGetter__('dataTransfer') is defined.
    2326PASS event.getTargetRanges is defined.
    2427PASS event.target.id is expectedTargetID
     
    2932PASS event.__lookupGetter__('inputType') is defined.
    3033PASS event.__lookupGetter__('data') is defined.
     34PASS event.__lookupGetter__('dataTransfer') is defined.
    3135PASS event.getTargetRanges is defined.
    3236PASS event.target.id is expectedTargetID
  • trunk/LayoutTests/fast/events/input-events-fired-when-typing.html

    r207670 r207841  
    3737            shouldBeDefined("event.__lookupGetter__('inputType')");
    3838            shouldBeDefined("event.__lookupGetter__('data')");
     39            shouldBeDefined("event.__lookupGetter__('dataTransfer')");
    3940            shouldBeDefined("event.getTargetRanges");
    4041            shouldBe("event.target.id", "expectedTargetID");
     
    4950            shouldBeDefined("event.__lookupGetter__('inputType')");
    5051            shouldBeDefined("event.__lookupGetter__('data')");
     52            shouldBeDefined("event.__lookupGetter__('dataTransfer')");
    5153            shouldBeDefined("event.getTargetRanges");
    5254            shouldBe("event.target.id", "expectedTargetID");
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r207698 r207841  
    12121212fast/events/input-events-ime-recomposition.html [ Failure ]
    12131213fast/events/input-events-ime-composition.html [ Failure ]
     1214fast/events/input-events-paste-rich-datatransfer.html [ Failure ]
     1215fast/events/input-events-spell-checking-datatransfer.html [ Failure ]
    12141216fast/events/before-input-events-prevent-default.html [ Failure ]
    12151217fast/events/before-input-events-prevent-default-in-textfield.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r207840 r207841  
     12016-10-25  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Support InputEvent.dataTransfer for the InputEvent spec
     4        https://bugs.webkit.org/show_bug.cgi?id=163213
     5        <rdar://problem/28700407>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Adds support for the dataTransfer attribute of InputEvent, which contains both HTML and plain text
     10        representations of inserted content corresponding to input types "insertFromPaste", "insertFromDrop" and
     11        "insertReplacementText". The specification calls for the data transfer's drag data item list to contain this
     12        information via two entries with type strings "text/html" and "text/plain". However, WebKit does not yet support
     13        the DataTransfer.items -- in lieu of this, we will provide this information for now via getData("text/plain")
     14        and getData("text/html"), respectively.
     15
     16        To support this attribute, we need a special type of DataTransfer which is readonly and returns canned data
     17        given a type string. To implement this, we introduce StaticPasteboard, a type of Pasteboard which is initialized
     18        with a map of type string to data. When asked for its data via getData, the StaticPasteboard searches its map
     19        for the requested type and returns the result, if any.
     20
     21        An editing command may now create a new DataTransfer via DataTransfer::createForInputEvent from HTML and
     22        plaintext strings, and then vend this information to its dispatched input events by overriding
     23        CompositeEditCommand::inputEventDataTransfer.
     24
     25        Some further work will be needed to ensure that all information exposed via this DataTransfer does not contain
     26        hidden content. To do this, we should create a new Document, "paste" the contents of our copied HTML string into
     27        it, then simulate selecting the content and generating markup from the selection to create a sanitized
     28        DocumentFragment corresponding to the original copied HTML. This will be addressed in a future patch.
     29
     30        Tests: fast/events/input-events-paste-rich-datatransfer.html
     31               fast/events/input-events-spell-checking-datatransfer.html
     32
     33        * PlatformEfl.cmake:
     34        * PlatformGTK.cmake:
     35        * PlatformWin.cmake:
     36
     37        Add StaticPasteboard.cpp.
     38
     39        * WebCore.xcodeproj/project.pbxproj:
     40        * dom/DataTransfer.cpp:
     41        (WebCore::DataTransfer::DataTransfer):
     42        (WebCore::DataTransfer::createForInputEvent):
     43
     44        Initializes a new DataTransfer for the purposes of input events. This takes a HTML and plain text
     45        representations of the data being inserted and creates a new readonly DataTransfer backed by a StaticPasteboard
     46        that only knows how to map the "text/plain" data type to the given plaintext string and "text/html" to the
     47        given HTML text.
     48
     49        * dom/DataTransfer.h:
     50        * dom/InputEvent.cpp:
     51        (WebCore::InputEvent::create):
     52        (WebCore::InputEvent::InputEvent):
     53        (WebCore::InputEvent::dataTransfer):
     54        * dom/InputEvent.h:
     55        * dom/InputEvent.idl:
     56
     57        Add the InputEvent.dataTransfer attribute.
     58
     59        * dom/Node.cpp:
     60        * editing/CompositeEditCommand.cpp:
     61        (WebCore::CompositeEditCommand::inputEventDataTransfer):
     62
     63        Add a new hook for CompositeEditCommands to vend a DataTransfer for the purposes of input events. By default,
     64        this is null.
     65
     66        * editing/CompositeEditCommand.h:
     67        * editing/Editor.cpp:
     68        (WebCore::dispatchBeforeInputEvent):
     69        (WebCore::dispatchInputEvent):
     70        (WebCore::dispatchBeforeInputEvents):
     71        (WebCore::dispatchInputEvents):
     72        (WebCore::Editor::willApplyEditing):
     73        (WebCore::Editor::appliedEditing):
     74        * editing/ReplaceRangeWithTextCommand.cpp:
     75        (WebCore::ReplaceRangeWithTextCommand::willApplyCommand):
     76        (WebCore::ReplaceRangeWithTextCommand::doApply):
     77        (WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer):
     78        * editing/ReplaceRangeWithTextCommand.h:
     79        * editing/ReplaceSelectionCommand.cpp:
     80        (WebCore::ReplaceSelectionCommand::willApplyCommand):
     81
     82        Initialize the ReplacementFragment here before applying the command, adjusting the DocumentFragment to be
     83        inserted in the process.
     84
     85        (WebCore::ReplaceSelectionCommand::doApply):
     86        (WebCore::ReplaceSelectionCommand::inputEventDataTransfer):
     87        (WebCore::ReplaceSelectionCommand::ensureReplacementFragment):
     88
     89        Returns the ReplacementFragment used to apply the command, initializing it if necessary and stripping extraneous
     90        nodes off of the document fragment in the process. Since ReplaceSelectionCommand may be used as a top-level
     91        editing command or a child of another CompositeEditCommand such as the ReplaceRangeWithTextCommand, the
     92        ReplacementFragment may be initialized either in willApplyCommand or in doApply.
     93
     94        * editing/ReplaceSelectionCommand.h:
     95        * editing/SpellingCorrectionCommand.cpp:
     96        (WebCore::SpellingCorrectionCommand::willApplyCommand):
     97        (WebCore::SpellingCorrectionCommand::doApply):
     98        (WebCore::SpellingCorrectionCommand::inputEventDataTransfer):
     99        * editing/SpellingCorrectionCommand.h:
     100
     101        Using the replacement text fragment, create and return a DataTransfer for input events.
     102
     103        * platform/Pasteboard.h:
     104        * platform/StaticPasteboard.cpp: Added.
     105        (WebCore::StaticPasteboard::create):
     106        (WebCore::StaticPasteboard::StaticPasteboard):
     107        (WebCore::StaticPasteboard::hasData):
     108        (WebCore::StaticPasteboard::types):
     109        (WebCore::StaticPasteboard::readString):
     110        * platform/StaticPasteboard.h: Copied from Source/WebCore/dom/InputEvent.cpp.
     111        * platform/efl/PasteboardEfl.cpp:
     112        (WebCore::Pasteboard::writeMarkup):
     113        (WebCore::Pasteboard::write):
     114        (WebCore::Pasteboard::read):
     115        * platform/gtk/PasteboardGtk.cpp:
     116        (WebCore::Pasteboard::writeMarkup):
     117        * platform/ios/PasteboardIOS.mm:
     118        (WebCore::Pasteboard::writeMarkup):
     119        * platform/mac/PasteboardMac.mm:
     120        (WebCore::Pasteboard::Pasteboard):
     121        (WebCore::Pasteboard::writeMarkup):
     122        * platform/win/PasteboardWin.cpp:
     123        (WebCore::Pasteboard::write):
     124        (WebCore::Pasteboard::read):
     125
     126        To account for virtual methods on Pasteboard, add implementations for methods that were previously defined but
     127        unimplemented on these platforms.
     128
    11292016-10-25  Andy Estes  <aestes@apple.com>
    2130
  • trunk/Source/WebCore/PlatformEfl.cmake

    r207590 r207841  
    8888
    8989    platform/KillRingNone.cpp
     90    platform/StaticPasteboard.cpp
    9091
    9192    platform/audio/efl/AudioBusEfl.cpp
  • trunk/Source/WebCore/PlatformGTK.cmake

    r207667 r207841  
    8585
    8686    platform/KillRingNone.cpp
     87    platform/StaticPasteboard.cpp
    8788    platform/UserAgentQuirks.cpp
    8889
  • trunk/Source/WebCore/PlatformWin.cmake

    r206779 r207841  
    6161    platform/KillRingNone.cpp
    6262    platform/LocalizedStrings.cpp
     63    platform/StaticPasteboard.cpp
    6364    platform/VNodeTracker.cpp
    6465
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r207835 r207841  
    63736373                F40EA8AB1B867E4400CE5581 /* NSScrollingInputFilterSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
    63746374                F42FFB461984B71600F6837F /* LengthRepeat.h in Headers */ = {isa = PBXBuildFile; fileRef = F42FFB451984B71600F6837F /* LengthRepeat.h */; };
     6375                F433E9031DBBDBA200EF0D14 /* StaticPasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = F433E9021DBBDBA200EF0D14 /* StaticPasteboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
     6376                F433E9051DBBDFCA00EF0D14 /* StaticPasteboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F433E9041DBBDBC200EF0D14 /* StaticPasteboard.cpp */; };
    63756377                F44EBBD91DB5D21400277334 /* StaticRange.h in Headers */ = {isa = PBXBuildFile; fileRef = F44EBBD81DB5D21400277334 /* StaticRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
    63766378                F44EBBDB1DB5DD9D00277334 /* StaticRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F44EBBDA1DB5DD9D00277334 /* StaticRange.cpp */; };
     
    1419214194                F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSScrollingInputFilterSPI.h; sourceTree = "<group>"; };
    1419314195                F42FFB451984B71600F6837F /* LengthRepeat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthRepeat.h; sourceTree = "<group>"; };
     14196                F433E9021DBBDBA200EF0D14 /* StaticPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticPasteboard.h; sourceTree = "<group>"; };
     14197                F433E9041DBBDBC200EF0D14 /* StaticPasteboard.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StaticPasteboard.cpp; sourceTree = "<group>"; };
    1419414198                F44EBBD61DB5D1B600277334 /* StaticRange.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StaticRange.idl; sourceTree = "<group>"; };
    1419514199                F44EBBD81DB5D21400277334 /* StaticRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticRange.h; sourceTree = "<group>"; };
     
    2218422188                                4B3043C60AE0370300A82647 /* Sound.h */,
    2218522189                                F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */,
     22190                                F433E9041DBBDBC200EF0D14 /* StaticPasteboard.cpp */,
     22191                                F433E9021DBBDBA200EF0D14 /* StaticPasteboard.h */,
    2218622192                                93B2D8150F9920D2006AE6B2 /* SuddenTermination.h */,
    2218722193                                97627B9714FB5424002CDCA1 /* Supplementable.h */,
     
    2452124527                                079D086B162F21F900DB8658 /* CaptionUserPreferencesMediaAF.h in Headers */,
    2452224528                                07B7116D1D899E63009F0FFB /* CaptureDevice.h in Headers */,
     24529                                F433E9031DBBDBA200EF0D14 /* StaticPasteboard.h in Headers */,
    2452324530                                07B7116F1D899E63009F0FFB /* CaptureDeviceManager.h in Headers */,
    2452424531                                99CC0B4F18BE9849006CEBCC /* CapturingInputCursor.h in Headers */,
     
    2901429021                                514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */,
    2901529022                                371A67CB11C6C7DB00047B8B /* HyphenationCF.cpp in Sources */,
     29023                                F433E9051DBBDFCA00EF0D14 /* StaticPasteboard.cpp in Sources */,
    2901629024                                97E4028F13A696ED00913D67 /* IconController.cpp in Sources */,
    2901729025                                5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */,
  • trunk/Source/WebCore/dom/DataTransfer.cpp

    r206867 r207841  
    3737#include "Image.h"
    3838#include "Pasteboard.h"
     39#include "StaticPasteboard.h"
    3940
    4041namespace WebCore {
     
    6061    , m_pasteboard(WTFMove(pasteboard))
    6162#if ENABLE(DRAG_SUPPORT)
    62     , m_forDrag(type != CopyAndPaste)
     63    , m_forDrag(type == DragAndDrop)
    6364    , m_forFileDrag(forFileDrag)
    6465    , m_dropEffect(ASCIILiteral("uninitialized"))
     
    6869{
    6970#if !ENABLE(DRAG_SUPPORT)
    70     ASSERT_UNUSED(type, type == CopyAndPaste);
     71    ASSERT_UNUSED(type, type != DragAndDrop);
    7172    ASSERT_UNUSED(forFileDrag, !forFileDrag);
    7273#endif
     
    197198
    198199    return !type.isNull() && types().contains(type);
     200}
     201
     202Ref<DataTransfer> DataTransfer::createForInputEvent(const String& plainText, const String& htmlText)
     203{
     204    TypeToStringMap typeToStringMap;
     205    typeToStringMap.set(ASCIILiteral("text/plain"), plainText);
     206    typeToStringMap.set(ASCIILiteral("text/html"), htmlText);
     207    return adoptRef(*new DataTransfer(DataTransferAccessPolicy::Readable, StaticPasteboard::create(WTFMove(typeToStringMap)), InputEvent));
    199208}
    200209
  • trunk/Source/WebCore/dom/DataTransfer.h

    r200192 r207841  
    4646    public:
    4747        static Ref<DataTransfer> createForCopyAndPaste(DataTransferAccessPolicy);
     48        static Ref<DataTransfer> createForInputEvent(const String& plainText, const String& htmlText);
    4849
    4950        WEBCORE_EXPORT ~DataTransfer();
     
    9899
    99100    private:
    100         enum Type { CopyAndPaste, DragAndDrop };
     101        enum Type { CopyAndPaste, DragAndDrop, InputEvent };
    101102        DataTransfer(DataTransferAccessPolicy, std::unique_ptr<Pasteboard>, Type = CopyAndPaste, bool forFileDrag = false);
    102103
  • trunk/Source/WebCore/dom/InputEvent.cpp

    r207670 r207841  
    2828
    2929#include "DOMWindow.h"
     30#include "DataTransfer.h"
    3031#include "EventNames.h"
    3132#include "Node.h"
     
    3637namespace WebCore {
    3738
    38 InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
     39Ref<InputEvent> InputEvent::create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, WebCore::DOMWindow *view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
     40{
     41    return adoptRef(*new InputEvent(eventType, inputType, canBubble, cancelable, view, data, WTFMove(dataTransfer), targetRanges, detail));
     42}
     43
     44InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
    3945    : UIEvent(eventType, canBubble, cancelable, view, detail)
    4046    , m_inputType(inputType)
    4147    , m_data(data)
     48    , m_dataTransfer(dataTransfer)
    4249    , m_targetRanges(targetRanges)
    4350{
     
    5158}
    5259
     60RefPtr<DataTransfer> InputEvent::dataTransfer() const
     61{
     62    return m_dataTransfer;
     63}
     64
    5365} // namespace WebCore
  • trunk/Source/WebCore/dom/InputEvent.h

    r207670 r207841  
    3636class InputEvent final : public UIEvent {
    3737public:
    38     static Ref<InputEvent> create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
    39     {
    40         return adoptRef(*new InputEvent(eventType, inputType, canBubble, cancelable, view, data, targetRanges, detail));
    41     }
    42 
    4338    struct Init : UIEventInit {
    4439        String data;
    4540    };
    4641
     42    static Ref<InputEvent> create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail);
    4743    static Ref<InputEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
    4844    {
     
    5046    }
    5147
    52     InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow*, const String& data, const Vector<RefPtr<StaticRange>>& targetRanges, int detail);
     48    InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow*, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail);
    5349    InputEvent(const AtomicString& eventType, const Init&, IsTrusted);
    5450
     
    5955    const String& inputType() const { return m_inputType; }
    6056    const String& data() const { return m_data; }
     57    RefPtr<DataTransfer> dataTransfer() const;
    6158    const Vector<RefPtr<StaticRange>>& getTargetRanges() { return m_targetRanges; }
    6259
     
    6461    String m_inputType;
    6562    String m_data;
     63    RefPtr<DataTransfer> m_dataTransfer;
    6664    Vector<RefPtr<StaticRange>> m_targetRanges;
    6765};
  • trunk/Source/WebCore/dom/InputEvent.idl

    r207670 r207841  
    3030    readonly attribute DOMString inputType;
    3131    readonly attribute DOMString? data;
     32    readonly attribute DataTransfer? dataTransfer;
    3233
    3334    sequence<StaticRange> getTargetRanges();
  • trunk/Source/WebCore/dom/Node.cpp

    r207627 r207841  
    3535#include "ContainerNodeAlgorithms.h"
    3636#include "ContextMenuController.h"
     37#include "DataTransfer.h"
    3738#include "DocumentType.h"
    3839#include "ElementIterator.h"
  • trunk/Source/WebCore/editing/CompositeEditCommand.cpp

    r207834 r207841  
    3131#include "ApplyStyleCommand.h"
    3232#include "BreakBlockquoteCommand.h"
     33#include "DataTransfer.h"
    3334#include "DeleteFromTextNodeCommand.h"
    3435#include "DeleteSelectionCommand.h"
     
    400401}
    401402
     403RefPtr<DataTransfer> CompositeEditCommand::inputEventDataTransfer() const
     404{
     405    return nullptr;
     406}
     407
    402408EditCommandComposition* CompositeEditCommand::ensureComposition()
    403409{
  • trunk/Source/WebCore/editing/CompositeEditCommand.h

    r207698 r207841  
    3636
    3737class EditingStyle;
     38class DataTransfer;
    3839class HTMLElement;
    3940class StaticRange;
     
    119120    virtual bool isBeforeInputEventCancelable() const { return true; }
    120121    Vector<RefPtr<StaticRange>> targetRangesForBindings() const;
     122    virtual RefPtr<DataTransfer> inputEventDataTransfer() const;
    121123
    122124protected:
  • trunk/Source/WebCore/editing/Editor.cpp

    r207698 r207841  
    112112namespace WebCore {
    113113
    114 static bool dispatchBeforeInputEvent(Element& element, const AtomicString& inputType, const String& data = { }, const Vector<RefPtr<StaticRange>>& targetRanges = { }, bool cancelable = true)
     114static bool dispatchBeforeInputEvent(Element& element, const AtomicString& inputType, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { }, bool cancelable = true)
    115115{
    116116    auto* settings = element.document().settings();
     
    118118        return true;
    119119
    120     return element.dispatchEvent(InputEvent::create(eventNames().beforeinputEvent, inputType, true, cancelable, element.document().defaultView(), data, targetRanges, 0));
    121 }
    122 
    123 static void dispatchInputEvent(Element& element, const AtomicString& inputType, const String& data = { }, const Vector<RefPtr<StaticRange>>& targetRanges = { })
     120    return element.dispatchEvent(InputEvent::create(eventNames().beforeinputEvent, inputType, true, cancelable, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
     121}
     122
     123static void dispatchInputEvent(Element& element, const AtomicString& inputType, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { })
    124124{
    125125    auto* settings = element.document().settings();
    126126    if (settings && settings->inputEventsEnabled())
    127         element.dispatchEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().defaultView(), data, targetRanges, 0));
     127        element.dispatchEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
    128128    else
    129129        element.dispatchInputEvent();
     
    10641064}
    10651065
    1066 static bool dispatchBeforeInputEvents(RefPtr<Element> startRoot, RefPtr<Element> endRoot, const AtomicString& inputTypeName, const String& data = { }, const Vector<RefPtr<StaticRange>>& targetRanges = { }, bool cancelable = true)
     1066static bool dispatchBeforeInputEvents(RefPtr<Element> startRoot, RefPtr<Element> endRoot, const AtomicString& inputTypeName, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { }, bool cancelable = true)
    10671067{
    10681068    bool continueWithDefaultBehavior = true;
    10691069    if (startRoot)
    1070         continueWithDefaultBehavior &= dispatchBeforeInputEvent(*startRoot, inputTypeName, data, targetRanges, cancelable);
     1070        continueWithDefaultBehavior &= dispatchBeforeInputEvent(*startRoot, inputTypeName, data, WTFMove(dataTransfer), targetRanges, cancelable);
    10711071    if (endRoot && endRoot != startRoot)
    1072         continueWithDefaultBehavior &= dispatchBeforeInputEvent(*endRoot, inputTypeName, data, targetRanges, cancelable);
     1072        continueWithDefaultBehavior &= dispatchBeforeInputEvent(*endRoot, inputTypeName, data, WTFMove(dataTransfer), targetRanges, cancelable);
    10731073    return continueWithDefaultBehavior;
    10741074}
    10751075
    1076 static void dispatchInputEvents(RefPtr<Element> startRoot, RefPtr<Element> endRoot, const AtomicString& inputTypeName, const String& data = { }, const Vector<RefPtr<StaticRange>>& targetRanges = { })
     1076static void dispatchInputEvents(RefPtr<Element> startRoot, RefPtr<Element> endRoot, const AtomicString& inputTypeName, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { })
    10771077{
    10781078    if (startRoot)
    1079         dispatchInputEvent(*startRoot, inputTypeName, data, targetRanges);
     1079        dispatchInputEvent(*startRoot, inputTypeName, data, WTFMove(dataTransfer), targetRanges);
    10801080    if (endRoot && endRoot != startRoot)
    1081         dispatchInputEvent(*endRoot, inputTypeName, data, targetRanges);
     1081        dispatchInputEvent(*endRoot, inputTypeName, data, WTFMove(dataTransfer), targetRanges);
    10821082}
    10831083
     
    10881088        return true;
    10891089
    1090     return dispatchBeforeInputEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement(), command.inputEventTypeName(), command.inputEventData(), targetRanges, command.isBeforeInputEventCancelable());
     1090    return dispatchBeforeInputEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement(), command.inputEventTypeName(), command.inputEventData(), command.inputEventDataTransfer(), targetRanges, command.isBeforeInputEventCancelable());
    10911091}
    10921092
     
    11071107   
    11081108    changeSelectionAfterCommand(newSelection, options);
    1109     dispatchInputEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement(), cmd->inputEventTypeName(), cmd->inputEventData());
     1109    dispatchInputEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement(), cmd->inputEventTypeName(), cmd->inputEventData(), cmd->inputEventDataTransfer());
    11101110
    11111111    updateEditorUINowIfScheduled();
  • trunk/Source/WebCore/editing/ReplaceRangeWithTextCommand.cpp

    r207670 r207841  
    2828
    2929#include "AlternativeTextController.h"
     30#include "DataTransfer.h"
    3031#include "Document.h"
    3132#include "DocumentFragment.h"
     
    4748}
    4849
     50bool ReplaceRangeWithTextCommand::willApplyCommand()
     51{
     52    m_textFragment = createFragmentFromText(*m_rangeToBeReplaced, m_text);
     53    return CompositeEditCommand::willApplyCommand();
     54}
     55
    4956void ReplaceRangeWithTextCommand::doApply()
    5057{
     
    6269
    6370    applyCommandToComposite(SetSelectionCommand::create(selection, FrameSelection::defaultSetSelectionOptions()));
    64 
    65     auto fragment = createFragmentFromText(*m_rangeToBeReplaced, m_text);
    66     applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTFMove(fragment), ReplaceSelectionCommand::MatchStyle, EditActionPaste));
     71    applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTFMove(m_textFragment), ReplaceSelectionCommand::MatchStyle, EditActionPaste));
    6772}
    6873
     
    7580}
    7681
     82RefPtr<DataTransfer> ReplaceRangeWithTextCommand::inputEventDataTransfer() const
     83{
     84    if (!isEditingTextAreaOrTextInput())
     85        return DataTransfer::createForInputEvent(m_text, createMarkup(*m_textFragment));
     86
     87    return CompositeEditCommand::inputEventDataTransfer();
     88}
     89
    7790Vector<RefPtr<StaticRange>> ReplaceRangeWithTextCommand::targetRanges() const
    7891{
  • trunk/Source/WebCore/editing/ReplaceRangeWithTextCommand.h

    r207670 r207841  
    3131namespace WebCore {
    3232
     33class DocumentFragment;
     34
    3335class ReplaceRangeWithTextCommand : public CompositeEditCommand {
    3436public:
     
    4042private:
    4143    ReplaceRangeWithTextCommand(RefPtr<Range> rangeToBeReplaced, const String& text);
     44    bool willApplyCommand() final;
    4245    void doApply() override;
    4346    String inputEventData() const final;
     47    RefPtr<DataTransfer> inputEventDataTransfer() const final;
    4448    Vector<RefPtr<StaticRange>> targetRanges() const final;
    4549
    4650    RefPtr<Range> m_rangeToBeReplaced;
     51    RefPtr<DocumentFragment> m_textFragment;
    4752    String m_text;
    4853};
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r207396 r207841  
    3333#include "BreakBlockquoteCommand.h"
    3434#include "CSSStyleDeclaration.h"
     35#include "DataTransfer.h"
    3536#include "Document.h"
    3637#include "DocumentFragment.h"
     
    6970
    7071enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment };
     72
     73static void removeHeadContents(ReplacementFragment&);
    7174
    7275// --- ReplacementFragment helper class
     
    910913}
    911914
     915bool ReplaceSelectionCommand::willApplyCommand()
     916{
     917    ensureReplacementFragment();
     918    m_documentFragmentPlainText = m_documentFragment->textContent();
     919    m_documentFragmentHTMLMarkup = createMarkup(*m_documentFragment);
     920    return CompositeEditCommand::willApplyCommand();
     921}
     922
    912923void ReplaceSelectionCommand::doApply()
    913924{
     
    923934        m_matchStyle = false;
    924935
    925     ReplacementFragment fragment(document(), m_documentFragment.get(), selection);
     936    ReplacementFragment& fragment = *ensureReplacementFragment();
    926937    if (performTrivialReplace(fragment))
    927938        return;
     
    10451056    // any work performed after this that queries or uses the typing style.
    10461057    frame().selection().clearTypingStyle();
    1047 
    1048     removeHeadContents(fragment);
    10491058
    10501059    // We don't want the destination to end up inside nodes that weren't selected.  To avoid that, we move the
     
    12631272}
    12641273
     1274RefPtr<DataTransfer> ReplaceSelectionCommand::inputEventDataTransfer() const
     1275{
     1276    if (isEditingTextAreaOrTextInput())
     1277        return CompositeEditCommand::inputEventDataTransfer();
     1278
     1279    return DataTransfer::createForInputEvent(m_documentFragmentPlainText, m_documentFragmentHTMLMarkup);
     1280}
     1281
    12651282bool ReplaceSelectionCommand::shouldRemoveEndBR(Node* endBR, const VisiblePosition& originalVisPosBeforeEndBR)
    12661283{
     
    14961513}
    14971514
     1515ReplacementFragment* ReplaceSelectionCommand::ensureReplacementFragment()
     1516{
     1517    if (!m_replacementFragment) {
     1518        m_replacementFragment = std::make_unique<ReplacementFragment>(document(), m_documentFragment.get(), endingSelection());
     1519        removeHeadContents(*m_replacementFragment);
     1520    }
     1521
     1522    return m_replacementFragment.get();
     1523}
     1524
    14981525// During simple pastes, where we're just pasting a text node into a run of text, we insert the text node
    14991526// directly into the text node that holds the selection.  This is much faster than the generalized code in
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.h

    r207010 r207841  
    6060
    6161    String inputEventData() const final;
     62    RefPtr<DataTransfer> inputEventDataTransfer() const final;
     63    bool willApplyCommand() final;
    6264    virtual void doApply();
    6365
     
    112114    void mergeTextNodesAroundPosition(Position&, Position& positionOnlyToBeUpdated);
    113115
     116    ReplacementFragment* ensureReplacementFragment();
    114117    bool performTrivialReplace(const ReplacementFragment&);
    115118
     
    122125    bool m_matchStyle;
    123126    RefPtr<DocumentFragment> m_documentFragment;
     127    std::unique_ptr<ReplacementFragment> m_replacementFragment;
     128    String m_documentFragmentHTMLMarkup;
     129    String m_documentFragmentPlainText;
    124130    bool m_preventNesting;
    125131    bool m_movingParagraph;
  • trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp

    r207670 r207841  
    2828
    2929#include "AlternativeTextController.h"
     30#include "DataTransfer.h"
    3031#include "Document.h"
    3132#include "DocumentFragment.h"
     
    9192}
    9293
     94bool SpellingCorrectionCommand::willApplyCommand()
     95{
     96    m_correctionFragment = createFragmentFromText(*m_rangeToBeCorrected, m_correction);
     97    return CompositeEditCommand::willApplyCommand();
     98}
     99
    93100void SpellingCorrectionCommand::doApply()
    94101{
     
    103110        return;
    104111
    105     auto fragment = createFragmentFromText(*m_rangeToBeCorrected, m_correction);
    106 
    107112    applyCommandToComposite(SetSelectionCommand::create(m_selectionToBeCorrected, FrameSelection::defaultSetSelectionOptions() | FrameSelection::SpellCorrectionTriggered));
    108113#if USE(AUTOCORRECTION_PANEL)
     
    110115#endif
    111116
    112     applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTFMove(fragment), ReplaceSelectionCommand::MatchStyle, EditActionPaste));
     117    applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTFMove(m_correctionFragment), ReplaceSelectionCommand::MatchStyle, EditActionPaste));
    113118}
    114119
     
    127132}
    128133
     134RefPtr<DataTransfer> SpellingCorrectionCommand::inputEventDataTransfer() const
     135{
     136    if (!isEditingTextAreaOrTextInput())
     137        return DataTransfer::createForInputEvent(m_correction, createMarkup(*m_correctionFragment));
     138
     139    return CompositeEditCommand::inputEventDataTransfer();
     140}
     141
    129142bool SpellingCorrectionCommand::shouldRetainAutocorrectionIndicator() const
    130143{
  • trunk/Source/WebCore/editing/SpellingCorrectionCommand.h

    r207670 r207841  
    4040private:
    4141    SpellingCorrectionCommand(PassRefPtr<Range> rangeToBeCorrected, const String& correction);
     42    bool willApplyCommand() final;
    4243    void doApply() override;
    4344    bool shouldRetainAutocorrectionIndicator() const override;
     
    4546    String inputEventData() const final;
    4647    Vector<RefPtr<StaticRange>> targetRanges() const final;
     48    RefPtr<DataTransfer> inputEventDataTransfer() const final;
    4749
    4850    RefPtr<Range> m_rangeToBeCorrected;
    4951    VisibleSelection m_selectionToBeCorrected;
     52    RefPtr<DocumentFragment> m_correctionFragment;
    5053    String m_corrected;
    5154    String m_correction;
  • trunk/Source/WebCore/platform/Pasteboard.h

    r207797 r207841  
    139139public:
    140140    Pasteboard();
    141     ~Pasteboard();
     141    virtual ~Pasteboard();
    142142
    143143#if PLATFORM(GTK)
     
    155155    static std::unique_ptr<Pasteboard> createPrivate(); // Temporary pasteboard. Can put data on this and then write to another pasteboard with writePasteboard.
    156156
    157     bool hasData();
    158     Vector<String> types();
    159     String readString(const String& type);
    160 
    161     void writeString(const String& type, const String& data);
    162     void clear();
    163     void clear(const String& type);
    164 
    165     void read(PasteboardPlainText&);
    166     void read(PasteboardWebContentReader&);
    167 
    168     void write(const PasteboardURL&);
    169     void write(const PasteboardImage&);
    170     void write(const PasteboardWebContent&);
    171 
    172     Vector<String> readFilenames();
    173     bool canSmartReplace();
    174 
    175     void writeMarkup(const String& markup);
     157    virtual bool hasData();
     158    virtual Vector<String> types();
     159    virtual String readString(const String& type);
     160
     161    virtual void writeString(const String& type, const String& data);
     162    virtual void clear();
     163    virtual void clear(const String& type);
     164
     165    virtual void read(PasteboardPlainText&);
     166    virtual void read(PasteboardWebContentReader&);
     167
     168    virtual void write(const PasteboardURL&);
     169    virtual void write(const PasteboardImage&);
     170    virtual void write(const PasteboardWebContent&);
     171
     172    virtual Vector<String> readFilenames();
     173    virtual bool canSmartReplace();
     174
     175    virtual void writeMarkup(const String& markup);
    176176    enum SmartReplaceOption { CanSmartReplace, CannotSmartReplace };
    177     WEBCORE_EXPORT void writePlainText(const String&, SmartReplaceOption); // FIXME: Two separate functions would be clearer than one function with an argument.
    178     void writePasteboard(const Pasteboard& sourcePasteboard);
     177    virtual WEBCORE_EXPORT void writePlainText(const String&, SmartReplaceOption); // FIXME: Two separate functions would be clearer than one function with an argument.
     178    virtual void writePasteboard(const Pasteboard& sourcePasteboard);
    179179
    180180#if ENABLE(DRAG_SUPPORT)
     
    182182    static std::unique_ptr<Pasteboard> createForDragAndDrop(const DragData&);
    183183
    184     void setDragImage(DragImageRef, const IntPoint& hotSpot);
     184    virtual void setDragImage(DragImageRef, const IntPoint& hotSpot);
    185185#endif
    186186
  • trunk/Source/WebCore/platform/StaticPasteboard.h

    r207840 r207841  
    2424 */
    2525
    26 #include "config.h"
    27 #include "InputEvent.h"
     26#pragma once
    2827
    29 #include "DOMWindow.h"
    30 #include "EventNames.h"
    31 #include "Node.h"
    32 #include "NotImplemented.h"
    33 #include <wtf/NeverDestroyed.h>
    34 #include <wtf/Vector.h>
     28#include "Pasteboard.h"
     29#include <wtf/HashMap.h>
     30#include <wtf/text/StringHash.h>
    3531
    3632namespace WebCore {
    3733
    38 InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, const Vector<RefPtr<StaticRange>>& targetRanges, int detail)
    39     : UIEvent(eventType, canBubble, cancelable, view, detail)
    40     , m_inputType(inputType)
    41     , m_data(data)
    42     , m_targetRanges(targetRanges)
    43 {
     34typedef HashMap<String, String> TypeToStringMap;
     35
     36class StaticPasteboard final : public Pasteboard {
     37public:
     38    static std::unique_ptr<StaticPasteboard> create(TypeToStringMap&&);
     39
     40    StaticPasteboard(TypeToStringMap&&);
     41
     42    bool hasData() final;
     43    Vector<String> types() final;
     44    String readString(const String& type) final;
     45
     46    void writeString(const String&, const String&) final { }
     47    void clear() final { }
     48    void clear(const String&) final { }
     49
     50    void read(PasteboardPlainText&) final { }
     51    void read(PasteboardWebContentReader&) final { }
     52
     53    void write(const PasteboardURL&) final { }
     54    void write(const PasteboardImage&) final { }
     55    void write(const PasteboardWebContent&) final { }
     56
     57    Vector<String> readFilenames() final { return { }; }
     58    bool canSmartReplace() final { return false; }
     59
     60    void writeMarkup(const String&) final { }
     61    void writePlainText(const String&, SmartReplaceOption) final { }
     62    void writePasteboard(const Pasteboard&) final { }
     63
     64#if ENABLE(DRAG_SUPPORT)
     65    void setDragImage(DragImageRef, const IntPoint&) final { }
     66#endif
     67
     68private:
     69    TypeToStringMap m_typeToStringMap;
     70};
     71
    4472}
    45 
    46 InputEvent::InputEvent(const AtomicString& eventType, const Init& initializer, IsTrusted isTrusted)
    47     : UIEvent(eventType, initializer, isTrusted)
    48     , m_inputType(emptyString())
    49     , m_data(initializer.data)
    50 {
    51 }
    52 
    53 } // namespace WebCore
  • trunk/Source/WebCore/platform/efl/PasteboardEfl.cpp

    r176780 r207841  
    126126}
    127127
     128void Pasteboard::writeMarkup(const String&)
     129{
     130    notImplemented();
    128131}
     132
     133void Pasteboard::write(const PasteboardWebContent&)
     134{
     135    notImplemented();
     136}
     137
     138void Pasteboard::read(PasteboardWebContentReader&)
     139{
     140    notImplemented();
     141}
     142
     143void Pasteboard::write(const PasteboardImage&)
     144{
     145    notImplemented();
     146}
     147
     148}
  • trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp

    r206256 r207841  
    8888}
    8989
     90Pasteboard::Pasteboard()
     91    : m_selectionData(SelectionData::create())
     92{
     93}
     94
    9095Pasteboard::~Pasteboard()
    9196{
     
    272277}
    273278
     279void Pasteboard::read(PasteboardWebContentReader&)
     280{
     281}
     282
    274283bool Pasteboard::hasData()
    275284{
     
    334343}
    335344
    336 }
     345void Pasteboard::writeMarkup(const String&)
     346{
     347}
     348
     349}
  • trunk/Source/WebCore/platform/ios/PasteboardIOS.mm

    r205516 r207841  
    8989}
    9090
     91void Pasteboard::writeMarkup(const String&)
     92{
     93}
     94
    9195std::unique_ptr<Pasteboard> Pasteboard::createForCopyAndPaste()
    9296{
  • trunk/Source/WebCore/platform/mac/PasteboardMac.mm

    r207797 r207841  
    108108}
    109109
     110Pasteboard::Pasteboard()
     111    : m_pasteboardName(emptyString())
     112    , m_changeCount(0)
     113{
     114}
     115
    110116Pasteboard::Pasteboard(const String& pasteboardName)
    111117    : m_pasteboardName(pasteboardName)
     
    282288}
    283289
     290void Pasteboard::writeMarkup(const String&)
     291{
     292}
     293
    284294void Pasteboard::read(PasteboardPlainText& text)
    285295{
  • trunk/Source/WebCore/platform/win/PasteboardWin.cpp

    r203324 r207841  
    10521052}
    10531053
     1054void Pasteboard::write(const PasteboardWebContent&)
     1055{
     1056}
     1057
     1058void Pasteboard::read(PasteboardWebContentReader&)
     1059{
     1060}
     1061
     1062void Pasteboard::write(const PasteboardImage&)
     1063{
     1064}
     1065
    10541066} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.