Title: [206843] trunk
Revision
206843
Author
wenson_hs...@apple.com
Date
2016-10-05 21:05:35 -0700 (Wed, 05 Oct 2016)

Log Message

Introduce InputEvent bindings in preparation for the input events spec
https://bugs.webkit.org/show_bug.cgi?id=162954

Reviewed by Ryosuke Niwa.

Source/WebCore:

Creates new bindings for InputEvent. Also introduces a runtime switch that allows Node to dispatch InputEvents
rather than generic events of type 'input'. Adds a new test verifying that when the switch is enabled, inputs
and contenteditable divs fire these new InputEvents on input. So far, only inputType is a part of the object
prototype, since we will be implementing this first. getTargetRanges() will follow once the finer details of
StaticRange are hashed out. See https://bugs.webkit.org/show_bug.cgi?id=162947 for more details.

Tests: fast/events/input-events-fired-when-typing.html
       fast/events/ios/input-events-fired-when-typing-in-contenteditable.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:
* dom/Event.cpp:
(WebCore::Event::composed):
(WebCore::Event::isInputEvent):
* dom/Event.h:
* dom/EventNames.in:
* dom/InputEvent.cpp: Added.
(WebCore::InputEvent::InputEvent):
* dom/InputEvent.h: Added.
* dom/InputEvent.idl: Added.
* dom/Node.cpp:
(WebCore::Node::dispatchInputEvent):
(WebCore::Node::defaultEventHandler):
* dom/Node.h:
* editing/Editor.cpp:
(WebCore::Editor::setBaseWritingDirection):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setEditingValue):
(WebCore::HTMLInputElement::setValueFromRenderer):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::listBoxOnChange):
(WebCore::HTMLSelectElement::dispatchChangeEventForMenuList):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTimelineElement::defaultEventHandler):
* page/Settings.in:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebKit2:

Adds a new runtime switch for enabling InputEvents.

* Shared/WebPreferencesDefinitions.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests:

Adds a new test verifying that InputEvents are fired when the runtime switch for input events is enabled.

* fast/events/input-events-fired-when-typing-expected.txt: Added.
* fast/events/input-events-fired-when-typing.html: Added.
* fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt: Added.
* fast/events/ios/input-events-fired-when-typing-in-contenteditable.html: Added.
* js/dom/global-constructors-attributes-expected.txt:
* platform/gtk/js/dom/global-constructors-attributes-expected.txt:
* platform/ios-simulator/TestExpectations:
* 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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206842 => 206843)


--- trunk/LayoutTests/ChangeLog	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/LayoutTests/ChangeLog	2016-10-06 04:05:35 UTC (rev 206843)
@@ -1,3 +1,23 @@
+2016-10-05  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Introduce InputEvent bindings in preparation for the input events spec
+        https://bugs.webkit.org/show_bug.cgi?id=162954
+
+        Reviewed by Ryosuke Niwa.
+
+        Adds a new test verifying that InputEvents are fired when the runtime switch for input events is enabled.
+
+        * fast/events/input-events-fired-when-typing-expected.txt: Added.
+        * fast/events/input-events-fired-when-typing.html: Added.
+        * fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt: Added.
+        * fast/events/ios/input-events-fired-when-typing-in-contenteditable.html: Added.
+        * js/dom/global-constructors-attributes-expected.txt:
+        * platform/gtk/js/dom/global-constructors-attributes-expected.txt:
+        * platform/ios-simulator/TestExpectations:
+        * 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:
+
 2016-10-05  Gyuyoung Kim  <gyuyoung....@navercorp.com>
 
         [EFL] Mark timeout tests to *Timeout*

Added: trunk/LayoutTests/fast/events/input-events-fired-when-typing-expected.txt (0 => 206843)


--- trunk/LayoutTests/fast/events/input-events-fired-when-typing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/input-events-fired-when-typing-expected.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -0,0 +1,17 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS event.__lookupGetter__('inputType') is defined.
+PASS Object.getPrototypeOf(event) is InputEvent.prototype
+PASS event.target.id is expectedTargetID
+PASS event.bubbles is true
+PASS event.cancelable is false
+PASS event.composed is true
+PASS event.__lookupGetter__('inputType') is defined.
+PASS Object.getPrototypeOf(event) is InputEvent.prototype
+PASS event.target.id is expectedTargetID
+PASS event.bubbles is true
+PASS event.cancelable is false
+PASS event.composed is true
+a
+

