|
| 1 | +2021-04-09 Wenson Hsieh <wenson_hsieh@apple.com> |
| 2 | + |
| 3 | + REGRESSION (r271660): Tap highlight no longer shows when tapping clickable elements without touch event listeners |
| 4 | + https://bugs.webkit.org/show_bug.cgi?id=224385 |
| 5 | + <rdar://problem/76462370> |
| 6 | + |
| 7 | + Reviewed by Tim Horton. |
| 8 | + |
| 9 | + In r271660, I added a call to `-finishInteraction` when resetting the synthetic tap gesture to fix a bug where |
| 10 | + it was possible for the tap highlight to remain indefinitely when tapping on a clickable element with a touchend |
| 11 | + event listener. This was because the touch end deferring gesture defers `-_singleTapDidReset:` until after |
| 12 | + `-_didGetTapHighlightForRequest:…nodeHasBuiltInClickHandling:`, where we receive the tap highlight information. |
| 13 | + |
| 14 | + ``` |
| 15 | + 2021-04-09 13:05:27.141097-0700 -[WKContentView(WKInteraction) _singleTapIdentified:] |
| 16 | + 2021-04-09 13:05:27.148678-0700 -[WKContentView(WKInteraction) _didGetTapHighlightForRequest:…nodeHasBuiltInClickHandling:] |
| 17 | + 2021-04-09 13:05:27.162525-0700 -[WKContentView(WKInteraction) _singleTapRecognized:] |
| 18 | + 2021-04-09 13:05:27.162675-0700 ↳ -[WKContentView(WKInteraction) _showTapHighlight] |
| 19 | + 2021-04-09 13:05:27.163250-0700 -[WKContentView(WKInteraction) _singleTapDidReset:] |
| 20 | + 2021-04-09 13:05:51.849481-0700 ↳ -[WKContentView(WKInteraction) _finishInteraction] |
| 21 | + ``` |
| 22 | + |
| 23 | + However, in the case where there is no touchend event listener and when fast-click is active, we reset the tap |
| 24 | + gesture before receiving the tap highlight information: |
| 25 | + |
| 26 | + ``` |
| 27 | + 2021-04-09 13:05:51.836638-0700 -[WKContentView(WKInteraction) _singleTapIdentified:] |
| 28 | + 2021-04-09 13:05:51.846152-0700 -[WKContentView(WKInteraction) _singleTapRecognized:] |
| 29 | + 2021-04-09 13:05:51.847196-0700 -[WKContentView(WKInteraction) _singleTapDidReset:] |
| 30 | + 2021-04-09 13:05:51.848563-0700 -[WKContentView(WKInteraction) _didGetTapHighlightForRequest:…nodeHasBuiltInClickHandling:] |
| 31 | + 2021-04-09 13:05:51.848851-0700 ↳ -[WKContentView(WKInteraction) _showTapHighlight] |
| 32 | + 2021-04-09 13:05:51.849481-0700 ↳ -[WKContentView(WKInteraction) _finishInteraction] |
| 33 | + |
| 34 | + ``` |
| 35 | + |
| 36 | + Critically, this means that calling `-_finishInteraction` in `-_singleTapDidReset:` prematurely flagged the |
| 37 | + tap highlight request as complete (by setting `_isTapHighlightIDValid` to `NO`) in the case where we aren't |
| 38 | + deferring gestures, which caused us to avoid showing the tap highlight at all when we eventually receive the tap |
| 39 | + highlight information. |
| 40 | + |
| 41 | + To fix this, only fade out the tap highlight view in `-_singleTapDidReset:` if the tap highlight request has |
| 42 | + already finished (i.e. `_isTapHighlightIDValid` has been set to `NO`). Additionally, split logic for fading out |
| 43 | + the highlight view into a separate method, and add a `BOOL` flag to make the fading idempotent. |
| 44 | + |
| 45 | + Test: fast/events/touch/ios/tap-highlight-during-synthetic-click.html |
| 46 | + |
| 47 | + * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: |
| 48 | + * UIProcess/API/ios/WKWebViewTestingIOS.mm: |
| 49 | + (-[WKWebView _tapHighlightViewRect]): |
| 50 | + * UIProcess/ios/WKContentViewInteraction.h: |
| 51 | + * UIProcess/ios/WKContentViewInteraction.mm: |
| 52 | + (-[WKContentView tapHighlightViewRect]): |
| 53 | + |
| 54 | + Also add a testing-only method to report the frame of the tap highlight view. Note that this only attempts to |
| 55 | + return the current `frame` of the tap highlight view instead of converting the frame to the coordinate system of |
| 56 | + the content view (as other similar testing hooks do), since the tap highlight view only exists in the view |
| 57 | + hierarchy for a brief duration. |
| 58 | + |
| 59 | + (-[WKContentView _finishInteraction]): |
| 60 | + (-[WKContentView _fadeTapHighlightViewIfNeeded]): |
| 61 | + (-[WKContentView _singleTapDidReset:]): |
| 62 | + |
1 | 63 | 2021-04-09 Brent Fulgham <bfulgham@apple.com> |
2 | 64 |
|
3 | 65 | [iOS] Correct process-info rules to restrict to self |
|
0 commit comments