Changeset 245285 in webkit
- Timestamp:
- May 14, 2019, 9:43:51 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/scrolling/ios/scroll-to-beginning-and-end-of-document-expected.txt (added)
-
LayoutTests/fast/scrolling/ios/scroll-to-beginning-and-end-of-document.html (added)
-
LayoutTests/resources/ui-helper.js (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245280 r245285 1 2019-05-14 Daniel Bates <dabates@apple.com> 2 3 [iOS] Cannot scroll to beginning of document after scrolling to end of document and vice versa via key commands 4 https://bugs.webkit.org/show_bug.cgi?id=197848 5 <rdar://problem/49523065> 6 7 Reviewed by Brent Fulgham. 8 9 Add a test to ensure that key commands can be used to scroll to the end of the page and then 10 to the beginning of the page. 11 12 * fast/scrolling/ios/scroll-to-beginning-and-end-of-document-expected.txt: Added. 13 * fast/scrolling/ios/scroll-to-beginning-and-end-of-document.html: Added. 14 * resources/ui-helper.js: 15 (window.UIHelper.callFunctionAndWaitForScrollToFinish): Added. Convenience function that invokes the 16 specified function and returns a Promise that is resolved once the page has finished scrolling. To know 17 if the page has finished scrolling we listen for DOM scroll events and repeatedly reset a 300ms timer. 18 The delay of 300ms was chosen to be > 250ms (to give some margin of error), which is the upper bound 19 delay between scroll event firings, last I recall. When the timer expires we assume that page has 20 finished scrolling. 21 (window.UIHelper): 22 1 23 2019-05-14 Said Abou-Hallawa <sabouhallawa@apple.com> 2 24 -
trunk/LayoutTests/resources/ui-helper.js
r245062 r245285 885 885 await this.activateAt(menuRect.left + menuRect.width / 2, menuRect.top + menuRect.height / 2); 886 886 } 887 888 static callFunctionAndWaitForScrollToFinish(functionToCall, ...theArguments) 889 { 890 return new Promise((resolved) => { 891 function scrollDidFinish() { 892 window.removeEventListener("scroll", handleScroll, true); 893 resolved(); 894 } 895 896 let lastScrollTimerId = 0; // When the timer with this id fires then the page has finished scrolling. 897 function handleScroll() { 898 if (lastScrollTimerId) { 899 window.clearTimeout(lastScrollTimerId); 900 lastScrollTimerId = 0; 901 } 902 lastScrollTimerId = window.setTimeout(scrollDidFinish, 300); // Over 250ms to give some room for error. 903 } 904 window.addEventListener("scroll", handleScroll, true); 905 906 functionToCall.apply(this, theArguments); 907 }); 908 } 887 909 } -
trunk/Source/WebKit/ChangeLog
r245284 r245285 1 2019-05-14 Daniel Bates <dabates@apple.com> 2 3 [iOS] Cannot scroll to beginning of document after scrolling to end of document and vice versa via key commands 4 https://bugs.webkit.org/show_bug.cgi?id=197848 5 <rdar://problem/49523065> 6 7 Reviewed by Brent Fulgham. 8 9 Following the fix for <rdar://problem/49523065>, UIKit no longer emits a keyup event for a Command- 10 modified key. This breaks WebKit's own implementation of key command handling for scrolling to the 11 beginning or end of the document (triggered using Command + Arrow Up and Command + Arrow Down, 12 respectively) because it watches for keyup events to reset state after initiating a scroll. If state 13 is not reset then the scroll key command logic becomes confused and may not perform a subsequent scroll. 14 It seems like we can actually get away with supporting these key commands and future Command modified 15 commands by preemptively reseting state on keydown if the Command modifier is held down. If this does 16 not work out then we can do something more complicated. 17 18 * UIProcess/ios/WKKeyboardScrollingAnimator.mm: 19 (-[WKKeyboardScrollingAnimator handleKeyEvent:]): 20 1 21 2019-05-14 Brent Fulgham <bfulgham@apple.com> 2 22 -
trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm
r244955 r245285 347 347 348 348 auto scroll = [self keyboardScrollForEvent:event]; 349 if (!scroll || event.type == WebEventKeyUp) { 349 350 // UIKit does not emit a keyup event when the Command key is down. See <rdar://problem/49523065>. 351 // For recognized key commands that include the Command key (e.g. Command + Arrow Up) we reset our 352 // state on keydown. 353 if (!scroll || event.type == WebEventKeyUp || (event.modifierFlags & WebEventFlagMaskCommandKey)) { 350 354 [self stopAnimatedScroll]; 351 355 _scrollTriggeringKeyIsPressed = NO;
Note:
See TracChangeset
for help on using the changeset viewer.