Added: trunk/LayoutTests/fast/events/input-events-fired-when-typing.html (0 => 206843)


--- trunk/LayoutTests/fast/events/input-events-fired-when-typing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/input-events-fired-when-typing.html	2016-10-06 04:05:35 UTC (rev 206843)
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+
+<head>
+    <script src=""
+    <script>
+        var expectedTargetID = "foo";
+
+        function contentEditable()
+        {
+            return document.querySelector("#foo");
+        }
+
+        function plainText()
+        {
+            return document.querySelector("#bar");
+        }
+
+        function beginTest()
+        {
+            if (!window.eventSender || !window.internals || !window.testRunner)
+                return;
+
+            internals.settings.setInputEventsEnabled(true);
+            testRunner.dumpAsText();
+            contentEditable().focus();
+            eventSender.keyDown("a", []);
+
+            expectedTargetID = "bar";
+            plainText().focus();
+            eventSender.keyDown("b", []);
+        }
+
+        function checkInputEvent(event)
+        {
+            shouldBeDefined("event.__lookupGetter__('inputType')");
+            shouldBe("Object.getPrototypeOf(event)", "InputEvent.prototype");
+            shouldBe("event.target.id", "expectedTargetID");
+            shouldBe("event.bubbles", "true");
+            shouldBe("event.cancelable", "false");
+            shouldBe("event.composed", "true");
+        }
+    </script>
+</head>
+
+<body _onload_=beginTest()>
+    <div id="foo" contenteditable _oninput_=checkInputEvent(event)></div>
+    <input id="bar" _oninput_=checkInputEvent(event)></input>
+    <script src=""
+</body>
+
+</html>

Added: trunk/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt (0 => 206843)


--- trunk/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -0,0 +1,10 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE 
+Does the event have an inputType method? YES
+Does the event have InputEvent's prototype? YES
+What is the event's id? editable
+Does the event bubble? YES
+Is the event cancelable? NO
+Is the event composed? YES
+

Added: trunk/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable.html (0 => 206843)


--- trunk/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable.html	2016-10-06 04:05:35 UTC (rev 206843)
@@ -0,0 +1,77 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+
+<head>
+    <script src=""
+    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
+    <script id="ui-script" type="text/plain">
+        (function() {
+            uiController.didShowKeyboardCallback = function() {
+                uiController.typeCharacterUsingHardwareKeyboard(" ", function() {
+                    uiController.uiScriptComplete();
+                });
+            }
+            uiController.singleTapAtPoint(100, 100, function() {});
+        })();
+    </script>
+
+    <script>
+        var progress = 0;
+
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+            internals.settings.setInputEventsEnabled(true);
+        }
+
+        function incrementProgress()
+        {
+            progress++;
+            if (progress == 2)
+                testRunner.notifyDone();
+        }
+
+        function getUIScript()
+        {
+            return document.getElementById("ui-script").text;
+        }
+
+        function runTest()
+        {
+            if (!window.testRunner || !testRunner.runUIScript)
+                return;
+
+            testRunner.runUIScript(getUIScript(), function(result) {
+                incrementProgress();
+            });
+        }
+
+        function yesno(b) { return b ? "YES" : "NO"; }
+
+        function handleInput(event)
+        {
+            debug("Does the event have an inputType method? " + yesno(event.__lookupGetter__("inputType")));
+            debug("Does the event have InputEvent's prototype? " + yesno(Object.getPrototypeOf(event) === InputEvent.prototype));
+            debug("What is the event's id? " + event.target.id);
+            debug("Does the event bubble? " + yesno(event.bubbles));
+            debug("Is the event cancelable? " + yesno(event.cancelable));
+            debug("Is the event composed? " + yesno(event.composed));
+            incrementProgress();
+        }
+    </script>
+    <style>
+    #editable {
+        width: 100vw;
+        height: 100vh;
+    }
+    </style>
+</head>
+
+<body style="margin: 0;" _onload_=runTest()>
+    <div contenteditable id="editable" _oninput_=handleInput(event)>
+    <div id="console"></div>
+    <script src=""
+</body>
+
+</html>

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


--- trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/LayoutTests/js/dom/global-constructors-attributes-expected.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -798,6 +798,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').value is InputEvent
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'KeyboardEvent').value is KeyboardEvent
 PASS Object.getOwnPropertyDescriptor(global, 'KeyboardEvent').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'KeyboardEvent').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt (206842 => 206843)


--- trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -893,6 +893,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').value is InputEvent
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').value is Int16Array
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('set') is false

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (206842 => 206843)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-10-06 04:05:35 UTC (rev 206843)
@@ -1197,6 +1197,7 @@
 fast/events/frame-tab-focus.html [ Failure ]
 fast/events/ime-composition-events-001.html [ Failure ]
 fast/events/inputText-never-fired-on-keydown-cancel.html [ Failure ]
+fast/events/input-events-fired-when-typing.html [ Failure ]
 fast/events/key-events-in-input-button.html [ Failure ]
 fast/events/keydown-1.html [ Failure ]
 fast/events/keydown-leftright-keys.html [ Failure ]

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


--- trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -913,6 +913,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').value is InputEvent
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').value is Int16Array
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('set') is false

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


--- trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -898,6 +898,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').value is InputEvent
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').value is Int16Array
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('set') is false

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


--- trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -913,6 +913,11 @@
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ImageData').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').value is InputEvent
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'InputEvent').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').value is Int16Array
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Int16Array').hasOwnProperty('set') is false

Modified: trunk/Source/WebCore/CMakeLists.txt (206842 => 206843)


--- trunk/Source/WebCore/CMakeLists.txt	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-10-06 04:05:35 UTC (rev 206843)
@@ -400,6 +400,7 @@
     dom/FocusEvent.idl
     dom/GlobalEventHandlers.idl
     dom/HashChangeEvent.idl
+    dom/InputEvent.idl
     dom/KeyboardEvent.idl
     dom/MessageChannel.idl
     dom/MessageEvent.idl
@@ -1445,6 +1446,7 @@
     dom/IdTargetObserver.cpp
     dom/IdTargetObserverRegistry.cpp
     dom/InlineStyleSheetOwner.cpp
+    dom/InputEvent.cpp
     dom/KeyboardEvent.cpp
     dom/LiveNodeList.cpp
     dom/LoadableClassicScript.cpp

Modified: trunk/Source/WebCore/ChangeLog (206842 => 206843)


--- trunk/Source/WebCore/ChangeLog	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/ChangeLog	2016-10-06 04:05:35 UTC (rev 206843)
@@ -1,3 +1,56 @@
+2016-10-05  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Introduce InputEvent bindings in preparation for the input events spec
+        https://bugs.webkit.org/show_bug.cgi?id=162954
+
+        Reviewed by Ryosuke Niwa.
+
+        Creates new bindings for InputEvent. Also introduces a runtime switch that allows Node to dispatch InputEvents
+        rather than generic events of type 'input'. Adds a new test verifying that when the switch is enabled, inputs
+        and contenteditable divs fire these new InputEvents on input. So far, only inputType is a part of the object
+        prototype, since we will be implementing this first. getTargetRanges() will follow once the finer details of
+        StaticRange are hashed out. See https://bugs.webkit.org/show_bug.cgi?id=162947 for more details.
+
+        Tests: fast/events/input-events-fired-when-typing.html
+               fast/events/ios/input-events-fired-when-typing-in-contenteditable.html
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMAllInOne.cpp:
+        * dom/Event.cpp:
+        (WebCore::Event::composed):
+        (WebCore::Event::isInputEvent):
+        * dom/Event.h:
+        * dom/EventNames.in:
+        * dom/InputEvent.cpp: Added.
+        (WebCore::InputEvent::InputEvent):
+        * dom/InputEvent.h: Added.
+        * dom/InputEvent.idl: Added.
+        * dom/Node.cpp:
+        (WebCore::Node::dispatchInputEvent):
+        (WebCore::Node::defaultEventHandler):
+        * dom/Node.h:
+        * editing/Editor.cpp:
+        (WebCore::Editor::setBaseWritingDirection):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setEditingValue):
+        (WebCore::HTMLInputElement::setValueFromRenderer):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::listBoxOnChange):
+        (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTimelineElement::defaultEventHandler):
+        * page/Settings.in:
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::Backup::Backup):
+        (WebCore::InternalSettings::Backup::restoreTo):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2016-10-05  Alex Christensen  <achristen...@webkit.org>
 
         URLParser should parse IPv4 addresses as the last two pieces of an IPv6 address

Modified: trunk/Source/WebCore/DerivedSources.cpp (206842 => 206843)


