Title: [206963] trunk
Revision
206963
Author
cdu...@apple.com
Date
2016-10-08 17:03:14 -0700 (Sat, 08 Oct 2016)

Log Message

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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206962 => 206963)


--- trunk/LayoutTests/ChangeLog	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/ChangeLog	2016-10-09 00:03:14 UTC (rev 206963)
@@ -1,3 +1,25 @@
+2016-10-08  Chris Dumez  <cdu...@apple.com>
+
+        Add support for ClipboardEvent
+        https://bugs.webkit.org/show_bug.cgi?id=163164
+
+        Reviewed by Darin Adler.
+
+        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:
+
 2016-10-08  Ryan Haddad  <ryanhad...@apple.com>
 
         Marking js/regress-141098.html as flaky on mac.

Added: trunk/LayoutTests/editing/pasteboard/clipboard-event-expected.txt (0 => 206963)


--- trunk/LayoutTests/editing/pasteboard/clipboard-event-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/clipboard-event-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -0,0 +1,28 @@
+Tests the ClipboardEvent.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS firedCopyEvent is false
+PASS firedPasteEvent is false
+PASS event.type is "copy"
+PASS event.__proto__ is ClipboardEvent.prototype
+PASS event.isTrusted is true
+PASS event.bubbles is true
+PASS event.cancelable is true
+PASS event.clipboardData.__proto__ is DataTransfer.prototype
+PASS firedCopyEvent is true
+PASS firedPasteEvent is false
+PASS event.type is "paste"
+PASS event.__proto__ is ClipboardEvent.prototype
+PASS event.isTrusted is true
+PASS event.bubbles is true
+PASS event.cancelable is true
+PASS event.clipboardData.__proto__ is DataTransfer.prototype
+PASS event.clipboardData.getData('text/plain') is "Content"
+PASS firedCopyEvent is false
+PASS firedPasteEvent is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/editing/pasteboard/clipboard-event.html (0 => 206963)


--- trunk/LayoutTests/editing/pasteboard/clipboard-event.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/clipboard-event.html	2016-10-09 00:03:14 UTC (rev 206963)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<textarea id="testArea">Content</textarea>
+<script src=""
+<script>
+description("Tests the ClipboardEvent.");
+
+function testClipboardEvent(e)
+{
+    event = e;
+    shouldBe("event.__proto__", "ClipboardEvent.prototype");
+    shouldBeTrue("event.isTrusted")
+    shouldBeTrue("event.bubbles");
+    shouldBeTrue("event.cancelable");
+    shouldBe("event.clipboardData.__proto__", "DataTransfer.prototype");
+}
+
+var firedCopyEvent = false;
+var firedPasteEvent = false;
+
+var testArea = document.getElementById("testArea");
+testArea.addEventListener("copy", function(e) {
+    event = e;
+    firedCopyEvent = true;
+    shouldBeEqualToString("event.type", "copy");
+    testClipboardEvent(event);
+});
+
+testArea.addEventListener("paste", function(e) {
+    event = e;
+    firedPasteEvent = true;
+    shouldBeEqualToString("event.type", "paste");
+    testClipboardEvent(event);
+    shouldBeEqualToString("event.clipboardData.getData('text/plain')", "Content");
+});
+
+testArea.focus();
+execSelectAllCommand();
+shouldBeFalse("firedCopyEvent");
+shouldBeFalse("firedPasteEvent");
+
+execCopyCommand();
+shouldBeTrue("firedCopyEvent");
+shouldBeFalse("firedPasteEvent")
+firedCopyEvent = false;
+
+execPasteCommand();
+shouldBeFalse("firedCopyEvent");
+shouldBeTrue("firedPasteEvent");
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/clipboard-event-constructor-expected.txt (0 => 206963)


--- trunk/LayoutTests/fast/events/clipboard-event-constructor-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/clipboard-event-constructor-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -0,0 +1,9 @@
+
+PASS First parameter is mandatory 
+PASS Omit init dictionary 
+PASS bubbles member 
+PASS bubbles member 
+PASS bubbles member 
+PASS bubbles member 
+PASS Passing a bad type for clipboardData member should throw 
+

Added: trunk/LayoutTests/fast/events/clipboard-event-constructor.html (0 => 206963)


