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

Changeset 245268 in webkit


Ignore:
Timestamp:
May 13, 2019, 7:25:34 PM (7 years ago)
Author:
Wenson Hsieh
Message:

[iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
https://bugs.webkit.org/show_bug.cgi?id=197821
<rdar://problem/50700512>

Reviewed by Tim Horton.

Source/WebKit:

After r244775, when running back-to-back layout tests on iOS that simulate taps in the same location, the double
tap gesture recognizer for recognizing double clicks ends up recognizing instead of the single tap gesture
recognizer in the subsequent test. This means that click handlers in the subsequent test will fail to recognize,
unless the element with the click handler is also accompanied by a dblclick handler.

To avoid this, we reset the double click gesture recognizer when navigating; this has the additional effect of
making it such that the second page doesn't end up observing a dblclick when the first click was only sent to
the first page.

  • UIProcess/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):

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

(-[WKContentView setupInteraction]):
(-[WKContentView _didStartProvisionalLoadForMainFrame]):

LayoutTests:

Removes workarounds in a couple of existing layout tests.

  • editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html:
  • editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245262 r245268  
     12019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
     4        https://bugs.webkit.org/show_bug.cgi?id=197821
     5        <rdar://problem/50700512>
     6
     7        Reviewed by Tim Horton.
     8
     9        Removes workarounds in a couple of existing layout tests.
     10
     11        * editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html:
     12        * editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html:
     13
    1142019-05-13  Jiewen Tan  <jiewen_tan@apple.com>
    215
  • trunk/LayoutTests/editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html

    r245067 r245268  
    4343
    4444        await UIHelper.activateElement(clickTarget);
    45 
    46         setTimeout(async function () {
    47             // The test is done, but we need to tap again to ensure we don't
    48             // hang the next test with a double tap.
    49             document.removeEventListener("selectionchange", didChangeSelection);
    50             await UIHelper.tapAt(10, 500);
    51 
    52             testRunner.notifyDone();
    53         }, 0);
     45        setTimeout(() => testRunner.notifyDone(), 0);
    5446    }
    5547    </script>
  • trunk/LayoutTests/editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html

    r245067 r245268  
    4242        clickTarget.addEventListener("click", event => {
    4343            event.preventDefault();
    44 
    45             setTimeout(async function () {
    46                 // The test is done, but we need to tap again to ensure we don't
    47                 // hang the next test with a double tap.
    48                 document.removeEventListener("selectionchange", didChangeSelection);
    49                 await UIHelper.tapAt(10, 500);
    50 
    51                 testRunner.notifyDone();
    52             }, 0);
     44            setTimeout(() => testRunner.notifyDone(), 0);
    5345        });
    5446
  • trunk/Source/WebKit/ChangeLog

    r245267 r245268  
     12019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
     4        https://bugs.webkit.org/show_bug.cgi?id=197821
     5        <rdar://problem/50700512>
     6
     7        Reviewed by Tim Horton.
     8
     9        After r244775, when running back-to-back layout tests on iOS that simulate taps in the same location, the double
     10        tap gesture recognizer for recognizing double clicks ends up recognizing instead of the single tap gesture
     11        recognizer in the subsequent test. This means that click handlers in the subsequent test will fail to recognize,
     12        unless the element with the click handler is also accompanied by a dblclick handler.
     13
     14        To avoid this, we reset the double click gesture recognizer when navigating; this has the additional effect of
     15        making it such that the second page doesn't end up observing a dblclick when the first click was only sent to
     16        the first page.
     17
     18        * UIProcess/ios/PageClientImplIOS.mm:
     19        (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
     20        * UIProcess/ios/WKContentViewInteraction.h:
     21        * UIProcess/ios/WKContentViewInteraction.mm:
     22        (-[WKContentView setupInteraction]):
     23        (-[WKContentView _didStartProvisionalLoadForMainFrame]):
     24
    1252019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
    226
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm

    r245112 r245268  
    216216{
    217217    [m_webView _didStartProvisionalLoadForMainFrame];
     218    [m_contentView _didStartProvisionalLoadForMainFrame];
    218219    [m_webView _hidePasswordView];
    219220}
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r245154 r245268  
    507507- (void)_handleAutocorrectionContext:(const WebKit::WebAutocorrectionContext&)context;
    508508
     509- (void)_didStartProvisionalLoadForMainFrame;
     510
    509511@end
    510512
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r245154 r245268  
    739739    [_doubleTapGestureRecognizerForDoubleClick setNumberOfTapsRequired:2];
    740740    [_doubleTapGestureRecognizerForDoubleClick setDelegate:self];
    741     [_doubleTapGestureRecognizerForDoubleClick setEnabled:YES];
    742741    [self addGestureRecognizer:_doubleTapGestureRecognizerForDoubleClick.get()];
    743742
     
    37613760{
    37623761    [self _invokePendingAutocorrectionContextHandler:[WKAutocorrectionContext autocorrectionContextWithWebContext:context]];
     3762}
     3763
     3764- (void)_didStartProvisionalLoadForMainFrame
     3765{
     3766    // Reset the double tap gesture recognizer to prevent any double click that is in the process of being recognized.
     3767    [_doubleTapGestureRecognizerForDoubleClick setEnabled:NO];
     3768    [_doubleTapGestureRecognizerForDoubleClick setEnabled:YES];
    37633769}
    37643770
Note: See TracChangeset for help on using the changeset viewer.