--- trunk/Source/WebCore/DerivedSources.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/DerivedSources.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -309,6 +309,7 @@
 #include "JSIDBVersionChangeEvent.cpp"
 #endif
 #include "JSImageData.cpp"
+#include "JSInputEvent.cpp"
 #include "JSInspectorFrontendHost.cpp"
 #include "JSKeyboardEvent.cpp"
 #include "JSLocation.cpp"

Modified: trunk/Source/WebCore/DerivedSources.make (206842 => 206843)


--- trunk/Source/WebCore/DerivedSources.make	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/DerivedSources.make	2016-10-06 04:05:35 UTC (rev 206843)
@@ -311,6 +311,7 @@
     $(WebCore)/dom/FocusEvent.idl \
     $(WebCore)/dom/GlobalEventHandlers.idl \
     $(WebCore)/dom/HashChangeEvent.idl \
+    $(WebCore)/dom/InputEvent.idl \
     $(WebCore)/dom/KeyboardEvent.idl \
     $(WebCore)/dom/MessageChannel.idl \
     $(WebCore)/dom/MessageEvent.idl \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (206842 => 206843)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-06 04:05:35 UTC (rev 206843)
@@ -1267,6 +1267,8 @@
 		2EA768040FE7126400AB9C8A /* WorkerScriptLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */; };
 		2EB4BCD2121F03E300EC4885 /* BlobResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */; };
 		2EB4BCD3121F03E300EC4885 /* BlobResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */; };
+		2EB767561DA19B99003E23B5 /* InputEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EB767551DA19B99003E23B5 /* InputEvent.cpp */; };
+		2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB767541DA19B67003E23B5 /* InputEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2EBBC3D81B65988300F5253D /* WheelEventDeltaFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2EC41DE41C0410A300D294FE /* RealtimeMediaSourceSupportedConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EC41DE21C0410A300D294FE /* RealtimeMediaSourceSupportedConstraints.cpp */; };
 		2ECF7ADC10162B3800427DE7 /* JSErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */; };
@@ -4067,7 +4069,9 @@
 		A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CB09DA2B47009633A5 /* JSMouseEvent.h */; };
 		A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */; };
 		A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */; };
+		A86629D309DA2B48009633A6 /* JSInputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CD09DA2B47009633A6 /* JSInputEvent.h */; };
 		A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */; };
+		A86629D409DA2B48009633A6 /* JSInputEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CE09DA2B47009633A6 /* JSInputEvent.cpp */; };
 		A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */; };
 		A871D4580A127CBC00B12A68 /* HTMLParamElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8200,6 +8204,9 @@
 		2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptLoaderClient.h; sourceTree = "<group>"; };
 		2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobResourceHandle.cpp; sourceTree = "<group>"; };
 		2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobResourceHandle.h; sourceTree = "<group>"; };
+		2EB767531DA19313003E23B5 /* InputEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = InputEvent.idl; sourceTree = "<group>"; };
+		2EB767541DA19B67003E23B5 /* InputEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputEvent.h; path = dom/InputEvent.h; sourceTree = SOURCE_ROOT; };
+		2EB767551DA19B99003E23B5 /* InputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputEvent.cpp; sourceTree = "<group>"; };
 		2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventDeltaFilter.h; sourceTree = "<group>"; };
 		2EC41DE21C0410A300D294FE /* RealtimeMediaSourceSupportedConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeMediaSourceSupportedConstraints.cpp; sourceTree = "<group>"; };
 		2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorEvent.cpp; sourceTree = "<group>"; };
@@ -11354,7 +11361,9 @@
 		A86629CB09DA2B47009633A5 /* JSMouseEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSMouseEvent.h; sourceTree = "<group>"; };
 		A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEvent.cpp; sourceTree = "<group>"; };
 		A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSKeyboardEvent.h; sourceTree = "<group>"; };
+		A86629CD09DA2B47009633A6 /* JSInputEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSInputEvent.h; sourceTree = "<group>"; };
 		A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyboardEvent.cpp; sourceTree = "<group>"; };
+		A86629CE09DA2B47009633A6 /* JSInputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSInputEvent.cpp; sourceTree = "<group>"; };
 		A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInElement.h; sourceTree = "<group>"; };
 		A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInElement.cpp; sourceTree = "<group>"; };
 		A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParamElement.h; sourceTree = "<group>"; };
@@ -19664,6 +19673,8 @@
 				0FDA7C1D188322FC00C954B5 /* JSGestureEvent.h */,
 				8482B74F1198CB6B00BFB005 /* JSHashChangeEvent.cpp */,
 				8482B7501198CB6B00BFB005 /* JSHashChangeEvent.h */,