--- trunk/LayoutTests/fast/events/clipboard-event-constructor.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/clipboard-event-constructor.html	2016-10-09 00:03:14 UTC (rev 206963)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>ClipboardEvent constructor</title>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+test(function() {
+    assert_throws(new TypeError(), function() {
+        new ClipboardEvent();
+    });
+}, "First parameter is mandatory");
+
+test(function() {
+    var event = new ClipboardEvent("foo");
+    assert_equals(event.type, "foo");
+    assert_equals(event.isTrusted, false);
+    assert_equals(event.bubbles, false);
+    assert_equals(event.cancelable, false);
+    assert_equals(event.composed, false);
+    assert_equals(event.clipboardData, null);
+}, "Omit init dictionary");
+
+test(function() {
+    var event = new ClipboardEvent("foo", {bubbles: true});
+    assert_equals(event.type, "foo");
+    assert_equals(event.isTrusted, false);
+    assert_equals(event.bubbles, true);
+    assert_equals(event.cancelable, false);
+    assert_equals(event.composed, false);
+    assert_equals(event.clipboardData, null);
+}, "bubbles member");
+
+test(function() {
+    var event = new ClipboardEvent("foo", {cancelable: true});
+    assert_equals(event.type, "foo");
+    assert_equals(event.isTrusted, false);
+    assert_equals(event.bubbles, false);
+    assert_equals(event.cancelable, true);
+    assert_equals(event.composed, false);
+    assert_equals(event.clipboardData, null);
+}, "bubbles member");
+
+test(function() {
+    var event = new ClipboardEvent("foo", {composed: true});
+    assert_equals(event.type, "foo");
+    assert_equals(event.isTrusted, false);
+    assert_equals(event.bubbles, false);
+    assert_equals(event.cancelable, false);
+    assert_equals(event.composed, true);
+    assert_equals(event.clipboardData, null);
+}, "bubbles member");
+
+test(function() {
+    var event = new ClipboardEvent("foo", {bubbles: true, cancelable: true, composed: true});
+    assert_equals(event.type, "foo");
+    assert_equals(event.isTrusted, false);
+    assert_equals(event.bubbles, true);
+    assert_equals(event.cancelable, true);
+    assert_equals(event.composed, true);
+    assert_equals(event.clipboardData, null);
+}, "bubbles member");
+
+test(function() {
+    assert_throws(new TypeError(), function() {
+        new ClipboardEvent("foo", {clipboardData: document});
+    });
+}, "Passing a bad type for clipboardData member should throw");
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt (206962 => 206963)


--- trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -46,7 +46,6 @@
 bubbles : 'false'
 cancelBubble : 'false'
 cancelable : 'false'
-clipboardData : 'undefined'
 composed : 'false'
 composedPath : 'function composedPath() {
     [native code]

Modified: trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt (206962 => 206963)


--- trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -25,7 +25,6 @@
 bubbles: false,
 cancelBubble: false,
 cancelable: true,
-clipboardData: undefined,
 colno: 14,
 composed: false,
 composedPath: function composedPath() { [native code] },

Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (206962 => 206963)


--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -243,7 +243,6 @@
     srcElement
     returnValue
     cancelBubble
-    clipboardData
     __proto__
 
 ALL PROPERTIES:
@@ -261,7 +260,6 @@
     srcElement
     returnValue
     cancelBubble
-    clipboardData
     composedPath
     stopPropagation
     preventDefault

Modified: trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt (206962 => 206963)


--- trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -228,6 +228,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').value is ClipboardEvent
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').value is CloseEvent
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (206962 => 206963)


--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -263,6 +263,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').value is ClipboardEvent
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').value is CloseEvent
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt (206962 => 206963)


--- trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -263,6 +263,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').value is ClipboardEvent
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').value is CloseEvent
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt (206962 => 206963)


--- trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -263,6 +263,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').value is ClipboardEvent
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').value is CloseEvent
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt (206962 => 206963)


--- trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -168,6 +168,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ClientRectList').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').value is ClipboardEvent
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'ClipboardEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').value is CloseEvent
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'CloseEvent').hasOwnProperty('set') is false

Modified: trunk/Source/WebCore/CMakeLists.txt (206962 => 206963)


--- trunk/Source/WebCore/CMakeLists.txt	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-10-09 00:03:14 UTC (rev 206963)
@@ -375,6 +375,7 @@
     dom/ChildNode.idl
     dom/ClientRect.idl
     dom/ClientRectList.idl
