Diff
Modified: branches/safari-603-branch/LayoutTests/ChangeLog (210721 => 210722)
--- branches/safari-603-branch/LayoutTests/ChangeLog 2017-01-13 07:05:07 UTC (rev 210721)
+++ branches/safari-603-branch/LayoutTests/ChangeLog 2017-01-13 07:05:11 UTC (rev 210722)
@@ -1,5 +1,22 @@
2017-01-12 Matthew Hanson <matthew_han...@apple.com>
+ Merge r210586. rdar://problem/29861147
+
+ 2017-01-11 Chris Dumez <cdu...@apple.com>
+
+ [iOS][WK2] KeyboardEvent.key always returns an empty string
+ https://bugs.webkit.org/show_bug.cgi?id=166918
+ <rdar://problem/29861147>
+
+ Reviewed by Wenson Hsieh.
+
+ Add layout test coverage.
+
+ * fast/events/ios/keyboard-event-key-attribute-expected.txt: Added.
+ * fast/events/ios/keyboard-event-key-attribute.html: Added.
+
+2017-01-12 Matthew Hanson <matthew_han...@apple.com>
+
Merge r210536. rdar://problem/29939970
2017-01-09 Chris Dumez <cdu...@apple.com>
Added: branches/safari-603-branch/LayoutTests/fast/events/ios/keyboard-event-key-attribute-expected.txt (0 => 210722)
--- branches/safari-603-branch/LayoutTests/fast/events/ios/keyboard-event-key-attribute-expected.txt (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/ios/keyboard-event-key-attribute-expected.txt 2017-01-13 07:05:11 UTC (rev 210722)
@@ -0,0 +1,10 @@
+Tests that KeyboardEvent.key is properly initialized on iOS.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.key is "a"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-603-branch/LayoutTests/fast/events/ios/keyboard-event-key-attribute.html (0 => 210722)
--- branches/safari-603-branch/LayoutTests/fast/events/ios/keyboard-event-key-attribute.html (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/ios/keyboard-event-key-attribute.html 2017-01-13 07:05:11 UTC (rev 210722)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width">
+<script src=""
+</head>
+<body>
+<input id="testInput" type="text">
+<script>
+description("Tests that KeyboardEvent.key is properly initialized on iOS.");
+jsTestIsAsync = true;
+
+function getTypingUIScript(x, y)
+{
+ return `
+ (function() {
+ uiController.didShowKeyboardCallback = function() {
+ uiController.typeCharacterUsingHardwareKeyboard('a', function() {
+ uiController.uiScriptComplete();
+ });
+ };
+ uiController.singleTapAtPoint(${x}, ${y}, function() { });
+ })();`
+}
+
+var testInput = document.getElementById("testInput");
+testInput._onkeydown_ = function(e) {
+ event = e;
+ shouldBeEqualToString("event.key", "a");
+ finishJSTest();
+};
+
+const x = testInput.offsetLeft + 5;
+const y = testInput.offsetTop + 5;
+testRunner.runUIScript(getTypingUIScript(x, y), function() { });
+</script>
+<script src=""
+</body>
+</html>
Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (210721 => 210722)
--- branches/safari-603-branch/Source/WebKit2/ChangeLog 2017-01-13 07:05:07 UTC (rev 210721)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog 2017-01-13 07:05:11 UTC (rev 210722)
@@ -1,5 +1,25 @@
2017-01-12 Matthew Hanson <matthew_han...@apple.com>
+ Merge r210586. rdar://problem/29861147
+
+ 2017-01-11 Chris Dumez <cdu...@apple.com>
+
+ [iOS][WK2] KeyboardEvent.key always returns an empty string
+ https://bugs.webkit.org/show_bug.cgi?id=166918
+ <rdar://problem/29861147>
+
+ Reviewed by Wenson Hsieh.
+
+ Make sure that KeyboardEvent.key gets properly initialized on iOS / WK2.
+
+ * Shared/WebEvent.h:
+ * Shared/WebKeyboardEvent.cpp:
+ (WebKit::WebKeyboardEvent::WebKeyboardEvent):
+ * Shared/ios/WebIOSEventFactory.mm:
+ (WebIOSEventFactory::createWebKeyboardEvent):
+
+2017-01-12 Matthew Hanson <matthew_han...@apple.com>
+
Merge r210689. rdar://problem/29985957
2017-01-12 Chris Dumez <cdu...@apple.com>
Modified: branches/safari-603-branch/Source/WebKit2/Shared/WebEvent.h (210721 => 210722)
--- branches/safari-603-branch/Source/WebKit2/Shared/WebEvent.h 2017-01-13 07:05:07 UTC (rev 210721)
+++ branches/safari-603-branch/Source/WebKit2/Shared/WebEvent.h 2017-01-13 07:05:11 UTC (rev 210722)
@@ -247,6 +247,8 @@
WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
#elif PLATFORM(GTK)
WebKeyboardEvent(Type, const String& text, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, Modifiers, double timestamp);
+#elif PLATFORM(IOS)
+ WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
#else
WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
#endif
Modified: branches/safari-603-branch/Source/WebKit2/Shared/WebKeyboardEvent.cpp (210721 => 210722)
--- branches/safari-603-branch/Source/WebKit2/Shared/WebKeyboardEvent.cpp 2017-01-13 07:05:07 UTC (rev 210721)
+++ branches/safari-603-branch/Source/WebKit2/Shared/WebKeyboardEvent.cpp 2017-01-13 07:05:11 UTC (rev 210722)
@@ -75,6 +75,24 @@
ASSERT(isKeyboardEventType(type));
}
+#elif PLATFORM(IOS)
+
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
+ : WebEvent(type, modifiers, timestamp)
+ , m_text(text)
+ , m_unmodifiedText(unmodifiedText)
+ , m_key(key)
+ , m_keyIdentifier(keyIdentifier)
+ , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
+ , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
+ , m_macCharCode(macCharCode)
+ , m_isAutoRepeat(isAutoRepeat)
+ , m_isKeypad(isKeypad)
+ , m_isSystemKey(isSystemKey)
+{
+ ASSERT(isKeyboardEventType(type));
+}
+
#else
WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
Modified: branches/safari-603-branch/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm (210721 => 210722)
--- branches/safari-603-branch/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm 2017-01-13 07:05:07 UTC (rev 210721)
+++ branches/safari-603-branch/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm 2017-01-13 07:05:11 UTC (rev 210722)
@@ -55,6 +55,7 @@
WebKit::WebEvent::Type type = (event.type == WebEventKeyUp) ? WebKit::WebEvent::KeyUp : WebKit::WebEvent::KeyDown;
String text = event.characters;
String unmodifiedText = event.charactersIgnoringModifiers;
+ String key = WebCore::keyForKeyEvent(event);
String keyIdentifier = WebCore::keyIdentifierForKeyEvent(event);
int windowsVirtualKeyCode = event.keyCode;
int nativeVirtualKeyCode = event.keyCode;
@@ -83,7 +84,7 @@
unmodifiedText = text;
}
- return WebKit::WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
+ return WebKit::WebKeyboardEvent(type, text, unmodifiedText, key, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
}
#endif // PLATFORM(IOS)