Introduce InputEvent bindings in preparation for the input events spec
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 04:05:35 +0000 (04:05 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 04:05:35 +0000 (04:05 +0000)
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206843 268f45cc-cd09-0410-ab3c-d52691b4dbfc

37 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/input-events-fired-when-typing-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/input-events-fired-when-typing.html [new file with mode: 0644]
LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable.html [new file with mode: 0644]
LayoutTests/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DOMAllInOne.cpp
Source/WebCore/dom/Event.cpp
Source/WebCore/dom/Event.h
Source/WebCore/dom/EventNames.in
Source/WebCore/dom/InputEvent.cpp [new file with mode: 0644]
Source/WebCore/dom/InputEvent.h [new file with mode: 0644]
Source/WebCore/dom/InputEvent.idl [new file with mode: 0644]
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/page/Settings.in
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 969c0c0..14ae879 100644 (file)
@@ -1,3 +1,23 @@
+2016-10-05  Wenson Hsieh  <wenson_hsieh@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.kim@navercorp.com>
 
         [EFL] Mark timeout tests to *Timeout*
diff --git a/LayoutTests/fast/events/input-events-fired-when-typing-expected.txt b/LayoutTests/fast/events/input-events-fired-when-typing-expected.txt
new file mode 100644 (file)
index 0000000..0d63d49
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/fast/events/input-events-fired-when-typing.html b/LayoutTests/fast/events/input-events-fired-when-typing.html
new file mode 100644 (file)
index 0000000..dd6261c
--- /dev/null
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+
+<head>
+    <script src="../../resources/js-test-pre.js"></script>
+    <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="../../resources/js-test-post.js"></script>
+</body>
+
+</html>
diff --git a/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt b/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt
new file mode 100644 (file)
index 0000000..b9c2b50
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable.html b/LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable.html
new file mode 100644 (file)
index 0000000..82a7ccd
--- /dev/null
@@ -0,0 +1,77 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+
+<head>
+    <script src="../../../resources/js-test-pre.js"></script>
+    <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="../../../resources/js-test-post.js"></script>
+</body>
+
+</html>
index 37aca91..5f0e924 100644 (file)
@@ -798,6 +798,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get')
 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
index 89affcb..df22bc0 100644 (file)
@@ -893,6 +893,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get')
 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
index 0ca2fc8..9272e2f 100644 (file)
@@ -1197,6 +1197,7 @@ fast/events/frame-scroll-fake-mouse-move.html [ Failure ]
 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 ]
index 4c5fa6f..82cc309 100644 (file)
@@ -898,6 +898,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get')
 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
index d20fa04..a8882fe 100644 (file)
@@ -913,6 +913,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get')
 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
index bb0fda5..372b7b0 100644 (file)
@@ -913,6 +913,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ImageData').hasOwnProperty('get')
 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
index 3ad9a9c..8c9cb66 100644 (file)
@@ -400,6 +400,7 @@ set(WebCore_NON_SVG_IDL_FILES
     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 @@ set(WebCore_SOURCES
     dom/IdTargetObserver.cpp
     dom/IdTargetObserverRegistry.cpp
     dom/InlineStyleSheetOwner.cpp
+    dom/InputEvent.cpp
     dom/KeyboardEvent.cpp
     dom/LiveNodeList.cpp
     dom/LoadableClassicScript.cpp
index 7e9c290..0273463 100644 (file)
@@ -1,3 +1,56 @@
+2016-10-05  Wenson Hsieh  <wenson_hsieh@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  <achristensen@webkit.org>
 
         URLParser should parse IPv4 addresses as the last two pieces of an IPv6 address
index 85caa17..8a8ae17 100644 (file)
 #include "JSIDBVersionChangeEvent.cpp"
 #endif
 #include "JSImageData.cpp"
+#include "JSInputEvent.cpp"
 #include "JSInspectorFrontendHost.cpp"
 #include "JSKeyboardEvent.cpp"
 #include "JSLocation.cpp"
index 25eda86..2a9d1f3 100644 (file)
@@ -311,6 +311,7 @@ JS_BINDING_IDLS = \
     $(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 \
index 116a50f..f273277 100644 (file)
                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 */; };
                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, ); }; };
                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>"; };
                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>"; };
                                0FDA7C1D188322FC00C954B5 /* JSGestureEvent.h */,
                                8482B74F1198CB6B00BFB005 /* JSHashChangeEvent.cpp */,
                                8482B7501198CB6B00BFB005 /* JSHashChangeEvent.h */,
