Diff
Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/ChangeLog 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog 2019-10-20 17:33:12 UTC (rev 251343)
@@ -1,5 +1,85 @@
2019-10-15 Kocsen Chung <kocsen_ch...@apple.com>
+ Cherry-pick r250780. rdar://problem/56061126
+
+ Provide options for DTTZ to happen in more situations
+ https://bugs.webkit.org/show_bug.cgi?id=202634
+ <rdar://problem/55732762>
+
+ Reviewed by Antoine Quint.
+
+ Add two options that can be enabled to trigger double tap zooming
+ in more places.
+
+ Firstly, an option to keep listening for a double-tap-to-zoom if the
+ first tap found a click handler on the body or document element. The
+ tap will still be dispatched. This is probably the most common case
+ for disabling a DTTZ.
+
+ Secondly, an option to always keep listening for a double-tap-to-zoom,
+ even if there was a clickable (non-root) element under the first tap.
+
+ * Shared/WebPreferences.yaml: Add ZoomOnDoubleTapWhenRoot and AlwaysZoomOnDoubleTap.
+ * UIProcess/PageClient.h: The message from the WebProcess now tells the UIProcess if
+ the tapped element was a root-level (document or body).
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary]):
+ (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):
+ Handle the two new options.
+
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::potentialTapAtPosition): Check if the tap was on a root-level element.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-07 Dean Jackson <d...@apple.com>
+
+ Provide options for DTTZ to happen in more situations
+ https://bugs.webkit.org/show_bug.cgi?id=202634
+ <rdar://problem/55732762>
+
+ Reviewed by Antoine Quint.
+
+ Add two options that can be enabled to trigger double tap zooming
+ in more places.
+
+ Firstly, an option to keep listening for a double-tap-to-zoom if the
+ first tap found a click handler on the body or document element. The
+ tap will still be dispatched. This is probably the most common case
+ for disabling a DTTZ.
+
+ Secondly, an option to always keep listening for a double-tap-to-zoom,
+ even if there was a clickable (non-root) element under the first tap.
+
+ * Shared/WebPreferences.yaml: Add ZoomOnDoubleTapWhenRoot and AlwaysZoomOnDoubleTap.
+ * UIProcess/PageClient.h: The message from the WebProcess now tells the UIProcess if
+ the tapped element was a root-level (document or body).
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary]):
+ (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):
+ Handle the two new options.
+
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::potentialTapAtPosition): Check if the tap was on a root-level element.
+
+2019-10-15 Kocsen Chung <kocsen_ch...@apple.com>
+
Cherry-pick r250755. rdar://problem/56061126
Use a better name than allowFastClicksEverywhere
Modified: branches/safari-608-branch/Source/WebKit/Shared/WebPreferences.yaml (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/Shared/WebPreferences.yaml 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/Shared/WebPreferences.yaml 2019-10-20 17:33:12 UTC (rev 251343)
@@ -1543,11 +1543,29 @@
type: bool
defaultValue: DEFAULT_PREFER_FASTER_CLICK_OVER_DOUBLE_TAP
condition: PLATFORM(IOS_FAMILY)
- humanReadableName: "Use fast clicks before double tap"
+ humanReadableName: "Fast clicks beat DTTZ"
humanReadableDescription: "Prefer a faster click over a double tap"
webcoreBinding: none
category: internal
+ZoomOnDoubleTapWhenRoot:
+ type: bool
+ defaultValue: false
+ condition: PLATFORM(IOS_FAMILY)
+ humanReadableName: "DTTZ also when root"
+ humanReadableDescription: "Double taps zoom, even if we dispatched a click on the root nodes"
+ webcoreBinding: none
+ category: internal
+
+AlwaysZoomOnDoubleTap:
+ type: bool
+ defaultValue: false
+ condition: PLATFORM(IOS_FAMILY)
+ humanReadableName: "DTTZ always"
+ humanReadableDescription: "Double taps zoom, even if we dispatched a click anywhere"
+ webcoreBinding: none
+ category: internal
+
InputTypeColorEnabled:
type: bool
defaultValue: DEFAULT_INPUT_TYPE_COLOR_ENABLED
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/PageClient.h (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/PageClient.h 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/PageClient.h 2019-10-20 17:33:12 UTC (rev 251343)
@@ -395,7 +395,7 @@
virtual void saveImageToLibrary(Ref<WebCore::SharedBuffer>&&) = 0;
virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect, WebCore::RouteSharingPolicy, const String&) = 0;
virtual void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) = 0;
- virtual void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale) = 0;
+ virtual void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) = 0;
virtual double minimumZoomScale() const = 0;
virtual WebCore::FloatRect documentRect() const = 0;
virtual void scrollingNodeScrollViewWillStartPanGesture() = 0;
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.h (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-10-20 17:33:12 UTC (rev 251343)
@@ -711,7 +711,7 @@
void didNotHandleTapAsClick(const WebCore::IntPoint&);
void didCompleteSyntheticClick();
void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID);
- void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale);
+ void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel);
void contentSizeCategoryDidChange(const String& contentSizeCategory);
void getSelectionContext(WTF::Function<void(const String&, const String&, const String&, CallbackBase::Error)>&&);
void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t requestID);
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-10-20 17:33:12 UTC (rev 251343)
@@ -195,7 +195,7 @@
DidNotHandleTapAsClick(WebCore::IntPoint point)
DidCompleteSyntheticClick()
DisableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID)
- HandleSmartMagnificationInformationForPotentialTap(uint64_t requestID, WebCore::FloatRect renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale)
+ HandleSmartMagnificationInformationForPotentialTap(uint64_t requestID, WebCore::FloatRect renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel)
DrawToPDFCallback(IPC::DataReference pdfData, WebKit::CallbackID callbackID)
SelectionRectsCallback(Vector<WebCore::SelectionRect> selectionRects, WebKit::CallbackID callbackID);
#endif
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2019-10-20 17:33:12 UTC (rev 251343)
@@ -164,7 +164,7 @@
bool showShareSheet(const WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&&) override;
void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) override;
- void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale) override;
+ void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) override;
double minimumZoomScale() const override;
WebCore::FloatRect documentRect() const override;
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2019-10-20 17:33:12 UTC (rev 251343)
@@ -245,9 +245,9 @@
[m_contentView _disableDoubleTapGesturesDuringTapIfNecessary:requestID];
}
-void PageClientImpl::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale)
+void PageClientImpl::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel)
{
- [m_contentView _handleSmartMagnificationInformationForPotentialTap:requestID renderRect:renderRect fitEntireRect:fitEntireRect viewportMinimumScale:viewportMinimumScale viewportMaximumScale:viewportMaximumScale];
+ [m_contentView _handleSmartMagnificationInformationForPotentialTap:requestID renderRect:renderRect fitEntireRect:fitEntireRect viewportMinimumScale:viewportMinimumScale viewportMaximumScale:viewportMaximumScale nodeIsRootLevel:nodeIsRootLevel];
}
double PageClientImpl::minimumZoomScale() const
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2019-10-20 17:33:12 UTC (rev 251343)
@@ -461,7 +461,7 @@
- (BOOL)_mayDisableDoubleTapGesturesDuringSingleTap;
- (void)_disableDoubleTapGesturesDuringTapIfNecessary:(uint64_t)requestID;
-- (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale;
+- (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale nodeIsRootLevel:(BOOL)nodeIsRootLevel;
- (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode activityStateChanges:(OptionSet<WebCore::ActivityState::Flag>)activityStateChanges userObject:(NSObject <NSSecureCoding> *)userObject;
- (void)_updateInputContextAfterBlurringAndRefocusingElement;
- (void)_elementDidBlur;
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-10-20 17:33:12 UTC (rev 251343)
@@ -1722,14 +1722,29 @@
[self _setDoubleTapGesturesEnabled:NO];
}
-- (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale
+- (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale nodeIsRootLevel:(BOOL)nodeIsRootLevel
{
- ASSERT(_page->preferences().fasterClicksEnabled());
+ const auto& preferences = _page->preferences();
+
+ ASSERT(preferences.fasterClicksEnabled());
if (!_potentialTapInProgress)
return;
- if (_page->preferences().preferFasterClickOverDoubleTap() && _page->preferFasterClickOverDoubleTap()) {
+ // We check both the system preference and the page preference, because we only want this
+ // to apply in "desktop" mode.
+ if (preferences.preferFasterClickOverDoubleTap() && _page->preferFasterClickOverDoubleTap()) {
RELEASE_LOG(ViewGestures, "Potential tap found an element and fast taps are preferred. Trigger click. (%p)", self);
+ if (preferences.zoomOnDoubleTapWhenRoot() && nodeIsRootLevel) {
+ RELEASE_LOG(ViewGestures, "The click handler was on a root-level element, so don't disable double-tap. (%p)", self);
+ return;
+ }
+
+ if (preferences.alwaysZoomOnDoubleTap()) {
+ RELEASE_LOG(ViewGestures, "DTTZ is forced on, so don't disable double-tap. (%p)", self);
+ return;
+ }
+
+ RELEASE_LOG(ViewGestures, "Give preference to click by disabling double-tap. (%p)", self);
[self _setDoubleTapGesturesEnabled:NO];
return;
}
@@ -2534,9 +2549,14 @@
- (void)_endPotentialTapAndEnableDoubleTapGesturesIfNecessary
{
- if (_webView._allowsDoubleTapGestures)
+ if (_webView._allowsDoubleTapGestures) {
+ RELEASE_LOG(ViewGestures, "ending potential tap - double taps are back. (%p)", self);
+
[self _setDoubleTapGesturesEnabled:YES];
+ }
+ RELEASE_LOG(ViewGestures, "Ending potential tap. (%p)", self);
+
_potentialTapInProgress = NO;
}
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-10-20 17:33:12 UTC (rev 251343)
@@ -1083,9 +1083,9 @@
pageClient().disableDoubleTapGesturesDuringTapIfNecessary(requestID);
}
-void WebPageProxy::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale)
+void WebPageProxy::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel)
{
- pageClient().handleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale);
+ pageClient().handleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale, nodeIsRootLevel);
}
uint32_t WebPageProxy::computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo& printInfo, DrawToPDFCallback::CallbackFunction&& callback)
Modified: branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (251342 => 251343)
--- branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-10-20 17:33:08 UTC (rev 251342)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-10-20 17:33:12 UTC (rev 251343)
@@ -1097,7 +1097,9 @@
double viewportMaximumScale;
m_viewGestureGeometryCollector->computeZoomInformationForNode(*m_potentialTapNode, origin, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale);
- send(Messages::WebPageProxy::HandleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale));
+
+ bool nodeIsRootLevel = is<WebCore::Document>(*m_potentialTapNode) || is<WebCore::HTMLBodyElement>(*m_potentialTapNode);
+ send(Messages::WebPageProxy::HandleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale, nodeIsRootLevel));
}
sendTapHighlightForNodeIfNecessary(requestID, m_potentialTapNode.get());