Changeset 246693 in webkit


Ignore:
Timestamp:
Jun 21, 2019 1:31:57 PM (5 years ago)
Author:
graouts@webkit.org
Message:

[iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
https://bugs.webkit.org/show_bug.cgi?id=198124
Source/WebKit:

<rdar://problem/50410863>

Reviewed by Dean Jackson.

Ensure we wait until completion of a tap before removing the pointer ID and the preventDefault() state along with it.

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

(-[WKContentView _singleTapDidReset:]):
(-[WKContentView _commitPotentialTapFailed]):
(-[WKContentView _didCompleteSyntheticClick]):
(-[WKContentView _singleTapRecognized:]):

LayoutTests:

Reviewed by Dean Jackson.

Add a new test that checks that calling preventDefault() within a "pointerdown" event handler correctly prevents
the dispatch of compatibility mouse events even with a slow tap.

  • pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown-expected.txt: Added.
  • pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246688 r246693  
     12019-06-21  Antoine Quint  <graouts@apple.com>
     2
     3        [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
     4        https://bugs.webkit.org/show_bug.cgi?id=198124
     5
     6        Reviewed by Dean Jackson.
     7
     8        Add a new test that checks that calling preventDefault() within a "pointerdown" event handler correctly prevents
     9        the dispatch of compatibility mouse events even with a slow tap.
     10
     11        * pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown-expected.txt: Added.
     12        * pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown.html: Added.
     13
    1142019-06-21  Russell Epstein  <russell_e@apple.com>
    215
  • trunk/Source/WebKit/ChangeLog

    r246687 r246693  
     12019-06-21  Antoine Quint  <graouts@apple.com>
     2
     3        [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
     4        https://bugs.webkit.org/show_bug.cgi?id=198124
     5        <rdar://problem/50410863>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Ensure we wait until completion of a tap before removing the pointer ID and the preventDefault() state along with it.
     10
     11        * UIProcess/ios/WKContentViewInteraction.h:
     12        * UIProcess/ios/WKContentViewInteraction.mm:
     13        (-[WKContentView _singleTapDidReset:]):
     14        (-[WKContentView _commitPotentialTapFailed]):
     15        (-[WKContentView _didCompleteSyntheticClick]):
     16        (-[WKContentView _singleTapRecognized:]):
     17
    1182019-06-21  Keith Rollin  <krollin@apple.com>
    219
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r246626 r246693  
    6060#import <wtf/text/WTFString.h>
    6161
     62#if ENABLE(POINTER_EVENTS)
     63#import <WebCore/PointerID.h>
     64#endif
     65
    6266namespace API {
    6367class OpenPanelParameters;
     
    320324    BOOL _isExpectingFastSingleTapCommit;
    321325    BOOL _showDebugTapHighlightsForFastClicking;
     326
     327#if ENABLE(POINTER_EVENTS)
     328    WebCore::PointerID m_commitPotentialTapPointerId;
     329#endif
    322330
    323331    BOOL _keyboardDidRequestDismissal;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r246665 r246693  
    23422342    cancelPotentialTapIfNecessary(self);
    23432343#if ENABLE(POINTER_EVENTS)
    2344     if (auto* singleTapTouchIdentifier = [_singleTapGestureRecognizer lastActiveTouchIdentifier])
    2345         _page->touchWithIdentifierWasRemoved([singleTapTouchIdentifier unsignedIntValue]);
     2344    if (auto* singleTapTouchIdentifier = [_singleTapGestureRecognizer lastActiveTouchIdentifier]) {
     2345        WebCore::PointerID pointerId = [singleTapTouchIdentifier unsignedIntValue];
     2346        if (m_commitPotentialTapPointerId != pointerId)
     2347            _page->touchWithIdentifierWasRemoved(pointerId);
     2348    }
    23462349#endif
    23472350}
     
    23552358- (void)_commitPotentialTapFailed
    23562359{
     2360#if ENABLE(POINTER_EVENTS)
     2361    _page->touchWithIdentifierWasRemoved(m_commitPotentialTapPointerId);
     2362    m_commitPotentialTapPointerId = 0;
     2363#endif
     2364
    23572365    [self _cancelInteraction];
    23582366   
     
    23822390- (void)_didCompleteSyntheticClick
    23832391{
     2392#if ENABLE(POINTER_EVENTS)
     2393    _page->touchWithIdentifierWasRemoved(m_commitPotentialTapPointerId);
     2394    m_commitPotentialTapPointerId = 0;
     2395#endif
     2396
    23842397    RELEASE_LOG(ViewGestures, "Synthetic click completed. (%p)", self);
    23852398    [self _resetInputViewDeferral];
     
    24102423    WebCore::PointerID pointerId = WebCore::mousePointerID;
    24112424#if ENABLE(POINTER_EVENTS)
    2412     if (auto* singleTapTouchIdentifier = [_singleTapGestureRecognizer lastActiveTouchIdentifier])
     2425    if (auto* singleTapTouchIdentifier = [_singleTapGestureRecognizer lastActiveTouchIdentifier]) {
    24132426        pointerId = [singleTapTouchIdentifier unsignedIntValue];
     2427        m_commitPotentialTapPointerId = pointerId;
     2428    }
    24142429#endif
    24152430    _page->commitPotentialTap(WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer)), _layerTreeTransactionIdAtLastTouchStart, pointerId);
Note: See TracChangeset for help on using the changeset viewer.