Skip to content
Permalink
Browse files
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:


Canonical link: https://commits.webkit.org/180896@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
whsieh committed Oct 6, 2016
1 parent 83699f7 commit a29d7904c6f653778154090720e6b707beed19c8
Showing with 470 additions and 12 deletions.
  1. +20 −0 LayoutTests/ChangeLog
  2. +17 −0 LayoutTests/fast/events/input-events-fired-when-typing-expected.txt
  3. +52 −0 LayoutTests/fast/events/input-events-fired-when-typing.html
  4. +10 −0 LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable-expected.txt
  5. +77 −0 LayoutTests/fast/events/ios/input-events-fired-when-typing-in-contenteditable.html
  6. +5 −0 LayoutTests/js/dom/global-constructors-attributes-expected.txt
  7. +5 −0 LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt
  8. +1 −0 LayoutTests/platform/ios-simulator/TestExpectations
  9. +5 −0 LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt
  10. +5 −0 LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt
  11. +5 −0 LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
  12. +2 −0 Source/WebCore/CMakeLists.txt
  13. +53 −0 Source/WebCore/ChangeLog
  14. +1 −0 Source/WebCore/DerivedSources.cpp
  15. +1 −0 Source/WebCore/DerivedSources.make
  16. +18 −0 Source/WebCore/WebCore.xcodeproj/project.pbxproj
  17. +1 −0 Source/WebCore/dom/DOMAllInOne.cpp
  18. +7 −1 Source/WebCore/dom/Event.cpp
  19. +1 −0 Source/WebCore/dom/Event.h
  20. +2 −0 Source/WebCore/dom/EventNames.in
  21. +49 −0 Source/WebCore/dom/InputEvent.cpp
  22. +64 −0 Source/WebCore/dom/InputEvent.h
  23. +30 −0 Source/WebCore/dom/InputEvent.idl
  24. +8 −3 Source/WebCore/dom/Node.cpp
  25. +1 −1 Source/WebCore/dom/Node.h
  26. +1 −1 Source/WebCore/editing/Editor.cpp
  27. +1 −1 Source/WebCore/html/HTMLFormControlElement.cpp
  28. +2 −2 Source/WebCore/html/HTMLInputElement.cpp
  29. +2 −2 Source/WebCore/html/HTMLSelectElement.cpp
  30. +1 −1 Source/WebCore/html/shadow/MediaControlElements.cpp
  31. +2 −0 Source/WebCore/page/Settings.in
  32. +2 −0 Source/WebCore/testing/InternalSettings.cpp
  33. +1 −0 Source/WebCore/testing/InternalSettings.h
  34. +2 −0 Source/WebCore/testing/InternalSettings.idl
  35. +13 −0 Source/WebKit2/ChangeLog
  36. +1 −0 Source/WebKit2/Shared/WebPreferencesDefinitions.h
  37. +2 −0 Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -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*
@@ -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

@@ -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>
@@ -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

@@ -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>
@@ -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
@@ -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
@@ -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 ]
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -309,6 +309,7 @@
#include "JSIDBVersionChangeEvent.cpp"
#endif
#include "JSImageData.cpp"
#include "JSInputEvent.cpp"
#include "JSInspectorFrontendHost.cpp"
#include "JSKeyboardEvent.cpp"
#include "JSLocation.cpp"
@@ -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 \

0 comments on commit a29d790

Please sign in to comment.