+    dom/ClipboardEvent.idl
     dom/Comment.idl
     dom/CompositionEvent.idl
     dom/CustomElementRegistry.idl
@@ -397,6 +398,7 @@
     dom/Element.idl
     dom/ErrorEvent.idl
     dom/Event.idl
+    dom/EventInit.idl
     dom/EventTarget.idl
     dom/FocusEvent.idl
     dom/GlobalEventHandlers.idl

Modified: trunk/Source/WebCore/ChangeLog (206962 => 206963)


--- trunk/Source/WebCore/ChangeLog	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/ChangeLog	2016-10-09 00:03:14 UTC (rev 206963)
@@ -1,3 +1,51 @@
+2016-10-08  Chris Dumez  <cdu...@apple.com>
+
+        Add support for ClipboardEvent
+        https://bugs.webkit.org/show_bug.cgi?id=163164
+
+        Reviewed by Darin Adler.
+
+        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):
+
 2016-10-06  Darin Adler  <da...@apple.com>
 
         Next step on moving to modern way to return DOM exceptions

Modified: trunk/Source/WebCore/DerivedSources.cpp (206962 => 206963)


--- trunk/Source/WebCore/DerivedSources.cpp	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/DerivedSources.cpp	2016-10-09 00:03:14 UTC (rev 206963)
@@ -136,6 +136,7 @@
 #include "JSCSSUnknownRule.cpp"
 #include "JSCSSValue.cpp"
 #include "JSCSSValueList.cpp"
+#include "JSClipboardEvent.cpp"
 #if ENABLE(CUSTOM_ELEMENTS)
 #include "JSCustomElementRegistry.cpp"
 #endif
@@ -188,6 +189,7 @@
 #include "JSElement.cpp"
 #include "JSErrorEvent.cpp"
 #include "JSEvent.cpp"
+#include "JSEventInit.cpp"
 #include "JSEventSource.cpp"
 #include "JSEventTarget.cpp"
 #include "JSFetchBody.cpp"

Modified: trunk/Source/WebCore/DerivedSources.make (206962 => 206963)


--- trunk/Source/WebCore/DerivedSources.make	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/DerivedSources.make	2016-10-09 00:03:14 UTC (rev 206963)
@@ -286,6 +286,7 @@
     $(WebCore)/dom/ClientRect.idl \
     $(WebCore)/dom/ClientRectList.idl \
     $(WebCore)/dom/Comment.idl \
+    $(WebCore)/dom/ClipboardEvent.idl \
     $(WebCore)/dom/CompositionEvent.idl \
     $(WebCore)/dom/CustomElementRegistry.idl \
     $(WebCore)/dom/CustomEvent.idl \
@@ -307,6 +308,7 @@
     $(WebCore)/dom/Element.idl \
     $(WebCore)/dom/ErrorEvent.idl \
     $(WebCore)/dom/Event.idl \
+    $(WebCore)/dom/EventInit.idl \
     $(WebCore)/dom/EventListener.idl \
     $(WebCore)/dom/EventTarget.idl \
     $(WebCore)/dom/FocusEvent.idl \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (206962 => 206963)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-09 00:03:14 UTC (rev 206963)
@@ -2885,6 +2885,11 @@
 		8367587E1C56E99B008A1087 /* JSHTMLDataElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834B86A91C56E93E00F3F0E3 /* JSHTMLDataElement.cpp */; };
 		8367587F1C56E99B008A1087 /* JSHTMLDataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B86A81C56E93E00F3F0E3 /* JSHTMLDataElement.h */; };
 		836C14431CDEAFD80073493F /* JSXPathNSResolverCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836C14421CDEAFCA0073493F /* JSXPathNSResolverCustom.cpp */; };
+		836D032A1DA89B9200FFD96B /* EventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 836D03281DA89B7300FFD96B /* EventInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		836D032F1DA8A13A00FFD96B /* JSEventInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836D032B1DA8A13200FFD96B /* JSEventInit.cpp */; };
+		836D03301DA8A13D00FFD96B /* JSEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 836D032C1DA8A13200FFD96B /* JSEventInit.h */; };
+		836D03311DA8A13F00FFD96B /* JSClipboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836D032D1DA8A13200FFD96B /* JSClipboardEvent.cpp */; };
+		836D03321DA8A14200FFD96B /* JSClipboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 836D032E1DA8A13200FFD96B /* JSClipboardEvent.h */; };
 		836DAA061CEAB80D00A2B707 /* RenderDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 836DAA051CEAB7CD00A2B707 /* RenderDescendantIterator.h */; };
 		836FBCEA178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */; };
 		836FBCEC178C117F00B21A15 /* SVGAnimatedProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */; };