+				A86629CE09DA2B47009633A6 /* JSInputEvent.cpp */,
+				A86629CD09DA2B47009633A6 /* JSInputEvent.h */,
 				A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */,
 				A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */,
 				E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */,
@@ -23110,6 +23121,9 @@
 				467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */,
 				AA4C3A740B2B1679002334A2 /* InlineStyleSheetOwner.cpp */,
 				AA4C3A750B2B1679002334A2 /* InlineStyleSheetOwner.h */,
+				2EB767551DA19B99003E23B5 /* InputEvent.cpp */,
+				2EB767541DA19B67003E23B5 /* InputEvent.h */,
+				2EB767531DA19313003E23B5 /* InputEvent.idl */,
 				85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */,
 				85031B2E0A44EFC700F992E0 /* KeyboardEvent.h */,
 				14CF7C2009F7110600EB3665 /* KeyboardEvent.idl */,
@@ -25168,6 +25182,7 @@
 				BC6C49F40D7DBA0500FFA558 /* JSImageConstructor.h in Headers */,
 				A77979290D6B9E64003851B9 /* JSImageData.h in Headers */,
 				7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */,
+				A86629D309DA2B48009633A6 /* JSInputEvent.h in Headers */,
 				A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */,
 				12A253E11C8FFF6600C22295 /* JSKeyframeEffect.h in Headers */,
 				935F45430F7C3B5F00D7C1FB /* JSLazyEventListener.h in Headers */,
@@ -25793,6 +25808,7 @@
 				854FE7310A2297BE0058D7AD /* NodeFilter.h in Headers */,
 				854FE7330A2297BE0058D7AD /* NodeFilterCondition.h in Headers */,
 				854FE7350A2297BE0058D7AD /* NodeIterator.h in Headers */,
+				2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */,
 				A818721B0977D3C0005826D9 /* NodeList.h in Headers */,
 				63189AE30E83A33300012E41 /* NodeRareData.h in Headers */,
 				63D7B32D0E78CD3F00F7617C /* NodeRenderStyle.h in Headers */,
@@ -27968,6 +27984,7 @@
 				0FDA7C2118832BCC00C954B5 /* DateTimeFormat.cpp in Sources */,
 				F55B3DB71251F12D003EF269 /* DateTimeInputType.cpp in Sources */,
 				F55B3DB91251F12D003EF269 /* DateTimeLocalInputType.cpp in Sources */,
+				2EB767561DA19B99003E23B5 /* InputEvent.cpp in Sources */,
 				0F6A12BD1A00923700C6DE72 /* DebugPageOverlays.cpp in Sources */,
 				45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */,
 				A8C228A211D5722E00D5A7D3 /* DecodedDataDocumentParser.cpp in Sources */,
@@ -28865,6 +28882,7 @@
 				A7D0318E0E93540300E24ACD /* JSImageDataCustom.cpp in Sources */,
 				7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */,
 				7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */,
+				A86629D409DA2B48009633A6 /* JSInputEvent.cpp in Sources */,
 				A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */,
 				12A253E01C8FFF6600C22295 /* JSKeyframeEffect.cpp in Sources */,
 				935F45420F7C3B5F00D7C1FB /* JSLazyEventListener.cpp in Sources */,

Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (206842 => 206843)


--- trunk/Source/WebCore/dom/DOMAllInOne.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -91,6 +91,7 @@
 #include "IdTargetObserver.cpp"
 #include "IdTargetObserverRegistry.cpp"
 #include "InlineStyleSheetOwner.cpp"
+#include "InputEvent.cpp"
 #include "KeyboardEvent.cpp"
 #include "CustomElementReactionQueue.cpp"
 #include "LiveNodeList.cpp"

Modified: trunk/Source/WebCore/dom/Event.cpp (206842 => 206843)


--- trunk/Source/WebCore/dom/Event.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/dom/Event.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -104,7 +104,8 @@
         || isFocusEvent()
         || isKeyboardEvent()
         || isMouseEvent()
-        || isTouchEvent();
+        || isTouchEvent()
+        || isInputEvent();
 }
 
 EventInterface Event::eventInterface() const
@@ -132,6 +133,11 @@
     return false;
 }
 