+                               A86629CE09DA2B47009633A6 /* JSInputEvent.cpp */,
+                               A86629CD09DA2B47009633A6 /* JSInputEvent.h */,
                                A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */,
                                A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */,
                                E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
index a5f8f40..2bbe467 100644 (file)
@@ -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"
index 0eff1fa..d63824d 100644 (file)
@@ -104,7 +104,8 @@ bool Event::composed() const
         || isFocusEvent()
         || isKeyboardEvent()
         || isMouseEvent()
-        || isTouchEvent();
+        || isTouchEvent()
+        || isInputEvent();
 }
 
 EventInterface Event::eventInterface() const
@@ -132,6 +133,11 @@ bool Event::isKeyboardEvent() const
     return false;
 }
 
+bool Event::isInputEvent() const
+{
+    return false;
+}
+
 bool Event::isCompositionEvent() const
 {
     return false;
index 5771940..bad9718 100644 (file)
@@ -143,6 +143,7 @@ public:
     virtual bool isMouseEvent() const;
     virtual bool isFocusEvent() const;
     virtual bool isKeyboardEvent() const;
+    virtual bool isInputEvent() const;
     virtual bool isCompositionEvent() const;
     virtual bool isTouchEvent() const;
 
index db00c50..03b677e 100644 (file)
@@ -12,6 +12,8 @@ CustomEvent
 ErrorEvent
 FocusEvent
 HashChangeEvent
+InputEvent
+InputEvents interfaceName=InputEvent
 KeyboardEvent
 KeyboardEvents interfaceName=KeyboardEvent
 MessageEvent
diff --git a/Source/WebCore/dom/InputEvent.cpp b/Source/WebCore/dom/InputEvent.cpp
new file mode 100644 (file)
index 0000000..e87b31f
--- /dev/null
@@ -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
diff --git a/Source/WebCore/dom/InputEvent.h b/Source/WebCore/dom/InputEvent.h
new file mode 100644 (file)
index 0000000..a65d332
--- /dev/null
@@ -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
diff --git a/Source/WebCore/dom/InputEvent.idl b/Source/WebCore/dom/InputEvent.idl
new file mode 100644 (file)
index 0000000..a422b97
--- /dev/null
@@ -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;
+};
index 660607b..c3e7400 100644 (file)
@@ -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 @@ bool Node::dispatchBeforeLoadEvent(const String& sourceURL)
     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 @@ void Node::defaultEventHandler(Event& event)
         }
 #endif
     } else if (event.type() == eventNames().webkitEditableContentChangedEvent) {
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
     }
 }
 
index e26c332..9664df7 100644 (file)
@@ -525,7 +525,7 @@ public:
 
     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&);
index bef165c..608f745 100644 (file)
@@ -1660,7 +1660,7 @@ void Editor::setBaseWritingDirection(WritingDirection direction)
         if (direction == NaturalWritingDirection)
             return;
         downcast<HTMLTextFormControlElement>(*focusedElement).setAttributeWithoutSynchronization(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
-        focusedElement->dispatchInputEvent();
+        focusedElement->dispatchInputEvent(emptyString());
         document().updateStyleIfNeeded();
         return;
     }
