Commit 8984da7
committed
Page scrolls more than one screenful when pressing Space or Fn+Down
https://bugs.webkit.org/show_bug.cgi?id=250598
rdar://104152802
Reviewed by Simon Fraser.
Before event handler driven smooth keyboard scrolling, pressing and holding the
spacebar or page up/down keys would do the following sequence of actions:
1. Scroll down the page by a "screenful".
2. On Cocoa platforms, the scrolling mechanism would wait until the `keyRepeatInterval`
has passed.
3. After the interval has passed, it would continue consistently page scrolling until
the key is released.
With the introduction of event handler driven smooth keyboard scrolling, step two
was omitted. However, because smooth scrolling was slower than previously, the behavior
was effectively unchanged, as the slowness of the scrolling compensated for what would
have been the key repeat interval.
After #8318, smooth scrolling was adjusted which
caused its velocity to increase. As a result, the lack of a delay was now noticable,
and page scrolling would scroll more than a "screenful" unless preisely one key event was sent.
This PR adjusts smooth scrolling such that the smooth keyboard scroll animation only
starts after the `keyRepeatInterval`, with the first part of the entire scroll behaving the
same as it did prior to smooth keyboard scrolling.
Note that this will apply to only spacebar and page up / down scrolling, and not arrow key
scrolling.
* Source/WebCore/editing/EditorCommand.cpp:
(WebCore::executeScrollPageBackward):
(WebCore::executeScrollPageForward):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::defaultKeyboardEventHandler):
(WebCore::EventHandler::defaultKeyboardScrollEventHandler):
(WebCore::EventHandler::defaultPageUpDownEventHandler):
(WebCore::EventHandler::defaultSpaceEventHandler):
(WebCore::EventHandler::beginKeyboardScrollGesture):
(WebCore::EventHandler::startKeyboardScrollAnimationOnDocument):
(WebCore::EventHandler::startKeyboardScrollAnimationOnRenderBoxLayer):
(WebCore::EventHandler::startKeyboardScrollAnimationOnRenderBoxAndItsAncestors):
(WebCore::EventHandler::startKeyboardScrollAnimationOnEnclosingScrollableContainer):
(WebCore::EventHandler::keyboardScrollRecursively):
(WebCore::EventHandler::keyboardScroll):
* Source/WebCore/page/EventHandler.h:
* Source/WebCore/platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
* Source/WebCore/platform/KeyboardScrollingAnimator.h:
Canonical link: https://commits.webkit.org/259146@main1 parent 88a0736 commit 8984da7
File tree
6 files changed
+40
-58
lines changed- Source
- WebCore
- editing
- page
- platform
- WebKit/UIProcess/mac
6 files changed
+40
-58
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1012 | 1012 | | |
1013 | 1013 | | |
1014 | 1014 | | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | 1015 | | |
1032 | 1016 | | |
1033 | 1017 | | |
| |||
1771 | 1755 | | |
1772 | 1756 | | |
1773 | 1757 | | |
1774 | | - | |
1775 | | - | |
1776 | 1758 | | |
1777 | 1759 | | |
1778 | 1760 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3918 | 3918 | | |
3919 | 3919 | | |
3920 | 3920 | | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
3921 | 3924 | | |
| 3925 | + | |
3922 | 3926 | | |
| 3927 | + | |
3923 | 3928 | | |
3924 | 3929 | | |
3925 | 3930 | | |
| |||
4337 | 4342 | | |
4338 | 4343 | | |
4339 | 4344 | | |
4340 | | - | |
| 4345 | + | |
4341 | 4346 | | |
4342 | 4347 | | |
4343 | 4348 | | |
4344 | 4349 | | |
4345 | 4350 | | |
4346 | 4351 | | |
4347 | | - | |
| 4352 | + | |
4348 | 4353 | | |
4349 | 4354 | | |
4350 | 4355 | | |
| |||
4395 | 4400 | | |
4396 | 4401 | | |
4397 | 4402 | | |
4398 | | - | |
| 4403 | + | |
4399 | 4404 | | |
4400 | 4405 | | |
4401 | 4406 | | |
| |||
4438 | 4443 | | |
4439 | 4444 | | |
4440 | 4445 | | |
4441 | | - | |
| 4446 | + | |
4442 | 4447 | | |
4443 | | - | |
| 4448 | + | |
4444 | 4449 | | |
4445 | 4450 | | |
4446 | 4451 | | |
4447 | 4452 | | |
4448 | 4453 | | |
4449 | 4454 | | |
4450 | 4455 | | |
4451 | | - | |
| 4456 | + | |
4452 | 4457 | | |
4453 | 4458 | | |
4454 | 4459 | | |
4455 | 4460 | | |
4456 | 4461 | | |
4457 | 4462 | | |
4458 | | - | |
| 4463 | + | |
4459 | 4464 | | |
4460 | 4465 | | |
4461 | | - | |
| 4466 | + | |
4462 | 4467 | | |
4463 | 4468 | | |
4464 | 4469 | | |
4465 | 4470 | | |
4466 | 4471 | | |
4467 | 4472 | | |
4468 | | - | |
| 4473 | + | |
4469 | 4474 | | |
4470 | 4475 | | |
4471 | | - | |
| 4476 | + | |
4472 | 4477 | | |
4473 | 4478 | | |
4474 | | - | |
| 4479 | + | |
4475 | 4480 | | |
4476 | 4481 | | |
4477 | 4482 | | |
4478 | 4483 | | |
4479 | 4484 | | |
4480 | 4485 | | |
4481 | 4486 | | |
4482 | | - | |
| 4487 | + | |
4483 | 4488 | | |
4484 | 4489 | | |
4485 | 4490 | | |
| |||
4495 | 4500 | | |
4496 | 4501 | | |
4497 | 4502 | | |
4498 | | - | |
| 4503 | + | |
4499 | 4504 | | |
4500 | 4505 | | |
4501 | 4506 | | |
4502 | 4507 | | |
4503 | 4508 | | |
4504 | | - | |
| 4509 | + | |
4505 | 4510 | | |
| 4511 | + | |
| 4512 | + | |
| 4513 | + | |
4506 | 4514 | | |
4507 | 4515 | | |
4508 | 4516 | | |
| |||
4517 | 4525 | | |
4518 | 4526 | | |
4519 | 4527 | | |
| 4528 | + | |
4520 | 4529 | | |
4521 | 4530 | | |
4522 | 4531 | | |
4523 | | - | |
4524 | 4532 | | |
4525 | 4533 | | |
4526 | 4534 | | |
4527 | 4535 | | |
4528 | | - | |
4529 | | - | |
4530 | | - | |
4531 | | - | |
4532 | | - | |
4533 | | - | |
| 4536 | + | |
4534 | 4537 | | |
4535 | 4538 | | |
4536 | 4539 | | |
| |||
4539 | 4542 | | |
4540 | 4543 | | |
4541 | 4544 | | |
4542 | | - | |
| 4545 | + | |
4543 | 4546 | | |
4544 | 4547 | | |
4545 | | - | |
| 4548 | + | |
4546 | 4549 | | |
4547 | 4550 | | |
4548 | 4551 | | |
| |||
4553 | 4556 | | |
4554 | 4557 | | |
4555 | 4558 | | |
4556 | | - | |
| 4559 | + | |
4557 | 4560 | | |
4558 | 4561 | | |
4559 | | - | |
| 4562 | + | |
4560 | 4563 | | |
4561 | 4564 | | |
4562 | 4565 | | |
| |||
4565 | 4568 | | |
4566 | 4569 | | |
4567 | 4570 | | |
4568 | | - | |
| 4571 | + | |
4569 | 4572 | | |
4570 | 4573 | | |
4571 | | - | |
| 4574 | + | |
4572 | 4575 | | |
4573 | 4576 | | |
4574 | 4577 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | | - | |
393 | | - | |
| 392 | + | |
| 393 | + | |
394 | 394 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
400 | 399 | | |
401 | 400 | | |
402 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2577 | 2577 | | |
2578 | 2578 | | |
2579 | 2579 | | |
2580 | | - | |
2581 | | - | |
2582 | 2580 | | |
2583 | 2581 | | |
2584 | 2582 | | |
| |||
0 commit comments