@@ -10014,6 +10019,13 @@
 		835F8B261D2D90BA00E408EC /* Slotable.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Slotable.idl; sourceTree = "<group>"; };
 		8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NonDocumentTypeChildNode.idl; sourceTree = "<group>"; };
 		836C14421CDEAFCA0073493F /* JSXPathNSResolverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathNSResolverCustom.cpp; sourceTree = "<group>"; };
+		836D03271DA89B7300FFD96B /* ClipboardEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ClipboardEvent.idl; sourceTree = "<group>"; };
+		836D03281DA89B7300FFD96B /* EventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventInit.h; sourceTree = "<group>"; };
+		836D03291DA89B7300FFD96B /* EventInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventInit.idl; sourceTree = "<group>"; };
+		836D032B1DA8A13200FFD96B /* JSEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventInit.cpp; sourceTree = "<group>"; };
+		836D032C1DA8A13200FFD96B /* JSEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventInit.h; sourceTree = "<group>"; };
+		836D032D1DA8A13200FFD96B /* JSClipboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClipboardEvent.cpp; sourceTree = "<group>"; };
+		836D032E1DA8A13200FFD96B /* JSClipboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSClipboardEvent.h; sourceTree = "<group>"; };
 		836DAA051CEAB7CD00A2B707 /* RenderDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderDescendantIterator.h; sourceTree = "<group>"; };
 		836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedTypeAnimator.cpp; sourceTree = "<group>"; };
 		836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedProperty.cpp; sourceTree = "<group>"; };
@@ -19675,6 +19687,8 @@
 				BC946347107A936600857193 /* JSBeforeLoadEvent.h */,
 				8225432CA9D4B4CF4628EC7F /* JSBeforeUnloadEvent.cpp */,
 				29E04A27BED2F81F98E9022B /* JSBeforeUnloadEvent.h */,
+				836D032D1DA8A13200FFD96B /* JSClipboardEvent.cpp */,
+				836D032E1DA8A13200FFD96B /* JSClipboardEvent.h */,
 				79AC9216109945C80021266E /* JSCompositionEvent.cpp */,
 				79AC9217109945C80021266E /* JSCompositionEvent.h */,
 				E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */,
@@ -19683,6 +19697,8 @@
 				2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */,
 				14E8378309F85D1C00B85AE4 /* JSEvent.cpp */,
 				14E8378D09F85D4F00B85AE4 /* JSEvent.h */,
+				836D032B1DA8A13200FFD96B /* JSEventInit.cpp */,
+				836D032C1DA8A13200FFD96B /* JSEventInit.h */,
 				C6A703325C9D0B6CDCBC4D78 /* JSEventTarget.cpp */,
 				5FC7DC26CFE2563200B85AE5 /* JSEventTarget.h */,
 				B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */,
@@ -22981,6 +22997,7 @@
 				BCC0657C0F3CE1B700CD2D87 /* ClientRectList.idl */,
 				85031B290A44EFC700F992E0 /* ClipboardEvent.cpp */,
 				85031B2A0A44EFC700F992E0 /* ClipboardEvent.h */,
+				836D03271DA89B7300FFD96B /* ClipboardEvent.idl */,
 				9BD8A95918BEFC7600987E9A /* CollectionIndexCache.cpp */,
 				E425A49918292B840020CFCF /* CollectionIndexCache.h */,
 				6550B697099DF0270090D781 /* Comment.cpp */,
@@ -23101,6 +23118,8 @@
 				4138D3331244054800323D33 /* EventContext.h */,
 				418A06CF133C04D500CD379C /* EventDispatcher.cpp */,
 				418A06CE133C04D500CD379C /* EventDispatcher.h */,
+				836D03281DA89B7300FFD96B /* EventInit.h */,
+				836D03291DA89B7300FFD96B /* EventInit.idl */,
 				935FBC4409BA00B900E230B1 /* EventListener.h */,
 				85AFA7410AAF298400E84305 /* EventListener.idl */,
 				AD4495F1141FC08900541EDF /* EventListenerMap.cpp */,
