Bug 229784 - KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true
Summary: KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrollin...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-01 17:35 PDT by Fujii Hironori
Modified: 2021-09-08 12:59 PDT (History)
5 users (show)

See Also:


Attachments
WIP patch (1.12 KB, patch)
2021-09-01 17:37 PDT, Fujii Hironori
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP patch (1.34 KB, patch)
2021-09-01 18:31 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
WIP Patch (5.04 KB, patch)
2021-09-02 23:40 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (6.57 KB, patch)
2021-09-05 23:03 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (6.58 KB, patch)
2021-09-07 17:06 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2021-09-01 17:35:25 PDT
KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true
Comment 1 Fujii Hironori 2021-09-01 17:37:11 PDT
Created attachment 437094 [details]
WIP patch
Comment 2 Darin Adler 2021-09-01 17:47:29 PDT
Can we create a test for this?

Given this is an improvement, I imagine the improvement is detectable, and we should add a test.
Comment 3 Fujii Hironori 2021-09-01 18:31:09 PDT
Yup, that's what I want to do now.
Comment 4 Fujii Hironori 2021-09-01 18:31:42 PDT
Created attachment 437101 [details]
WIP patch
Comment 5 Fujii Hironori 2021-09-02 23:40:51 PDT
Created attachment 437246 [details]
WIP Patch
Comment 6 Fujii Hironori 2021-09-05 23:03:33 PDT
Created attachment 437385 [details]
Patch
Comment 7 Tim Horton 2021-09-07 13:19:42 PDT
Comment on attachment 437385 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437385&action=review

> LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp.html:19
> +            await UIHelper.delayFor(500);

Is there any way to write this test without a 500ms pause? We generally try to avoid this at the scale of 60k tests :)
Comment 8 Fujii Hironori 2021-09-07 17:04:46 PDT
Comment on attachment 437385 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437385&action=review

>> LayoutTests/fast/scrolling/keyboard-scrolling-last-timestamp.html:19
>> +            await UIHelper.delayFor(500);
> 
> Is there any way to write this test without a 500ms pause? We generally try to avoid this at the scale of 60k tests :)

Good point. UIHelper.waitForTargetScrollAnimationToSettle seems the one I want.
Comment 9 Fujii Hironori 2021-09-07 17:06:19 PDT
Created attachment 437572 [details]
Patch
Comment 10 Darin Adler 2021-09-07 17:09:43 PDT
Comment on attachment 437572 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437572&action=review

> LayoutTests/ChangeLog:9
> +        * fast/scrolling/keyboard-scrolling-last-timestamp-expected.txt: Added.
> +        * fast/scrolling/keyboard-scrolling-last-timestamp.html: Added.

What happens in this test if default handled is not set?
Comment 11 Fujii Hironori 2021-09-07 17:24:26 PDT
Comment on attachment 437572 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437572&action=review

>> LayoutTests/ChangeLog:9
>> +        * fast/scrolling/keyboard-scrolling-last-timestamp.html: Added.
> 
> What happens in this test if default handled is not set?

internals.lastHandledUserGestureTimestamp() didn't change by the key events before my change.

EventHandler::keyEvent updates lastHandledUserGestureTimestamp if the default hander handled.
https://github.com/WebKit/WebKit/blob/292ba371d52e1291c750185a82c7ce04e231e508/Source/WebCore/page/EventHandler.cpp#L3490
Comment 12 Darin Adler 2021-09-07 18:24:11 PDT
Comment on attachment 437572 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437572&action=review

>>> LayoutTests/ChangeLog:9
>>> +        * fast/scrolling/keyboard-scrolling-last-timestamp.html: Added.
>> 
>> What happens in this test if default handled is not set?
> 
> internals.lastHandledUserGestureTimestamp() didn't change by the key events before my change.
> 
> EventHandler::keyEvent updates lastHandledUserGestureTimestamp if the default hander handled.
> https://github.com/WebKit/WebKit/blob/292ba371d52e1291c750185a82c7ce04e231e508/Source/WebCore/page/EventHandler.cpp#L3490

Creating finding that. I guess it’s hard to test since "defaultHandled" is an internal thing, not directly visible to the web platform. I suppose we primarily can detect it by seeing that certain default behavior didn’t happen.
Comment 13 Fujii Hironori 2021-09-07 23:39:34 PDT
Comment on attachment 437572 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437572&action=review

>>>> LayoutTests/ChangeLog:9
>>>> +        * fast/scrolling/keyboard-scrolling-last-timestamp.html: Added.
>>> 
>>> What happens in this test if default handled is not set?
>> 
>> internals.lastHandledUserGestureTimestamp() didn't change by the key events before my change.
>> 
>> EventHandler::keyEvent updates lastHandledUserGestureTimestamp if the default hander handled.
>> https://github.com/WebKit/WebKit/blob/292ba371d52e1291c750185a82c7ce04e231e508/Source/WebCore/page/EventHandler.cpp#L3490
> 
> Creating finding that. I guess it’s hard to test since "defaultHandled" is an internal thing, not directly visible to the web platform. I suppose we primarily can detect it by seeing that certain default behavior didn’t happen.

I don't understand. How can I do that?
I think TestWebKitAPI can test this change by using WKPageUIClientV0::didNotHandleKeyEvent. Is it better?
Comment 14 Darin Adler 2021-09-08 09:57:09 PDT
(In reply to Fujii Hironori from comment #13)
> I don't understand. How can I do that?

I don’t know if you can.

> I think TestWebKitAPI can test this change by using
> WKPageUIClientV0::didNotHandleKeyEvent. Is it better?

Probably better in some ways, but this is also OK.
Comment 15 Fujii Hironori 2021-09-08 12:58:10 PDT
Comment on attachment 437572 [details]
Patch

Clearing flags on attachment: 437572

Committed r282165 (241457@main): <https://commits.webkit.org/241457@main>
Comment 16 Fujii Hironori 2021-09-08 12:58:14 PDT
All reviewed patches have been landed.  Closing bug.
Comment 17 Radar WebKit Bug Importer 2021-09-08 12:59:16 PDT
<rdar://problem/82887017>