+bool Event::isInputEvent() const
+{
+    return false;
+}
+
 bool Event::isCompositionEvent() const
 {
     return false;

Modified: trunk/Source/WebCore/dom/Event.h (206842 => 206843)


--- trunk/Source/WebCore/dom/Event.h	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/dom/Event.h	2016-10-06 04:05:35 UTC (rev 206843)
@@ -143,6 +143,7 @@
     virtual bool isMouseEvent() const;
     virtual bool isFocusEvent() const;
     virtual bool isKeyboardEvent() const;
+    virtual bool isInputEvent() const;
     virtual bool isCompositionEvent() const;
     virtual bool isTouchEvent() const;
 

Modified: trunk/Source/WebCore/dom/EventNames.in (206842 => 206843)


--- trunk/Source/WebCore/dom/EventNames.in	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/dom/EventNames.in	2016-10-06 04:05:35 UTC (rev 206843)
@@ -12,6 +12,8 @@
 ErrorEvent
 FocusEvent
 HashChangeEvent
+InputEvent
+InputEvents interfaceName=InputEvent
 KeyboardEvent
 KeyboardEvents interfaceName=KeyboardEvent
 MessageEvent

Added: trunk/Source/WebCore/dom/InputEvent.cpp (0 => 206843)


--- trunk/Source/WebCore/dom/InputEvent.cpp	                        (rev 0)
+++ trunk/Source/WebCore/dom/InputEvent.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "InputEvent.h"
+
+#include "DOMWindow.h"
+#include "EventNames.h"
+#include "NotImplemented.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, int detail)
+    : UIEvent(eventType, canBubble, cancelable, view, detail)
+    , m_inputType(inputType)
+{
+}
+
+InputEvent::InputEvent(const AtomicString& eventType, const InputEventInit& initializer)
+    : UIEvent(eventType, initializer)
+    , m_inputType(initializer.inputType)
+{
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/dom/InputEvent.h (0 => 206843)


--- trunk/Source/WebCore/dom/InputEvent.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/InputEvent.h	2016-10-06 04:05:35 UTC (rev 206843)
@@ -0,0 +1,64 @@
+/*
+ * 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
+
+#include "UIEvent.h"
+
+namespace WebCore {
+
+class DOMWindow;
+class DataTransfer;
+
+struct InputEventInit : public UIEventInit {
+    String inputType;
+};
+
+class InputEvent final : public UIEvent {
+public:
+    static Ref<InputEvent> create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, int detail)
+    {
+        return adoptRef(*new InputEvent(eventType, inputType, canBubble, cancelable, view, detail));
+    }
+
+    static Ref<InputEvent> createForBindings(const AtomicString& type, const InputEventInit& initializer)
+    {
+        return adoptRef(*new InputEvent(type, initializer));
+    }
+
+    InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow*, int detail);
+    InputEvent(const AtomicString& eventType, const InputEventInit&);
+
+    virtual ~InputEvent() { }
+
+    bool isInputEvent() const override { return true; }
+    EventInterface eventInterface() const final { return InputEventInterfaceType; }
+    String inputType() const { return m_inputType.string(); }
+
+private:
+    AtomicString m_inputType;
+};
+
+} // namespace WebCore

Added: trunk/Source/WebCore/dom/InputEvent.idl (0 => 206843)


--- trunk/Source/WebCore/dom/InputEvent.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/InputEvent.idl	2016-10-06 04:05:35 UTC (rev 206843)
@@ -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. ``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.
+*/
+
+[
+    ConstructorTemplate=Event
+] interface InputEvent : UIEvent {
+    [InitializedByEventConstructor] readonly attribute DOMString inputType;
+};

Modified: trunk/Source/WebCore/dom/Node.cpp (206842 => 206843)


--- trunk/Source/WebCore/dom/Node.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/dom/Node.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -47,6 +47,7 @@
 #include "HTMLImageElement.h"
 #include "HTMLSlotElement.h"
 #include "HTMLStyleElement.h"
+#include "InputEvent.h"
 #include "InspectorController.h"
 #include "KeyboardEvent.h"
 #include "Logging.h"
@@ -61,6 +62,7 @@
 #include "RenderTextControl.h"
 #include "RenderView.h"
 #include "ScopedEventQueue.h"
+#include "Settings.h"
 #include "StorageEvent.h"
 #include "StyleResolver.h"
 #include "StyleSheetContents.h"
@@ -2200,9 +2202,12 @@
     return !beforeLoadEvent->defaultPrevented();
 }
 
-void Node::dispatchInputEvent()
+void Node::dispatchInputEvent(const AtomicString& inputType)
 {
-    dispatchScopedEvent(Event::create(eventNames().inputEvent, true, false));
+    if (document().settings()->inputEventsEnabled())
+        dispatchScopedEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, document().defaultView(), 0));
+    else
+        dispatchScopedEvent(Event::create(eventNames().inputEvent, true, false));
 }
 
 void Node::defaultEventHandler(Event& event)
