Changeset 191072 in webkit


Ignore:
Timestamp:
Oct 14, 2015 2:20:50 PM (9 years ago)
Author:
Wenson Hsieh
Message:

Web pages with unscalable viewports shouldn't have a single tap delay
https://bugs.webkit.org/show_bug.cgi?id=149968
<rdar://problem/23054453>

Reviewed by Simon Fraser.

Source/WebKit2:

When a viewport is unscalable (specified through the meta viewport tag) we
do not add a delay to our single tap gesture recognizer. We do this by
disabling or reinitializing the WKContentView's double tap gesture recognizer
when the viewport becomes unscalable or scalable, respectively. A viewport is
deemed unscalable when it has user-scalable = no, or when the minimum scale is
greater than or equal to the maximum scale.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _didCommitLayerTree:]):

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Pulled logic

for initializing a double tap gesture recognizer out into a helper function.

(-[WKContentView setupInteraction]):
(-[WKContentView _setDoubleTapGesturesEnabled:]): Turns gesture recognition for double

taps on or off.

LayoutTests:

Add a layout test to check that when a viewport is unscalable (specified through
the meta viewport tag) we do not add a delay to our single tap gesture recognizer.

  • fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt: Added.
  • fast/events/ios/unscalable-viewport-clicks-on-doubletap.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r191066 r191072  
     12015-10-14  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Web pages with unscalable viewports shouldn't have a single tap delay
     4        https://bugs.webkit.org/show_bug.cgi?id=149968
     5        <rdar://problem/23054453>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add a layout test to check that when a viewport is unscalable (specified through
     10        the meta viewport tag) we do not add a delay to our single tap gesture recognizer.
     11
     12        * fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt: Added.
     13        * fast/events/ios/unscalable-viewport-clicks-on-doubletap.html: Added.
     14
    1152015-10-14  Jiewen Tan  <jiewen_tan@apple.com>
    216
  • trunk/Source/WebKit2/ChangeLog

    r191065 r191072  
     12015-10-14  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Web pages with unscalable viewports shouldn't have a single tap delay
     4        https://bugs.webkit.org/show_bug.cgi?id=149968
     5        <rdar://problem/23054453>
     6
     7        Reviewed by Simon Fraser.
     8
     9        When a viewport is unscalable (specified through the meta viewport tag) we
     10        do not add a delay to our single tap gesture recognizer. We do this by
     11        disabling or reinitializing the WKContentView's double tap gesture recognizer
     12        when the viewport becomes unscalable or scalable, respectively. A viewport is
     13        deemed unscalable when it has user-scalable = no, or when the minimum scale is
     14        greater than or equal to the maximum scale.
     15
     16        * UIProcess/API/Cocoa/WKWebView.mm:
     17        (-[WKWebView _didCommitLayerTree:]):
     18        * UIProcess/ios/WKContentViewInteraction.h:
     19        * UIProcess/ios/WKContentViewInteraction.mm:
     20        (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Pulled logic
     21                for initializing a double tap gesture recognizer out into a helper function.
     22        (-[WKContentView setupInteraction]):
     23        (-[WKContentView _setDoubleTapGesturesEnabled:]): Turns gesture recognition for double
     24                taps on or off.
     25
    1262015-10-14  Anders Carlsson  <andersca@apple.com>
    227
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r191063 r191072  
    10071007        [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
    10081008
     1009    [_contentView _setDoubleTapGesturesEnabled:[_scrollView isZoomEnabled] && [_scrollView minimumZoomScale] < [_scrollView maximumZoomScale]];
     1010
    10091011    [self _updateScrollViewBackground];
    10101012
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h

    r190284 r191072  
    204204- (void)_disableInspectorNodeSearch;
    205205- (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler;
     206- (void)_setDoubleTapGesturesEnabled:(BOOL)enabled;
    206207@end
    207208
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r190841 r191072  
    297297}
    298298
     299- (void)_createAndConfigureDoubleTapGestureRecognizer
     300{
     301    _doubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognized:)]);
     302    [_doubleTapGestureRecognizer setNumberOfTapsRequired:2];
     303    [_doubleTapGestureRecognizer setDelegate:self];
     304    [self addGestureRecognizer:_doubleTapGestureRecognizer.get()];
     305    [_singleTapGestureRecognizer requireOtherGestureToFail:_doubleTapGestureRecognizer.get()];
     306}
     307
    299308- (void)setupInteraction
    300309{
     
    320329    [self addGestureRecognizer:_singleTapGestureRecognizer.get()];
    321330
    322     _doubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognized:)]);
    323     [_doubleTapGestureRecognizer setNumberOfTapsRequired:2];
    324     [_doubleTapGestureRecognizer setDelegate:self];
    325     [self addGestureRecognizer:_doubleTapGestureRecognizer.get()];
    326     [_singleTapGestureRecognizer requireOtherGestureToFail:_doubleTapGestureRecognizer.get()];
     331    [self _createAndConfigureDoubleTapGestureRecognizer];
    327332
    328333    _twoFingerDoubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_twoFingerDoubleTapRecognized:)]);
     
    22402245}
    22412246
     2247- (void)_setDoubleTapGesturesEnabled:(BOOL)enabled
     2248{
     2249    if (enabled && ![_doubleTapGestureRecognizer isEnabled]) {
     2250        // The first tap recognized after re-enabling double tap gestures will not wait for the
     2251        // second tap before committing. To fix this, we use a new double tap gesture recognizer.
     2252        [self removeGestureRecognizer:_doubleTapGestureRecognizer.get()];
     2253        [_doubleTapGestureRecognizer setDelegate:nil];
     2254        [self _createAndConfigureDoubleTapGestureRecognizer];
     2255    }
     2256    [_doubleTapGestureRecognizer setEnabled:enabled];
     2257}
     2258
    22422259- (void)accessoryAutoFill
    22432260{
Note: See TracChangeset for help on using the changeset viewer.