<!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>[164937] trunk/Source</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/164937">164937</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-03-01 21:25:27 -0800 (Sat, 01 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>WebKit2 View Gestures (Smart Magnification): Support for iOS
https://bugs.webkit.org/show_bug.cgi?id=129146
<rdar://problem/16032668>
Reviewed by Benjamin Poulain.
Add support for double-tap smart magnification on iOS.
* DerivedSources.make:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
WKContentView is no longer API, so it can know about WKWebView
and will always have one.
(-[WKWebView contentView:didCommitLayerTree:WebKit::]):
Don't replace the zoom scale if we're currently animating.
(-[WKWebView _takeViewSnapshot]):
Rename.
(-[WKWebView _zoomToPoint:WebCore::atScale:]):
(-[WKWebView _zoomToRect:WebCore::atScale:origin:WebCore::]):
(constrainContentOffset):
(-[WKWebView _scrollToRect:WebCore::origin:WebCore::minimumScrollDistance:]):
(-[WKWebView _zoomOutWithOrigin:]):
(-[WKWebView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
Add _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:
and _zoomOutWithOrigin: as internal API, for use by SmartMagnificationController via WKContentView.
These will use some heuristics to generally center the target rect in the view
in a way that should match WebKit1 fairly closely.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
Don't use the WKContentViewDelegate protocol for things that don't belong there.
* UIProcess/ios/SmartMagnificationController.h: Added.
* UIProcess/ios/SmartMagnificationController.messages.in: Added.
* UIProcess/ios/SmartMagnificationController.mm: Added.
(WebKit::SmartMagnificationController::SmartMagnificationController):
(WebKit::SmartMagnificationController::~SmartMagnificationController):
(WebKit::SmartMagnificationController::handleSmartMagnificationGesture):
(WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
SmartMagnificationController sits off of WKContentView, and sends/receives
messages to the WebProcess to do the smart magnification hit-testing.
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView initWithFrame:context:WebKit::configuration:WebKit::webView:]):
As before, teach WKContentView about its owning WKWebView.
(-[WKContentView _takeViewSnapshot]):
Rename.
(-[WKContentView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
(-[WKContentView _zoomOutWithOrigin:]):
Forward _zoomToRect:::::: and _zoomOutWithOrigin: to WKWebView.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView _doubleTapRecognized:]):
(-[WKContentView _twoFingerDoubleTapRecognized:]):
Forward double tap to the SmartMagnificationController.
* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureController.messages.in:
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
Retrieve the minimum/maximum viewport scale from the WebProcess.
* WebKit2.xcodeproj/project.pbxproj:
Add new files.
* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::ViewGestureGeometryCollector):
(WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
(WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
(WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
Factor out code to send the geometry back to the UI process.
* WebProcess/WebPage/ViewGestureGeometryCollector.h:
* WebProcess/WebPage/ViewGestureGeometryCollector.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebPage/WebPage.h:
We should have a ViewGestureGeometryCollector on iOS too.
* WebCore.exp.in:
Add an export.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DerivedSourcesmake">trunk/Source/WebKit2/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKViewIOSmm">trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewh">trunk/Source/WebKit2/UIProcess/ios/WKContentView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionh">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerh">trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllermessagesin">trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm">trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorcpp">trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorh">trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageViewGestureGeometryCollectormessagesin">trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessiosSmartMagnificationControllerh">trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosSmartMagnificationControllermessagesin">trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosSmartMagnificationControllermm">trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebCore/ChangeLog        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-03-01 Tim Horton <timothy_horton@apple.com>
+
+ WebKit2 View Gestures (Smart Magnification): Support for iOS
+ https://bugs.webkit.org/show_bug.cgi?id=129146
+ <rdar://problem/16032668>
+
+ Reviewed by Benjamin Poulain.
+
+ * WebCore.exp.in:
+ Add an export.
+
</ins><span class="cx"> 2014-03-01 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r164929 and r164934.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -1892,6 +1892,7 @@
</span><span class="cx"> __ZNK7WebCore9FloatRect10intersectsERKS0_
</span><span class="cx"> __ZNK7WebCore9FloatRectcv6CGRectEv
</span><span class="cx"> __ZNK7WebCore9FloatSize6isZeroEv
</span><ins>+__ZNK7WebCore9FloatSize14diagonalLengthEv
</ins><span class="cx"> __ZNK7WebCore9FrameTree10childCountEv
</span><span class="cx"> __ZNK7WebCore9FrameTree12traverseNextEPKNS_5FrameE
</span><span class="cx"> __ZNK7WebCore9FrameTree14isDescendantOfEPKNS_5FrameE
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -1,3 +1,91 @@
</span><ins>+2014-03-01 Tim Horton <timothy_horton@apple.com>
+
+ WebKit2 View Gestures (Smart Magnification): Support for iOS
+ https://bugs.webkit.org/show_bug.cgi?id=129146
+ <rdar://problem/16032668>
+
+ Reviewed by Benjamin Poulain.
+
+ Add support for double-tap smart magnification on iOS.
+
+ * DerivedSources.make:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView initWithFrame:configuration:]):
+ WKContentView is no longer API, so it can know about WKWebView
+ and will always have one.
+
+ (-[WKWebView contentView:didCommitLayerTree:WebKit::]):
+ Don't replace the zoom scale if we're currently animating.
+
+ (-[WKWebView _takeViewSnapshot]):
+ Rename.
+
+ (-[WKWebView _zoomToPoint:WebCore::atScale:]):
+ (-[WKWebView _zoomToRect:WebCore::atScale:origin:WebCore::]):
+ (constrainContentOffset):
+ (-[WKWebView _scrollToRect:WebCore::origin:WebCore::minimumScrollDistance:]):
+ (-[WKWebView _zoomOutWithOrigin:]):
+ (-[WKWebView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
+ Add _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:
+ and _zoomOutWithOrigin: as internal API, for use by SmartMagnificationController via WKContentView.
+ These will use some heuristics to generally center the target rect in the view
+ in a way that should match WebKit1 fairly closely.
+
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ Don't use the WKContentViewDelegate protocol for things that don't belong there.
+
+ * UIProcess/ios/SmartMagnificationController.h: Added.
+ * UIProcess/ios/SmartMagnificationController.messages.in: Added.
+ * UIProcess/ios/SmartMagnificationController.mm: Added.
+ (WebKit::SmartMagnificationController::SmartMagnificationController):
+ (WebKit::SmartMagnificationController::~SmartMagnificationController):
+ (WebKit::SmartMagnificationController::handleSmartMagnificationGesture):
+ (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
+ SmartMagnificationController sits off of WKContentView, and sends/receives
+ messages to the WebProcess to do the smart magnification hit-testing.
+
+ * UIProcess/ios/WKContentView.h:
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView initWithFrame:context:WebKit::configuration:WebKit::webView:]):
+ As before, teach WKContentView about its owning WKWebView.
+
+ (-[WKContentView _takeViewSnapshot]):
+ Rename.
+
+ (-[WKContentView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
+ (-[WKContentView _zoomOutWithOrigin:]):
+ Forward _zoomToRect:::::: and _zoomOutWithOrigin: to WKWebView.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView setupInteraction]):
+ (-[WKContentView _doubleTapRecognized:]):
+ (-[WKContentView _twoFingerDoubleTapRecognized:]):
+ Forward double tap to the SmartMagnificationController.
+
+ * UIProcess/mac/ViewGestureController.h:
+ * UIProcess/mac/ViewGestureController.messages.in:
+ * UIProcess/mac/ViewGestureControllerMac.mm:
+ (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
+ Retrieve the minimum/maximum viewport scale from the WebProcess.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add new files.
+
+ * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
+ (WebKit::ViewGestureGeometryCollector::ViewGestureGeometryCollector):
+ (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
+ (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
+ (WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
+ Factor out code to send the geometry back to the UI process.
+
+ * WebProcess/WebPage/ViewGestureGeometryCollector.h:
+ * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ * WebProcess/WebPage/WebPage.h:
+ We should have a ViewGestureGeometryCollector on iOS too.
+
</ins><span class="cx"> 2014-03-01 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed follow-up to r164905 and r164912.
</span></span></pre></div>
<a id="trunkSourceWebKit2DerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DerivedSources.make (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DerivedSources.make        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/DerivedSources.make        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx"> RemoteScrollingCoordinator \
</span><span class="cx"> SecItemShim \
</span><span class="cx"> SecItemShimProxy \
</span><ins>+ SmartMagnificationController \
</ins><span class="cx"> StorageAreaMap \
</span><span class="cx"> StorageManager \
</span><span class="cx"> ViewGestureController \
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -144,9 +144,8 @@
</span><span class="cx">
</span><span class="cx"> [self addSubview:_scrollView.get()];
</span><span class="cx">
</span><del>- _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:context configuration:std::move(webPageConfiguration)]);
</del><ins>+ _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:context configuration:std::move(webPageConfiguration) webView:self]);
</ins><span class="cx"> _page = [_contentView page];
</span><del>- [_contentView setDelegate:self];
</del><span class="cx"> [_contentView layer].anchorPoint = CGPointZero;
</span><span class="cx"> [_contentView setFrame:bounds];
</span><span class="cx"> [_scrollView addSubview:_contentView.get()];
</span><span class="lines">@@ -316,19 +315,17 @@
</span><span class="cx"> return [_contentView browsingContextController];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#pragma mark WKContentViewDelegate
-
-- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
</del><ins>+- (void)_didCommitLoadForMainFrame
</ins><span class="cx"> {
</span><span class="cx"> _isWaitingForNewLayerTreeAfterDidCommitLoad = YES;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction
</del><ins>+- (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction
</ins><span class="cx"> {
</span><span class="cx"> [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()];
</span><span class="cx"> [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
</span><span class="cx"> [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
</span><del>- if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing])
</del><ins>+ if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom])
</ins><span class="cx"> [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
</span><span class="cx">
</span><span class="cx"> if (_gestureController)
</span><span class="lines">@@ -342,7 +339,7 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (RetainPtr<CGImageRef>)takeViewSnapshotForContentView:(WKContentView *)contentView
</del><ins>+- (RetainPtr<CGImageRef>)_takeViewSnapshot
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: We should be able to use acquire an IOSurface directly, instead of going to CGImage here and back in ViewSnapshotStore.
</span><span class="cx"> UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, self.window.screen.scale);
</span><span class="lines">@@ -352,6 +349,114 @@
</span><span class="cx"> return image.CGImage;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)_zoomToPoint:(WebCore::FloatPoint)point atScale:(double)scale
+{
+ double maximumZoomDuration = 0.4;
+ double minimumZoomDuration = 0.1;
+ double zoomDurationFactor = 0.3;
+
+ CFTimeInterval duration = std::min(fabs(log([_scrollView zoomScale]) - log(scale)) * zoomDurationFactor + minimumZoomDuration, maximumZoomDuration);
+
+ if (scale != [_scrollView zoomScale])
+ [_contentView willStartUserTriggeredZoom];
+
+ [_scrollView _zoomToCenter:point scale:scale duration:duration];
+}
+
+- (void)_zoomToRect:(WebCore::FloatRect)targetRect atScale:(double)scale origin:(WebCore::FloatPoint)origin
+{
+ WebCore::FloatSize unobscuredContentSize = _page->unobscuredContentRect().size();
+ WebCore::FloatSize targetRectSizeAfterZoom = targetRect.size();
+ targetRectSizeAfterZoom.scale(scale);
+
+ // Center the target rect in the scroll view.
+ // If the target doesn't fit in the scroll view, center on the gesture location instead.
+ WebCore::FloatPoint zoomCenter = targetRect.center();
+
+ if (targetRectSizeAfterZoom.width() > unobscuredContentSize.width())
+ zoomCenter.setX(origin.x());
+ if (targetRectSizeAfterZoom.height() > unobscuredContentSize.height())
+ zoomCenter.setY(origin.y());
+
+ [self _zoomToPoint:zoomCenter atScale:scale];
+}
+
+static WebCore::FloatPoint constrainContentOffset(WebCore::FloatPoint contentOffset, WebCore::FloatSize contentSize, WebCore::FloatSize unobscuredContentSize)
+{
+ WebCore::FloatSize maximumContentOffset = contentSize - unobscuredContentSize;
+ contentOffset = contentOffset.shrunkTo(WebCore::FloatPoint(maximumContentOffset.width(), maximumContentOffset.height()));
+ contentOffset = contentOffset.expandedTo(WebCore::FloatPoint());
+ return contentOffset;
+}
+
+- (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance
+{
+ WebCore::FloatRect unobscuredContentRect = _page->unobscuredContentRect();
+ WebCore::FloatPoint unobscuredContentOffset = unobscuredContentRect.location();
+ WebCore::FloatSize contentSize([_contentView bounds].size);
+
+ // Center the target rect in the scroll view.
+ // If the target doesn't fit in the scroll view, center on the gesture location instead.
+ WebCore::FloatPoint newUnobscuredContentOffset;
+ if (targetRect.width() <= unobscuredContentRect.width())
+ newUnobscuredContentOffset.setX(targetRect.x() - (unobscuredContentRect.width() - targetRect.width()) / 2);
+ else
+ newUnobscuredContentOffset.setX(origin.x() - unobscuredContentRect.width() / 2);
+ if (targetRect.height() <= unobscuredContentRect.height())
+ newUnobscuredContentOffset.setY(targetRect.y() - (unobscuredContentRect.height() - targetRect.height()) / 2);
+ else
+ newUnobscuredContentOffset.setY(origin.y() - unobscuredContentRect.height() / 2);
+ newUnobscuredContentOffset = constrainContentOffset(newUnobscuredContentOffset, contentSize, unobscuredContentRect.size());
+
+ if (unobscuredContentOffset == newUnobscuredContentOffset) {
+ if (targetRect.width() > unobscuredContentRect.width())
+ newUnobscuredContentOffset.setX(origin.x() - unobscuredContentRect.width() / 2);
+ if (targetRect.height() > unobscuredContentRect.height())
+ newUnobscuredContentOffset.setY(origin.y() - unobscuredContentRect.height() / 2);
+ newUnobscuredContentOffset = constrainContentOffset(newUnobscuredContentOffset, contentSize, unobscuredContentRect.size());
+ }
+
+ WebCore::FloatSize scrollViewOffsetDelta = newUnobscuredContentOffset - unobscuredContentOffset;
+ scrollViewOffsetDelta.scale([_scrollView zoomScale]);
+
+ float scrollDistance = scrollViewOffsetDelta.diagonalLength();
+ if (scrollDistance < minimumScrollDistance)
+ return false;
+
+ [_scrollView setContentOffset:([_scrollView contentOffset] + scrollViewOffsetDelta) animated:YES];
+ return true;
+}
+
+- (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin
+{
+ [self _zoomToPoint:origin atScale:[_scrollView minimumZoomScale]];
+}
+
+- (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 = [_scrollView zoomScale];
+
+ WebCore::FloatSize unobscuredContentSize = _page->unobscuredContentRect().size();
+ double horizontalScale = unobscuredContentSize.width() * currentScale / targetRect.width();
+ double verticalScale = unobscuredContentSize.height() * currentScale / targetRect.height();
+
+ horizontalScale = std::min(std::max(horizontalScale, minimumScale), maximumScale);
+ verticalScale = std::min(std::max(verticalScale, minimumScale), maximumScale);
+
+ double targetScale = fitEntireRect ? std::min(horizontalScale, verticalScale) : horizontalScale;
+ if (fabs(targetScale - currentScale) < maximumScaleFactorDeltaForPanScroll) {
+ if ([self _scrollToRect:targetRect origin:origin minimumScrollDistance:minimumScrollDistance])
+ return true;
+ } else if (targetScale != currentScale) {
+ [self _zoomToRect:targetRect atScale:targetScale origin:origin];
+ return true;
+ }
+
+ return false;
+}
+
</ins><span class="cx"> #pragma mark - UIScrollViewDelegate
</span><span class="cx">
</span><span class="cx"> - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -31,11 +31,12 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #import "WKContentView.h"
</span><ins>+#import <WebCore/FloatRect.h>
</ins><span class="cx"> #import <UIKit/UIScrollView_Private.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-#define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate, WKContentViewDelegate>
</del><ins>+#define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate>
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if !defined(WK_WEB_VIEW_PROTOCOLS)
</span><span class="lines">@@ -51,6 +52,16 @@
</span><span class="cx"> @package
</span><span class="cx"> RefPtr<WebKit::WebPageProxy> _page;
</span><span class="cx"> }
</span><ins>+
+#if PLATFORM(IOS)
+- (void)_didCommitLoadForMainFrame;
+- (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
+
+- (RetainPtr<CGImageRef>)_takeViewSnapshot;
+
+- (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance;
+- (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin;
+#endif
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKViewIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -230,7 +230,7 @@
</span><span class="cx"> webPageConfiguration.pageGroup = toImpl(pageGroupRef);
</span><span class="cx"> webPageConfiguration.relatedPage = toImpl(relatedPage);
</span><span class="cx">
</span><del>- _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:*toImpl(contextRef) configuration:std::move(webPageConfiguration)]);
</del><ins>+ _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:*toImpl(contextRef) configuration:std::move(webPageConfiguration) webView:nil]);
</ins><span class="cx">
</span><span class="cx"> [[_contentView layer] setAnchorPoint:CGPointZero];
</span><span class="cx"> [_contentView setFrame:bounds];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosSmartMagnificationControllerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h (0 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.h        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SmartMagnificationController_h
+#define SmartMagnificationController_h
+
+#if PLATFORM(IOS)
+
+#include "MessageReceiver.h"
+#include <WebCore/FloatRect.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS WKContentView;
+OBJC_CLASS UIScrollView;
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class SmartMagnificationController : private IPC::MessageReceiver {
+ WTF_MAKE_NONCOPYABLE(SmartMagnificationController);
+public:
+ SmartMagnificationController(WKContentView *);
+ ~SmartMagnificationController();
+
+ void handleSmartMagnificationGesture(WebCore::FloatPoint origin);
+ void handleResetMagnificationGesture(WebCore::FloatPoint origin);
+
+private:
+ // IPC::MessageReceiver.
+ virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
+
+ void didCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect renderRect, WebCore::FloatRect visibleContentBounds, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale);
+
+ WebPageProxy& m_webPageProxy;
+ WKContentView *m_contentView;
+};
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
+
+#endif // SmartMagnificationController_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosSmartMagnificationControllermessagesin"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.messages.in (0 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.messages.in         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.messages.in        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+# Copyright (C) 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#if PLATFORM(IOS)
+
+messages -> SmartMagnificationController {
+ DidCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect renderRect, WebCore::FloatRect visibleContentBounds, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale)
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosSmartMagnificationControllermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm (0 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ios/SmartMagnificationController.mm        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "SmartMagnificationController.h"
+
+#if PLATFORM(IOS)
+
+#import "SmartMagnificationControllerMessages.h"
+#import "ViewGestureGeometryCollectorMessages.h"
+#import "WKContentView.h"
+#import "WKScrollView.h"
+#import "WebPageGroup.h"
+#import "WebPageMessages.h"
+#import "WebPageProxy.h"
+#import "WebProcessProxy.h"
+#import <UIKit/UIKit.h>
+#import <UIKit/UIKit_Private.h>
+
+using namespace WebCore;
+
+static const float smartMagnificationPanScrollThresholdZoomedOut = 60;
+static const float smartMagnificationPanScrollThresholdIPhone = 100;
+static const float smartMagnificationPanScrollThresholdIPad = 150;
+static const float smartMagnificationElementPadding = 0.05;
+
+static const double smartMagnificationMaximumScale = 1.6;
+static const double smartMagnificationMinimumScale = 0;
+
+namespace WebKit {
+
+SmartMagnificationController::SmartMagnificationController(WKContentView *contentView)
+ : m_webPageProxy(*contentView.page)
+ , m_contentView(contentView)
+{
+ m_webPageProxy.process().addMessageReceiver(Messages::SmartMagnificationController::messageReceiverName(), m_webPageProxy.pageID(), *this);
+}
+
+SmartMagnificationController::~SmartMagnificationController()
+{
+ m_webPageProxy.process().removeMessageReceiver(Messages::SmartMagnificationController::messageReceiverName(), m_webPageProxy.pageID());
+}
+
+void SmartMagnificationController::handleSmartMagnificationGesture(FloatPoint origin)
+{
+ m_webPageProxy.process().send(Messages::ViewGestureGeometryCollector::CollectGeometryForSmartMagnificationGesture(origin), m_webPageProxy.pageID());
+}
+
+void SmartMagnificationController::handleResetMagnificationGesture(FloatPoint origin)
+{
+ [m_contentView _zoomOutWithOrigin:origin];
+}
+
+void SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture(FloatPoint origin, FloatRect targetRect, FloatRect visibleContentRect, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale)
+{
+ if (targetRect.isEmpty()) {
+ // FIXME: If we don't zoom, send the tap along to text selection (see <rdar://problem/6810344>).
+ [m_contentView _zoomOutWithOrigin:origin];
+ return;
+ }
+
+ targetRect.inflateX(smartMagnificationElementPadding * targetRect.width());
+ targetRect.inflateY(smartMagnificationElementPadding * targetRect.height());
+
+ double maximumScale = std::min(viewportMaximumScale, smartMagnificationMaximumScale);
+ double minimumScale = std::max(viewportMinimumScale, smartMagnificationMinimumScale);
+
+ // FIXME: Check if text selection wants to consume the double tap before we attempt magnification.
+
+ // If the content already fits in the scroll view and we're already zoomed in to the target scale,
+ // it is most likely that the user intended to scroll, so use a small distance threshold to initiate panning.
+ float minimumScrollDistance;
+ if ([m_contentView bounds].size.width <= m_webPageProxy.unobscuredContentRect().width())
+ minimumScrollDistance = smartMagnificationPanScrollThresholdZoomedOut;
+ else if (UICurrentUserInterfaceIdiomIsPad())
+ minimumScrollDistance = smartMagnificationPanScrollThresholdIPad;
+ else
+ minimumScrollDistance = smartMagnificationPanScrollThresholdIPhone;
+
+ // For replaced elements like images, we want to fit the whole element
+ // in the view, so scale it down enough to make both dimensions fit if possible.
+ // For other elements, try to fit them horizontally.
+ if ([m_contentView _zoomToRect:targetRect withOrigin:origin fitEntireRect:isReplacedElement minimumScale:minimumScale maximumScale:maximumScale minimumScrollDistance:minimumScrollDistance])
+ return;
+
+ // FIXME: If we still don't zoom, send the tap along to text selection (see <rdar://problem/6810344>).
+ [m_contentView _zoomOutWithOrigin:origin];
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><span class="cx"> @class WKContentView;
</span><ins>+@class WKWebView;
</ins><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> class DrawingAreaProxy;
</span><span class="lines">@@ -43,26 +44,17 @@
</span><span class="cx"> struct WebPageConfiguration;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@protocol WKContentViewDelegate <NSObject>
-- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView;
-- (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
-
-// FIXME: This doesn't belong in a 'delegate'.
-- (RetainPtr<CGImageRef>)takeViewSnapshotForContentView:(WKContentView *)contentView;
-@end
-
</del><span class="cx"> @interface WKContentView : UIView {
</span><span class="cx"> @package
</span><span class="cx"> RefPtr<WebKit::WebPageProxy> _page;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @property (nonatomic, readonly) WKBrowsingContextController *browsingContextController;
</span><del>-@property (nonatomic, assign) id <WKContentViewDelegate> delegate;
</del><span class="cx">
</span><span class="cx"> @property (nonatomic, readonly) WebKit::WebPageProxy* page;
</span><span class="cx"> @property (nonatomic, readonly) BOOL isAssistingNode;
</span><span class="cx">
</span><del>-- (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration;
</del><ins>+- (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration webView:(WKWebView *)webView;
</ins><span class="cx">
</span><span class="cx"> - (void)setMinimumSize:(CGSize)size;
</span><span class="cx"> - (void)setMinimumLayoutSize:(CGSize)size;
</span><span class="lines">@@ -86,4 +78,7 @@
</span><span class="cx">
</span><span class="cx"> - (RetainPtr<CGImageRef>)_takeViewSnapshot;
</span><span class="cx">
</span><ins>+- (BOOL)_zoomToRect:(CGRect)targetRect withOrigin:(CGPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(CGFloat)minimumScrollDistance;
+- (void)_zoomOutWithOrigin:(CGPoint)origin;
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import "PageClientImplIOS.h"
</span><span class="cx"> #import "RemoteLayerTreeDrawingAreaProxy.h"
</span><span class="cx"> #import "RemoteScrollingCoordinatorProxy.h"
</span><ins>+#import "SmartMagnificationController.h"
</ins><span class="cx"> #import "WebKit2Initialize.h"
</span><span class="cx"> #import "WKBrowsingContextControllerInternal.h"
</span><span class="cx"> #import "WKBrowsingContextGroupPrivate.h"
</span><span class="lines">@@ -38,6 +39,7 @@
</span><span class="cx"> #import "WKPreferencesInternal.h"
</span><span class="cx"> #import "WKProcessGroupPrivate.h"
</span><span class="cx"> #import "WKProcessPoolInternal.h"
</span><ins>+#import "WKWebViewInternal.h"
</ins><span class="cx"> #import "WKWebViewConfiguration.h"
</span><span class="cx"> #import "WebContext.h"
</span><span class="cx"> #import "WebFrameProxy.h"
</span><span class="lines">@@ -62,9 +64,11 @@
</span><span class="cx"> RetainPtr<WKBrowsingContextController> _browsingContextController;
</span><span class="cx">
</span><span class="cx"> RetainPtr<UIView> _rootContentView;
</span><ins>+
+ WKWebView *_webView;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-- (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration
</del><ins>+- (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration webView:(WKWebView *)webView
</ins><span class="cx"> {
</span><span class="cx"> if (!(self = [super initWithFrame:frame]))
</span><span class="cx"> return nil;
</span><span class="lines">@@ -79,6 +83,8 @@
</span><span class="cx"> _page->setUseFixedLayout(true);
</span><span class="cx"> _page->setDelegatesScrolling(true);
</span><span class="cx">
</span><ins>+ _webView = webView;
+
</ins><span class="cx"> WebContext::statistics().wkViewCount++;
</span><span class="cx">
</span><span class="cx"> _rootContentView = adoptNS([[UIView alloc] init]);
</span><span class="lines">@@ -243,9 +249,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)_didCommitLoadForMainFrame
</span><span class="cx"> {
</span><del>- if ([_delegate respondsToSelector:@selector(contentViewDidCommitLoadForMainFrame:)])
- [_delegate contentViewDidCommitLoadForMainFrame:self];
-
</del><ins>+ [_webView _didCommitLoadForMainFrame];
</ins><span class="cx"> [self _stopAssistingNode];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -256,8 +260,7 @@
</span><span class="cx"> [self setBounds:{CGPointZero, contentsSize}];
</span><span class="cx"> [_rootContentView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)];
</span><span class="cx">
</span><del>- if ([_delegate respondsToSelector:@selector(contentView:didCommitLayerTree:)])
- [_delegate contentView:self didCommitLayerTree:layerTreeTransaction];
</del><ins>+ [_webView _didCommitLayerTree:layerTreeTransaction];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_setAcceleratedCompositingRootView:(UIView *)rootView
</span><span class="lines">@@ -277,9 +280,19 @@
</span><span class="cx">
</span><span class="cx"> - (RetainPtr<CGImageRef>)_takeViewSnapshot
</span><span class="cx"> {
</span><del>- return [_delegate takeViewSnapshotForContentView:self];
</del><ins>+ return [_webView _takeViewSnapshot];
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+- (BOOL)_zoomToRect:(CGRect)targetRect withOrigin:(CGPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(CGFloat)minimumScrollDistance
+{
+ return [_webView _zoomToRect:targetRect withOrigin:origin fitEntireRect:fitEntireRect minimumScale:minimumScale maximumScale:maximumScale minimumScrollDistance:minimumScrollDistance];
+}
+
+- (void)_zoomOutWithOrigin:(CGPoint)origin
+{
+ return [_webView _zoomOutWithOrigin:origin];
+}
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> class NativeWebTouchEvent;
</span><ins>+class SmartMagnificationController;
</ins><span class="cx"> class WebPageProxy;
</span><span class="cx"> struct AssistedNodeInformation;
</span><span class="cx"> struct InteractionInformationAtPosition;
</span><span class="lines">@@ -96,6 +97,8 @@
</span><span class="cx"> RetainPtr<NSString> _markedText;
</span><span class="cx"> RetainPtr<WKActionSheetAssistant> _actionSheetAssistant;
</span><span class="cx">
</span><ins>+ std::unique_ptr<WebKit::SmartMagnificationController> _smartMagnificationController;
+
</ins><span class="cx"> id <UITextInputDelegate> _inputDelegate;
</span><span class="cx">
</span><span class="cx"> uint64_t _latestTapHighlightID;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #import "NativeWebKeyboardEvent.h"
</span><span class="cx"> #import "NativeWebTouchEvent.h"
</span><ins>+#import "SmartMagnificationController.h"
</ins><span class="cx"> #import "WebEvent.h"
</span><span class="cx"> #import "WebIOSEventFactory.h"
</span><span class="cx"> #import "WebPageMessages.h"
</span><span class="lines">@@ -151,6 +152,12 @@
</span><span class="cx"> [self addGestureRecognizer:_doubleTapGestureRecognizer.get()];
</span><span class="cx"> [_singleTapGestureRecognizer requireOtherGestureToFail:_doubleTapGestureRecognizer.get()];
</span><span class="cx">
</span><ins>+ _twoFingerDoubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_twoFingerDoubleTapRecognized:)]);
+ [_twoFingerDoubleTapGestureRecognizer setNumberOfTapsRequired:2];
+ [_twoFingerDoubleTapGestureRecognizer setNumberOfTouchesRequired:2];
+ [_twoFingerDoubleTapGestureRecognizer setDelegate:self];
+ [self addGestureRecognizer:_twoFingerDoubleTapGestureRecognizer.get()];
+
</ins><span class="cx"> _highlightLongPressGestureRecognizer = adoptNS([[_UIWebHighlightLongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_highlightLongPressRecognized:)]);
</span><span class="cx"> [_highlightLongPressGestureRecognizer setDelay:highlightDelay];
</span><span class="cx"> [_highlightLongPressGestureRecognizer setDelegate:self];
</span><span class="lines">@@ -174,6 +181,7 @@
</span><span class="cx"> [self useSelectionAssistantWithMode:UIWebSelectionModeWeb];
</span><span class="cx">
</span><span class="cx"> _actionSheetAssistant = adoptNS([[WKActionSheetAssistant alloc] initWithView:self]);
</span><ins>+ _smartMagnificationController = std::make_unique<SmartMagnificationController>(self);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)cleanupInteraction
</span><span class="lines">@@ -640,12 +648,12 @@
</span><span class="cx">
</span><span class="cx"> - (void)_doubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
</span><span class="cx"> {
</span><del>- // FIXME: Add implementation.
</del><ins>+ _smartMagnificationController->handleSmartMagnificationGesture(gestureRecognizer.location);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_twoFingerDoubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
</span><span class="cx"> {
</span><del>- // FIXME: Add implementation.
</del><ins>+ _smartMagnificationController->handleResetMagnificationGesture(gestureRecognizer.location);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_twoFingerPanRecognized:(UIPanGestureRecognizer *)gestureRecognizer
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> // Message handlers.
</span><span class="cx"> void didCollectGeometryForMagnificationGesture(WebCore::FloatRect visibleContentBounds, bool frameHandlesMagnificationGesture);
</span><del>- void didCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect renderRect, WebCore::FloatRect visibleContentBounds, bool isReplacedElement, bool frameHandlesMagnificationGesture);
</del><ins>+ void didCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect renderRect, WebCore::FloatRect visibleContentBounds, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale);
</ins><span class="cx"> void didHitRenderTreeSizeThreshold();
</span><span class="cx">
</span><span class="cx"> void endMagnificationGesture();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.messages.in (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.messages.in        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.messages.in        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> messages -> ViewGestureController {
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> DidCollectGeometryForMagnificationGesture(WebCore::FloatRect visibleContentBounds, bool frameHandlesMagnificationGesture)
</span><del>- DidCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect renderRect, WebCore::FloatRect visibleContentBounds, bool isReplacedElement, bool frameHandlesMagnificationGesture)
</del><ins>+ DidCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect renderRect, WebCore::FloatRect visibleContentBounds, bool isReplacedElement, bool frameHandlesMagnificationGesture, double viewportMinimumScale, double viewportMaximumScale)
</ins><span class="cx"> DidHitRenderTreeSizeThreshold()
</span><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -205,11 +205,8 @@
</span><span class="cx"> return std::max(fabs(a.x() - b.x()), std::max(fabs(a.y() - b.y()), std::max(fabs(a.width() - b.width()), fabs(a.height() - b.height()))));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ViewGestureController::didCollectGeometryForSmartMagnificationGesture(FloatPoint origin, FloatRect renderRect, FloatRect visibleContentRect, bool isReplacedElement, bool frameHandlesMagnificationGesture)
</del><ins>+void ViewGestureController::didCollectGeometryForSmartMagnificationGesture(FloatPoint origin, FloatRect renderRect, FloatRect visibleContentRect, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale)
</ins><span class="cx"> {
</span><del>- if (frameHandlesMagnificationGesture)
- return;
-
</del><span class="cx"> double currentScaleFactor = m_webPageProxy.pageScaleFactor();
</span><span class="cx">
</span><span class="cx"> FloatRect unscaledTargetRect = renderRect;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -524,8 +524,12 @@
</span><span class="cx">                 2DA944BA1884EA3C00ED86DB /* WebPageIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */; };
</span><span class="cx">                 2DA944BD188511E700ED86DB /* NetworkProcessIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */; };
</span><span class="cx">                 2DACE64E18ADBFF000E4CA76 /* WKThumbnailViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACE64D18ADBFF000E4CA76 /* WKThumbnailViewInternal.h */; };
</span><ins>+                2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */; };
+                2DAF06D718BD1A470081CEB1 /* SmartMagnificationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */; };
</ins><span class="cx">                 2DDE0AFA18298CC900F97EAA /* RemoteLayerTreePropertyApplier.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */; };
</span><span class="cx">                 2DDE0AFB18298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DDE0AF918298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm */; };
</span><ins>+                2DE6943D18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */; };
+                2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */; };
</ins><span class="cx">                 2DF9593B18A42412009785A1 /* ViewGestureControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */; };
</span><span class="cx">                 31099973146C75A20029DEB9 /* WebNotificationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31099971146C759B0029DEB9 /* WebNotificationClient.cpp */; };
</span><span class="cx">                 310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31099968146C71F50029DEB9 /* WebNotificationClient.h */; };
</span><span class="lines">@@ -2273,8 +2277,13 @@
</span><span class="cx">                 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageIOS.mm; path = ios/WebPageIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessIOS.mm; path = NetworkProcess/ios/NetworkProcessIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DACE64D18ADBFF000E4CA76 /* WKThumbnailViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKThumbnailViewInternal.h; sourceTree = "<group>"; };
</span><ins>+                2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmartMagnificationController.h; path = ios/SmartMagnificationController.h; sourceTree = "<group>"; };
+                2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SmartMagnificationController.mm; path = ios/SmartMagnificationController.mm; sourceTree = "<group>"; };
+                2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = SmartMagnificationController.messages.in; path = ios/SmartMagnificationController.messages.in; sourceTree = "<group>"; };
</ins><span class="cx">                 2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreePropertyApplier.h; sourceTree = "<group>"; };
</span><span class="cx">                 2DDE0AF918298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreePropertyApplier.mm; sourceTree = "<group>"; };
</span><ins>+                2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SmartMagnificationControllerMessageReceiver.cpp; path = SmartMagnificationControllerMessageReceiver.cpp; sourceTree = "<group>"; };
+                2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmartMagnificationControllerMessages.h; path = SmartMagnificationControllerMessages.h; sourceTree = "<group>"; };
</ins><span class="cx">                 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ViewGestureControllerIOS.mm; path = ios/ViewGestureControllerIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 31099968146C71F50029DEB9 /* WebNotificationClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebNotificationClient.h; sourceTree = "<group>"; };
</span><span class="cx">                 31099971146C759B0029DEB9 /* WebNotificationClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationClient.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -4325,6 +4334,9 @@
</span><span class="cx">                                 0F0C365B18C05CA100F607D7 /* RemoteScrollingCoordinatorProxyIOS.mm */,
</span><span class="cx">                                 2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */,
</span><span class="cx">                                 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */,
</span><ins>+                                2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */,
+                                2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */,
+                                2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */,
</ins><span class="cx">                                 2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */,
</span><span class="cx">                                 2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */,
</span><span class="cx">                                 2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */,
</span><span class="lines">@@ -6114,6 +6126,8 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 2D819B9F1862800E001F03D1 /* ViewGestureGeometryCollectorMessageReceiver.cpp */,
</span><span class="cx">                                 2D819BA01862800E001F03D1 /* ViewGestureGeometryCollectorMessages.h */,
</span><ins>+                                2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */,
+                                2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */,
</ins><span class="cx">                                 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */,
</span><span class="cx">                                 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */,
</span><span class="cx">                                 E17AE2C216B9C63A001C42F1 /* com.apple.WebKit.NetworkProcess.sb */,
</span><span class="lines">@@ -6440,6 +6454,7 @@
</span><span class="cx">                                 1F604BA81889FA7400EE0395 /* WKRenderingProgressEvents.h in Headers */,
</span><span class="cx">                                 1A422F8F18B29C6400D8CD96 /* HistoryClient.h in Headers */,
</span><span class="cx">                                 BCBAACEB145225E30053F82F /* WKProcessGroup.h in Headers */,
</span><ins>+                                2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */,
</ins><span class="cx">                                 377EAD4817E2C77B002D193D /* WKUserContentInjectedFrames.h in Headers */,
</span><span class="cx">                                 BC8699B5116AADAA002A925B /* WKView.h in Headers */,
</span><span class="cx">                                 BC8F2F2B16273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.h in Headers */,
</span><span class="lines">@@ -6724,6 +6739,7 @@
</span><span class="cx">                                 3F87B9C0158940D80090FF62 /* WebColorPicker.h in Headers */,
</span><span class="cx">                                 BC4A6290147312BE006C681A /* WebConnection.h in Headers */,
</span><span class="cx">                                 0FCB4E5418BBE044000FCFC9 /* WKScrollView.h in Headers */,
</span><ins>+                                2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */,
</ins><span class="cx">                                 BC4A6292147312BE006C681A /* WebConnectionClient.h in Headers */,
</span><span class="cx">                                 1A1FEC1D1627B45700700F6D /* WebConnectionMessages.h in Headers */,
</span><span class="cx">                                 BC4A62A814744EC7006C681A /* WebConnectionToWebProcess.h in Headers */,
</span><span class="lines">@@ -7872,6 +7888,7 @@
</span><span class="cx">                                 93FC67BD12D3CCF200A60610 /* DecoderAdapter.cpp in Sources */,
</span><span class="cx">                                 BCE81D98131AE02100241910 /* DictionaryPopupInfo.cpp in Sources */,
</span><span class="cx">                                 5167EEA1170377BF007681CA /* DiskCacheMonitor.mm in Sources */,
</span><ins>+                                2DAF06D718BD1A470081CEB1 /* SmartMagnificationController.mm in Sources */,
</ins><span class="cx">                                 2D6CD11A189058A500E5A4A0 /* ViewSnapshotStore.mm in Sources */,
</span><span class="cx">                                 518E8F0716B2093700E91429 /* Download.cpp in Sources */,
</span><span class="cx">                                 2D47B56C1810714E003A3AEE /* RemoteLayerBackingStore.mm in Sources */,
</span><span class="lines">@@ -8076,6 +8093,7 @@
</span><span class="cx">                                 1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */,
</span><span class="cx">                                 1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */,
</span><span class="cx">                                 0F59479C187B3B6000437857 /* RemoteScrollingTree.cpp in Sources */,
</span><ins>+                                2DE6943D18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp in Sources */,
</ins><span class="cx">                                 1AA3D75B1651B44F008713D0 /* RemoteLayerTreeHost.mm in Sources */,
</span><span class="cx">                                 1AF1AC6B1651759E00C17D7F /* RemoteLayerTreeTransaction.mm in Sources */,
</span><span class="cx">                                 E1B78473163F253E0007B692 /* RemoteNetworkingContext.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -26,26 +26,34 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ViewGestureGeometryCollector.h"
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
-
-#include "ViewGestureControllerMessages.h"
</del><span class="cx"> #include "ViewGestureGeometryCollectorMessages.h"
</span><span class="cx"> #include "WebCoreArgumentCoders.h"
</span><span class="cx"> #include "WebFrame.h"
</span><span class="cx"> #include "WebPage.h"
</span><span class="cx"> #include "WebProcess.h"
</span><ins>+#include <WebCore/Frame.h>
</ins><span class="cx"> #include <WebCore/FrameView.h>
</span><span class="cx"> #include <WebCore/HitTestResult.h>
</span><span class="cx"> #include <WebCore/RenderView.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#include "SmartMagnificationControllerMessages.h"
+#endif
+
+#if PLATFORM(MAC)
+#include "ViewGestureControllerMessages.h"
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> ViewGestureGeometryCollector::ViewGestureGeometryCollector(WebPage& webPage)
</span><span class="cx"> : m_webPage(webPage)
</span><ins>+#if PLATFORM(MAC)
</ins><span class="cx"> , m_renderTreeSizeNotificationThreshold(0)
</span><span class="cx"> , m_renderTreeSizeNotificationTimer(RunLoop::main(), this, &ViewGestureGeometryCollector::renderTreeSizeNotificationTimerFired)
</span><ins>+#endif
</ins><span class="cx"> {
</span><span class="cx"> WebProcess::shared().addMessageReceiver(Messages::ViewGestureGeometryCollector::messageReceiverName(), m_webPage.pageID(), *this);
</span><span class="cx"> }
</span><span class="lines">@@ -55,32 +63,56 @@
</span><span class="cx"> WebProcess::shared().removeMessageReceiver(Messages::ViewGestureGeometryCollector::messageReceiverName(), m_webPage.pageID());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ViewGestureGeometryCollector::collectGeometryForMagnificationGesture()
</del><ins>+void ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture(FloatPoint origin, FloatRect targetRect, FloatRect visibleContentRect, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale)
</ins><span class="cx"> {
</span><del>- FloatRect visibleContentRect = m_webPage.mainFrameView()->visibleContentRectIncludingScrollbars();
- bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame()->handlesPageScaleGesture();
- m_webPage.send(Messages::ViewGestureController::DidCollectGeometryForMagnificationGesture(visibleContentRect, frameHandlesMagnificationGesture));
</del><ins>+#if PLATFORM(MAC)
+ m_webPage.send(Messages::ViewGestureController::DidCollectGeometryForSmartMagnificationGesture(origin, targetRect, visibleContentRect, isReplacedElement, viewportMinimumScale, viewportMaximumScale));
+#endif
+#if PLATFORM(IOS)
+ m_webPage.send(Messages::SmartMagnificationController::DidCollectGeometryForSmartMagnificationGesture(origin, targetRect, visibleContentRect, isReplacedElement, viewportMinimumScale, viewportMaximumScale));
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture(FloatPoint origin)
</span><span class="cx"> {
</span><span class="cx"> FloatRect visibleContentRect = m_webPage.mainFrameView()->visibleContentRectIncludingScrollbars();
</span><del>- bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame()->handlesPageScaleGesture();
</del><span class="cx">
</span><del>- FloatPoint scrolledOrigin = origin;
- scrolledOrigin.moveBy(m_webPage.mainFrameView()->scrollPosition());
</del><ins>+ if (m_webPage.mainWebFrame()->handlesPageScaleGesture())
+ return;
</ins><span class="cx">
</span><span class="cx"> HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
</span><del>- HitTestResult hitTestResult = HitTestResult(scrolledOrigin);
</del><ins>+ IntPoint originInContentsSpace = m_webPage.mainFrameView()->windowToContents(roundedIntPoint(origin));
+ HitTestResult hitTestResult = HitTestResult(originInContentsSpace);
+
</ins><span class="cx"> m_webPage.mainFrameView()->renderView()->hitTest(request, hitTestResult);
</span><span class="cx">
</span><del>- if (hitTestResult.innerNode()) {
</del><ins>+ if (Node* node = hitTestResult.innerNode()) {
</ins><span class="cx"> bool isReplaced;
</span><del>- FloatRect renderRect = hitTestResult.innerNode()->renderRect(&isReplaced);
- m_webPage.send(Messages::ViewGestureController::DidCollectGeometryForSmartMagnificationGesture(origin, renderRect, visibleContentRect, isReplaced, frameHandlesMagnificationGesture));
</del><ins>+ FloatRect renderRect = node->renderRect(&isReplaced);
+
+#if PLATFORM(MAC)
+ double viewportMinimumScale = 0;
+ double viewportMaximumScale = std::numeric_limits<double>::max();
+#else
+ double viewportMinimumScale = m_webPage.minimumPageScaleFactor();
+ double viewportMaximumScale = m_webPage.maximumPageScaleFactor();
+#endif
+
+ dispatchDidCollectGeometryForSmartMagnificationGesture(origin, renderRect, visibleContentRect, isReplaced, viewportMinimumScale, viewportMaximumScale);
+ return;
</ins><span class="cx"> }
</span><ins>+
+ dispatchDidCollectGeometryForSmartMagnificationGesture(FloatPoint(), FloatRect(), FloatRect(), false, 0, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC)
+void ViewGestureGeometryCollector::collectGeometryForMagnificationGesture()
+{
+ FloatRect visibleContentRect = m_webPage.mainFrameView()->visibleContentRectIncludingScrollbars();
+ bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame()->handlesPageScaleGesture();
+ m_webPage.send(Messages::ViewGestureController::DidCollectGeometryForMagnificationGesture(visibleContentRect, frameHandlesMagnificationGesture));
+}
+
</ins><span class="cx"> void ViewGestureGeometryCollector::mainFrameDidLayout()
</span><span class="cx"> {
</span><span class="cx"> if (m_renderTreeSizeNotificationThreshold && m_webPage.renderTreeSize() >= m_renderTreeSizeNotificationThreshold) {
</span><span class="lines">@@ -93,7 +125,7 @@
</span><span class="cx"> {
</span><span class="cx"> m_webPage.send(Messages::ViewGestureController::DidHitRenderTreeSizeThreshold());
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span><del>-#endif // !PLATFORM(IOS)
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageViewGestureGeometryCollectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.h        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -26,13 +26,12 @@
</span><span class="cx"> #ifndef ViewGestureGeometryCollector_h
</span><span class="cx"> #define ViewGestureGeometryCollector_h
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
-
</del><span class="cx"> #include "MessageReceiver.h"
</span><span class="cx"> #include <wtf/RunLoop.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class FloatPoint;
</span><ins>+class FloatRect;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -51,20 +50,25 @@
</span><span class="cx"> virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
</span><span class="cx">
</span><span class="cx"> // Message handlers.
</span><ins>+ void collectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin);
+
+#if PLATFORM(MAC)
</ins><span class="cx"> void collectGeometryForMagnificationGesture();
</span><del>- void collectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin);
</del><span class="cx"> void setRenderTreeSizeNotificationThreshold(uint64_t size) { m_renderTreeSizeNotificationThreshold = size; }
</span><span class="cx">
</span><span class="cx"> void renderTreeSizeNotificationTimerFired();
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+ void dispatchDidCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect targetRect, WebCore::FloatRect visibleContentRect, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale);
+
</ins><span class="cx"> WebPage& m_webPage;
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC)
</ins><span class="cx"> uint64_t m_renderTreeSizeNotificationThreshold;
</span><span class="cx"> RunLoop::Timer<ViewGestureGeometryCollector> m_renderTreeSizeNotificationTimer;
</span><ins>+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span><del>-#endif // !PLATFORM(IOS)
-
</del><span class="cx"> #endif // ViewGestureGeometryCollector
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageViewGestureGeometryCollectormessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.messages.in (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.messages.in        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.messages.in        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -20,14 +20,12 @@
</span><span class="cx"> # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
-
</del><span class="cx"> messages -> ViewGestureGeometryCollector {
</span><ins>+ CollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin)
</ins><span class="cx">
</span><del>-CollectGeometryForMagnificationGesture()
-CollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin)
</del><ins>+#if !PLATFORM(IOS)
+ CollectGeometryForMagnificationGesture()
</ins><span class="cx">
</span><del>-SetRenderTreeSizeNotificationThreshold(uint64_t size)
-}
-
</del><ins>+ SetRenderTreeSizeNotificationThreshold(uint64_t size)
</ins><span class="cx"> #endif
</span><ins>+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -254,9 +254,7 @@
</span><span class="cx"> , m_pdfPluginEnabled(false)
</span><span class="cx"> , m_hasCachedWindowFrame(false)
</span><span class="cx"> , m_keyboardEventBeingInterpreted(0)
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx"> , m_viewGestureGeometryCollector(*this)
</span><del>-#endif
</del><span class="cx"> #elif PLATFORM(GTK) && HAVE(ACCESSIBILITY)
</span><span class="cx"> , m_accessibilityObject(0)
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (164936 => 164937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-02 03:58:59 UTC (rev 164936)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-02 05:25:27 UTC (rev 164937)
</span><span class="lines">@@ -992,9 +992,7 @@
</span><span class="cx">
</span><span class="cx"> WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted;
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx"> ViewGestureGeometryCollector m_viewGestureGeometryCollector;
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> #elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
</span><span class="cx"> GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
</span></span></pre>
</div>
</div>
</body>
</html>