<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[193554] branches/safari-601.1.46-branch/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/193554">193554</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2015-12-05 22:12:47 -0800 (Sat, 05 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/191309">r191309</a>.  rdar://problem/23766300</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchSourceWebKit2ChangeLog">branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewmm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewInternalh">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessPageClienth">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessWebPageProxyh">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessWebPageProxymessagesin">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosPageClientImplIOSh">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosPageClientImplIOSmm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosSmartMagnificationControllerh">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosSmartMagnificationControllermm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosWKContentViewInteractionh">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosWKContentViewInteractionmm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessiosWebPageProxyIOSmm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorcpp">branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorh">branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2WebProcessWebPageiosWebPageIOSmm">branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -1,5 +1,69 @@
</span><span class="cx"> 2015-12-05  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r191309.
+
+    2015-10-17  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+            Extend fast-clicking behavior to trigger on elements that have negligible zoom
+            https://bugs.webkit.org/show_bug.cgi?id=150248
+            &lt;rdar://problem/23140069&gt;
+
+            Reviewed by Simon Fraser.
+
+            Currently, fast-clicking only triggers on pages that have unscalable viewports. To allow more websites to benefit from fast-clicking
+            behavior, we generalize fast-clicking to also occur when tapping on elements for which double-tap-to-zoom would zoom the element in
+            or out by an insignificant amount. We define an insignificant amount of zoom to mean that zooming would increase the viewport scale
+            by less than a configurable threshold, or decrease the viewport scale by more than a configurable threshold. We accomplish this by
+            temporarily disabling the double tap gesture recognizer for the duration of the tap. This patch refactors some logic used to compute
+            zoomed viewports to make it possible to predict the change in viewport scale when double tapping to zoom. See the changes in
+            SmartMagnificationController and ViewGestureGeometryCollector for more details.
+
+            There are no new tests, since this patch does not change existing behavior. Instead, this patch adds the machinery needed for zoom-
+            dependent fast-clicking: by setting the preferences WebKitFastClickingEnabled and WebKitFastClickZoomThreshold, we will be able to tweak
+            the behavior dynamically.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _didCommitLayerTree:]):
+            (-[WKWebView _contentZoomScale]):
+            (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
+            (-[WKWebView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
+            (-[WKWebView _viewportIsUserScalable]):
+            * UIProcess/API/Cocoa/WKWebViewInternal.h:
+            * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+            * UIProcess/PageClient.h:
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.messages.in:
+            * UIProcess/ios/PageClientImplIOS.h:
+            * UIProcess/ios/PageClientImplIOS.mm:
+            (WebKit::PageClientImpl::disableDoubleTapGesturesUntilTapIsFinishedIfNecessary):
+            * UIProcess/ios/SmartMagnificationController.h:
+            * UIProcess/ios/SmartMagnificationController.mm:
+            (WebKit::SmartMagnificationController::adjustSmartMagnificationTargetRectAndZoomScales):
+            (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
+            (WebKit::SmartMagnificationController::magnify):
+            * UIProcess/ios/WKContentViewInteraction.h:
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
+            (-[WKContentView _fastClickZoomThreshold]):
+            (-[WKContentView _allowDoubleTapToZoomForCurrentZoomScale:andTargetZoomScale:]):
+            (-[WKContentView _disableDoubleTapGesturesUntilTapIsFinishedIfNecessary:allowsDoubleTapZoom:targetRect:isReplaced:minimumScale:maximumScale:]):
+            (-[WKContentView _highlightLongPressRecognized:]):
+            (-[WKContentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary]):
+            (-[WKContentView _singleTapRecognized:]):
+            (cancelPotentialTapIfNecessary):
+            (-[WKContentView _singleTapCommited:]):
+            (-[WKContentView webSelectionRects]): Deleted.
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::disableDoubleTapGesturesUntilTapIsFinishedIfNecessary):
+            * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
+            (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
+            (WebKit::ViewGestureGeometryCollector::computeZoomInformationForNode):
+            * WebProcess/WebPage/ViewGestureGeometryCollector.h:
+            * WebProcess/WebPage/ios/WebPageIOS.mm:
+            (WebKit::WebPage::potentialTapAtPosition):
+
+2015-12-05  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r191072.
</span><span class="cx"> 
</span><span class="cx">     2015-10-14  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -994,7 +994,7 @@
</span><span class="cx">     if (!layerTreeTransaction.scaleWasSetByUIProcess() &amp;&amp; ![_scrollView isZooming] &amp;&amp; ![_scrollView isZoomBouncing] &amp;&amp; ![_scrollView _isAnimatingZoom])
</span><span class="cx">         [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
</span><span class="cx"> 
</span><del>-    [_contentView _setDoubleTapGesturesEnabled:[_scrollView isZoomEnabled] &amp;&amp; [_scrollView minimumZoomScale] &lt; [_scrollView maximumZoomScale]];
</del><ins>+    [_contentView _setDoubleTapGesturesEnabled:self._viewportIsUserScalable];
</ins><span class="cx"> 
</span><span class="cx">     [self _updateScrollViewBackground];
</span><span class="cx"> 
</span><span class="lines">@@ -1395,12 +1395,13 @@
</span><span class="cx">                         force:YES];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance
</del><ins>+- (CGFloat)_contentZoomScale
</ins><span class="cx"> {
</span><del>-    const float maximumScaleFactorDeltaForPanScroll = 0.02;
</del><ins>+    return contentZoomScale(self);
+}
</ins><span class="cx"> 
</span><del>-    double currentScale = contentZoomScale(self);
-
</del><ins>+- (CGFloat)_targetContentZoomScaleForRect:(const WebCore::FloatRect&amp;)targetRect currentScale:(double)currentScale fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale
+{
</ins><span class="cx">     WebCore::FloatSize unobscuredContentSize([self _contentRectForUserInteraction].size);
</span><span class="cx">     double horizontalScale = unobscuredContentSize.width() * currentScale / targetRect.width();
</span><span class="cx">     double verticalScale = unobscuredContentSize.height() * currentScale / targetRect.height();
</span><span class="lines">@@ -1408,7 +1409,16 @@
</span><span class="cx">     horizontalScale = std::min(std::max(horizontalScale, minimumScale), maximumScale);
</span><span class="cx">     verticalScale = std::min(std::max(verticalScale, minimumScale), maximumScale);
</span><span class="cx"> 
</span><del>-    double targetScale = fitEntireRect ? std::min(horizontalScale, verticalScale) : horizontalScale;
</del><ins>+    return fitEntireRect ? std::min(horizontalScale, verticalScale) : horizontalScale;
+}
+
+- (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance
+{
+    const float maximumScaleFactorDeltaForPanScroll = 0.02;
+
+    double currentScale = contentZoomScale(self);
+    double targetScale = [self _targetContentZoomScaleForRect:targetRect currentScale:currentScale fitEntireRect:fitEntireRect minimumScale:minimumScale maximumScale:maximumScale];
+
</ins><span class="cx">     if (fabs(targetScale - currentScale) &lt; maximumScaleFactorDeltaForPanScroll) {
</span><span class="cx">         if ([self _scrollToRect:targetRect origin:origin minimumScrollDistance:minimumScrollDistance])
</span><span class="cx">             return true;
</span><span class="lines">@@ -3071,6 +3081,11 @@
</span><span class="cx">     return _viewportMetaTagWidth;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)_viewportIsUserScalable
+{
+    return [_scrollView isZoomEnabled] &amp;&amp; [_scrollView minimumZoomScale] &lt; [_scrollView maximumZoomScale];
+}
+
</ins><span class="cx"> - (_WKWebViewPrintFormatter *)_webViewPrintFormatter
</span><span class="cx"> {
</span><span class="cx">     UIViewPrintFormatter *viewPrintFormatter = self.viewPrintFormatter;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -109,6 +109,9 @@
</span><span class="cx"> - (void)_navigationGestureDidBegin;
</span><span class="cx"> - (void)_navigationGestureDidEnd;
</span><span class="cx"> 
</span><ins>+- (CGFloat)_contentZoomScale;
+- (CGFloat)_targetContentZoomScaleForRect:(const WebCore::FloatRect&amp;)targetRect currentScale:(double)currentScale fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale;
+
</ins><span class="cx"> @property (nonatomic, readonly) UIEdgeInsets _computedContentInset;
</span><span class="cx"> #else
</span><span class="cx"> @property (nonatomic, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -128,6 +128,7 @@
</span><span class="cx"> 
</span><span class="cx"> // The viewport meta tag width is negative if the value is not defined.
</span><span class="cx"> @property (nonatomic, readonly) CGFloat _viewportMetaTagWidth;
</span><ins>+@property (nonatomic, readonly) BOOL _viewportIsUserScalable;
</ins><span class="cx"> 
</span><span class="cx"> @property (nonatomic, readonly) _WKWebViewPrintFormatter *_webViewPrintFormatter;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/PageClient.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/PageClient.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/PageClient.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -278,6 +278,7 @@
</span><span class="cx">     virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect&amp; elementRect) = 0;
</span><span class="cx">     virtual void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale) = 0;
</span><span class="cx">     virtual void didChangeViewportMetaTagWidth(float) = 0;
</span><ins>+    virtual void disableDoubleTapGesturesUntilTapIsFinishedIfNecessary(uint64_t requestID, bool allowsDoubleTapZoom, const WebCore::FloatRect&amp; targetRect, bool isReplacedElement, double minimumScale, double maximumScale) = 0;
</ins><span class="cx">     virtual double minimumZoomScale() const = 0;
</span><span class="cx">     virtual WebCore::FloatRect documentRect() const = 0;
</span><span class="cx">     virtual void overflowScrollViewWillStartPanGesture() = 0;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -520,6 +520,7 @@
</span><span class="cx">     void commitPotentialTapFailed();
</span><span class="cx">     void didNotHandleTapAsClick(const WebCore::IntPoint&amp;);
</span><span class="cx">     void viewportMetaTagWidthDidChange(float width);
</span><ins>+    void disableDoubleTapGesturesUntilTapIsFinishedIfNecessary(uint64_t requestID, bool allowsDoubleTapZoom, const WebCore::FloatRect&amp; targetRect, bool isReplacedElement, double minimumScale, double maximumScale);
</ins><span class="cx">     void didFinishDrawingPagesToPDF(const IPC::DataReference&amp;);
</span><span class="cx">     void contentSizeCategoryDidChange(const String&amp; contentSizeCategory);
</span><span class="cx">     void getLookupContextAtPoint(const WebCore::IntPoint&amp;, std::function&lt;void(const String&amp;, CallbackBase::Error)&gt;);
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -189,6 +189,7 @@
</span><span class="cx">     CommitPotentialTapFailed()
</span><span class="cx">     DidNotHandleTapAsClick(WebCore::IntPoint point)
</span><span class="cx">     ViewportMetaTagWidthDidChange(float width)
</span><ins>+    DisableDoubleTapGesturesUntilTapIsFinishedIfNecessary(uint64_t requestID, bool allowsDoubleTapZoom, WebCore::FloatRect targetRect, bool isReplacedElement, double minimumScale, double maximumScale)
</ins><span class="cx">     DidFinishDrawingPagesToPDF(IPC::DataReference pdfData)
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(GTK)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -134,6 +134,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) override;
</span><span class="cx">     virtual void didChangeViewportMetaTagWidth(float) override;
</span><ins>+    virtual void disableDoubleTapGesturesUntilTapIsFinishedIfNecessary(uint64_t requestID, bool allowsDoubleTapZoom, const WebCore::FloatRect&amp; targetRect, bool isReplacedElement, double minimumScale, double maximumScale) override;
</ins><span class="cx">     virtual double minimumZoomScale() const override;
</span><span class="cx">     virtual WebCore::FloatRect documentRect() const override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -270,6 +270,14 @@
</span><span class="cx">     [m_webView _setViewportMetaTagWidth:newWidth];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::disableDoubleTapGesturesUntilTapIsFinishedIfNecessary(uint64_t requestID, bool allowsDoubleTapZoom, const WebCore::FloatRect&amp; targetRect, bool isReplacedElement, double minimumScale, double maximumScale)
+{
+    if (!m_webView._viewportIsUserScalable)
+        return;
+
+    [m_contentView _disableDoubleTapGesturesUntilTapIsFinishedIfNecessary:requestID allowsDoubleTapZoom:allowsDoubleTapZoom targetRect:targetRect isReplaced:isReplacedElement minimumScale:minimumScale maximumScale:maximumScale];
+}
+
</ins><span class="cx"> double PageClientImpl::minimumZoomScale() const
</span><span class="cx"> {
</span><span class="cx">     if (UIScrollView *scroller = [m_webView scrollView])
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosSmartMagnificationControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> 
</span><span class="cx">     void handleSmartMagnificationGesture(WebCore::FloatPoint origin);
</span><span class="cx">     void handleResetMagnificationGesture(WebCore::FloatPoint origin);
</span><ins>+    void adjustSmartMagnificationTargetRectAndZoomScales(bool addMagnificationPadding, WebCore::FloatRect&amp; targetRect, double&amp; minimumScale, double&amp; maximumScale);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     // IPC::MessageReceiver.
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosSmartMagnificationControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -78,6 +78,17 @@
</span><span class="cx">     [m_contentView _zoomOutWithOrigin:origin];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SmartMagnificationController::adjustSmartMagnificationTargetRectAndZoomScales(bool addMagnificationPadding, WebCore::FloatRect&amp; targetRect, double&amp; minimumScale, double&amp; maximumScale)
+{
+    if (addMagnificationPadding) {
+        targetRect.inflateX(smartMagnificationElementPadding * targetRect.width());
+        targetRect.inflateY(smartMagnificationElementPadding * targetRect.height());
+    }
+
+    minimumScale = std::max(minimumScale, smartMagnificationMinimumScale);
+    maximumScale = std::min(maximumScale, smartMagnificationMaximumScale);
+}
+
</ins><span class="cx"> void SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture(FloatPoint origin, FloatRect targetRect, FloatRect visibleContentRect, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale)
</span><span class="cx"> {
</span><span class="cx">     if (targetRect.isEmpty()) {
</span><span class="lines">@@ -85,15 +96,10 @@
</span><span class="cx">         [m_contentView _zoomOutWithOrigin:origin];
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    double minimumScale = viewportMinimumScale;
+    double maximumScale = viewportMaximumScale;
+    adjustSmartMagnificationTargetRectAndZoomScales(!isReplacedElement, targetRect, minimumScale, maximumScale);
</ins><span class="cx"> 
</span><del>-    if (!isReplacedElement) {
-        targetRect.inflateX(smartMagnificationElementPadding * targetRect.width());
-        targetRect.inflateY(smartMagnificationElementPadding * targetRect.height());
-    }
-
-    double maximumScale = std::min(viewportMaximumScale, smartMagnificationMaximumScale);
-    double minimumScale = std::max(viewportMinimumScale, smartMagnificationMinimumScale);
-
</del><span class="cx">     // FIXME: Check if text selection wants to consume the double tap before we attempt magnification.
</span><span class="cx"> 
</span><span class="cx">     // If the content already fits in the scroll view and we're already zoomed in to the target scale,
</span><span class="lines">@@ -118,12 +124,9 @@
</span><span class="cx"> 
</span><span class="cx"> void SmartMagnificationController::magnify(FloatPoint origin, FloatRect targetRect, FloatRect visibleContentRect, double viewportMinimumScale, double viewportMaximumScale)
</span><span class="cx"> {
</span><del>-    targetRect.inflateX(smartMagnificationElementPadding * targetRect.width());
-    targetRect.inflateY(smartMagnificationElementPadding * targetRect.height());
-
-    double maximumScale = std::min(viewportMaximumScale, smartMagnificationMaximumScale);
-    double minimumScale = std::max(viewportMinimumScale, smartMagnificationMinimumScale);
-
</del><ins>+    double maximumScale = viewportMaximumScale;
+    double minimumScale = viewportMinimumScale;
+    adjustSmartMagnificationTargetRectAndZoomScales(true, targetRect, minimumScale, maximumScale);
</ins><span class="cx">     [m_contentView _zoomToRect:targetRect withOrigin:origin fitEntireRect:NO minimumScale:minimumScale maximumScale:maximumScale minimumScrollDistance:0];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx"> 
</span><span class="cx">     id &lt;UITextInputDelegate&gt; _inputDelegate;
</span><span class="cx"> 
</span><del>-    uint64_t _latestTapHighlightID;
</del><ins>+    uint64_t _latestTapID;
</ins><span class="cx">     struct TapHighlightInformation {
</span><span class="cx">         WebCore::Color color;
</span><span class="cx">         Vector&lt;WebCore::FloatQuad&gt; quads;
</span><span class="lines">@@ -187,6 +187,7 @@
</span><span class="cx"> - (void)_commitPotentialTapFailed;
</span><span class="cx"> - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const WebCore::Color&amp;)color quads:(const Vector&lt;WebCore::FloatQuad&gt;&amp;)highlightedQuads topLeftRadius:(const WebCore::IntSize&amp;)topLeftRadius topRightRadius:(const WebCore::IntSize&amp;)topRightRadius bottomLeftRadius:(const WebCore::IntSize&amp;)bottomLeftRadius bottomRightRadius:(const WebCore::IntSize&amp;)bottomRightRadius;
</span><span class="cx"> 
</span><ins>+- (void)_disableDoubleTapGesturesUntilTapIsFinishedIfNecessary:(uint64_t)requestID allowsDoubleTapZoom:(bool)allowsDoubleTapZoom targetRect:(WebCore::FloatRect)targetRect isReplaced:(BOOL)isReplacedElement minimumScale:(double)minimumScale maximumScale:(double)maximumScale;
</ins><span class="cx"> - (void)_startAssistingNode:(const WebKit::AssistedNodeInformation&amp;)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode userObject:(NSObject &lt;NSSecureCoding&gt; *)userObject;
</span><span class="cx"> - (void)_stopAssistingNode;
</span><span class="cx"> - (void)_selectionChanged;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -765,7 +765,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const WebCore::Color&amp;)color quads:(const Vector&lt;WebCore::FloatQuad&gt;&amp;)highlightedQuads topLeftRadius:(const WebCore::IntSize&amp;)topLeftRadius topRightRadius:(const WebCore::IntSize&amp;)topRightRadius bottomLeftRadius:(const WebCore::IntSize&amp;)bottomLeftRadius bottomRightRadius:(const WebCore::IntSize&amp;)bottomRightRadius
</span><span class="cx"> {
</span><del>-    if (!_isTapHighlightIDValid || _latestTapHighlightID != requestID)
</del><ins>+    if (!_isTapHighlightIDValid || _latestTapID != requestID)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     _isTapHighlightIDValid = NO;
</span><span class="lines">@@ -785,6 +785,44 @@
</span><span class="cx">     [self _showTapHighlight];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (CGFloat)_fastClickZoomThreshold
+{
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    if (![defaults boolForKey:@&quot;WebKitFastClickingEnabled&quot;])
+        return 0;
+
+    return [defaults floatForKey:@&quot;WebKitFastClickZoomThreshold&quot;];
+}
+
+- (BOOL)_allowDoubleTapToZoomForCurrentZoomScale:(CGFloat)currentZoomScale andTargetZoomScale:(CGFloat)targetZoomScale
+{
+    CGFloat zoomThreshold = [self _fastClickZoomThreshold];
+    if (!zoomThreshold)
+        return YES;
+
+    CGFloat minimumZoomRatioForDoubleTapToZoomIn = 1 + zoomThreshold;
+    CGFloat maximumZoomRatioForDoubleTapToZoomOut = 1 / minimumZoomRatioForDoubleTapToZoomIn;
+    CGFloat zoomRatio = targetZoomScale / currentZoomScale;
+    return zoomRatio &lt; maximumZoomRatioForDoubleTapToZoomOut || zoomRatio &gt; minimumZoomRatioForDoubleTapToZoomIn;
+}
+
+- (void)_disableDoubleTapGesturesUntilTapIsFinishedIfNecessary:(uint64_t)requestID allowsDoubleTapZoom:(bool)allowsDoubleTapZoom targetRect:(WebCore::FloatRect)targetRect isReplaced:(BOOL)isReplacedElement minimumScale:(double)minimumScale maximumScale:(double)maximumScale
+{
+    if (!_potentialTapInProgress || _latestTapID != requestID)
+        return;
+
+    if (allowsDoubleTapZoom) {
+        // Though the element allows us to zoom in on double tap, we avoid this behavior in favor of fast clicking if the difference in scale is insignificant.
+        _smartMagnificationController-&gt;adjustSmartMagnificationTargetRectAndZoomScales(!isReplacedElement, targetRect, minimumScale, maximumScale);
+        CGFloat currentZoomScale = [_webView _contentZoomScale];
+        CGFloat targetZoomScale = [_webView _targetContentZoomScaleForRect:targetRect currentScale:currentZoomScale fitEntireRect:isReplacedElement minimumScale:minimumScale maximumScale:maximumScale];
+        if ([self _allowDoubleTapToZoomForCurrentZoomScale:currentZoomScale andTargetZoomScale:targetZoomScale])
+            return;
+    }
+
+    [self _setDoubleTapGesturesEnabled:NO];
+}
+
</ins><span class="cx"> - (void)_cancelLongPressGestureRecognizer
</span><span class="cx"> {
</span><span class="cx">     [_highlightLongPressGestureRecognizer cancel];
</span><span class="lines">@@ -1088,7 +1126,7 @@
</span><span class="cx">     case UIGestureRecognizerStateBegan:
</span><span class="cx">         _highlightLongPressCanClick = YES;
</span><span class="cx">         cancelPotentialTapIfNecessary(self);
</span><del>-        _page-&gt;tapHighlightAtPosition([gestureRecognizer startPoint], ++_latestTapHighlightID);
</del><ins>+        _page-&gt;tapHighlightAtPosition([gestureRecognizer startPoint], ++_latestTapID);
</ins><span class="cx">         _isTapHighlightIDValid = YES;
</span><span class="cx">         break;
</span><span class="cx">     case UIGestureRecognizerStateEnded:
</span><span class="lines">@@ -1123,12 +1161,20 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_endPotentialTapAndEnableDoubleTapGesturesIfNecessary
+{
+    if (_webView._viewportIsUserScalable)
+        [self _setDoubleTapGesturesEnabled:YES];
+
+    _potentialTapInProgress = NO;
+}
+
</ins><span class="cx"> - (void)_singleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
</span><span class="cx"> {
</span><span class="cx">     ASSERT(gestureRecognizer == _singleTapGestureRecognizer);
</span><span class="cx">     ASSERT(!_potentialTapInProgress);
</span><span class="cx"> 
</span><del>-    _page-&gt;potentialTapAtPosition(gestureRecognizer.location, ++_latestTapHighlightID);
</del><ins>+    _page-&gt;potentialTapAtPosition(gestureRecognizer.location, ++_latestTapID);
</ins><span class="cx">     _potentialTapInProgress = YES;
</span><span class="cx">     _isTapHighlightIDValid = YES;
</span><span class="cx"> }
</span><span class="lines">@@ -1136,7 +1182,7 @@
</span><span class="cx"> static void cancelPotentialTapIfNecessary(WKContentView* contentView)
</span><span class="cx"> {
</span><span class="cx">     if (contentView-&gt;_potentialTapInProgress) {
</span><del>-        contentView-&gt;_potentialTapInProgress = NO;
</del><ins>+        [contentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary];
</ins><span class="cx">         [contentView _cancelInteraction];
</span><span class="cx">         contentView-&gt;_page-&gt;cancelPotentialTap();
</span><span class="cx">     }
</span><span class="lines">@@ -1175,7 +1221,7 @@
</span><span class="cx"> 
</span><span class="cx">     _lastInteractionLocation = gestureRecognizer.location;
</span><span class="cx"> 
</span><del>-    _potentialTapInProgress = NO;
</del><ins>+    [self _endPotentialTapAndEnableDoubleTapGesturesIfNecessary];
</ins><span class="cx"> 
</span><span class="cx">     if (_hasTapHighlightForPotentialTap) {
</span><span class="cx">         [self _showTapHighlight];
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -919,6 +919,11 @@
</span><span class="cx">     m_pageClient.didChangeViewportMetaTagWidth(width);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::disableDoubleTapGesturesUntilTapIsFinishedIfNecessary(uint64_t requestID, bool allowsDoubleTapZoom, const WebCore::FloatRect&amp; targetRect, bool isReplacedElement, double minimumScale, double maximumScale)
+{
+    m_pageClient.disableDoubleTapGesturesUntilTapIsFinishedIfNecessary(requestID, allowsDoubleTapZoom, targetRect, isReplacedElement, minimumScale, maximumScale);
+}
+
</ins><span class="cx"> void WebPageProxy::didFinishDrawingPagesToPDF(const IPC::DataReference&amp; pdfData)
</span><span class="cx"> {
</span><span class="cx">     m_pageClient.didFinishDrawingPagesToPDF(pdfData);
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -86,39 +86,45 @@
</span><span class="cx">     HitTestResult hitTestResult = HitTestResult(originInContentsSpace);
</span><span class="cx"> 
</span><span class="cx">     m_webPage.mainFrameView()-&gt;renderView()-&gt;hitTest(HitTestRequest(), hitTestResult);
</span><ins>+    Node* node = hitTestResult.innerNode();
+    if (!node) {
+        dispatchDidCollectGeometryForSmartMagnificationGesture(FloatPoint(), FloatRect(), FloatRect(), false, 0, 0);
+        return;
+    }
</ins><span class="cx"> 
</span><del>-    if (Node* node = hitTestResult.innerNode()) {
-        bool isReplaced;
-        FloatRect renderRect = node-&gt;renderRect(&amp;isReplaced);
</del><ins>+    bool isReplaced;
+    FloatRect renderRect;
+    double viewportMinimumScale;
+    double viewportMaximumScale;
</ins><span class="cx"> 
</span><del>-        if (node-&gt;document().isImageDocument()) {
-            if (HTMLImageElement* imageElement = static_cast&lt;ImageDocument&amp;&gt;(node-&gt;document()).imageElement()) {
-                if (node != imageElement) {
-                    renderRect = imageElement-&gt;renderRect(&amp;isReplaced);
-                    FloatPoint newOrigin = origin;
-                    if (origin.x() &lt; renderRect.x() || origin.x() &gt; renderRect.maxX())
-                        newOrigin.setX(renderRect.x() + renderRect.width() / 2);
-                    if (origin.y() &lt; renderRect.y() || origin.y() &gt; renderRect.maxY())
-                        newOrigin.setY(renderRect.y() + renderRect.height() / 2);
-                    origin = newOrigin;
-                }
-                isReplaced = true;
</del><ins>+    computeZoomInformationForNode(*node, origin, renderRect, isReplaced, viewportMinimumScale, viewportMaximumScale);
+    dispatchDidCollectGeometryForSmartMagnificationGesture(origin, renderRect, visibleContentRect, isReplaced, viewportMinimumScale, viewportMaximumScale);
+}
+
+void ViewGestureGeometryCollector::computeZoomInformationForNode(Node&amp; node, FloatPoint&amp; origin, FloatRect&amp; renderRect, bool&amp; isReplaced, double&amp; viewportMinimumScale, double&amp; viewportMaximumScale)
+{
+    renderRect = node.renderRect(&amp;isReplaced);
+    if (node.document().isImageDocument()) {
+        if (HTMLImageElement* imageElement = static_cast&lt;ImageDocument&amp;&gt;(node.document()).imageElement()) {
+            if (&amp;node != imageElement) {
+                renderRect = imageElement-&gt;renderRect(&amp;isReplaced);
+                FloatPoint newOrigin = origin;
+                if (origin.x() &lt; renderRect.x() || origin.x() &gt; renderRect.maxX())
+                    newOrigin.setX(renderRect.x() + renderRect.width() / 2);
+                if (origin.y() &lt; renderRect.y() || origin.y() &gt; renderRect.maxY())
+                    newOrigin.setY(renderRect.y() + renderRect.height() / 2);
+                origin = newOrigin;
</ins><span class="cx">             }
</span><ins>+            isReplaced = true;
</ins><span class="cx">         }
</span><del>-
</del><ins>+    }
</ins><span class="cx"> #if PLATFORM(MAC)
</span><del>-        double viewportMinimumScale = 0;
-        double viewportMaximumScale = std::numeric_limits&lt;double&gt;::max();
</del><ins>+    viewportMinimumScale = 0;
+    viewportMaximumScale = std::numeric_limits&lt;double&gt;::max();
</ins><span class="cx"> #else
</span><del>-        double viewportMinimumScale = m_webPage.minimumPageScaleFactor();
-        double viewportMaximumScale = m_webPage.maximumPageScaleFactor();
</del><ins>+    viewportMinimumScale = m_webPage.minimumPageScaleFactor();
+    viewportMaximumScale = m_webPage.maximumPageScaleFactor();
</ins><span class="cx"> #endif
</span><del>-
-        dispatchDidCollectGeometryForSmartMagnificationGesture(origin, renderRect, visibleContentRect, isReplaced, viewportMinimumScale, viewportMaximumScale);
-        return;
-    }
-
-    dispatchDidCollectGeometryForSmartMagnificationGesture(FloatPoint(), FloatRect(), FloatRect(), false, 0, 0);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class FloatPoint;
</span><span class="cx"> class FloatRect;
</span><ins>+class Node;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -44,6 +45,7 @@
</span><span class="cx">     ~ViewGestureGeometryCollector();
</span><span class="cx"> 
</span><span class="cx">     void mainFrameDidLayout();
</span><ins>+    void computeZoomInformationForNode(WebCore::Node&amp;, WebCore::FloatPoint&amp; origin, WebCore::FloatRect&amp; renderRect, bool&amp; isReplaced, double&amp; viewportMinimumScale, double&amp; viewportMaximumScale);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     // IPC::MessageReceiver.
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (193553 => 193554)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2015-12-06 06:09:46 UTC (rev 193553)
+++ branches/safari-601.1.46-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2015-12-06 06:12:47 UTC (rev 193554)
</span><span class="lines">@@ -662,6 +662,16 @@
</span><span class="cx"> {
</span><span class="cx">     m_potentialTapNode = m_page-&gt;mainFrame().nodeRespondingToClickEvents(position, m_potentialTapLocation);
</span><span class="cx">     sendTapHighlightForNodeIfNecessary(requestID, m_potentialTapNode.get());
</span><ins>+    if (m_potentialTapNode) {
+        FloatPoint origin = position;
+        FloatRect renderRect;
+        bool isReplaced;
+        double viewportMinimumScale;
+        double viewportMaximumScale;
+
+        m_viewGestureGeometryCollector.computeZoomInformationForNode(*m_potentialTapNode.get(), origin, renderRect, isReplaced, viewportMinimumScale, viewportMaximumScale);
+        send(Messages::WebPageProxy::DisableDoubleTapGesturesUntilTapIsFinishedIfNecessary(requestID, true, renderRect, isReplaced, viewportMinimumScale, viewportMaximumScale));
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::commitPotentialTap(uint64_t lastLayerTreeTransactionId)
</span></span></pre>
</div>
</div>

</body>
</html>