Add support for KeyboardEvent.key attribute
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2016 21:32:47 +0000 (21:32 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2016 21:32:47 +0000 (21:32 +0000)
commit20fbbc28c0fef895f61578206fb94e3ca6bdf987
treec32bcc93f01353df2a44b00d3d4c35ea60c84eed
parentd34c825c6b699cc53e2673d69b4dc86e472d88a9
Add support for KeyboardEvent.key attribute
https://bugs.webkit.org/show_bug.cgi?id=36267

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline because that the tests are failing differently now that we support
the key attribute on KeyboardEvent but are still missing other standard API
on this interface.

* web-platform-tests/dom/events/Event-init-while-dispatching-expected.txt:
* web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:

Source/WebCore:

Add support for KeyboardEvent.key attribute:
- https://w3c.github.io/uievents/#dom-keyboardevent-key

This is behind a compile time flag that is only enabled on Mac and
iOS and the implementation is still missing for other platforms.

Test: fast/events/keyboardevent-key.html

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:
* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
(WebCore::PlatformKeyboardEvent::key):
* platform/cocoa/KeyEventCocoa.h:
* platform/cocoa/KeyEventCocoa.mm:
(WebCore::keyForCharCode):
* platform/ios/PlatformEventFactoryIOS.h:
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::keyForKeyEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
* platform/mac/PlatformEventFactoryMac.h:
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::keyForKeyEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
(WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Deleted.
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue):
(JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue):

Source/WebKit2:

Add support for KeyboardEvent.key attribute.

* Shared/WebEvent.h:
(WebKit::WebKeyboardEvent::key):
(WebKit::WebKeyboardEvent::unmodifiedText): Deleted.
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
(WebKit::WebKeyboardEvent::encode):
(WebKit::WebKeyboardEvent::decode):
* Shared/mac/WebEventFactory.mm:
(WebKit::WebEventFactory::createWebKeyboardEvent):

Source/WTF:

Add compile time flag for the key attribute on KeyboardEvent and enable
it on Cocoa only.

* wtf/FeatureDefines.h:

LayoutTests:

Extend layout test coverage.

* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.html:
* fast/events/key-events-in-input-button-expected.txt:
* fast/events/key-events-in-input-button.html:
* fast/events/key-events-in-input-text-expected.txt:
* fast/events/key-events-in-input-text.html:
* fast/events/keyboardevent-key-expected.txt: Added.
* fast/events/keyboardevent-key.html: Added.
* fast/events/special-key-events-in-input-text-expected.txt:
* fast/events/special-key-events-in-input-text.html:
* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt
LayoutTests/fast/events/constructors/keyboard-event-constructor.html
LayoutTests/fast/events/key-events-in-input-button-expected.txt
LayoutTests/fast/events/key-events-in-input-button.html
LayoutTests/fast/events/key-events-in-input-text-expected.txt
LayoutTests/fast/events/key-events-in-input-text.html
LayoutTests/fast/events/keyboardevent-key-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/keyboardevent-key.html [new file with mode: 0644]
LayoutTests/fast/events/special-key-events-in-input-text-expected.txt
LayoutTests/fast/events/special-key-events-in-input-text.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-init-while-dispatching-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt
LayoutTests/platform/ios-simulator/TestExpectations
Source/WTF/ChangeLog
Source/WTF/wtf/FeatureDefines.h
Source/WebCore/ChangeLog
Source/WebCore/dom/KeyboardEvent.cpp
Source/WebCore/dom/KeyboardEvent.h
Source/WebCore/dom/KeyboardEvent.idl
Source/WebCore/platform/PlatformKeyboardEvent.h
Source/WebCore/platform/cocoa/KeyEventCocoa.h
Source/WebCore/platform/cocoa/KeyEventCocoa.mm
Source/WebCore/platform/ios/PlatformEventFactoryIOS.h
Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
Source/WebCore/platform/mac/PlatformEventFactoryMac.h
Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
Source/WebCore/replay/SerializationMethods.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebEvent.h
Source/WebKit2/Shared/WebEventConversion.cpp
Source/WebKit2/Shared/WebKeyboardEvent.cpp
Source/WebKit2/Shared/mac/WebEventFactory.mm