@@ -25276,6 +25295,7 @@
 				8A9A588811E84F37008ACFD1 /* JSPerformanceTiming.h in Headers */,
 				FDEA6247152102FC00479DF0 /* JSPeriodicWave.h in Headers */,
 				93B70D6C09EB0C7C009D8468 /* JSPluginElementFunctions.h in Headers */,
+				836D03301DA8A13D00FFD96B /* JSEventInit.h in Headers */,
 				5189F01E10B37BD900F3C739 /* JSPopStateEvent.h in Headers */,
 				598365DD1355F557001B185D /* JSPositionCallback.h in Headers */,
 				FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */,
@@ -26158,6 +26178,7 @@
 				BCE32B9C1517C0B200F542EC /* RenderMultiColumnSet.h in Headers */,
 				94DE5C921D83011D00164F2A /* CSSSupportsParser.h in Headers */,
 				BC1A7D9818FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h in Headers */,
+				836D032A1DA89B9200FFD96B /* EventInit.h in Headers */,
 				8AC822FD180FC03300FB64D5 /* RenderNamedFlowFragment.h in Headers */,
 				BC85F23D151915E000BC17BE /* RenderNamedFlowThread.h in Headers */,
 				BCEA4880097D93020094C9E4 /* RenderObject.h in Headers */,
@@ -26956,6 +26977,7 @@
 				9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */,
 				A863E2011343412000274926 /* UnicodeBidi.h in Headers */,
 				518864E11BBAF57400E540C9 /* UniqueIDBDatabase.h in Headers */,
+				836D03321DA8A14200FFD96B /* JSClipboardEvent.h in Headers */,
 				5198F7A51BBDB79300E2CC5F /* UniqueIDBDatabaseConnection.h in Headers */,
 				5198F7A91BBDD38500E2CC5F /* UniqueIDBDatabaseTransaction.h in Headers */,
 				E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */,
@@ -28127,6 +28149,7 @@
 				9BAB6C6D12550631001626D4 /* EditingStyle.cpp in Sources */,
 				4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */,
 				9B55EEE91B3E8898005342BC /* EditorCocoa.mm in Sources */,
+				836D032F1DA8A13A00FFD96B /* JSEventInit.cpp in Sources */,
 				93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */,
 				FED13D3A0CEA934600D89466 /* EditorIOS.mm in Sources */,
 				ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */,
@@ -30492,6 +30515,7 @@
 				3140379C124BEA7F00AF40E4 /* WebCoreMotionManager.mm in Sources */,
 				CDC979F41C498C0900DB50D4 /* WebCoreNSErrorExtras.mm in Sources */,
 				934D9BA50B8C116B007B42A9 /* WebCoreNSStringExtras.mm in Sources */,
+				836D03311DA8A13F00FFD96B /* JSClipboardEvent.cpp in Sources */,
 				C5B4C24E1509236C00A6EF37 /* WebCoreNSURLExtras.mm in Sources */,
 				CD225C0B1C46FBF400140761 /* WebCoreNSURLSession.mm in Sources */,
 				B50F5B810E96CD9900AD71A6 /* WebCoreObjCExtras.mm in Sources */,

Modified: trunk/Source/WebCore/bindings/js/JSEventCustom.cpp (206962 => 206963)


--- trunk/Source/WebCore/bindings/js/JSEventCustom.cpp	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/bindings/js/JSEventCustom.cpp	2016-10-09 00:03:14 UTC (rev 206963)
@@ -43,11 +43,6 @@
 
 namespace WebCore {
 
-JSValue JSEvent::clipboardData(ExecState& state) const
-{
-    return wrapped().isClipboardEvent() ? toJS(&state, globalObject(), wrapped().clipboardData()) : jsUndefined();
-}
-
 #define TRY_TO_WRAP_WITH_INTERFACE(interfaceName) \
     case interfaceName##InterfaceType: \
         return createWrapper<interfaceName>(globalObject, WTFMove(event));

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (206962 => 206963)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-10-09 00:03:14 UTC (rev 206963)
@@ -3991,6 +3991,7 @@
     return 1 if defined $automaticallyGeneratedDefaultValue && $automaticallyGeneratedDefaultValue eq $defaultValue;
 
     return 1 if $defaultValue eq "null" && $codeGenerator->IsWrapperType($parameterType);
+    return 1 if $defaultValue eq "[]" && $codeGenerator->IsDictionaryType($parameterType);
 
     return 0;
 }

