<!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>[163515] 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/163515">163515</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-05 22:45:41 -0800 (Wed, 05 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited
https://bugs.webkit.org/show_bug.cgi?id=127886

Reviewed by Simon Fraser.

Source/WebCore: 

The updates of the views on the UIProcess side was completely disconnected
from the tiles updates from the DrawingArea. There is a non-negligible time
between the size/scale update and the new tiles coming, which causes
visual glitches.

There are three main cases where the tiles and content would be out of sync
with the UIViews:
-When loading a new page with different content width of a different viewport.
-When a page changes its viewport.
-When the viewport-constrainted viewport size changes.

To fix the issue, WKView is modified to maintain the old state of WKContentView
and UIScrollView until the new tiles are available.

Geometry/scale update are split in two phases:
1) A source (the page or the user) changes parameters of the geometry. The WebProcess updates
   its layout accordingly.
   At this point, the UIViews are unchanged and are left with the old parameters.
2) Eventually, new tiles come and commitLayerTree() is called on the drawing area proxy.
   At that point, WKContentView and its UIScrollView are updated to match the committed
   size and scale for the page.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* page/ViewportConfiguration.cpp: Added.
(WebCore::constraintsAreAllRelative):
(WebCore::ViewportConfiguration::ViewportConfiguration):
(WebCore::ViewportConfiguration::setDefaultConfiguration):
(WebCore::ViewportConfiguration::setContentsSize):
(WebCore::ViewportConfiguration::setMinimumLayoutSize):
(WebCore::ViewportConfiguration::setViewportArguments):
(WebCore::ViewportConfiguration::layoutSize):
(WebCore::ViewportConfiguration::initialScale):
(WebCore::ViewportConfiguration::minimumScale):
(WebCore::ViewportConfiguration::maximumScale):
(WebCore::ViewportConfiguration::allowsUserScaling):
(WebCore::viewportArgumentValueIsValid):
(WebCore::applyViewportArgument):
(WebCore::ViewportConfiguration::updateConfiguration):
(WebCore::ViewportConfiguration::layoutWidth):
(WebCore::ViewportConfiguration::layoutHeight):
* page/ViewportConfiguration.h: Added.
(WebCore::ViewportConfigurationConfiguration::ViewportConfigurationConfiguration):
(WebCore::ViewportConfiguration::defaultConfiguration):
(WebCore::ViewportConfiguration::contentsSize):
(WebCore::ViewportConfiguration::minimumLayoutSize):
(WebCore::ViewportConfiguration::viewportArguments):

Source/WebKit2: 

* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::mainFrameContentsSize):
(WebKit::RemoteLayerTreeTransaction::setMainFrameContentsSize):
(WebKit::RemoteLayerTreeTransaction::pageScaleFactor):
(WebKit::RemoteLayerTreeTransaction::setPageScaleFactor):
(WebKit::RemoteLayerTreeTransaction::minimumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::setMinimumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::maximumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::setMaximumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::allowsUserScaling):
(WebKit::RemoteLayerTreeTransaction::setAllowsUserScaling):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):
* UIProcess/API/ios/PageClientImplIOS.h:
* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didCommitLayerTree):
* UIProcess/API/ios/WKContentView.h:
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView setMinimumLayoutSize:]):
(-[WKContentView willStartUserTriggeredZoom]):
(-[WKContentView _didCommitLayerTree:WebKit::]):
* UIProcess/API/ios/WKContentViewInternal.h:
* UIProcess/API/ios/WKViewIOS.mm:
(-[WKView contentViewDidCommitLoadForMainFrame:]):
(-[WKView contentView:didCommitLayerTree:WebKit::]):
(-[WKView scrollViewWillBeginZooming:withView:]):
(-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
(-[WKView _frameOrBoundsChanged]):
(-[WKView minimumLayoutSizeOverride]):
(-[WKView setMinimumLayoutSizeOverride:]):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setVirtualViewportMinimumLayoutSize):
(WebKit::WebPageProxy::didCommitLayerTree):
(WebKit::WebPageProxy::willStartUserTriggeredZooming):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::contentsSizeChanged):
(WebKit::WebChromeClient::dispatchViewportPropertiesDidChange):
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::didReceiveMobileDocType):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::mainFrameDidLayout):
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::viewportPropertiesDidChange):
(WebKit::WebPage::minimumPageScaleFactor):
(WebKit::WebPage::maximumPageScaleFactor):
(WebKit::WebPage::allowsUserScaling):
(WebKit::WebPage::setVirtualViewportMinimumLayoutSize):
(WebKit::WebPage::virtualViewportChanged):
(WebKit::WebPage::willStartUserTriggeredZooming):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::flushLayers):</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="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm</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="#trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKContentViewh">trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKContentViewInternalh">trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKViewIOSmm">trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportiosWebChromeClientIOSmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm</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>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorepageViewportConfigurationcpp">trunk/Source/WebCore/page/ViewportConfiguration.cpp</a></li>
<li><a href="#trunkSourceWebCorepageViewportConfigurationh">trunk/Source/WebCore/page/ViewportConfiguration.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebCore/ChangeLog        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -1,5 +1,60 @@
</span><span class="cx"> 2014-02-05  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><ins>+        [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited
+        https://bugs.webkit.org/show_bug.cgi?id=127886
+
+        Reviewed by Simon Fraser.
+
+        The updates of the views on the UIProcess side was completely disconnected
+        from the tiles updates from the DrawingArea. There is a non-negligible time
+        between the size/scale update and the new tiles coming, which causes
+        visual glitches.
+
+        There are three main cases where the tiles and content would be out of sync
+        with the UIViews:
+        -When loading a new page with different content width of a different viewport.
+        -When a page changes its viewport.
+        -When the viewport-constrainted viewport size changes.
+
+        To fix the issue, WKView is modified to maintain the old state of WKContentView
+        and UIScrollView until the new tiles are available.
+
+        Geometry/scale update are split in two phases:
+        1) A source (the page or the user) changes parameters of the geometry. The WebProcess updates
+           its layout accordingly.
+           At this point, the UIViews are unchanged and are left with the old parameters.
+        2) Eventually, new tiles come and commitLayerTree() is called on the drawing area proxy.
+           At that point, WKContentView and its UIScrollView are updated to match the committed
+           size and scale for the page.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/ViewportConfiguration.cpp: Added.
+        (WebCore::constraintsAreAllRelative):
+        (WebCore::ViewportConfiguration::ViewportConfiguration):
+        (WebCore::ViewportConfiguration::setDefaultConfiguration):
+        (WebCore::ViewportConfiguration::setContentsSize):
+        (WebCore::ViewportConfiguration::setMinimumLayoutSize):
+        (WebCore::ViewportConfiguration::setViewportArguments):
+        (WebCore::ViewportConfiguration::layoutSize):
+        (WebCore::ViewportConfiguration::initialScale):
+        (WebCore::ViewportConfiguration::minimumScale):
+        (WebCore::ViewportConfiguration::maximumScale):
+        (WebCore::ViewportConfiguration::allowsUserScaling):
+        (WebCore::viewportArgumentValueIsValid):
+        (WebCore::applyViewportArgument):
+        (WebCore::ViewportConfiguration::updateConfiguration):
+        (WebCore::ViewportConfiguration::layoutWidth):
+        (WebCore::ViewportConfiguration::layoutHeight):
+        * page/ViewportConfiguration.h: Added.
+        (WebCore::ViewportConfigurationConfiguration::ViewportConfigurationConfiguration):
+        (WebCore::ViewportConfiguration::defaultConfiguration):
+        (WebCore::ViewportConfiguration::contentsSize):
+        (WebCore::ViewportConfiguration::minimumLayoutSize):
+        (WebCore::ViewportConfiguration::viewportArguments):
+
+2014-02-05  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
</ins><span class="cx">         SelectorCodeGenerator::generateElementHasTagName should match the local name before the namespace
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=128167
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -568,6 +568,8 @@
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA37flushCompositingStateForThisLayerOnlyEv
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv
</span><span class="cx"> __ZNK7WebCore15GraphicsLayerCA49platformCALayerContentsScaleMultiplierForNewTilesEPNS_15PlatformCALayerE
</span><ins>+__ZNK7WebCore21ViewportConfiguration10layoutSizeEv
+__ZNK7WebCore21ViewportConfiguration12initialScaleEv
</ins><span class="cx"> __ZN7WebCore15GraphicsLayerCA7setNameERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA7setSizeERKNS_9FloatSizeE
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA8addChildEPNS_13GraphicsLayerE
</span><span class="lines">@@ -575,6 +577,7 @@
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCAD2Ev
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA19setCustomAppearanceENS_13GraphicsLayer16CustomAppearanceE
</span><span class="cx"> __ZNK7WebCore15GraphicsLayerCA14primaryLayerIDEv
</span><ins>+__ZNK7WebCore21ViewportConfiguration12minimumScaleEv
</ins><span class="cx"> __ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj
</span><span class="cx"> __ZN7WebCore15HitTestLocationC1ERKNS_10FloatPointE
</span><span class="cx"> __ZN7WebCore15HitTestLocationD1Ev
</span><span class="lines">@@ -845,6 +848,10 @@
</span><span class="cx"> __ZN7WebCore21SerializedScriptValueD1Ev
</span><span class="cx"> __ZN7WebCore21URLByRemovingUserInfoEP5NSURL
</span><span class="cx"> __ZN7WebCore21UserContentURLPattern5parseERKN3WTF6StringE
</span><ins>+__ZN7WebCore21ViewportConfiguration15setContentsSizeERKNS_7IntSizeE
+__ZN7WebCore21ViewportConfiguration20setMinimumLayoutSizeERKNS_7IntSizeE
+__ZN7WebCore21ViewportConfiguration20setViewportArgumentsERKNS_17ViewportArgumentsE
+__ZN7WebCore21ViewportConfiguration23setDefaultConfigurationERKNS0_10ParametersE
</ins><span class="cx"> __ZN7WebCore21WindowsLatin1EncodingEv
</span><span class="cx"> __ZN7WebCore21createCFURLFromBufferEPKcmPK7__CFURL
</span><span class="cx"> __ZN7WebCore21findEventWithKeyStateEPNS_5EventE
</span><span class="lines">@@ -909,6 +916,7 @@
</span><span class="cx"> __ZN7WebCore24FrameDestructionObserverD2Ev
</span><span class="cx"> __ZN7WebCore24ImmutableStylePropertiesD1Ev
</span><span class="cx"> __ZN7WebCore24ReferenceFilterOperationC1ERKN3WTF6StringES4_NS_15FilterOperation13OperationTypeE
</span><ins>+__ZN7WebCore21ViewportConfigurationC1Ev
</ins><span class="cx"> __ZN7WebCore24createFragmentFromMarkupERNS_8DocumentERKN3WTF6StringES5_NS_19ParserContentPolicyE
</span><span class="cx"> __ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore24deleteCookiesForHostnameERKNS_21NetworkStorageSessionERKN3WTF6StringE
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -983,6 +983,8 @@
</span><span class="cx">                 26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */; };
</span><span class="cx">                 26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; };
</span><span class="cx">                 26F40D4A14904A6300CA67C4 /* EventLoopIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26F40D4914904A6300CA67C4 /* EventLoopIOS.mm */; };
</span><ins>+                26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */; };
+                26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 26FAE4CC1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */; };
</span><span class="cx">                 26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */; };
</span><span class="cx">                 26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */; };
</span><span class="lines">@@ -7769,6 +7771,8 @@
</span><span class="cx">                 26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FileSystemIOS.mm; path = ios/FileSystemIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26F40D4914904A6300CA67C4 /* EventLoopIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = EventLoopIOS.mm; path = ios/EventLoopIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportConfiguration.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewportConfiguration.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandleCFURLConnectionDelegate.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleCFURLConnectionDelegate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousResourceHandleCFURLConnectionDelegate.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16199,6 +16203,8 @@
</span><span class="cx">                                 BC8BF1591058141800A40A07 /* UserStyleSheetTypes.h */,
</span><span class="cx">                                 F513A3E915FF4841001526DB /* ValidationMessageClient.h */,
</span><span class="cx">                                 8678D0BA1878E810003ABDE6 /* ViewState.h */,
</span><ins>+                                26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */,
+                                26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */,
</ins><span class="cx">                                 1ABA80051897355500DCE9D6 /* VisitedLinkProvider.cpp */,
</span><span class="cx">                                 1ABA7FFF1897341200DCE9D6 /* VisitedLinkProvider.h */,
</span><span class="cx">                                 BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */,
</span><span class="lines">@@ -24374,6 +24380,7 @@
</span><span class="cx">                                 B2FA3D790AB75A6F000E5AC4 /* JSSVGFEFloodElement.h in Headers */,
</span><span class="cx">                                 B2FA3D7B0AB75A6F000E5AC4 /* JSSVGFEFuncAElement.h in Headers */,
</span><span class="cx">                                 B2FA3D7D0AB75A6F000E5AC4 /* JSSVGFEFuncBElement.h in Headers */,
</span><ins>+                                26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */,
</ins><span class="cx">                                 B2FA3D7F0AB75A6F000E5AC4 /* JSSVGFEFuncGElement.h in Headers */,
</span><span class="cx">                                 B2FA3D810AB75A6F000E5AC4 /* JSSVGFEFuncRElement.h in Headers */,
</span><span class="cx">                                 B2FA3D830AB75A6F000E5AC4 /* JSSVGFEGaussianBlurElement.h in Headers */,
</span><span class="lines">@@ -26928,6 +26935,7 @@
</span><span class="cx">                                 148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */,
</span><span class="cx">                                 A024575116CEAA27000E5671 /* EXTDrawBuffers.cpp in Sources */,
</span><span class="cx">                                 6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */,
</span><ins>+                                26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */,
</ins><span class="cx">                                 44DAB5B115A623580097C1E4 /* Extensions3DOpenGLCommon.cpp in Sources */,
</span><span class="cx">                                 7728694E14F8882500F484DC /* EXTTextureFilterAnisotropic.cpp in Sources */,
</span><span class="cx">                                 97C740141603F7A10011FF2D /* FeatureObserver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorepageViewportConfigurationcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/ViewportConfiguration.cpp (0 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ViewportConfiguration.cpp                                (rev 0)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -0,0 +1,265 @@
</span><ins>+/*
+ * Copyright (C) 2005-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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ViewportConfiguration.h&quot;
+
+#include &lt;wtf/Assertions.h&gt;
+#include &lt;wtf/MathExtras.h&gt;
+
+namespace WebCore {
+
+#if !ASSERT_DISABLED
+static bool constraintsAreAllRelative(const ViewportConfiguration::Parameters&amp; configuration)
+{
+    return !configuration.widthIsSet &amp;&amp; !configuration.heightIsSet &amp;&amp; !configuration.initialScaleIsSet;
+}
+#endif
+
+ViewportConfiguration::ViewportConfiguration()
+    : m_contentSize(1024, 768)
+    , m_minimumLayoutSize(m_contentSize)
+{
+    // Setup a reasonable default configuration to avoid computing infinite scale/sizes.
+    // Those are the original iPhone configuration.
+    m_defaultConfiguration.width = 980;
+    m_defaultConfiguration.widthIsSet = true;
+    m_defaultConfiguration.allowsUserScaling = true;
+    m_defaultConfiguration.minimumScale = 0.25;
+    m_defaultConfiguration.maximumScale = 5;
+    updateConfiguration();
+}
+
+void ViewportConfiguration::setDefaultConfiguration(const ViewportConfiguration::Parameters&amp; defaultConfiguration)
+{
+    ASSERT(!constraintsAreAllRelative(m_configuration));
+    ASSERT(!m_defaultConfiguration.initialScaleIsSet || defaultConfiguration.initialScale &gt; 0);
+    ASSERT(defaultConfiguration.minimumScale &gt; 0);
+    ASSERT(defaultConfiguration.maximumScale &gt;= defaultConfiguration.minimumScale);
+
+    m_defaultConfiguration = defaultConfiguration;
+    updateConfiguration();
+}
+
+void ViewportConfiguration::setContentsSize(const IntSize&amp; contentSize)
+{
+    if (m_contentSize == contentSize)
+        return;
+
+    m_contentSize = contentSize;
+    updateConfiguration();
+}
+
+void ViewportConfiguration::setMinimumLayoutSize(const IntSize&amp; minimumLayoutSize)
+{
+    if (m_minimumLayoutSize == minimumLayoutSize)
+        return;
+
+    m_minimumLayoutSize = minimumLayoutSize;
+    updateConfiguration();
+}
+
+void ViewportConfiguration::setViewportArguments(const ViewportArguments&amp; viewportArguments)
+{
+    if (m_viewportArguments == viewportArguments)
+        return;
+
+    m_viewportArguments = viewportArguments;
+    updateConfiguration();
+}
+
+IntSize ViewportConfiguration::layoutSize() const
+{
+    return IntSize(layoutWidth(), layoutHeight());
+}
+
+double ViewportConfiguration::initialScale() const
+{
+    ASSERT(!constraintsAreAllRelative(m_configuration));
+
+    // If the document has specified its own initial scale, use it regardless.
+    // This is guaranteed to be sanity checked already, so no need for MIN/MAX.
+    if (m_configuration.initialScaleIsSet)
+        return m_configuration.initialScale;
+
+    // If not, it is up to us to determine the initial scale.
+    // We want a scale small enough to fit the document width-wise.
+    double width = m_contentSize.width() &gt; 0 ? m_contentSize.width() : layoutWidth();
+    double initialScale = 0;
+    if (width &gt; 0)
+        initialScale = m_minimumLayoutSize.width() / width;
+
+    // Prevent the intial scale from shrinking to a height smaller than our view's minimum height.
+    double height = m_contentSize.height() &gt; 0 ? m_contentSize.height() : layoutHeight();
+    if (height &gt; 0 &amp;&amp; height * initialScale &lt; m_minimumLayoutSize.height())
+        initialScale = m_minimumLayoutSize.height() / height;
+    return std::min(std::max(initialScale, m_configuration.minimumScale), m_configuration.maximumScale);
+}
+
+double ViewportConfiguration::minimumScale() const
+{
+    // If we scale to fit, then this is our minimum scale as well.
+    if (!m_configuration.initialScaleIsSet)
+        return initialScale();
+
+    // If not, we still need to sanity check our value.
+    double minimumScale = m_configuration.initialScale;
+
+    double contentWidth = m_contentSize.width();
+    if (contentWidth &gt; 0 &amp;&amp; contentWidth * minimumScale &lt; m_minimumLayoutSize.width())
+        minimumScale = m_minimumLayoutSize.width() / contentWidth;
+
+    double contentHeight = m_contentSize.height();
+    if (contentHeight &gt; 0 &amp;&amp; contentHeight * minimumScale &lt; m_minimumLayoutSize.height())
+        minimumScale = m_minimumLayoutSize.height() / contentHeight;
+
+    minimumScale = std::min(std::max(minimumScale, m_configuration.minimumScale), m_configuration.maximumScale);
+
+    return minimumScale;
+}
+
+static inline bool viewportArgumentValueIsValid(float value)
+{
+    return value &gt; 0;
+}
+
+template&lt;typename ValueType, typename ViewportArgumentsType&gt;
+static inline void applyViewportArgument(ValueType&amp; value, ViewportArgumentsType viewportArgumentValue, ValueType minimum, ValueType maximum)
+{
+    if (viewportArgumentValueIsValid(viewportArgumentValue))
+        value = std::min(maximum, std::max(minimum, static_cast&lt;ValueType&gt;(viewportArgumentValue)));
+}
+
+template&lt;typename ValueType, typename ViewportArgumentsType&gt;
+static inline void applyViewportArgument(ValueType&amp; value, bool&amp; valueIsSet, ViewportArgumentsType viewportArgumentValue, ValueType minimum, ValueType maximum)
+{
+    if (viewportArgumentValueIsValid(viewportArgumentValue)) {
+        value = std::min(maximum, std::max(minimum, static_cast&lt;ValueType&gt;(viewportArgumentValue)));
+        valueIsSet = true;
+    } else
+        valueIsSet = false;
+}
+
+void ViewportConfiguration::updateConfiguration()
+{
+    m_configuration = m_defaultConfiguration;
+
+    const double minimumViewportArgumentsScaleFactor = 0.1;
+    const double maximumViewportArgumentsScaleFactor = 10.0;
+
+    bool viewportArgumentsOverridesInitialScale;
+    bool viewportArgumentsOverridesWidth;
+    bool viewportArgumentsOverridesHeight;
+
+    applyViewportArgument(m_configuration.minimumScale, m_viewportArguments.minZoom, minimumViewportArgumentsScaleFactor, maximumViewportArgumentsScaleFactor);
+    applyViewportArgument(m_configuration.maximumScale, m_viewportArguments.maxZoom, m_configuration.minimumScale, maximumViewportArgumentsScaleFactor);
+    applyViewportArgument(m_configuration.initialScale, viewportArgumentsOverridesInitialScale, m_viewportArguments.zoom, m_configuration.minimumScale, m_configuration.maximumScale);
+
+    double minimumViewportArgumentsDimension = 10;
+    double maximumViewportArgumentsDimension = 10000;
+    applyViewportArgument(m_configuration.width, viewportArgumentsOverridesWidth, m_viewportArguments.width, minimumViewportArgumentsDimension, maximumViewportArgumentsDimension);
+    applyViewportArgument(m_configuration.height, viewportArgumentsOverridesHeight, m_viewportArguments.height, minimumViewportArgumentsDimension, maximumViewportArgumentsDimension);
+
+    if (viewportArgumentsOverridesInitialScale || viewportArgumentsOverridesWidth || viewportArgumentsOverridesHeight) {
+        m_configuration.initialScaleIsSet = viewportArgumentsOverridesInitialScale;
+        m_configuration.widthIsSet = viewportArgumentsOverridesWidth;
+        m_configuration.heightIsSet = viewportArgumentsOverridesHeight;
+    }
+
+    if (viewportArgumentValueIsValid(m_viewportArguments.userZoom))
+        m_configuration.allowsUserScaling = m_viewportArguments.userZoom != 0.;
+}
+
+int ViewportConfiguration::layoutWidth() const
+{
+    ASSERT(!constraintsAreAllRelative(m_configuration));
+
+    if (m_configuration.widthIsSet) {
+        // If we scale to fit, then accept the viewport width with sanity checking.
+        if (!m_configuration.initialScaleIsSet) {
+            double maximumScale = this-&gt;maximumScale();
+            double maximumContentWidthInViewportCoordinate = maximumScale * m_configuration.width;
+            if (maximumContentWidthInViewportCoordinate &lt; m_minimumLayoutSize.width()) {
+                // The content zoomed to maxScale does not fit the the view. Return the minimum width
+                // satisfying the constraint maximumScale.
+                return std::round(m_minimumLayoutSize.width() / maximumScale);
+            }
+            return std::round(m_configuration.width);
+        }
+
+        // If not, make sure the viewport width and initial scale can co-exist.
+        double initialContentWidthInViewportCoordinate = m_configuration.width * m_configuration.initialScale;
+        if (initialContentWidthInViewportCoordinate &lt; m_contentSize.width()) {
+            // The specified width does not fit in viewport. Return the minimum width that satisfy the initialScale constraint.
+            return std::round(m_minimumLayoutSize.width() / m_configuration.initialScale);
+        }
+        return std::round(m_configuration.width);
+    }
+
+    // If the page has a real scale, then just return the minimum size over the initial scale.
+    if (m_configuration.initialScaleIsSet &amp;&amp; !m_configuration.heightIsSet)
+        return std::round(m_minimumLayoutSize.width() / m_configuration.initialScale);
+
+    if (m_minimumLayoutSize.height() &gt; 0)
+        return std::round(m_minimumLayoutSize.width() * layoutHeight() / m_minimumLayoutSize.height());
+    return m_minimumLayoutSize.width();
+}
+
+int ViewportConfiguration::layoutHeight() const
+{
+    ASSERT(!constraintsAreAllRelative(m_configuration));
+
+    if (m_configuration.heightIsSet) {
+        // If we scale to fit, then accept the viewport height with sanity checking.
+        if (!m_configuration.initialScaleIsSet) {
+            double maximumScale = this-&gt;maximumScale();
+            double maximumContentHeightInViewportCoordinate = maximumScale * m_configuration.height;
+            if (maximumContentHeightInViewportCoordinate &lt; m_minimumLayoutSize.height()) {
+                // The content zoomed to maxScale does not fit the the view. Return the minimum height that
+                // satisfy the constraint maximumScale.
+                return std::round(m_minimumLayoutSize.height() / maximumScale);
+            }
+            return std::round(m_configuration.height);
+        }
+
+        // If not, make sure the viewport width and initial scale can co-exist.
+        double initialContentHeightInViewportCoordinate = m_configuration.height * m_configuration.initialScale;
+        if (initialContentHeightInViewportCoordinate &lt; m_minimumLayoutSize.height()) {
+            // The specified width does not fit in viewport. Return the minimum height that satisfy the initialScale constraint.
+            return std::round(m_minimumLayoutSize.height() / m_configuration.initialScale);
+        }
+        return std::round(m_configuration.height);
+    }
+
+    // If the page has a real scale, then just return the minimum size over the initial scale.
+    if (m_configuration.initialScaleIsSet &amp;&amp; !m_configuration.widthIsSet)
+        return std::round(m_minimumLayoutSize.height() / m_configuration.initialScale);
+
+    if (m_minimumLayoutSize.width() &gt; 0)
+        return std::round(m_minimumLayoutSize.height() * layoutWidth() / m_minimumLayoutSize.width());
+    return m_minimumLayoutSize.height();
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorepageViewportConfigurationh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/ViewportConfiguration.h (0 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ViewportConfiguration.h                                (rev 0)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+/*
+ * Copyright (C) 2005-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 ViewportConfiguration_h
+#define ViewportConfiguration_h
+
+#include &quot;IntSize.h&quot;
+#include &quot;ViewportArguments.h&quot;
+#include &lt;wtf/Noncopyable.h&gt;
+
+namespace WebCore {
+
+class ViewportConfiguration {
+    WTF_MAKE_NONCOPYABLE(ViewportConfiguration); WTF_MAKE_FAST_ALLOCATED;
+public:
+    // FIXME: unify with ViewportArguments.
+    struct Parameters {
+        Parameters()
+            : width(0)
+            , height(0)
+            , initialScale(0)
+            , minimumScale(0)
+            , maximumScale(0)
+            , allowsUserScaling(false)
+            , widthIsSet(false)
+            , heightIsSet(false)
+            , initialScaleIsSet(false)
+        {
+        }
+
+        double width;
+        double height;
+        double initialScale;
+        double minimumScale;
+        double maximumScale;
+        bool allowsUserScaling;
+
+        bool widthIsSet;
+        bool heightIsSet;
+        bool initialScaleIsSet;
+    };
+
+    ViewportConfiguration();
+
+    const Parameters&amp; defaultConfiguration() const { return m_defaultConfiguration; }
+    void setDefaultConfiguration(const Parameters&amp;);
+
+    const IntSize&amp; contentsSize() const { return m_contentSize; }
+    void setContentsSize(const IntSize&amp;);
+
+    const IntSize&amp; minimumLayoutSize() const { return m_minimumLayoutSize; }
+    void setMinimumLayoutSize(const IntSize&amp;);
+
+    const ViewportArguments&amp; viewportArguments() const { return m_viewportArguments; }
+    void setViewportArguments(const ViewportArguments&amp;);
+
+    IntSize layoutSize() const;
+    double initialScale() const;
+    double minimumScale() const;
+    double maximumScale() const { return m_configuration.maximumScale; }
+    bool allowsUserScaling() const { return m_configuration.allowsUserScaling; }
+
+private:
+    void updateConfiguration();
+    int layoutWidth() const;
+    int layoutHeight() const;
+
+    Parameters m_configuration;
+    Parameters m_defaultConfiguration;
+    IntSize m_contentSize;
+    IntSize m_minimumLayoutSize;
+    ViewportArguments m_viewportArguments;
+};
+
+} // namespace WebCore
+
+#endif // ViewportConfiguration_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -1,3 +1,73 @@
</span><ins>+2014-02-05  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited
+        https://bugs.webkit.org/show_bug.cgi?id=127886
+
+        Reviewed by Simon Fraser.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        (WebKit::RemoteLayerTreeTransaction::mainFrameContentsSize):
+        (WebKit::RemoteLayerTreeTransaction::setMainFrameContentsSize):
+        (WebKit::RemoteLayerTreeTransaction::pageScaleFactor):
+        (WebKit::RemoteLayerTreeTransaction::setPageScaleFactor):
+        (WebKit::RemoteLayerTreeTransaction::minimumScaleFactor):
+        (WebKit::RemoteLayerTreeTransaction::setMinimumScaleFactor):
+        (WebKit::RemoteLayerTreeTransaction::maximumScaleFactor):
+        (WebKit::RemoteLayerTreeTransaction::setMaximumScaleFactor):
+        (WebKit::RemoteLayerTreeTransaction::allowsUserScaling):
+        (WebKit::RemoteLayerTreeTransaction::setAllowsUserScaling):
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::encode):
+        (WebKit::RemoteLayerTreeTransaction::decode):
+        * UIProcess/API/ios/PageClientImplIOS.h:
+        * UIProcess/API/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::didCommitLayerTree):
+        * UIProcess/API/ios/WKContentView.h:
+        * UIProcess/API/ios/WKContentView.mm:
+        (-[WKContentView setMinimumLayoutSize:]):
+        (-[WKContentView willStartUserTriggeredZoom]):
+        (-[WKContentView _didCommitLayerTree:WebKit::]):
+        * UIProcess/API/ios/WKContentViewInternal.h:
+        * UIProcess/API/ios/WKViewIOS.mm:
+        (-[WKView contentViewDidCommitLoadForMainFrame:]):
+        (-[WKView contentView:didCommitLayerTree:WebKit::]):
+        (-[WKView scrollViewWillBeginZooming:withView:]):
+        (-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
+        (-[WKView _frameOrBoundsChanged]):
+        (-[WKView minimumLayoutSizeOverride]):
+        (-[WKView setMinimumLayoutSizeOverride:]):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::setVirtualViewportMinimumLayoutSize):
+        (WebKit::WebPageProxy::didCommitLayerTree):
+        (WebKit::WebPageProxy::willStartUserTriggeredZooming):
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::contentsSizeChanged):
+        (WebKit::WebChromeClient::dispatchViewportPropertiesDidChange):
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::didReceiveMobileDocType):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        (WebKit::WebPage::mainFrameDidLayout):
+        (WebKit::WebPage::didCommitLoad):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::viewportPropertiesDidChange):
+        (WebKit::WebPage::minimumPageScaleFactor):
+        (WebKit::WebPage::maximumPageScaleFactor):
+        (WebKit::WebPage::allowsUserScaling):
+        (WebKit::WebPage::setVirtualViewportMinimumLayoutSize):
+        (WebKit::WebPage::virtualViewportChanged):
+        (WebKit::WebPage::willStartUserTriggeredZooming):
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+
</ins><span class="cx"> 2014-02-05  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2] Add the minimumLayoutSizeOverride SPI to WKWebView
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -155,11 +155,31 @@
</span><span class="cx">     HashMap&lt;WebCore::GraphicsLayer::PlatformLayerID, LayerProperties&gt; changedLayers() const { return m_changedLayerProperties; }
</span><span class="cx">     Vector&lt;WebCore::GraphicsLayer::PlatformLayerID&gt; destroyedLayers() const { return m_destroyedLayerIDs; }
</span><span class="cx"> 
</span><ins>+    WebCore::IntSize contentsSize() const { return m_contentsSize; }
+    void setContentsSize(const WebCore::IntSize&amp; size) { m_contentsSize = size; };
+
+    double pageScaleFactor() const { return m_pageScaleFactor; }
+    void setPageScaleFactor(double pageScaleFactor) { m_pageScaleFactor = pageScaleFactor; }
+
+    double minimumScaleFactor() const { return m_minimumScaleFactor; }
+    void setMinimumScaleFactor(double scale) { m_minimumScaleFactor = scale; }
+
+    double maximumScaleFactor() const { return m_maximumScaleFactor; }
+    void setMaximumScaleFactor(double scale) { m_maximumScaleFactor = scale; }
+
+    bool allowsUserScaling() const { return m_allowsUserScaling; }
+    void setAllowsUserScaling(bool allowsUserScaling) { m_allowsUserScaling = allowsUserScaling; }
+
</ins><span class="cx"> private:
</span><span class="cx">     WebCore::GraphicsLayer::PlatformLayerID m_rootLayerID;
</span><span class="cx">     HashMap&lt;WebCore::GraphicsLayer::PlatformLayerID, LayerProperties&gt; m_changedLayerProperties;
</span><span class="cx">     Vector&lt;LayerCreationProperties&gt; m_createdLayers;
</span><span class="cx">     Vector&lt;WebCore::GraphicsLayer::PlatformLayerID&gt; m_destroyedLayerIDs;
</span><ins>+    WebCore::IntSize m_contentsSize;
+    double m_pageScaleFactor;
+    double m_minimumScaleFactor;
+    double m_maximumScaleFactor;
+    bool m_allowsUserScaling;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -348,6 +348,11 @@
</span><span class="cx">     encoder &lt;&lt; m_createdLayers;
</span><span class="cx">     encoder &lt;&lt; m_changedLayerProperties;
</span><span class="cx">     encoder &lt;&lt; m_destroyedLayerIDs;
</span><ins>+    encoder &lt;&lt; m_contentsSize;
+    encoder &lt;&lt; m_pageScaleFactor;
+    encoder &lt;&lt; m_minimumScaleFactor;
+    encoder &lt;&lt; m_maximumScaleFactor;
+    encoder &lt;&lt; m_allowsUserScaling;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RemoteLayerTreeTransaction::decode(IPC::ArgumentDecoder&amp; decoder, RemoteLayerTreeTransaction&amp; result)
</span><span class="lines">@@ -371,6 +376,21 @@
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (!decoder.decode(result.m_contentsSize))
+        return false;
+
+    if (!decoder.decode(result.m_pageScaleFactor))
+        return false;
+
+    if (!decoder.decode(result.m_minimumScaleFactor))
+        return false;
+
+    if (!decoder.decode(result.m_maximumScaleFactor))
+        return false;
+
+    if (!decoder.decode(result.m_allowsUserScaling))
+        return false;
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -35,16 +35,11 @@
</span><span class="cx"> #import &quot;WKWebViewConfiguration.h&quot;
</span><span class="cx"> #import &quot;WebBackForwardList.h&quot;
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><ins>+#import &lt;WebKit2/RemoteLayerTreeTransaction.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #import &quot;WKScrollView.h&quot;
</span><del>-
-static const float minWebViewScale = 0.25;
-static const float maxWebViewScale = 5;
-static _UIWebViewportConfiguration standardViewportConfiguration = { { UIWebViewportStandardViewportWidth, UIWebViewportGrowsAndShrinksToFitHeight }, UIWebViewportScaleForScalesToFit, minWebViewScale, maxWebViewScale, true
-};
-
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; !PLATFORM(IOS)
</span><span class="lines">@@ -58,10 +53,10 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     RetainPtr&lt;WKScrollView&gt; _scrollView;
</span><span class="cx">     RetainPtr&lt;WKContentView&gt; _contentView;
</span><del>-    RetainPtr&lt;_UIWebViewportHandler&gt; _viewportHandler;
</del><span class="cx"> 
</span><del>-    BOOL _userHasChangedPageScale;
</del><ins>+    BOOL _isWaitingForNewLayerTreeAfterDidCommitLoad;
</ins><span class="cx">     BOOL _hasStaticMinimumLayoutSize;
</span><ins>+    CGSize _minimumLayoutSizeOverride;
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; !PLATFORM(IOS)
</span><span class="cx">     RetainPtr&lt;WKView&gt; _wkView;
</span><span class="lines">@@ -99,9 +94,6 @@
</span><span class="cx">     [_contentView setFrame:bounds];
</span><span class="cx">     [_scrollView addSubview:_contentView.get()];
</span><span class="cx"> 
</span><del>-    _viewportHandler = adoptNS([[_UIWebViewportHandler alloc] init]);
-    [_viewportHandler setDelegate:self];
-
</del><span class="cx">     [self _frameOrBoundsChanged];
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -213,77 +205,27 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma mark WKContentViewDelegate
</span><span class="cx"> 
</span><del>-- (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize
-{
-    CGFloat zoomScale = [_scrollView zoomScale];
-    CGSize contentsSizeInScrollViewCoordinates = CGSizeMake(newSize.width * zoomScale, newSize.height * zoomScale);
-    [_scrollView setContentSize:contentsSizeInScrollViewCoordinates];
-
-    [_viewportHandler update:^{
-         [_viewportHandler setDocumentBounds:{CGPointZero, newSize}];
-    }];
-}
-
</del><span class="cx"> - (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
</span><span class="cx"> {
</span><del>-    _userHasChangedPageScale = NO;
-
-    WKContentType contentType = [_contentView contentType];
-    [_viewportHandler update:^{
-        [_viewportHandler clearWebKitViewportConfigurationFlags];
-        _UIWebViewportConfiguration configuration = standardViewportConfiguration;
-
-        if (contentType == PlainText) {
-            CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width;
-            configuration.size.width = screenWidth;
-        } else if (contentType == WKContentType::Image)
-            configuration.minimumScale = 0.01;
-
-        [_viewportHandler resetViewportConfiguration:&amp;configuration];
-    }];
</del><ins>+    _isWaitingForNewLayerTreeAfterDidCommitLoad = YES;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)contentViewDidReceiveMobileDocType:(WKContentView *)contentView
</del><ins>+- (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction
</ins><span class="cx"> {
</span><del>-    [_viewportHandler update:^{
-        _UIWebViewportConfiguration configuration = standardViewportConfiguration;
-        configuration.minimumScale = 1;
-        configuration.size = CGSizeMake(320, UIWebViewportGrowsAndShrinksToFitHeight);
-        [_viewportHandler resetViewportConfiguration:&amp;configuration];
-    }];
-}
</del><ins>+    [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()];
+    [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
+    [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
+    if (![_scrollView isZooming] &amp;&amp; ![_scrollView isZoomBouncing])
+        [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
</ins><span class="cx"> 
</span><del>-- (void)contentView:(WKContentView *)contentView didChangeViewportArgumentsSize:(CGSize)newSize initialScale:(float)initialScale minimumScale:(float)minimumScale maximumScale:(float)maximumScale allowsUserScaling:(float)allowsUserScaling
-{
-    [_viewportHandler update:^{
-        [_viewportHandler applyWebKitViewportArgumentsSize:newSize initialScale:initialScale minimumScale:minimumScale maximumScale:maximumScale allowsUserScaling:allowsUserScaling];
-    }];
-}
-
-#pragma mark - _UIWebViewportHandlerDelegate
-
-- (void)viewportHandlerDidChangeScales:(_UIWebViewportHandler *)viewportHandler
-{
-    ASSERT(viewportHandler == _viewportHandler);
-    [_scrollView setMinimumZoomScale:viewportHandler.minimumScale];
-    [_scrollView setMaximumZoomScale:viewportHandler.maximumScale];
-    [_scrollView setZoomEnabled:viewportHandler.allowsUserScaling];
-
-    if (!_userHasChangedPageScale)
-        [self _setDocumentScale:viewportHandler.initialScale];
-    else {
-        CGFloat currentScale = [_scrollView zoomScale];
-        CGFloat validScale = std::max(std::min(currentScale, static_cast&lt;CGFloat&gt;(viewportHandler.maximumScale)), static_cast&lt;CGFloat&gt;(viewportHandler.minimumScale));
-        [self _setDocumentScale:validScale];
</del><ins>+    if (_isWaitingForNewLayerTreeAfterDidCommitLoad) {
+        UIEdgeInsets inset = [_scrollView contentInset];
+        [_scrollView setContentOffset:CGPointMake(-inset.left, -inset.top)];
+        _isWaitingForNewLayerTreeAfterDidCommitLoad = NO;
</ins><span class="cx">     }
</span><ins>+    
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)viewportHandler:(_UIWebViewportHandler *)viewportHandler didChangeViewportSize:(CGSize)newSize
-{
-    ASSERT(viewportHandler == _viewportHandler);
-    [_contentView setViewportSize:newSize];
-}
-
</del><span class="cx"> #pragma mark - UIScrollViewDelegate
</span><span class="cx"> 
</span><span class="cx"> - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
</span><span class="lines">@@ -295,7 +237,7 @@
</span><span class="cx"> - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
</span><span class="cx"> {
</span><span class="cx">     if (scrollView.pinchGestureRecognizer.state == UIGestureRecognizerStateBegan)
</span><del>-        _userHasChangedPageScale = YES;
</del><ins>+        [_contentView willStartUserTriggeredZoom];
</ins><span class="cx">     [_contentView willStartZoomOrScroll];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -343,11 +285,8 @@
</span><span class="cx"> {
</span><span class="cx">     CGRect bounds = self.bounds;
</span><span class="cx"> 
</span><del>-    if (!_hasStaticMinimumLayoutSize) {
-        [_viewportHandler update:^{
-            [_viewportHandler setAvailableViewSize:bounds.size];
-        }];
-    }
</del><ins>+    if (!_hasStaticMinimumLayoutSize)
+        [_contentView setMinimumLayoutSize:bounds.size];
</ins><span class="cx">     [_scrollView setFrame:bounds];
</span><span class="cx">     [_contentView setMinimumSize:bounds.size];
</span><span class="cx"> }
</span><span class="lines">@@ -368,15 +307,14 @@
</span><span class="cx"> - (CGSize)_minimumLayoutSizeOverride
</span><span class="cx"> {
</span><span class="cx">     ASSERT(_hasStaticMinimumLayoutSize);
</span><del>-    return [_viewportHandler availableViewSize];
</del><ins>+    return _minimumLayoutSizeOverride;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_setMinimumLayoutSizeOverride:(CGSize)minimumLayoutSizeOverride
</span><span class="cx"> {
</span><span class="cx">     _hasStaticMinimumLayoutSize = YES;
</span><del>-    [_viewportHandler update:^{
-        [_viewportHandler setAvailableViewSize:minimumLayoutSizeOverride];
-    }];
</del><ins>+    _minimumLayoutSizeOverride = minimumLayoutSizeOverride;
+    [_contentView setMinimumLayoutSize:minimumLayoutSizeOverride];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -32,11 +32,10 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #import &quot;WKContentViewInternal.h&quot;
</span><span class="cx"> #import &lt;UIKit/UIScrollView_Private.h&gt;
</span><del>-#import &lt;UIKit/_UIWebViewportHandler.h&gt;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-#define WK_WEB_VIEW_PROTOCOLS &lt;UIScrollViewDelegate, WKContentViewDelegate, _UIWebViewportHandlerDelegate&gt;
</del><ins>+#define WK_WEB_VIEW_PROTOCOLS &lt;UIScrollViewDelegate, WKContentViewDelegate&gt;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if !defined(WK_WEB_VIEW_PROTOCOLS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -62,7 +62,6 @@
</span><span class="cx">     virtual void toolTipChanged(const String&amp;, const String&amp;) override;
</span><span class="cx">     virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&amp;, WebSecurityOrigin&amp;, GeolocationPermissionRequestProxy&amp;) override;
</span><span class="cx">     virtual void didCommitLoadForMainFrame() override;
</span><del>-    virtual void didChangeContentSize(const WebCore::IntSize&amp;) override;
</del><span class="cx">     virtual void setCursor(const WebCore::Cursor&amp;) override;
</span><span class="cx">     virtual void setCursorHiddenUntilMouseMoves(bool) override;
</span><span class="cx">     virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&amp;) override;
</span><span class="lines">@@ -101,11 +100,9 @@
</span><span class="cx">     virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&amp;) override;
</span><span class="cx">     virtual void clearCustomSwipeViews() override;
</span><span class="cx"> 
</span><del>-    virtual void mainDocumentDidReceiveMobileDocType() override;
-
</del><span class="cx">     virtual void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp; color, const Vector&lt;WebCore::FloatQuad&gt;&amp; highlightedQuads, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius) override;
</span><span class="cx"> 
</span><del>-    void didChangeViewportArguments(const WebCore::ViewportArguments&amp; viewportArguments) override;
</del><ins>+    virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&amp;) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void startAssistingNode(const WebCore::IntRect&amp;, bool hasNextFocusable, bool hasPreviousFocusable) override;
</span><span class="cx">     virtual void stopAssistingNode() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -147,11 +147,6 @@
</span><span class="cx">     [m_view _didCommitLoadForMainFrame];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageClientImpl::didChangeContentSize(const IntSize&amp; contentsSize)
-{
-    [m_view _didChangeContentSize:contentsSize];
-}
-
</del><span class="cx"> void PageClientImpl::setCursor(const Cursor&amp;)
</span><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="lines">@@ -344,19 +339,14 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageClientImpl::mainDocumentDidReceiveMobileDocType()
-{
-    [m_view _didReceiveMobileDocTypeForMainFrame];
-}
-
</del><span class="cx"> void PageClientImpl::didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp; color, const Vector&lt;WebCore::FloatQuad&gt;&amp; highlightedQuads, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius)
</span><span class="cx"> {
</span><span class="cx">     [m_view _didGetTapHighlightForRequest:requestID color:color quads:highlightedQuads topLeftRadius:topLeftRadius topRightRadius:topRightRadius bottomLeftRadius:bottomLeftRadius bottomRightRadius:bottomRightRadius];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageClientImpl::didChangeViewportArguments(const WebCore::ViewportArguments&amp; viewportArguments)
</del><ins>+void PageClientImpl::didCommitLayerTree(const RemoteLayerTreeTransaction&amp; layerTreeTransaction)
</ins><span class="cx"> {
</span><del>-    [m_view _didChangeViewportArguments:viewportArguments];
</del><ins>+    [m_view _didCommitLayerTree:layerTreeTransaction];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::startAssistingNode(const WebCore::IntRect&amp;, bool, bool)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKContentViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -39,13 +39,14 @@
</span><span class="cx">     Image
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+namespace WebKit {
+class RemoteLayerTreeTransaction;
+}
+
</ins><span class="cx"> @protocol WKContentViewDelegate &lt;NSObject&gt;
</span><span class="cx"> @optional
</span><del>-- (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize;
</del><span class="cx"> - (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView;
</span><del>-- (void)contentViewDidReceiveMobileDocType:(WKContentView *)contentView;
-- (void)contentView:(WKContentView *)contentView didChangeViewportArgumentsSize:(CGSize)newSize initialScale:(float)initialScale minimumScale:(float)minimumScale maximumScale:(float)maximumScale allowsUserScaling:(float)allowsUserScaling;
-
</del><ins>+- (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> WK_API_CLASS
</span><span class="lines">@@ -66,10 +67,12 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)setMinimumSize:(CGSize)size;
</span><span class="cx"> - (void)setViewportSize:(CGSize)size;
</span><ins>+- (void)setMinimumLayoutSize:(CGSize)size;
</ins><span class="cx"> 
</span><span class="cx"> - (void)didFinishScrollTo:(CGPoint)contentOffset;
</span><span class="cx"> - (void)didScrollTo:(CGPoint)contentOffset;
</span><span class="cx"> - (void)didZoomToScale:(CGFloat)scale;
</span><span class="cx"> - (void)willStartZoomOrScroll;
</span><ins>+- (void)willStartUserTriggeredZoom;
</ins><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -209,6 +209,11 @@
</span><span class="cx">     [self _updateViewExposedRect];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)setMinimumLayoutSize:(CGSize)size
+{
+    _page-&gt;setViewportConfigurationMinimumLayoutSize(IntSize(CGCeiling(size.width), CGCeiling(size.height)));
+}
+
</ins><span class="cx"> - (void)didFinishScrollTo:(CGPoint)contentOffset
</span><span class="cx"> {
</span><span class="cx">     _currentExposedRectPosition = contentOffset;
</span><span class="lines">@@ -231,6 +236,11 @@
</span><span class="cx">     [_interactionView _willStartScrollingOrZooming];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)willStartUserTriggeredZoom
+{
+    _page-&gt;willStartUserTriggeredZooming();
+}
+
</ins><span class="cx"> - (void)didZoomToScale:(CGFloat)scale
</span><span class="cx"> {
</span><span class="cx">     _page-&gt;didFinishZooming(scale);
</span><span class="lines">@@ -304,28 +314,18 @@
</span><span class="cx">         [_delegate contentViewDidCommitLoadForMainFrame:self];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_didChangeContentSize:(CGSize)contentsSize
</del><ins>+- (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction
</ins><span class="cx"> {
</span><ins>+    CGSize contentsSize = layerTreeTransaction.contentsSize();
+
</ins><span class="cx">     [self setBounds:{CGPointZero, contentsSize}];
</span><span class="cx">     [_interactionView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)];
</span><span class="cx">     [_rootContentView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)];
</span><span class="cx"> 
</span><del>-    if ([_delegate respondsToSelector:@selector(contentView:contentsSizeDidChange:)])
-        [_delegate contentView:self contentsSizeDidChange:contentsSize];
</del><ins>+    if ([_delegate respondsToSelector:@selector(contentView:didCommitLayerTree:)])
+        [_delegate contentView:self didCommitLayerTree:layerTreeTransaction];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_didReceiveMobileDocTypeForMainFrame
-{
-    if ([_delegate respondsToSelector:@selector(contentViewDidReceiveMobileDocType:)])
-        [_delegate contentViewDidReceiveMobileDocType:self];
-}
-
-- (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&amp;)arguments
-{
-    if ([_delegate respondsToSelector:@selector(contentView:didChangeViewportArgumentsSize:initialScale:minimumScale:maximumScale:allowsUserScaling:)])
-        [_delegate contentView:self didChangeViewportArgumentsSize:CGSizeMake(arguments.width, arguments.height) initialScale:arguments.zoom minimumScale:arguments.minZoom maximumScale:arguments.maxZoom allowsUserScaling:arguments.userZoom];
-}
-
</del><span class="cx"> - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const Color&amp;)color quads:(const Vector&lt;FloatQuad&gt;&amp;)highlightedQuads topLeftRadius:(const IntSize&amp;)topLeftRadius topRightRadius:(const IntSize&amp;)topRightRadius bottomLeftRadius:(const IntSize&amp;)bottomLeftRadius bottomRightRadius:(const IntSize&amp;)bottomRightRadius
</span><span class="cx"> {
</span><span class="cx">     [_interactionView _didGetTapHighlightForRequest:requestID color:color quads:highlightedQuads topLeftRadius:topLeftRadius topRightRadius:topRightRadius bottomLeftRadius:bottomLeftRadius bottomRightRadius:bottomRightRadius];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKContentViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> class DrawingAreaProxy;
</span><span class="cx"> class GeolocationPermissionRequestProxy;
</span><span class="cx"> class LayerTreeContext;
</span><ins>+class RemoteLayerTreeTransaction;
</ins><span class="cx"> class WebFrameProxy;
</span><span class="cx"> class WebPageProxy;
</span><span class="cx"> class WebSecurityOrigin;
</span><span class="lines">@@ -57,9 +58,7 @@
</span><span class="cx"> - (void)_setAcceleratedCompositingRootLayer:(CALayer *)rootLayer;
</span><span class="cx"> 
</span><span class="cx"> - (void)_didCommitLoadForMainFrame;
</span><del>-- (void)_didChangeContentSize:(CGSize)contentsSize;
-- (void)_didReceiveMobileDocTypeForMainFrame;
-- (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&amp;)viewportArguments;
</del><ins>+- (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction;
</ins><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></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKViewIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -32,14 +32,10 @@
</span><span class="cx"> #import &quot;WKScrollView.h&quot;
</span><span class="cx"> #import &lt;UIKit/UIScreen.h&gt;
</span><span class="cx"> #import &lt;UIKit/UIScrollView_Private.h&gt;
</span><del>-#import &lt;UIKit/_UIWebViewportHandler.h&gt;
</del><ins>+#import &lt;WebKit2/RemoteLayerTreeTransaction.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><del>-static const float minWebViewScale = 0.25;
-static const float maxWebViewScale = 5;
-static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UIWebViewportStandardViewportWidth, UIWebViewportGrowsAndShrinksToFitHeight }, UIWebViewportScaleForScalesToFit, minWebViewScale, maxWebViewScale, true };
-
-@interface WKView () &lt;UIScrollViewDelegate, WKContentViewDelegate, _UIWebViewportHandlerDelegate&gt;
</del><ins>+@interface WKView () &lt;UIScrollViewDelegate, WKContentViewDelegate&gt;
</ins><span class="cx"> - (void)_setDocumentScale:(CGFloat)newScale;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="lines">@@ -47,9 +43,9 @@
</span><span class="cx">     RetainPtr&lt;WKScrollView&gt; _scrollView;
</span><span class="cx">     RetainPtr&lt;WKContentView&gt; _contentView;
</span><span class="cx"> 
</span><del>-    BOOL _userHasChangedPageScale;
-    RetainPtr&lt;_UIWebViewportHandler&gt; _viewportHandler;
</del><ins>+    BOOL _isWaitingForNewLayerTreeAfterDidCommitLoad;
</ins><span class="cx">     BOOL _hasStaticMinimumLayoutSize;
</span><ins>+    CGSize _minimumLayoutSizeOverride;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (id)initWithCoder:(NSCoder *)coder
</span><span class="lines">@@ -103,82 +99,27 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma mark WKContentViewDelegate
</span><span class="cx"> 
</span><del>-- (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize
-{
-    CGFloat zoomScale = [_scrollView zoomScale];
-    CGSize contentsSizeInScrollViewCoordinates = CGSizeMake(newSize.width * zoomScale, newSize.height * zoomScale);
-    [_scrollView setContentSize:contentsSizeInScrollViewCoordinates];
-
-    [_viewportHandler update:^{
-         [_viewportHandler setDocumentBounds:{CGPointZero, newSize}];
-    }];
-}
-
</del><span class="cx"> - (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
</span><span class="cx"> {
</span><del>-    _userHasChangedPageScale = NO;
-
-    WKContentType contentType = [_contentView contentType];
-    [_viewportHandler update:^{
-        [_viewportHandler clearWebKitViewportConfigurationFlags];
-        struct _UIWebViewportConfiguration configuration = standardViewportConfiguration;
-
-        if (contentType == PlainText) {
-            CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width;
-            configuration.size.width = screenWidth;
-        } else if (contentType == WKContentType::Image)
-            configuration.minimumScale = 0.01;
-
-        [_viewportHandler resetViewportConfiguration:&amp;configuration];
-    }];
</del><ins>+    _isWaitingForNewLayerTreeAfterDidCommitLoad = YES;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)contentViewDidReceiveMobileDocType:(WKContentView *)contentView
</del><ins>+- (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction
</ins><span class="cx"> {
</span><del>-    [_viewportHandler update:^{
-        struct _UIWebViewportConfiguration configuration = standardViewportConfiguration;
-        configuration.minimumScale = 1;
-        configuration.size = CGSizeMake(320.0, UIWebViewportGrowsAndShrinksToFitHeight);
-        [_viewportHandler resetViewportConfiguration:&amp;configuration];
-    }];
-}
</del><ins>+    [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()];
+    [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
+    [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
+    if (![_scrollView isZooming] &amp;&amp; ![_scrollView isZoomBouncing])
+        [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
</ins><span class="cx"> 
</span><del>-- (void)contentView:(WKContentView *)contentView didChangeViewportArgumentsSize:(CGSize)newSize initialScale:(float)initialScale minimumScale:(float)minimumScale maximumScale:(float)maximumScale allowsUserScaling:(float)allowsUserScaling
-{
-    [_viewportHandler update:^{
-        [_viewportHandler applyWebKitViewportArgumentsSize:newSize
-                                              initialScale:initialScale
-                                              minimumScale:minimumScale
-                                              maximumScale:maximumScale
-                                         allowsUserScaling:allowsUserScaling];
-    }];
-}
-
-#pragma mark - _UIWebViewportHandlerDelegate
-
-- (void)viewportHandlerDidChangeScales:(_UIWebViewportHandler *)viewportHandler
-{
-    ASSERT(viewportHandler == _viewportHandler);
-    [_scrollView setMinimumZoomScale:viewportHandler.minimumScale];
-    [_scrollView setMaximumZoomScale:viewportHandler.maximumScale];
-    [_scrollView setZoomEnabled:viewportHandler.allowsUserScaling];
-
-    if (!_userHasChangedPageScale)
-        [self _setDocumentScale:viewportHandler.initialScale];
-    else {
-        CGFloat currentScale = [_scrollView zoomScale];
-        CGFloat validScale = std::max(std::min(currentScale, static_cast&lt;CGFloat&gt;(viewportHandler.maximumScale)), static_cast&lt;CGFloat&gt;(viewportHandler.minimumScale));
-        [self _setDocumentScale:validScale];
</del><ins>+    if (_isWaitingForNewLayerTreeAfterDidCommitLoad) {
+        UIEdgeInsets inset = [_scrollView contentInset];
+        [_scrollView setContentOffset:CGPointMake(-inset.left, -inset.top)];
+        _isWaitingForNewLayerTreeAfterDidCommitLoad = NO;
</ins><span class="cx">     }
</span><del>-}
</del><span class="cx"> 
</span><del>-- (void)viewportHandler:(_UIWebViewportHandler *)viewportHandler didChangeViewportSize:(CGSize)newSize
-{
-    ASSERT(viewportHandler == _viewportHandler);
-    [_contentView setViewportSize:newSize];
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> #pragma mark - UIScrollViewDelegate
</span><span class="cx"> 
</span><span class="cx"> - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
</span><span class="lines">@@ -190,7 +131,7 @@
</span><span class="cx"> - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
</span><span class="cx"> {
</span><span class="cx">     if (scrollView.pinchGestureRecognizer.state == UIGestureRecognizerStateBegan)
</span><del>-        _userHasChangedPageScale = YES;
</del><ins>+        [_contentView willStartUserTriggeredZoom];
</ins><span class="cx">     [_contentView willStartZoomOrScroll];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -255,20 +196,14 @@
</span><span class="cx">     [_contentView setFrame:bounds];
</span><span class="cx">     [_scrollView addSubview:_contentView.get()];
</span><span class="cx"> 
</span><del>-    _viewportHandler = adoptNS([[_UIWebViewportHandler alloc] init]);
-    [_viewportHandler setDelegate:self];
-
</del><span class="cx">     [self _frameOrBoundsChanged];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_frameOrBoundsChanged
</span><span class="cx"> {
</span><span class="cx">     CGRect bounds = [self bounds];
</span><del>-    if (!_hasStaticMinimumLayoutSize) {
-        [_viewportHandler update:^{
-            [_viewportHandler setAvailableViewSize:bounds.size];
-        }];
-    }
</del><ins>+    if (!_hasStaticMinimumLayoutSize)
+        [_contentView setMinimumLayoutSize:bounds.size];
</ins><span class="cx">     [_scrollView setFrame:bounds];
</span><span class="cx">     [_contentView setMinimumSize:bounds.size];
</span><span class="cx"> }
</span><span class="lines">@@ -310,15 +245,14 @@
</span><span class="cx"> - (CGSize)minimumLayoutSizeOverride
</span><span class="cx"> {
</span><span class="cx">     ASSERT(_hasStaticMinimumLayoutSize);
</span><del>-    return [_viewportHandler availableViewSize];
</del><ins>+    return _minimumLayoutSizeOverride;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)setMinimumLayoutSizeOverride:(CGSize)minimumLayoutSizeOverride
</span><span class="cx"> {
</span><span class="cx">     _hasStaticMinimumLayoutSize = YES;
</span><del>-    [_viewportHandler update:^{
-        [_viewportHandler setAvailableViewSize:minimumLayoutSizeOverride];
-    }];
</del><ins>+    _minimumLayoutSizeOverride = minimumLayoutSizeOverride;
+    [_contentView setMinimumLayoutSize:minimumLayoutSizeOverride];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> class DrawingAreaProxy;
</span><span class="cx"> class FindIndicator;
</span><span class="cx"> class NativeWebKeyboardEvent;
</span><ins>+class RemoteLayerTreeTransaction;
</ins><span class="cx"> class WebContextMenuProxy;
</span><span class="cx"> class WebEditCommandProxy;
</span><span class="cx"> class WebPopupMenuProxy;
</span><span class="lines">@@ -149,7 +150,7 @@
</span><span class="cx">     virtual void handleDownloadRequest(DownloadProxy*) = 0;
</span><span class="cx"> #endif // PLATFORM(EFL) || PLATFORM(GTK)
</span><span class="cx"> 
</span><del>-#if PLATFORM(EFL) || PLATFORM(IOS)
</del><ins>+#if PLATFORM(EFL)
</ins><span class="cx">     virtual void didChangeContentSize(const WebCore::IntSize&amp;) = 0;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -238,11 +239,9 @@
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    virtual void mainDocumentDidReceiveMobileDocType() = 0;
-
</del><span class="cx">     virtual void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp;, const Vector&lt;WebCore::FloatQuad&gt;&amp; highlightedQuads, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius) = 0;
</span><span class="cx"> 
</span><del>-    virtual void didChangeViewportArguments(const WebCore::ViewportArguments&amp;) = 0;
</del><ins>+    virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&amp;) = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void startAssistingNode(const WebCore::IntRect&amp;, bool hasNextFocusable, bool hasPreviousFocusable) = 0;
</span><span class="cx">     virtual void stopAssistingNode() = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -2874,7 +2874,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(EFL) || PLATFORM(GTK)
</span><span class="cx"> 
</span><del>-#if PLATFORM(EFL) || PLATFORM(IOS)
</del><ins>+#if PLATFORM(EFL)
</ins><span class="cx"> void WebPageProxy::didChangeContentSize(const IntSize&amp; size)
</span><span class="cx"> {
</span><span class="cx">     m_pageClient.didChangeContentSize(size);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -139,6 +139,7 @@
</span><span class="cx"> class NativeWebMouseEvent;
</span><span class="cx"> class NativeWebWheelEvent;
</span><span class="cx"> class PageClient;
</span><ins>+class RemoteLayerTreeTransaction;
</ins><span class="cx"> class RemoteScrollingCoordinatorProxy;
</span><span class="cx"> class StringPairVector;
</span><span class="cx"> class WebBackForwardList;
</span><span class="lines">@@ -438,6 +439,8 @@
</span><span class="cx">     void executeEditCommand(const String&amp; commandName);
</span><span class="cx">     void validateCommand(const String&amp; commandName, PassRefPtr&lt;ValidateCommandCallback&gt;);
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&amp;);
+    void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&amp;);
</ins><span class="cx">     void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, PassRefPtr&lt;GestureCallback&gt;);
</span><span class="cx">     void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, PassRefPtr&lt;TouchesCallback&gt;);
</span><span class="cx">     void selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, PassRefPtr&lt;GestureCallback&gt;);
</span><span class="lines">@@ -821,6 +824,7 @@
</span><span class="cx">     bool suppressVisibilityUpdates() { return m_suppressVisibilityUpdates; }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    void willStartUserTriggeredZooming();
</ins><span class="cx">     void didFinishScrolling(const WebCore::FloatPoint&amp; contentOffset);
</span><span class="cx">     void didFinishZooming(float newScale);
</span><span class="cx"> 
</span><span class="lines">@@ -993,7 +997,7 @@
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS)
</span><span class="cx">     void didFindZoomableArea(const WebCore::IntPoint&amp;, const WebCore::IntRect&amp;);
</span><span class="cx"> #endif
</span><del>-#if PLATFORM(EFL) || PLATFORM(IOS)
</del><ins>+#if PLATFORM(EFL)
</ins><span class="cx">     void didChangeContentSize(const WebCore::IntSize&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -1135,12 +1139,8 @@
</span><span class="cx"> #endif // PLATFORM(MAC) &amp;&amp; !PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    void mainDocumentDidReceiveMobileDocType();
-
</del><span class="cx">     void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp; color, const Vector&lt;WebCore::FloatQuad&gt;&amp; geometries, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius);
</span><span class="cx"> 
</span><del>-    void didChangeViewportArguments(const WebCore::ViewportArguments&amp; viewportArguments);
-
</del><span class="cx">     void startAssistingNode(const WebCore::IntRect&amp;, bool hasNextFocusable, bool hasPreviousFocusable);
</span><span class="cx">     void stopAssistingNode();
</span><span class="cx">     void notifyRevealedSelection();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">     DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(EFL) || PLATFORM(IOS)
</del><ins>+#if PLATFORM(EFL)
</ins><span class="cx">     DidChangeContentSize(WebCore::IntSize newSize)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -306,10 +306,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    MainDocumentDidReceiveMobileDocType();
-
</del><span class="cx">     DidGetTapHighlightGeometries(uint64_t requestID, WebCore::Color color, Vector&lt;WebCore::FloatQuad&gt; geometries, WebCore::IntSize topLeftRadius, WebCore::IntSize topRightRadius, WebCore::IntSize bottomLeftRadius, WebCore::IntSize bottomRightRadius)
</span><del>-    DidChangeViewportArguments(WebCore::ViewportArguments viewportArguments)
</del><span class="cx"> 
</span><span class="cx">     StartAssistingNode(WebCore::IntRect scrollRect, bool hasNextFocusable, bool hasPreviousFocusable)
</span><span class="cx">     StopAssistingNode()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -229,6 +229,16 @@
</span><span class="cx">     callback-&gt;performCallbackWithReturnValue(beforeText, markedText, selectedText, afterText, location, length);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&amp; size)
+{
+    m_process-&gt;send(Messages::WebPage::SetViewportConfigurationMinimumLayoutSize(size), m_pageID);
+}
+
+void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&amp; layerTreeTransaction)
+{
+    m_pageClient.didCommitLayerTree(layerTreeTransaction);
+}
+
</ins><span class="cx"> void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::TextGranularity granularity, uint32_t gestureType, uint32_t gestureState, PassRefPtr&lt;GestureCallback&gt; callback)
</span><span class="cx"> {
</span><span class="cx">     if (!isValid()) {
</span><span class="lines">@@ -417,6 +427,11 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::willStartUserTriggeredZooming()
+{
+    process().send(Messages::WebPage::WillStartUserTriggeredZooming(), m_pageID);
+}
+
</ins><span class="cx"> void WebPageProxy::didFinishScrolling(const WebCore::FloatPoint&amp; contentOffset)
</span><span class="cx"> {
</span><span class="cx">     process().send(Messages::WebPage::DidFinishScrolling(contentOffset), m_pageID);
</span><span class="lines">@@ -441,21 +456,11 @@
</span><span class="cx">     process().send(Messages::WebPage::BlurAssistedNode(), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::mainDocumentDidReceiveMobileDocType()
-{
-    m_pageClient.mainDocumentDidReceiveMobileDocType();
-}
-
</del><span class="cx"> void WebPageProxy::didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp; color, const Vector&lt;WebCore::FloatQuad&gt;&amp; highlightedQuads, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius)
</span><span class="cx"> {
</span><span class="cx">     m_pageClient.didGetTapHighlightGeometries(requestID, color, highlightedQuads, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::didChangeViewportArguments(const WebCore::ViewportArguments&amp; viewportArguments)
-{
-    m_pageClient.didChangeViewportArguments(viewportArguments);
-}
-
</del><span class="cx"> void WebPageProxy::startAssistingNode(const WebCore::IntRect&amp; scrollRect, bool hasNextFocusable, bool hasPreviousFocusable)
</span><span class="cx"> {
</span><span class="cx">     m_pageClient.startAssistingNode(scrollRect, hasNextFocusable, hasPreviousFocusable);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -89,6 +89,9 @@
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><span class="cx">     m_webPageProxy-&gt;scrollingCoordinatorProxy()-&gt;updateScrollingTree(scrollingTreeTransaction);
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(IOS)
+    m_webPageProxy-&gt;didCommitLayerTree(layerTreeTransaction);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -501,10 +501,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_page-&gt;send(Messages::WebPageProxy::DidChangeContentSize(size));
</span><span class="cx"> #endif
</span><del>-#if PLATFORM(IOS)
-    m_page-&gt;send(Messages::WebPageProxy::DidChangeContentSize(size));
-#endif
</del><span class="cx"> 
</span><ins>+
</ins><span class="cx">     m_page-&gt;drawingArea()-&gt;mainFrameContentSizeChanged(size);
</span><span class="cx"> 
</span><span class="cx">     FrameView* frameView = frame-&gt;view();
</span><span class="lines">@@ -849,10 +847,9 @@
</span><span class="cx"> 
</span><span class="cx"> void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments&amp; viewportArguments) const
</span><span class="cx"> {
</span><del>-#if PLATFORM(IOS)
-    m_page-&gt;send(Messages::WebPageProxy::DidChangeViewportArguments(viewportArguments));
-#else
</del><span class="cx">     UNUSED_PARAM(viewportArguments);
</span><ins>+#if PLATFORM(IOS)
+    m_page-&gt;viewportPropertiesDidChange(viewportArguments);
</ins><span class="cx"> #endif
</span><span class="cx"> #if USE(TILED_BACKING_STORE)
</span><span class="cx">     if (!m_page-&gt;useFixedLayout())
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportiosWebChromeClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebChromeClient::didReceiveMobileDocType()
</span><span class="cx"> {
</span><del>-    m_page-&gt;send(Messages::WebPageProxy::MainDocumentDidReceiveMobileDocType());
</del><ins>+    // FIXME: update the ViewportConfiguration accordingly.
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebChromeClient::setNeedsScrollNotifications(WebCore::Frame*, bool)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -281,6 +281,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     , m_shouldReturnWordAtSelection(false)
</span><ins>+    , m_userHasChangedPageScaleFactor(false)
</ins><span class="cx"> #endif
</span><span class="cx">     , m_inspectorClient(0)
</span><span class="cx">     , m_backgroundColor(Color::white)
</span><span class="lines">@@ -3075,6 +3076,12 @@
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; !PLATFORM(IOS)
</span><span class="cx">     m_viewGestureGeometryCollector.mainFrameDidLayout();
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(IOS)
+    if (FrameView* frameView = mainFrameView()) {
+        m_viewportConfiguration.setContentsSize(frameView-&gt;contentsSize());
+        viewportConfigurationChanged();
+    }
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::addPluginView(PluginView* pluginView)
</span><span class="lines">@@ -3977,7 +3984,23 @@
</span><span class="cx">         if (page &amp;&amp; page-&gt;pageScaleFactor() != 1)
</span><span class="cx">             scalePage(1, IntPoint());
</span><span class="cx">     }
</span><ins>+#if PLATFORM(IOS)
+    m_userHasChangedPageScaleFactor = false;
</ins><span class="cx"> 
</span><ins>+    // FIXME: Setup a real configuration.
+    ViewportConfiguration::Parameters defaultConfiguration;
+    defaultConfiguration.width = 980;
+    defaultConfiguration.widthIsSet = true;
+    defaultConfiguration.allowsUserScaling = true;
+    defaultConfiguration.minimumScale = 0.25;
+    defaultConfiguration.maximumScale = 5;
+
+    m_viewportConfiguration.setDefaultConfiguration(defaultConfiguration);
+    m_viewportConfiguration.setViewportArguments(ViewportArguments());
+    m_viewportConfiguration.setContentsSize(m_viewportConfiguration.minimumLayoutSize());
+    viewportConfigurationChanged();
+#endif
+
</ins><span class="cx"> #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
</span><span class="cx">     resetPrimarySnapshottedPlugIn();
</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 (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx"> #include &lt;WebCore/TextChecking.h&gt;
</span><span class="cx"> #include &lt;WebCore/UserActivity.h&gt;
</span><span class="cx"> #include &lt;WebCore/ViewState.h&gt;
</span><ins>+#include &lt;WebCore/ViewportConfiguration.h&gt;
</ins><span class="cx"> #include &lt;WebCore/WebCoreKeyboardUIMode.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="lines">@@ -411,6 +412,12 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    void viewportPropertiesDidChange(const WebCore::ViewportArguments&amp;);
+
+    double minimumPageScaleFactor() const;
+    double maximumPageScaleFactor() const;
+    bool allowsUserScaling() const;
+
</ins><span class="cx">     void handleTap(const WebCore::IntPoint&amp;);
</span><span class="cx">     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -629,6 +636,9 @@
</span><span class="cx">     void updateVisibilityState(bool isInitialState = false);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&amp;);
+    void viewportConfigurationChanged();
+    void willStartUserTriggeredZooming();
</ins><span class="cx">     void didFinishScrolling(const WebCore::FloatPoint&amp; contentOffset);
</span><span class="cx">     void didFinishZooming(float);
</span><span class="cx"> #endif
</span><span class="lines">@@ -1049,6 +1059,9 @@
</span><span class="cx">     RefPtr&lt;WebCore::Range&gt; m_currentWordRange;
</span><span class="cx">     RefPtr&lt;WebCore::Node&gt; m_interactionNode;
</span><span class="cx">     bool m_shouldReturnWordAtSelection;
</span><ins>+
+    WebCore::ViewportConfiguration m_viewportConfiguration;
+    bool m_userHasChangedPageScaleFactor;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     WebInspectorClient* m_inspectorClient;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -41,6 +41,8 @@
</span><span class="cx">     MouseEventSyncForTesting(WebKit::WebMouseEvent event) -&gt; (bool handled)
</span><span class="cx">     WheelEventSyncForTesting(WebKit::WebWheelEvent event) -&gt; (bool handled)
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    SetViewportConfigurationMinimumLayoutSize(WebCore::IntSize size)
+
</ins><span class="cx">     HandleTap(WebCore::IntPoint point)
</span><span class="cx">     TapHighlightAtPosition(uint64_t requestID, WebCore::FloatPoint point)
</span><span class="cx">     BlurAssistedNode()
</span><span class="lines">@@ -313,6 +315,7 @@
</span><span class="cx">     SetVisibilityStatePrerender()
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    WillStartUserTriggeredZooming();
</ins><span class="cx">     DidFinishScrolling(WebCore::FloatPoint contentOffset);
</span><span class="cx">     DidFinishZooming(float scale);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -79,6 +79,27 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::viewportPropertiesDidChange(const ViewportArguments&amp; viewportArguments)
+{
+    m_viewportConfiguration.setViewportArguments(viewportArguments);
+    viewportConfigurationChanged();
+}
+
+double WebPage::minimumPageScaleFactor() const
+{
+    return m_viewportConfiguration.minimumScale();
+}
+
+double WebPage::maximumPageScaleFactor() const
+{
+    return m_viewportConfiguration.maximumScale();
+}
+
+bool WebPage::allowsUserScaling() const
+{
+    return m_viewportConfiguration.allowsUserScaling();
+}
+
</ins><span class="cx"> bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* event, bool)
</span><span class="cx"> {
</span><span class="cx">     bool eventWasHandled = false;
</span><span class="lines">@@ -960,6 +981,30 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::setViewportConfigurationMinimumLayoutSize(const IntSize&amp; size)
+{
+    m_viewportConfiguration.setMinimumLayoutSize(size);
+    viewportConfigurationChanged();
+}
+
+void WebPage::viewportConfigurationChanged()
+{
+    setFixedLayoutSize(m_viewportConfiguration.layoutSize());
+
+    double scale;
+    if (m_userHasChangedPageScaleFactor)
+        scale = std::max(std::min(pageScaleFactor(), m_viewportConfiguration.maximumScale()), m_viewportConfiguration.minimumScale());
+    else
+        scale = m_viewportConfiguration.initialScale();
+
+    m_page-&gt;setPageScaleFactor(scale, m_page-&gt;mainFrame().view()-&gt;scrollPosition());
+}
+
+void WebPage::willStartUserTriggeredZooming()
+{
+    m_userHasChangedPageScaleFactor = true;
+}
+
</ins><span class="cx"> void WebPage::didFinishScrolling(const WebCore::FloatPoint&amp; contentOffset)
</span><span class="cx"> {
</span><span class="cx">     m_page-&gt;mainFrame().view()-&gt;setScrollOffset(WebCore::IntPoint(contentOffset));
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (163514 => 163515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-02-06 06:19:16 UTC (rev 163514)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-02-06 06:45:41 UTC (rev 163515)
</span><span class="lines">@@ -321,6 +321,13 @@
</span><span class="cx">     // FIXME: minize these transactions if nothing changed.
</span><span class="cx">     RemoteLayerTreeTransaction layerTransaction;
</span><span class="cx">     m_remoteLayerTreeContext-&gt;buildTransaction(layerTransaction, *m_rootLayer);
</span><ins>+    layerTransaction.setContentsSize(m_webPage-&gt;corePage()-&gt;mainFrame().view()-&gt;contentsSize());
+    layerTransaction.setPageScaleFactor(m_webPage-&gt;corePage()-&gt;pageScaleFactor());
+#if PLATFORM(IOS)
+    layerTransaction.setMinimumScaleFactor(m_webPage-&gt;minimumPageScaleFactor());
+    layerTransaction.setMaximumScaleFactor(m_webPage-&gt;maximumPageScaleFactor());
+    layerTransaction.setAllowsUserScaling(m_webPage-&gt;allowsUserScaling());
+#endif
</ins><span class="cx"> 
</span><span class="cx">     RemoteScrollingCoordinatorTransaction scrollingTransaction;
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span></span></pre>
</div>
</div>

</body>
</html>