@@ -2268,7 +2273,7 @@
         }
 #endif
     } else if (event.type() == eventNames().webkitEditableContentChangedEvent) {
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
     }
 }
 

Modified: trunk/Source/WebCore/dom/Node.h (206842 => 206843)


--- trunk/Source/WebCore/dom/Node.h	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/dom/Node.h	2016-10-06 04:05:35 UTC (rev 206843)
@@ -525,7 +525,7 @@
 
     bool dispatchBeforeLoadEvent(const String& sourceURL);
 
-    virtual void dispatchInputEvent();
+    virtual void dispatchInputEvent(const AtomicString& inputType);
 
     // Perform the default action for an event.
     virtual void defaultEventHandler(Event&);

Modified: trunk/Source/WebCore/editing/Editor.cpp (206842 => 206843)


--- trunk/Source/WebCore/editing/Editor.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/editing/Editor.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -1660,7 +1660,7 @@
         if (direction == NaturalWritingDirection)
             return;
         downcast<HTMLTextFormControlElement>(*focusedElement).setAttributeWithoutSynchronization(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
-        focusedElement->dispatchInputEvent();
+        focusedElement->dispatchInputEvent(emptyString());
         document().updateStyleIfNeeded();
         return;
     }

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (206842 => 206843)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -326,7 +326,7 @@
 void HTMLFormControlElement::dispatchFormControlInputEvent()
 {
     setChangedSinceLastFormControlChangeEvent(true);
-    HTMLElement::dispatchInputEvent();
+    HTMLElement::dispatchInputEvent(emptyString());
 }
 
 bool HTMLFormControlElement::isDisabledFormControl() const

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (206842 => 206843)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -1015,7 +1015,7 @@
     else
         cacheSelectionInResponseToSetValue(max);
 
-    dispatchInputEvent();
+    dispatchInputEvent(emptyString());
 }
 
 void HTMLInputElement::setValue(const String& value, ExceptionCode& ec, TextFieldEventBehavior eventBehavior)
@@ -1095,7 +1095,7 @@
 
     // Input event is fired by the Node::defaultEventHandler for editable controls.
     if (!isTextField())
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
 
     updateValidity();
 

Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (206842 => 206843)


--- trunk/Source/WebCore/html/HTMLSelectElement.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -669,7 +669,7 @@
     }
 
     if (fireOnChange) {
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
         dispatchFormControlChangeEvent();
     }
 }
@@ -682,7 +682,7 @@
     if (m_lastOnChangeIndex != selected && m_isProcessingUserDrivenChange) {
         m_lastOnChangeIndex = selected;
         m_isProcessingUserDrivenChange = false;
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
         dispatchFormControlChangeEvent();
     }
 }

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (206842 => 206843)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -863,7 +863,7 @@
         return;
 
     double time = value().toDouble();
-    if (event.type() == eventNames().inputEvent && time != mediaController()->currentTime())
+    if ((event.isInputEvent() || event.type() == eventNames().inputEvent) && time != mediaController()->currentTime())
         mediaController()->setCurrentTime(time);
 
     RenderSlider& slider = downcast<RenderSlider>(*renderer());

Modified: trunk/Source/WebCore/page/Settings.in (206842 => 206843)


--- trunk/Source/WebCore/page/Settings.in	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/page/Settings.in	2016-10-06 04:05:35 UTC (rev 206843)
@@ -278,5 +278,7 @@
 # Runtime-enabled features
 visualViewportEnabled initial=false
 
+inputEventsEnabled initial=false
+
 quickTimePluginReplacementEnabled initial=defaultQuickTimePluginReplacementEnabled
 youTubeFlashPluginReplacementEnabled initial=defaultYouTubeFlashPluginReplacementEnabled

Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (206842 => 206843)


