Title: [206724] trunk
Revision
206724
Author
[email protected]
Date
2016-10-02 14:33:28 -0700 (Sun, 02 Oct 2016)

Log Message

Add support for KeyboardEvent.repeat attribute
https://bugs.webkit.org/show_bug.cgi?id=162854

Reviewed by Darin Adler.

Source/WebCore:

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

No new tests, extended existing test.

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:

LayoutTests:

Extend layout test coverage.

* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206723 => 206724)


--- trunk/LayoutTests/ChangeLog	2016-10-02 21:28:31 UTC (rev 206723)
+++ trunk/LayoutTests/ChangeLog	2016-10-02 21:33:28 UTC (rev 206724)
@@ -1,5 +1,17 @@
 2016-10-02  Chris Dumez  <[email protected]>
 
+        Add support for KeyboardEvent.repeat attribute
+        https://bugs.webkit.org/show_bug.cgi?id=162854
+
+        Reviewed by Darin Adler.
+
+        Extend layout test coverage.
+
+        * fast/events/constructors/keyboard-event-constructor-expected.txt:
+        * fast/events/constructors/keyboard-event-constructor.html:
+
+2016-10-02  Chris Dumez  <[email protected]>
+
         Unreviewed, rolling out r206692 and r206718.
 
         Seems to have caused >200 failures on Sierra

Modified: trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt (206723 => 206724)


--- trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt	2016-10-02 21:28:31 UTC (rev 206723)
+++ trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt	2016-10-02 21:33:28 UTC (rev 206724)
@@ -19,6 +19,9 @@
 PASS new KeyboardEvent('eventType', { cancelable: true }).cancelable is true
 PASS new KeyboardEvent('eventType', { view: window }).view is window
 PASS new KeyboardEvent('eventType', { view: this }).view is this
+PASS new KeyboardEvent('eventType', { }).repeat is false
+PASS new KeyboardEvent('eventType', { repeat: false }).repeat is false
+PASS new KeyboardEvent('eventType', { repeat: true }).repeat is true
 PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window.
 PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window.
 PASS new KeyboardEvent('eventType', { view: undefined }).view is null

Modified: trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html (206723 => 206724)


--- trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html	2016-10-02 21:28:31 UTC (rev 206723)
+++ trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html	2016-10-02 21:33:28 UTC (rev 206724)
@@ -35,6 +35,11 @@
 shouldBe("new KeyboardEvent('eventType', { view: window }).view", "window");
 shouldBe("new KeyboardEvent('eventType', { view: this }).view", "this");
 
+// repeat is passed.
+shouldBe("new KeyboardEvent('eventType', { }).repeat", "false");
+shouldBe("new KeyboardEvent('eventType', { repeat: false }).repeat", "false");
+shouldBe("new KeyboardEvent('eventType', { repeat: true }).repeat", "true");
+
 // Non-window objects.
 shouldThrowErrorName("new KeyboardEvent('eventType', { view: testObject }).view", "TypeError");
 shouldThrowErrorName("new KeyboardEvent('eventType', { view: document }).view", "TypeError");

Modified: trunk/Source/WebCore/ChangeLog (206723 => 206724)


--- trunk/Source/WebCore/ChangeLog	2016-10-02 21:28:31 UTC (rev 206723)
+++ trunk/Source/WebCore/ChangeLog	2016-10-02 21:33:28 UTC (rev 206724)
@@ -1,3 +1,20 @@
+2016-10-02  Chris Dumez  <[email protected]>
+
+        Add support for KeyboardEvent.repeat attribute
+        https://bugs.webkit.org/show_bug.cgi?id=162854
+
+        Reviewed by Darin Adler.
+
+        Add support for KeyboardEvent.repeat attribute:
+        - https://w3c.github.io/uievents/#dom-keyboardevent-repeat
+
+        No new tests, extended existing test.
+
+        * dom/KeyboardEvent.cpp:
+        (WebCore::KeyboardEvent::KeyboardEvent):
+        * dom/KeyboardEvent.h:
+        * dom/KeyboardEvent.idl:
+
 2016-10-02  Darin Adler  <[email protected]>
 
         Rename ExceptionCode-based exception handling to "legacy"

Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (206723 => 206724)


--- trunk/Source/WebCore/dom/KeyboardEvent.cpp	2016-10-02 21:28:31 UTC (rev 206723)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp	2016-10-02 21:33:28 UTC (rev 206724)
@@ -106,6 +106,7 @@
     , m_keyEvent(std::make_unique<PlatformKeyboardEvent>(key))
     , m_keyIdentifier(key.keyIdentifier())
     , m_location(keyLocationCode(key))
+    , m_repeat(key.isAutoRepeat())
     , m_altGraphKey(false)
 #if PLATFORM(COCOA)
 #if USE(APPKIT)
@@ -128,6 +129,7 @@
     : UIEventWithKeyState(eventType, initializer)
     , m_keyIdentifier(initializer.keyIdentifier)
     , m_location(initializer.location)
+    , m_repeat(initializer.repeat)
     , m_altGraphKey(false)
 #if PLATFORM(COCOA)
     , m_handledByInputMethod(false)

Modified: trunk/Source/WebCore/dom/KeyboardEvent.h (206723 => 206724)


--- trunk/Source/WebCore/dom/KeyboardEvent.h	2016-10-02 21:28:31 UTC (rev 206723)
+++ trunk/Source/WebCore/dom/KeyboardEvent.h	2016-10-02 21:33:28 UTC (rev 206724)
@@ -36,6 +36,7 @@
 struct KeyboardEventInit : public UIEventWithKeyStateInit {
     String keyIdentifier;
     unsigned location { 0 };
+    bool repeat { false };
 };
 
 class KeyboardEvent final : public UIEventWithKeyState {
@@ -80,6 +81,7 @@
     
     const String& keyIdentifier() const { return m_keyIdentifier; }
     unsigned location() const { return m_location; }
+    bool repeat() const { return m_repeat; }
 
     WEBCORE_EXPORT bool getModifierState(const String& keyIdentifier) const;
 
@@ -113,6 +115,7 @@
     std::unique_ptr<PlatformKeyboardEvent> m_keyEvent;
     String m_keyIdentifier;
     unsigned m_location;
+    bool m_repeat : 1;
     bool m_altGraphKey : 1;
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebCore/dom/KeyboardEvent.idl (206723 => 206724)


--- trunk/Source/WebCore/dom/KeyboardEvent.idl	2016-10-02 21:28:31 UTC (rev 206723)
+++ trunk/Source/WebCore/dom/KeyboardEvent.idl	2016-10-02 21:33:28 UTC (rev 206724)
@@ -37,6 +37,8 @@
     [InitializedByEventConstructor] readonly attribute boolean metaKey;
     readonly attribute boolean altGraphKey;
 
+    [InitializedByEventConstructor] readonly attribute boolean repeat;
+
     // FIXME: this does not match the version in the DOM spec.
     // FIXME: Using "undefined" as default parameter value is wrong.
     void initKeyboardEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to