Title: [243454] trunk/Source/WebKit
Revision
243454
Author
[email protected]
Date
2019-03-25 13:55:33 -0700 (Mon, 25 Mar 2019)

Log Message

Animated keyboard scrolling is extremely chaotic
https://bugs.webkit.org/show_bug.cgi?id=196164
<rdar://problem/48702444>

Reviewed by Simon Fraser.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _interpretKeyEvent:isCharEvent:]):
Consume keyboard events instead of interpreting them traditionally
if WKKeyboardScrollingAnimator is animating.

* UIProcess/ios/WKKeyboardScrollingAnimator.h:
* UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollingAnimator beginWithEvent:]):
(-[WKKeyboardScrollingAnimator handleKeyEvent:]):
(-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
(-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
(-[WKKeyboardScrollingAnimator displayLinkFired:]):
(-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
Expose the current state of interactive scrolling, and rename the related member.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (243453 => 243454)


--- trunk/Source/WebKit/ChangeLog	2019-03-25 20:46:53 UTC (rev 243453)
+++ trunk/Source/WebKit/ChangeLog	2019-03-25 20:55:33 UTC (rev 243454)
@@ -1,3 +1,26 @@
+2019-03-25  Tim Horton  <[email protected]>
+
+        Animated keyboard scrolling is extremely chaotic
+        https://bugs.webkit.org/show_bug.cgi?id=196164
+        <rdar://problem/48702444>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _interpretKeyEvent:isCharEvent:]):
+        Consume keyboard events instead of interpreting them traditionally
+        if WKKeyboardScrollingAnimator is animating.
+
+        * UIProcess/ios/WKKeyboardScrollingAnimator.h:
+        * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
+        (-[WKKeyboardScrollingAnimator beginWithEvent:]):
+        (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
+        (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
+        (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
+        (-[WKKeyboardScrollingAnimator displayLinkFired:]):
+        (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
+        Expose the current state of interactive scrolling, and rename the related member.
+
 2019-03-25  Keith Rollin  <[email protected]>
 
         Add WebKit logging for first paint and other interesting layout milestones

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (243453 => 243454)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-03-25 20:46:53 UTC (rev 243453)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-03-25 20:55:33 UTC (rev 243454)
@@ -4449,7 +4449,7 @@
     if (!contentEditable && event.isTabKey)
         return NO;
 
-    if ([_keyboardScrollingAnimator beginWithEvent:event])
+    if ([_keyboardScrollingAnimator beginWithEvent:event] || [_keyboardScrollingAnimator scrollTriggeringKeyIsPressed])
         return YES;
 
     UIKeyboardImpl *keyboard = [UIKeyboardImpl sharedInstance];

Modified: trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h (243453 => 243454)


--- trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h	2019-03-25 20:46:53 UTC (rev 243453)
+++ trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h	2019-03-25 20:55:33 UTC (rev 243454)
@@ -62,6 +62,8 @@
 - (BOOL)beginWithEvent:(::WebEvent *)event;
 - (void)handleKeyEvent:(::WebEvent *)event;
 
+- (BOOL)scrollTriggeringKeyIsPressed;
+
 @property (nonatomic, weak) id <WKKeyboardScrollViewAnimatorDelegate> delegate;
 
 @end

Modified: trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm (243453 => 243454)


--- trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm	2019-03-25 20:46:53 UTC (rev 243453)
+++ trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm	2019-03-25 20:55:33 UTC (rev 243454)
@@ -99,7 +99,7 @@
 
     Optional<WebKit::KeyboardScroll> _currentScroll;
 
-    BOOL _hasPressedScrollingKey;
+    BOOL _scrollTriggeringKeyIsPressed;
 
     WebCore::FloatSize _velocity; // Points per second.
 
@@ -295,13 +295,13 @@
     if (!scroll)
         return NO;
 
-    if (_hasPressedScrollingKey)
+    if (_scrollTriggeringKeyIsPressed)
         return NO;
 
     if (![_scrollable rubberbandableDirections].at(boxSide(scroll->direction)))
         return NO;
 
-    _hasPressedScrollingKey = YES;
+    _scrollTriggeringKeyIsPressed = YES;
     _currentScroll = scroll;
 
 #if ENABLE(ANIMATED_KEYBOARD_SCROLLING)
@@ -328,13 +328,13 @@
 
 - (void)handleKeyEvent:(::WebEvent *)event
 {
-    if (!_hasPressedScrollingKey)
+    if (!_scrollTriggeringKeyIsPressed)
         return;
 
     auto scroll = [self keyboardScrollForEvent:event];
     if (!scroll || event.type == WebEventKeyUp) {
         [self stopAnimatedScroll];
-        _hasPressedScrollingKey = NO;
+        _scrollTriggeringKeyIsPressed = NO;
     }
 }
 
@@ -382,6 +382,11 @@
 #endif
 }
 
+- (BOOL)scrollTriggeringKeyIsPressed
+{
+    return _scrollTriggeringKeyIsPressed;
+}
+
 - (void)willStartInteractiveScroll
 {
     // If the user touches the screen to start an interactive scroll, stop everything.
@@ -458,7 +463,7 @@
 
     // If we've effectively stopped scrolling, and no key is pressed,
     // shut down the display link.
-    if (!_hasPressedScrollingKey && _velocity.diagonalLengthSquared() < 1) {
+    if (!_scrollTriggeringKeyIsPressed && _velocity.diagonalLengthSquared() < 1) {
         [_scrollable didFinishScrolling];
         [self stopDisplayLink];
         _velocity = { };
@@ -564,6 +569,11 @@
     return [_animator handleKeyEvent:event];
 }
 
+- (BOOL)scrollTriggeringKeyIsPressed
+{
+    return [_animator scrollTriggeringKeyIsPressed];
+}
+
 - (BOOL)isKeyboardScrollable
 {
     if (!_delegateRespondsToIsKeyboardScrollable)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to