Title: [284975] releases/WebKitGTK/webkit-2.34
Revision
284975
Author
ape...@igalia.com
Date
2021-10-28 03:02:54 -0700 (Thu, 28 Oct 2021)

Log Message

Merge r282165 - KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true
https://bugs.webkit.org/show_bug.cgi?id=229784

Reviewed by Darin Adler.

Source/WebCore:

If a KeyboardEvent is handled by the default event handler, it
should be marked by Event::setDefaultHandled.

Test: fast/scrolling/keyboard-scrolling-last-timestamp.html

* page/EventHandler.cpp:
(WebCore::EventHandler::defaultKeyboardEventHandler):
(WebCore::EventHandler::defaultArrowEventHandler):

LayoutTests:

* fast/scrolling/keyboard-scrolling-last-timestamp-expected.txt: Added.
* fast/scrolling/keyboard-scrolling-last-timestamp.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog (284974 => 284975)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2021-10-28 10:02:45 UTC (rev 284974)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2021-10-28 10:02:54 UTC (rev 284975)
@@ -1,3 +1,13 @@
+2021-09-08  Fujii Hironori  <hironori.fu...@sony.com>
+
+        KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true
+        https://bugs.webkit.org/show_bug.cgi?id=229784
+
+        Reviewed by Darin Adler.
+
+        * fast/scrolling/keyboard-scrolling-last-timestamp-expected.txt: Added.
+        * fast/scrolling/keyboard-scrolling-last-timestamp.html: Added.
+
 2021-09-01  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         CSSFontFaceSet.clear() should not clear CSS-connected members

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/TestExpectations (284974 => 284975)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/TestExpectations	2021-10-28 10:02:45 UTC (rev 284974)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/TestExpectations	2021-10-28 10:02:54 UTC (rev 284975)
@@ -95,6 +95,7 @@
 fast/forms/enterkeyhint-attribute-values.html [ Skip ]
 fast/scrolling/keyboard-scrolling-distance-downArrow.html [ Skip ]
 fast/scrolling/keyboard-scrolling-distance-pageDown.html [ Skip ]
+fast/scrolling/keyboard-scrolling-last-timestamp.html [ Skip ]
 
 # Highlighting marked text ranges from layout tests is only supported in WebKit2.
 editing/input/composition-highlights.html [ Skip ]

Added: releases/WebKitGTK/webkit-2.34/LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp-expected.txt (0 => 284975)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp-expected.txt	2021-10-28 10:02:54 UTC (rev 284975)
@@ -0,0 +1,6 @@
+
+PASS DOMContentLoaded
+PASS space
+PASS downArrow
+PASS pageDown
+

Added: releases/WebKitGTK/webkit-2.34/LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp.html (0 => 284975)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp.html	2021-10-28 10:02:54 UTC (rev 284975)
@@ -0,0 +1,36 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ EventHandlerDrivenSmoothKeyboardScrollingEnabled=true ] -->
+<meta charset=utf-8>
+<script src=""
+<script src=""
+<script src=""
+<script>
+    promise_test(() => {
+        return new Promise(resolve => {
+            window.addEventListener('DOMContentLoaded', resolve);
+        });
+    }, 'DOMContentLoaded');
+
+    function test_key(key) {
+        return async () => {
+            let previousScrollY = scrollY;
+            let previousTimestamp = internals.lastHandledUserGestureTimestamp();
+
+            let wait = UIHelper.waitForTargetScrollAnimationToSettle(window);
+            UIHelper.keyDown(key);
+            await wait;
+
+            assert_not_equals(scrollY, previousScrollY);
+            assert_not_equals(internals.lastHandledUserGestureTimestamp(), previousTimestamp);
+        };
+    }
+    
+    promise_test(test_key(' '), 'space');
+    promise_test(test_key('downArrow'), 'downArrow');
+    promise_test(test_key('pageDown'), 'pageDown');
+</script>
+<style>
+    body {
+        border: blue 10px solid;
+        height: 10000px;
+    }
+</style>

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/platform/wk2/TestExpectations (284974 => 284975)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/platform/wk2/TestExpectations	2021-10-28 10:02:45 UTC (rev 284974)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/platform/wk2/TestExpectations	2021-10-28 10:02:54 UTC (rev 284975)
@@ -856,6 +856,7 @@
 js/throw-large-string-oom.html [ Pass ]
 fast/scrolling/keyboard-scrolling-distance-downArrow.html [ Pass ]
 fast/scrolling/keyboard-scrolling-distance-pageDown.html [ Pass ]
+fast/scrolling/keyboard-scrolling-last-timestamp.html [ Pass ]
 fast/speechrecognition/permission-error.html [ Pass ]
 fast/speechrecognition/start-recognition-then-stop.html [ Pass ]
 fast/speechrecognition/start-second-recognition.html [ Pass ]

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog (284974 => 284975)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2021-10-28 10:02:45 UTC (rev 284974)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2021-10-28 10:02:54 UTC (rev 284975)
@@ -1,3 +1,19 @@
+2021-09-08  Fujii Hironori  <hironori.fu...@sony.com>
+
+        KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true
+        https://bugs.webkit.org/show_bug.cgi?id=229784
+
+        Reviewed by Darin Adler.
+
+        If a KeyboardEvent is handled by the default event handler, it
+        should be marked by Event::setDefaultHandled.
+
+        Test: fast/scrolling/keyboard-scrolling-last-timestamp.html
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::defaultKeyboardEventHandler):
+        (WebCore::EventHandler::defaultArrowEventHandler):
+
 2021-09-01  Fujii Hironori  <hironori.fu...@sony.com>
 
         REGRESSION(r280928) The smooth keyboard scrolling is unconditionally enabled for PageUp and PageDown keys

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/page/EventHandler.cpp (284974 => 284975)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/page/EventHandler.cpp	2021-10-28 10:02:45 UTC (rev 284974)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/page/EventHandler.cpp	2021-10-28 10:02:54 UTC (rev 284975)
@@ -3807,9 +3807,10 @@
             defaultTabEventHandler(event);
         else if (event.keyIdentifier() == "U+0008")
             defaultBackspaceEventHandler(event);
-        else if (event.keyIdentifier() == "PageUp" || event.keyIdentifier() == "PageDown")
-            startKeyboardScrolling(event);
-        else {
+        else if (event.keyIdentifier() == "PageUp" || event.keyIdentifier() == "PageDown") {
+            if (startKeyboardScrolling(event))
+                event.setDefaultHandled();
+        } else {
             FocusDirection direction = focusDirectionForKey(event.keyIdentifier());
             if (direction != FocusDirection::None)
                 defaultArrowEventHandler(direction, event);
@@ -4307,7 +4308,8 @@
     ASSERT(event.type() == eventNames().keydownEvent);
 
     if (!isSpatialNavigationEnabled(&m_frame)) {
-        startKeyboardScrolling(event);
+        if (startKeyboardScrolling(event))
+            event.setDefaultHandled();
         return;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to