Modified: trunk/Source/WebCore/dom/ClipboardEvent.cpp (206962 => 206963)


--- trunk/Source/WebCore/dom/ClipboardEvent.cpp	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/dom/ClipboardEvent.cpp	2016-10-09 00:03:14 UTC (rev 206963)
@@ -28,8 +28,9 @@
 
 namespace WebCore {
 
-ClipboardEvent::ClipboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DataTransfer* dataTransfer)
-    : Event(eventType, canBubble, cancelable), m_dataTransfer(dataTransfer)
+ClipboardEvent::ClipboardEvent(const AtomicString& type, const Init& init, IsTrusted isTrusted)
+    : Event(type, init, isTrusted)
+    , m_clipboardData(init.clipboardData)
 {
 }
 
@@ -39,8 +40,7 @@
 
 EventInterface ClipboardEvent::eventInterface() const
 {
-    // Notice that there is no ClipboardEvent.idl.
-    return EventInterfaceType;
+    return ClipboardEventInterfaceType;
 }
 
 bool ClipboardEvent::isClipboardEvent() const

Modified: trunk/Source/WebCore/dom/ClipboardEvent.h (206962 => 206963)


--- trunk/Source/WebCore/dom/ClipboardEvent.h	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/dom/ClipboardEvent.h	2016-10-09 00:03:14 UTC (rev 206963)
@@ -28,28 +28,39 @@
 
 namespace WebCore {
 
-    class DataTransfer;
+class DataTransfer;
 
-    class ClipboardEvent final : public Event {
-    public:
-        virtual ~ClipboardEvent();
+class ClipboardEvent final : public Event {
+public:
+    virtual ~ClipboardEvent();
 
-        static Ref<ClipboardEvent> create(const AtomicString& type, bool canBubbleArg, bool cancelableArg, DataTransfer* clipboardArg)
+    struct Init : public EventInit {
+        Init(bool bubbles, bool cancelable, bool composed, RefPtr<DataTransfer>&& clipboardData)
+            : EventInit(bubbles, cancelable, composed)
+            , clipboardData(WTFMove(clipboardData))
         {
-            return adoptRef(*new ClipboardEvent(type, canBubbleArg, cancelableArg, clipboardArg));
         }
 
-        DataTransfer* internalDataTransfer() const override { return m_dataTransfer.get(); }
+        RefPtr<DataTransfer> clipboardData;
+    };
 
-    private:
-        ClipboardEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, DataTransfer*);
+    static Ref<ClipboardEvent> create(const AtomicString& type, const Init& init, IsTrusted isTrusted = IsTrusted::No)
+    {
+        auto event = adoptRef(*new ClipboardEvent(type, init, isTrusted));
+        return event;
+    }
 
-        EventInterface eventInterface() const override;
-        bool isClipboardEvent() const override;
+    DataTransfer* clipboardData() const { return m_clipboardData.get(); }
 
-        RefPtr<DataTransfer> m_dataTransfer;
-    };
+private:
+    ClipboardEvent(const AtomicString& type, const Init&, IsTrusted);
 
+    EventInterface eventInterface() const final;
+    bool isClipboardEvent() const final;
+
+    RefPtr<DataTransfer> m_clipboardData;
+};
+
 } // namespace WebCore
 
 #endif // ClipboardEvent_h

Added: trunk/Source/WebCore/dom/ClipboardEvent.idl (0 => 206963)


--- trunk/Source/WebCore/dom/ClipboardEvent.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/ClipboardEvent.idl	2016-10-09 00:03:14 UTC (rev 206963)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+[
+    Constructor(DOMString type, optional ClipboardEventInit eventInitDict)
+] interface ClipboardEvent : Event {
+    readonly attribute DataTransfer? clipboardData;
+};
+
+dictionary ClipboardEventInit : EventInit {
+    DataTransfer? clipboardData = null;
+};

Modified: trunk/Source/WebCore/dom/Event.cpp (206962 => 206963)


