Add support for ClipboardEvent
https://bugs.webkit.org/show_bug.cgi?id=163164

Reviewed by Darin Adler.

Source/WebCore:

Add support for ClipboardEvent:
- https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces

Firefox and Chrome both already support this.

This gives us 5 more points on html5test.com.

Tests: editing/pasteboard/clipboard-event.html
       fast/events/clipboard-event-constructor.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSEventCustom.cpp:
(WebCore::toJSNewlyCreated): Deleted.

* bindings/scripts/CodeGeneratorJS.pm:
(WillConvertUndefinedToDefaultParameterValue):
We use [] as implicit default value for dictionary parameters. This change
is so we call convertDictionary<>() even if the parameter is undefined
because we want to pass a struct to the implementation initialized with
the default member values defined in the IDL.

* dom/ClipboardEvent.cpp:
(WebCore::ClipboardEvent::ClipboardEvent):
(WebCore::ClipboardEvent::eventInterface):
* dom/ClipboardEvent.h:
* dom/ClipboardEvent.idl: Added.
* dom/Event.cpp:
(WebCore::Event::Event):
* dom/Event.h:
* dom/Event.idl:
* dom/EventInit.h: Added.
* dom/EventInit.idl: Added.
* dom/EventNames.in:
* dom/MouseEvent.h:
(WebCore::MouseEvent::dataTransfer):
* editing/Editor.cpp:
(WebCore::Editor::dispatchCPPEvent):

LayoutTests:

Extended layout test coverage.

* editing/pasteboard/clipboard-event-expected.txt: Added.
* editing/pasteboard/clipboard-event.html: Added.
* fast/events/clipboard-event-constructor-expected.txt: Added.
* fast/events/clipboard-event-constructor.html: Added.
* fast/xmlhttprequest/xmlhttprequest-get-expected.txt:
* http/tests/workers/worker-importScriptsOnError-expected.txt:
* inspector/model/remote-object-get-properties-expected.txt:
* js/dom/global-constructors-attributes-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/dom/Event.h b/Source/WebCore/dom/Event.h
index bad9718..d5ce3d0 100644
--- a/Source/WebCore/dom/Event.h
+++ b/Source/WebCore/dom/Event.h
@@ -25,6 +25,7 @@
 #define Event_h
 
 #include "DOMTimeStamp.h"
+#include "EventInit.h"
 #include "EventInterfaces.h"
 #include "ScriptWrappable.h"
 #include <wtf/RefCounted.h>
@@ -38,12 +39,6 @@
 class EventTarget;
 class HTMLIFrameElement;
 
-struct EventInit {
-    bool bubbles { false };
-    bool cancelable { false };
-    bool composed { false };
-};
-
 enum EventInterface {
 
 #define DOM_EVENT_INTERFACE_DECLARE(name) name##InterfaceType,
@@ -54,6 +49,8 @@
 
 class Event : public ScriptWrappable, public RefCounted<Event> {
 public:
+    enum class IsTrusted { No, Yes };
+
     enum PhaseType { 
         NONE                = 0,
         CAPTURING_PHASE     = 1, 
@@ -134,8 +131,6 @@
     bool legacyReturnValue() const { return !defaultPrevented(); }
     void setLegacyReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); }
 
-    DataTransfer* clipboardData() const { return isClipboardEvent() ? internalDataTransfer() : nullptr; }
-
     virtual EventInterface eventInterface() const;
 
     // These events are general classes of events.
@@ -188,8 +183,6 @@
     Event* underlyingEvent() const { return m_underlyingEvent.get(); }
     void setUnderlyingEvent(Event*);
 
-    virtual DataTransfer* internalDataTransfer() const { return 0; }
-
     bool isBeingDispatched() const { return eventPhase(); }
 
     virtual Ref<Event> cloneFor(HTMLIFrameElement*) const;
@@ -200,7 +193,7 @@
     Event();
     WEBCORE_EXPORT Event(const AtomicString& type, bool canBubble, bool cancelable);
     Event(const AtomicString& type, bool canBubble, bool cancelable, double timestamp);
-    Event(const AtomicString& type, const EventInit&);
+    Event(const AtomicString& type, const EventInit&, IsTrusted = IsTrusted::No);
 
     virtual void receivedTarget();
     bool dispatched() const { return m_target; }