⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243454 in webkit


Ignore:
Timestamp:
Mar 25, 2019, 1:55:33 PM (7 years ago)
Author:
timothy_horton@apple.com
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.

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243453 r243454  
     12019-03-25  Tim Horton  <timothy_horton@apple.com>
     2
     3        Animated keyboard scrolling is extremely chaotic
     4        https://bugs.webkit.org/show_bug.cgi?id=196164
     5        <rdar://problem/48702444>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/ios/WKContentViewInteraction.mm:
     10        (-[WKContentView _interpretKeyEvent:isCharEvent:]):
     11        Consume keyboard events instead of interpreting them traditionally
     12        if WKKeyboardScrollingAnimator is animating.
     13
     14        * UIProcess/ios/WKKeyboardScrollingAnimator.h:
     15        * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
     16        (-[WKKeyboardScrollingAnimator beginWithEvent:]):
     17        (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
     18        (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
     19        (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
     20        (-[WKKeyboardScrollingAnimator displayLinkFired:]):
     21        (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
     22        Expose the current state of interactive scrolling, and rename the related member.
     23
    1242019-03-25  Keith Rollin  <krollin@apple.com>
    225
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r243370 r243454  
    44504450        return NO;
    44514451
    4452     if ([_keyboardScrollingAnimator beginWithEvent:event])
     4452    if ([_keyboardScrollingAnimator beginWithEvent:event] || [_keyboardScrollingAnimator scrollTriggeringKeyIsPressed])
    44534453        return YES;
    44544454
  • trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h

    r242695 r243454  
    6363- (void)handleKeyEvent:(::WebEvent *)event;
    6464
     65- (BOOL)scrollTriggeringKeyIsPressed;
     66
    6567@property (nonatomic, weak) id <WKKeyboardScrollViewAnimatorDelegate> delegate;
    6668
  • trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm

    r242695 r243454  
    100100    Optional<WebKit::KeyboardScroll> _currentScroll;
    101101
    102     BOOL _hasPressedScrollingKey;
     102    BOOL _scrollTriggeringKeyIsPressed;
    103103
    104104    WebCore::FloatSize _velocity; // Points per second.
     
    296296        return NO;
    297297
    298     if (_hasPressedScrollingKey)
     298    if (_scrollTriggeringKeyIsPressed)
    299299        return NO;
    300300
     
    302302        return NO;
    303303
    304     _hasPressedScrollingKey = YES;
     304    _scrollTriggeringKeyIsPressed = YES;
    305305    _currentScroll = scroll;
    306306
     
    329329- (void)handleKeyEvent:(::WebEvent *)event
    330330{
    331     if (!_hasPressedScrollingKey)
     331    if (!_scrollTriggeringKeyIsPressed)
    332332        return;
    333333
     
    335335    if (!scroll || event.type == WebEventKeyUp) {
    336336        [self stopAnimatedScroll];
    337         _hasPressedScrollingKey = NO;
     337        _scrollTriggeringKeyIsPressed = NO;
    338338    }
    339339}
     
    381381    [self stopRepeatTimer];
    382382#endif
     383}
     384
     385- (BOOL)scrollTriggeringKeyIsPressed
     386{
     387    return _scrollTriggeringKeyIsPressed;
    383388}
    384389
     
    459464    // If we've effectively stopped scrolling, and no key is pressed,
    460465    // shut down the display link.
    461     if (!_hasPressedScrollingKey && _velocity.diagonalLengthSquared() < 1) {
     466    if (!_scrollTriggeringKeyIsPressed && _velocity.diagonalLengthSquared() < 1) {
    462467        [_scrollable didFinishScrolling];
    463468        [self stopDisplayLink];
     
    563568{
    564569    return [_animator handleKeyEvent:event];
     570}
     571
     572- (BOOL)scrollTriggeringKeyIsPressed
     573{
     574    return [_animator scrollTriggeringKeyIsPressed];
    565575}
    566576
Note: See TracChangeset for help on using the changeset viewer.