Changeset 250780 in webkit
- Timestamp:
- Oct 7, 2019 11:48:48 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r250779 r250780 1 2019-10-07 Dean Jackson <dino@apple.com> 2 3 Provide options for DTTZ to happen in more situations 4 https://bugs.webkit.org/show_bug.cgi?id=202634 5 <rdar://problem/55732762> 6 7 Reviewed by Antoine Quint. 8 9 Add two options that can be enabled to trigger double tap zooming 10 in more places. 11 12 Firstly, an option to keep listening for a double-tap-to-zoom if the 13 first tap found a click handler on the body or document element. The 14 tap will still be dispatched. This is probably the most common case 15 for disabling a DTTZ. 16 17 Secondly, an option to always keep listening for a double-tap-to-zoom, 18 even if there was a clickable (non-root) element under the first tap. 19 20 * Shared/WebPreferences.yaml: Add ZoomOnDoubleTapWhenRoot and AlwaysZoomOnDoubleTap. 21 * UIProcess/PageClient.h: The message from the WebProcess now tells the UIProcess if 22 the tapped element was a root-level (document or body). 23 * UIProcess/WebPageProxy.h: 24 * UIProcess/WebPageProxy.messages.in: 25 * UIProcess/ios/PageClientImplIOS.h: 26 * UIProcess/ios/PageClientImplIOS.mm: 27 (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap): 28 * UIProcess/ios/WKContentViewInteraction.h: 29 * UIProcess/ios/WKContentViewInteraction.mm: 30 (-[WKContentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary]): 31 (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]): 32 Handle the two new options. 33 34 * UIProcess/ios/WebPageProxyIOS.mm: 35 (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap): 36 * WebProcess/WebPage/ios/WebPageIOS.mm: 37 (WebKit::WebPage::potentialTapAtPosition): Check if the tap was on a root-level element. 38 1 39 2019-10-07 Matt Mokary <mmokary@apple.com> 2 40 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r250755 r250780 1573 1573 defaultValue: DEFAULT_PREFER_FASTER_CLICK_OVER_DOUBLE_TAP 1574 1574 condition: PLATFORM(IOS_FAMILY) 1575 humanReadableName: " Use fast clicks before double tap"1575 humanReadableName: "Fast clicks beat DTTZ" 1576 1576 humanReadableDescription: "Prefer a faster click over a double tap" 1577 webcoreBinding: none 1578 category: internal 1579 1580 ZoomOnDoubleTapWhenRoot: 1581 type: bool 1582 defaultValue: false 1583 condition: PLATFORM(IOS_FAMILY) 1584 humanReadableName: "DTTZ also when root" 1585 humanReadableDescription: "Double taps zoom, even if we dispatched a click on the root nodes" 1586 webcoreBinding: none 1587 category: internal 1588 1589 AlwaysZoomOnDoubleTap: 1590 type: bool 1591 defaultValue: false 1592 condition: PLATFORM(IOS_FAMILY) 1593 humanReadableName: "DTTZ always" 1594 humanReadableDescription: "Double taps zoom, even if we dispatched a click anywhere" 1577 1595 webcoreBinding: none 1578 1596 category: internal -
trunk/Source/WebKit/UIProcess/PageClient.h
r250645 r250780 397 397 virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect, WebCore::RouteSharingPolicy, const String&) = 0; 398 398 virtual void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) = 0; 399 virtual void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale ) = 0;399 virtual void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) = 0; 400 400 virtual double minimumZoomScale() const = 0; 401 401 virtual WebCore::FloatRect documentRect() const = 0; -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r250755 r250780 721 721 void didCompleteSyntheticClick(); 722 722 void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID); 723 void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale );723 void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel); 724 724 void contentSizeCategoryDidChange(const String& contentSizeCategory); 725 725 void getSelectionContext(WTF::Function<void(const String&, const String&, const String&, CallbackBase::Error)>&&); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r249739 r250780 196 196 DidCompleteSyntheticClick() 197 197 DisableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) 198 HandleSmartMagnificationInformationForPotentialTap(uint64_t requestID, WebCore::FloatRect renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale )198 HandleSmartMagnificationInformationForPotentialTap(uint64_t requestID, WebCore::FloatRect renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) 199 199 SelectionRectsCallback(Vector<WebCore::SelectionRect> selectionRects, WebKit::CallbackID callbackID); 200 200 #endif -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h
r249051 r250780 165 165 166 166 void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) override; 167 void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale ) override;167 void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) override; 168 168 169 169 double minimumZoomScale() const override; -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r250093 r250780 246 246 } 247 247 248 void PageClientImpl::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale )249 { 250 [m_contentView _handleSmartMagnificationInformationForPotentialTap:requestID renderRect:renderRect fitEntireRect:fitEntireRect viewportMinimumScale:viewportMinimumScale viewportMaximumScale:viewportMaximumScale ];248 void PageClientImpl::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) 249 { 250 [m_contentView _handleSmartMagnificationInformationForPotentialTap:requestID renderRect:renderRect fitEntireRect:fitEntireRect viewportMinimumScale:viewportMinimumScale viewportMaximumScale:viewportMaximumScale nodeIsRootLevel:nodeIsRootLevel]; 251 251 } 252 252 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r250345 r250780 469 469 - (BOOL)_mayDisableDoubleTapGesturesDuringSingleTap; 470 470 - (void)_disableDoubleTapGesturesDuringTapIfNecessary:(uint64_t)requestID; 471 - (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale ;471 - (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale nodeIsRootLevel:(BOOL)nodeIsRootLevel; 472 472 - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode activityStateChanges:(OptionSet<WebCore::ActivityState::Flag>)activityStateChanges userObject:(NSObject <NSSecureCoding> *)userObject; 473 473 - (void)_updateInputContextAfterBlurringAndRefocusingElement; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r250755 r250780 1723 1723 } 1724 1724 1725 - (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale 1726 { 1727 ASSERT(_page->preferences().fasterClicksEnabled()); 1725 - (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale nodeIsRootLevel:(BOOL)nodeIsRootLevel 1726 { 1727 const auto& preferences = _page->preferences(); 1728 1729 ASSERT(preferences.fasterClicksEnabled()); 1728 1730 if (!_potentialTapInProgress) 1729 1731 return; 1730 1732 1731 if (_page->preferences().preferFasterClickOverDoubleTap() && _page->preferFasterClickOverDoubleTap()) { 1733 // We check both the system preference and the page preference, because we only want this 1734 // to apply in "desktop" mode. 1735 if (preferences.preferFasterClickOverDoubleTap() && _page->preferFasterClickOverDoubleTap()) { 1732 1736 RELEASE_LOG(ViewGestures, "Potential tap found an element and fast taps are preferred. Trigger click. (%p)", self); 1737 if (preferences.zoomOnDoubleTapWhenRoot() && nodeIsRootLevel) { 1738 RELEASE_LOG(ViewGestures, "The click handler was on a root-level element, so don't disable double-tap. (%p)", self); 1739 return; 1740 } 1741 1742 if (preferences.alwaysZoomOnDoubleTap()) { 1743 RELEASE_LOG(ViewGestures, "DTTZ is forced on, so don't disable double-tap. (%p)", self); 1744 return; 1745 } 1746 1747 RELEASE_LOG(ViewGestures, "Give preference to click by disabling double-tap. (%p)", self); 1733 1748 [self _setDoubleTapGesturesEnabled:NO]; 1734 1749 return; … … 2536 2551 - (void)_endPotentialTapAndEnableDoubleTapGesturesIfNecessary 2537 2552 { 2538 if (_webView._allowsDoubleTapGestures) 2553 if (_webView._allowsDoubleTapGestures) { 2554 RELEASE_LOG(ViewGestures, "ending potential tap - double taps are back. (%p)", self); 2555 2539 2556 [self _setDoubleTapGesturesEnabled:YES]; 2557 } 2558 2559 RELEASE_LOG(ViewGestures, "Ending potential tap. (%p)", self); 2540 2560 2541 2561 _potentialTapInProgress = NO; -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r250755 r250780 1083 1083 } 1084 1084 1085 void WebPageProxy::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale )1086 { 1087 pageClient().handleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale );1085 void WebPageProxy::handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) 1086 { 1087 pageClient().handleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale, nodeIsRootLevel); 1088 1088 } 1089 1089 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r250642 r250780 1093 1093 1094 1094 m_viewGestureGeometryCollector->computeZoomInformationForNode(*m_potentialTapNode, origin, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale); 1095 send(Messages::WebPageProxy::HandleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale)); 1095 1096 bool nodeIsRootLevel = is<WebCore::Document>(*m_potentialTapNode) || is<WebCore::HTMLBodyElement>(*m_potentialTapNode); 1097 send(Messages::WebPageProxy::HandleSmartMagnificationInformationForPotentialTap(requestID, renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale, nodeIsRootLevel)); 1096 1098 } 1097 1099
Note: See TracChangeset
for help on using the changeset viewer.