--- trunk/Source/WebCore/dom/Event.cpp	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/dom/Event.cpp	2016-10-09 00:03:14 UTC (rev 206963)
@@ -56,12 +56,13 @@
 {
 }
 
-Event::Event(const AtomicString& eventType, const EventInit& initializer)
+Event::Event(const AtomicString& eventType, const EventInit& initializer, IsTrusted isTrusted)
     : m_type(eventType)
     , m_isInitialized(true)
     , m_canBubble(initializer.bubbles)
     , m_cancelable(initializer.cancelable)
     , m_composed(initializer.composed)
+    , m_isTrusted(isTrusted == IsTrusted::Yes)
     , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
 {
 }

Modified: trunk/Source/WebCore/dom/Event.h (206962 => 206963)


--- trunk/Source/WebCore/dom/Event.h	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/dom/Event.h	2016-10-09 00:03:14 UTC (rev 206963)
@@ -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; }

Modified: trunk/Source/WebCore/dom/Event.idl (206962 => 206963)


--- trunk/Source/WebCore/dom/Event.idl	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/dom/Event.idl	2016-10-09 00:03:14 UTC (rev 206963)
@@ -71,6 +71,4 @@
     readonly attribute EventTarget srcElement;
     [ImplementedAs=legacyReturnValue] attribute boolean returnValue;
     attribute boolean cancelBubble;
-
-    [Custom] readonly attribute DataTransfer clipboardData;
 };

Added: trunk/Source/WebCore/dom/EventInit.h (0 => 206963)


--- trunk/Source/WebCore/dom/EventInit.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/EventInit.h	2016-10-09 00:03:14 UTC (rev 206963)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+struct EventInit {
+    EventInit() = default;
+    EventInit(bool bubbles, bool cancelable, bool composed)
+        : bubbles(bubbles)
+        , cancelable(cancelable)
+        , composed(composed)
+    { }
+
+    bool bubbles { false };
+    bool cancelable { false };
+    bool composed { false };
+};
+
+}

Added: trunk/Source/WebCore/dom/EventInit.idl (0 => 206963)


--- trunk/Source/WebCore/dom/EventInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/EventInit.idl	2016-10-09 00:03:14 UTC (rev 206963)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+dictionary EventInit {
+    boolean bubbles = false;
+    boolean cancelable = false;
+    boolean composed = false;
+};

Modified: trunk/Source/WebCore/dom/EventNames.in (206962 => 206963)


--- trunk/Source/WebCore/dom/EventNames.in	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/dom/EventNames.in	2016-10-09 00:03:14 UTC (rev 206963)
@@ -6,6 +6,7 @@
 AnimationEvent
 BeforeLoadEvent
 BeforeUnloadEvent
+ClipboardEvent
 CloseEvent
 CompositionEvent
 CustomEvent

Modified: trunk/Source/WebCore/dom/MouseEvent.h (206962 => 206963)


--- trunk/Source/WebCore/dom/MouseEvent.h	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/dom/MouseEvent.h	2016-10-09 00:03:14 UTC (rev 206963)
@@ -89,9 +89,7 @@
     WEBCORE_EXPORT Node* toElement() const;
     WEBCORE_EXPORT Node* fromElement() const;
 
-    // FIXME: These functions can be merged if m_dataTransfer is only initialized for drag events.
     DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.get() : nullptr; }
-    DataTransfer* internalDataTransfer() const override { return m_dataTransfer.get(); }
 
     EventInterface eventInterface() const override;
 

Modified: trunk/Source/WebCore/editing/Editor.cpp (206962 => 206963)


--- trunk/Source/WebCore/editing/Editor.cpp	2016-10-08 23:17:05 UTC (rev 206962)
+++ trunk/Source/WebCore/editing/Editor.cpp	2016-10-09 00:03:14 UTC (rev 206963)
@@ -883,7 +883,7 @@
 
     RefPtr<DataTransfer> dataTransfer = DataTransfer::createForCopyAndPaste(policy);
 
-    Ref<Event> event = ClipboardEvent::create(eventType, true, true, dataTransfer.get());
+    auto event = ClipboardEvent::create(eventType, { true, true, false, dataTransfer.get() }, Event::IsTrusted::Yes);
     target->dispatchEvent(event);
     bool noDefaultProcessing = event->defaultPrevented();
     if (noDefaultProcessing && policy == DataTransferAccessPolicy::Writable) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to