index 41a1eba..fbfb275 100644 (file)
@@ -326,7 +326,7 @@ void HTMLFormControlElement::dispatchFormControlChangeEvent()
 void HTMLFormControlElement::dispatchFormControlInputEvent()
 {
     setChangedSinceLastFormControlChangeEvent(true);
-    HTMLElement::dispatchInputEvent();
+    HTMLElement::dispatchInputEvent(emptyString());
 }
 
 bool HTMLFormControlElement::isDisabledFormControl() const
index fb7cded..691a8f5 100644 (file)
@@ -1015,7 +1015,7 @@ void HTMLInputElement::setEditingValue(const String& value)
     else
         cacheSelectionInResponseToSetValue(max);
 
-    dispatchInputEvent();
+    dispatchInputEvent(emptyString());
 }
 
 void HTMLInputElement::setValue(const String& value, ExceptionCode& ec, TextFieldEventBehavior eventBehavior)
@@ -1095,7 +1095,7 @@ void HTMLInputElement::setValueFromRenderer(const String& value)
 
     // Input event is fired by the Node::defaultEventHandler for editable controls.
     if (!isTextField())
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
 
     updateValidity();
 
index e13ea98..0e8559a 100644 (file)
@@ -669,7 +669,7 @@ void HTMLSelectElement::listBoxOnChange()
     }
 
     if (fireOnChange) {
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
         dispatchFormControlChangeEvent();
     }
 }
@@ -682,7 +682,7 @@ void HTMLSelectElement::dispatchChangeEventForMenuList()
     if (m_lastOnChangeIndex != selected && m_isProcessingUserDrivenChange) {
         m_lastOnChangeIndex = selected;
         m_isProcessingUserDrivenChange = false;
-        dispatchInputEvent();
+        dispatchInputEvent(emptyString());
         dispatchFormControlChangeEvent();
     }
 }
index 0f495a7..b7b705e 100644 (file)
@@ -863,7 +863,7 @@ void MediaControlTimelineElement::defaultEventHandler(Event& event)
         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());
index 68a39dc..85fcdf8 100644 (file)
@@ -278,5 +278,7 @@ variationFontsEnabled initial=true, setNeedsStyleRecalcInAllFrames=1, conditiona
 # Runtime-enabled features
 visualViewportEnabled initial=false
 
+inputEventsEnabled initial=false
+
 quickTimePluginReplacementEnabled initial=defaultQuickTimePluginReplacementEnabled
 youTubeFlashPluginReplacementEnabled initial=defaultYouTubeFlashPluginReplacementEnabled
index cbdcac5..d28b568 100644 (file)
@@ -111,6 +111,7 @@ InternalSettings::Backup::Backup(Settings& settings)
 #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 @@ void InternalSettings::Backup::restoreTo(Settings& settings)
 #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);
index 9165adc..1cfa506 100644 (file)
@@ -110,6 +110,7 @@ public:
 #if ENABLE(VARIATION_FONTS)
         bool m_variationFontsEnabled;
 #endif
+        bool m_inputEventsEnabled;
 
         UserInterfaceDirectionPolicy m_userInterfaceDirectionPolicy;
         TextDirection m_systemLayoutDirection;
index cbdcda1..3bd762c 100644 (file)
@@ -88,5 +88,7 @@
 
     [MayThrowLegacyException] boolean variationFontsEnabled();
     [MayThrowLegacyException] void setVariationFontsEnabled(boolean enabled);
+
+    void setInputEventsEnabled(boolean enabled);
 };
 
index 649c18e..d1a0e90 100644 (file)
@@ -1,3 +1,16 @@
+2016-10-05  Wenson Hsieh  <wenson_hsieh@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  <mmaxfield@apple.com>
 
         Put variation fonts work behind a compile-time flag
index d946ba1..8e2a5e2 100644 (file)
     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") \
     \
index 1fec6ec..8861618 100644 (file)
@@ -3228,6 +3228,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     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());