(iPad) Link tapping is sluggish on many sites
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2019 19:15:57 +0000 (19:15 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2019 19:15:57 +0000 (19:15 +0000)
commit5c9f3756eaf9ffc642877ceca12b321abf3ce2aa
tree15d29ccc4c90f05b44660c4a3b363365497e9e57
parent66246fa884a9e6aadfc423a11f778e04ee126a80
(iPad) Link tapping is sluggish on many sites
https://bugs.webkit.org/show_bug.cgi?id=193522
<rdar://problem/47102987>

Reviewed by Wenson Hsieh.

Source/WebKit:

Some WKWebView clients might set the initial zoom scale of the page to
something other than 1, which disables the "fast tap" behaviour.
The fix is very simple -- just check against the initial scale rather
than 1.

The most likely regression from this would be pages designed for desktop,
but provide a viewport tag saying width=device-width and initial-scale.
They might stop allowing double-tap-to-zoom.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _allowsDoubleTapGestures]): Check against initial page scale.

LayoutTests:

Add a test that checks a double tap will trigger a click
event on a page that is at initial scale.

Extra bonus: for some reason adding this test, or making this code
change, uncovered a couple of bugs in existing tests. The
viewport-zooms-from-element-to-initial-scale test was completely wrong
because it was expecting the incorrect result, which was triggered by
the zoom callback firing early at a forced scale value. The
viewport-no-width-value-allows-double-tap test was triggering a JS
error in its UI script. I modernised both of these to use UIHelper instead.

* fast/events/ios/fast-click-double-tap-sends-click-when-initial-scale-expected.txt: Added.
* fast/events/ios/fast-click-double-tap-sends-click-when-initial-scale.html: Added.
* fast/events/ios/viewport-no-width-value-allows-double-tap.html:
* fast/events/ios/viewport-zooms-from-element-to-initial-scale-expected.txt:
* fast/events/ios/viewport-zooms-from-element-to-initial-scale.html:
* resources/ui-helper.js: Add doubleTapAt and zoomByDoubleTapAt helpers. Remove the
unnecessary "Done" return value from many of the callbacks. Give zoomToScale a return
value.
(window.UIHelper.tapAt.return.new.Promise):
(window.UIHelper.tapAt):
(window.UIHelper.doubleTapAt.return.new.Promise):
(window.UIHelper.doubleTapAt):
(window.UIHelper.zoomByDoubleTappingAt):
(window.UIHelper.activateAt.return.new.Promise):
(window.UIHelper.activateAt):
(window.UIHelper.toggleCapsLock):
(window.UIHelper.ensurePresentationUpdate.return.new.Promise):
(window.UIHelper.ensurePresentationUpdate):
(window.UIHelper.activateAndWaitForInputSessionAt.return.new.Promise.):
(window.UIHelper.activateFormControl.return.new.Promise.):
(window.UIHelper.replaceTextAtRange):
(window.UIHelper.zoomToScale):
(window.UIHelper.stylusTapAt.return.new.Promise):
(window.UIHelper.stylusTapAt):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240119 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/ios/fast-click-double-tap-sends-click-when-initial-scale-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/ios/fast-click-double-tap-sends-click-when-initial-scale.html [new file with mode: 0644]
LayoutTests/fast/events/ios/viewport-no-width-value-allows-double-tap.html
LayoutTests/fast/events/ios/viewport-zooms-from-element-to-initial-scale-expected.txt
LayoutTests/fast/events/ios/viewport-zooms-from-element-to-initial-scale.html
LayoutTests/resources/ui-helper.js
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm