Bug 229733

Summary: REGRESSION(r280928) The smooth keyboard scrolling is unconditionally enabled for PageUp and PageDown keys
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: ScrollingAssignee: Fujii Hironori <Hironori.Fujii>
Status: RESOLVED FIXED    
Severity: Normal CC: a9016009, darin, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Fujii Hironori 2021-08-31 13:41:21 PDT
REGRESSION(r280928) The smooth keyboard scrolling is enabled only for PageUp and PageDown keys

Since: r280928 (Bug 228156)

1. Start WinCairo MiniBrowser
2. Press PageDown key

Actual: scolling smoothly
Expected: scolling not smoothly

NOTE: Space key and Arrow key don't trigger the smooth keyboard scrolling.
Comment 1 Fujii Hironori 2021-08-31 13:51:10 PDT
Created attachment 436938 [details]
Patch
Comment 2 Darin Adler 2021-08-31 13:52:43 PDT
Comment on attachment 436938 [details]
Patch

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

> Source/WebCore/page/EventHandler.cpp:3812
> +        else if (m_frame.settings().eventHandlerDrivenSmoothKeyboardScrollingEnabled()
> +            && (event.keyIdentifier() == "PageUp" || event.keyIdentifier() == "PageDown"))
>              startKeyboardScrolling(event);

This looks like it will make PageUp and PageDown not scroll at all? Is that right?
Comment 3 Fujii Hironori 2021-08-31 14:17:22 PDT
Comment on attachment 436938 [details]
Patch

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

>> Source/WebCore/page/EventHandler.cpp:3812
>>              startKeyboardScrolling(event);
> 
> This looks like it will make PageUp and PageDown not scroll at all? Is that right?

This change restores the previous behavior before r280928.
If the key event isn't consumed by WebCore's handleKeyEvent, WebKit's WebPage::performDefaultBehaviorForKeyEvent handles it.
Comment 4 Tim Horton 2021-08-31 14:20:42 PDT
Comment on attachment 436938 [details]
Patch

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

> Source/WebCore/ChangeLog:3
> +        REGRESSION(r280928) The smooth keyboard scrolling is enabled only for PageUp and PageDown keys

From the wording of the title ("enabled only for") I assumed the fix would be "enable it for more things". But actually it is fixing the fact that it was accidentally enabled unconditionally for pageup/down. Current title is fine, but a rewording could make it more clear. Regardless, this seems fine.

>>> Source/WebCore/page/EventHandler.cpp:3812
>>>              startKeyboardScrolling(event);
>> 
>> This looks like it will make PageUp and PageDown not scroll at all? Is that right?
> 
> This change restores the previous behavior before r280928.
> If the key event isn't consumed by WebCore's handleKeyEvent, WebKit's WebPage::performDefaultBehaviorForKeyEvent handles it.

Possible we should just move the setting check /inside/ startKeyboardScrolling?
Comment 5 Fujii Hironori 2021-08-31 17:14:22 PDT
Comment on attachment 436938 [details]
Patch

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

>> Source/WebCore/ChangeLog:3
>> +        REGRESSION(r280928) The smooth keyboard scrolling is enabled only for PageUp and PageDown keys
> 
> From the wording of the title ("enabled only for") I assumed the fix would be "enable it for more things". But actually it is fixing the fact that it was accidentally enabled unconditionally for pageup/down. Current title is fine, but a rewording could make it more clear. Regardless, this seems fine.

Fixed.

>>>> Source/WebCore/page/EventHandler.cpp:3812
>>>>              startKeyboardScrolling(event);
>>> 
>>> This looks like it will make PageUp and PageDown not scroll at all? Is that right?
>> 
>> This change restores the previous behavior before r280928.
>> If the key event isn't consumed by WebCore's handleKeyEvent, WebKit's WebPage::performDefaultBehaviorForKeyEvent handles it.
> 
> Possible we should just move the setting check /inside/ startKeyboardScrolling?

Good idea. Will fix.
Comment 6 Fujii Hironori 2021-08-31 17:24:32 PDT
Created attachment 436971 [details]
Patch
Comment 7 Darin Adler 2021-08-31 17:30:49 PDT
Comment on attachment 436971 [details]
Patch

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

> Source/WebCore/page/EventHandler.cpp:3812
> +                event.setDefaultHandled();

What was calling setDefaultHandled here before? Change log doesn’t mention this change, and it’s a change that affects only the other ports, not WinCairo.

> Source/WebCore/page/EventHandler.cpp:4312
> +            event.setDefaultHandled();

Ditto.
Comment 8 Fujii Hironori 2021-08-31 17:49:05 PDT
Comment on attachment 436971 [details]
Patch

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

>> Source/WebCore/page/EventHandler.cpp:3812
>> +                event.setDefaultHandled();
> 
> What was calling setDefaultHandled here before? Change log doesn’t mention this change, and it’s a change that affects only the other ports, not WinCairo.

Yes. It's another change. I'm going to split the patch for the part.
Comment 9 Fujii Hironori 2021-08-31 17:50:05 PDT
Created attachment 436975 [details]
Patch
Comment 10 Fujii Hironori 2021-09-01 12:50:19 PDT
Comment on attachment 436975 [details]
Patch

Clearing flags on attachment: 436975

Committed r281867 (241197@main): <https://commits.webkit.org/241197@main>
Comment 11 Fujii Hironori 2021-09-01 12:50:23 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2021-09-01 12:51:27 PDT
<rdar://problem/82641834>
Comment 13 Fujii Hironori 2021-09-01 17:38:20 PDT
(In reply to Fujii Hironori from comment #8)
> Yes. It's another change. I'm going to split the patch for the part.

Filed: Bug 229784 – KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true
Comment 14 Adrian Perez 2021-11-04 02:48:52 PDT
*** Bug 232701 has been marked as a duplicate of this bug. ***