--- trunk/Source/WebCore/testing/InternalSettings.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -111,6 +111,7 @@
 #if ENABLE(VARIATION_FONTS)
     , m_variationFontsEnabled(settings.variationFontsEnabled())
 #endif
+    , m_inputEventsEnabled(settings.inputEventsEnabled())
     , m_userInterfaceDirectionPolicy(settings.userInterfaceDirectionPolicy())
     , m_systemLayoutDirection(settings.systemLayoutDirection())
     , m_pdfImageCachingPolicy(settings.pdfImageCachingPolicy())
@@ -189,6 +190,7 @@
 #if ENABLE(VARIATION_FONTS)
     settings.setVariationFontsEnabled(m_variationFontsEnabled);
 #endif
+    settings.setInputEventsEnabled(m_inputEventsEnabled);
     settings.setUserInterfaceDirectionPolicy(m_userInterfaceDirectionPolicy);
     settings.setSystemLayoutDirection(m_systemLayoutDirection);
     settings.setPdfImageCachingPolicy(m_pdfImageCachingPolicy);

Modified: trunk/Source/WebCore/testing/InternalSettings.h (206842 => 206843)


--- trunk/Source/WebCore/testing/InternalSettings.h	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/testing/InternalSettings.h	2016-10-06 04:05:35 UTC (rev 206843)
@@ -110,6 +110,7 @@
 #if ENABLE(VARIATION_FONTS)
         bool m_variationFontsEnabled;
 #endif
+        bool m_inputEventsEnabled;
 
         UserInterfaceDirectionPolicy m_userInterfaceDirectionPolicy;
         TextDirection m_systemLayoutDirection;

Modified: trunk/Source/WebCore/testing/InternalSettings.idl (206842 => 206843)


--- trunk/Source/WebCore/testing/InternalSettings.idl	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebCore/testing/InternalSettings.idl	2016-10-06 04:05:35 UTC (rev 206843)
@@ -88,5 +88,7 @@
 
     [MayThrowLegacyException] boolean variationFontsEnabled();
     [MayThrowLegacyException] void setVariationFontsEnabled(boolean enabled);
+
+    void setInputEventsEnabled(boolean enabled);
 };
 

Modified: trunk/Source/WebKit2/ChangeLog (206842 => 206843)


--- trunk/Source/WebKit2/ChangeLog	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebKit2/ChangeLog	2016-10-06 04:05:35 UTC (rev 206843)
@@ -1,3 +1,16 @@
+2016-10-05  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Introduce InputEvent bindings in preparation for the input events spec
+        https://bugs.webkit.org/show_bug.cgi?id=162954
+
+        Reviewed by Ryosuke Niwa.
+
+        Adds a new runtime switch for enabling InputEvents.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-10-05  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Put variation fonts work behind a compile-time flag

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (206842 => 206843)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-10-06 04:05:35 UTC (rev 206843)
@@ -292,6 +292,7 @@
     macro(GamepadsEnabled, gamepadsEnabled, Bool, bool, false, "Gamepads", "Web Gamepad API support") \
     macro(ModernMediaControlsEnabled, modernMediaControlsEnabled, Bool, bool, false, "Modern Media Controls", "Use modern media controls look") \
     macro(VariationFontsEnabled, variationFontsEnabled, Bool, bool, true, "Variation Fonts", "Enable variation fonts") \
+    macro(InputEventsEnabled, inputEventsEnabled, Bool, bool, true, "Input Events", "Enable InputEvents support") \
     macro(VisualViewportEnabled, visualViewportEnabled, Bool, bool, false, "Visual Viewport", "Use Visual Viewport for fixed elements when zooming") \
     macro(WebGL2Enabled, webGL2Enabled, Bool, bool, true, "WebGL 2.0", "WebGL 2 prototype") \
     \

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (206842 => 206843)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-10-06 02:35:12 UTC (rev 206842)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-10-06 04:05:35 UTC (rev 206843)
@@ -3228,6 +3228,8 @@
     settings.setVariationFontsEnabled(store.getBoolValueForKey(WebPreferencesKey::variationFontsEnabledKey()));
 #endif
 
+    settings.setInputEventsEnabled(store.getBoolValueForKey(WebPreferencesKey::inputEventsEnabledKey()));
+
     RuntimeEnabledFeatures::sharedFeatures().setModernMediaControlsEnabled(store.getBoolValueForKey(WebPreferencesKey::modernMediaControlsEnabledKey()));
 
     bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to