<!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>[205641] releases/WebKitGTK/webkit-2.14/Source/WebKit2</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/205395">r205395</a> - [Threaded Compositor] Move the viewport controller off the compositing thread
https://bugs.webkit.org/show_bug.cgi?id=161532

Reviewed by Michael Catanzaro.

While working on bug #161242 I've realized that having the view port controller in the compositing thread makes
everything more complex. The viewport controller receives changes about things like contents size, viewport
size, etc. and uses that information to compute the visible contents rect and page scale factor. Then it
notifies back to main thread about the computed visible contents rect and page scale. Those computations are not
heave at all, so they could be done in the main thread and we would avoid communications between the main and
compositing thread in both directions. The main thread needs the visible contents rect to notify the compositing
coordinator and the page cale to scale the page in case of pixed layout. But the compositing thread only needs
to know the effective scale and scroll position. So, instead of going to the compositing thread after every
change that might update the visible contents rect and page scale factor, we could do those calculations in the
main thread and only notify the compositing thread about the actual changes in the scroll position and effective scale.

* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::createTilesIfNeeded): Return early if backingStore is nullptr, which can
happen if the layer shouldn't have a backing store and was removed by the previous call to prepareContentBackingStore().
(WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded): Ditto.
* Shared/CoordinatedGraphics/SimpleViewportController.cpp:
(WebKit::SimpleViewportController::SimpleViewportController): Remove the client since we no longer need to
notify about changes.
(WebKit::SimpleViewportController::didChangeViewportSize): Remove call to syncVisibleContents().
(WebKit::SimpleViewportController::didChangeContentsSize): Ditto.
(WebKit::SimpleViewportController::didChangeViewportAttributes): Ditto.
(WebKit::SimpleViewportController::didScroll): Removed unused scrollBy methods and renamed scrollTo as
didiScroll for consistency. Save the position without calling boundContentsPosition, because that's already
donde when the position is used to compute the contents visible rectangle.
(WebKit::SimpleViewportController::visibleContentsRect): No need to notify about the changes.
(WebKit::SimpleViewportController::visibleContentsSize): Deleted.
* Shared/CoordinatedGraphics/SimpleViewportController.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::create): Pass a reference to the client instead of a pointer. It's no longer
possible to have a valid pointer when the object has been destroyed, so we can better use a reference now.
(WebKit::ThreadedCompositor::ThreadedCompositor): Ditto.
(WebKit::ThreadedCompositor::~ThreadedCompositor): Remove assert.
(WebKit::ThreadedCompositor::invalidate): No need to invalidate the client.
(WebKit::ThreadedCompositor::setScaleFactor): Set the effective scale factor that should be used for rendering.
(WebKit::ThreadedCompositor::setScrollPosition): Set the current scroll position and effective scale factor.
(WebKit::ThreadedCompositor::setViewportSize): Set the viewport size and effective scale factor.
(WebKit::ThreadedCompositor::renderNextFrame): Update m_client use that is no longer a pointer.
(WebKit::ThreadedCompositor::commitScrollOffset): Ditto.
(WebKit::ThreadedCompositor::renderLayerTree): Call glViewport after a resize and use m_viewportSize,
m_scrollPosition and m_scaleFactor members.
(WebKit::ThreadedCompositor::didChangeVisibleRect): Deleted.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Pass the compositor client as a
reference to ThreadedCompositor constructor.
(WebKit::ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents): Update the viewport and call didChangeViewport().
(WebKit::ThreadedCoordinatedLayerTreeHost::contentsSizeChanged): Ditto.
(WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): Pass the effective scale factor to
the compositor.
(WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange): Update the viewport, the compositor and call didChangeViewport().
(WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Update the viewport and call didChangeViewport().
(WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewport): Notify the compositing coordinator about the new
visible contents rectangle, and update the threaded compositor if needed.
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsCoordinatedGraphicsScenecpp">releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsSimpleViewportControllercpp">releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsSimpleViewportControllerh">releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsthreadedcompositorThreadedCompositorcpp">releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsthreadedcompositorThreadedCompositorh">releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHostcpp">releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHosth">releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit214SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2016-09-02  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [Threaded Compositor] Move the viewport controller off the compositing thread
+        https://bugs.webkit.org/show_bug.cgi?id=161532
+
+        Reviewed by Michael Catanzaro.
+
+        While working on bug #161242 I've realized that having the view port controller in the compositing thread makes
+        everything more complex. The viewport controller receives changes about things like contents size, viewport
+        size, etc. and uses that information to compute the visible contents rect and page scale factor. Then it
+        notifies back to main thread about the computed visible contents rect and page scale. Those computations are not
+        heave at all, so they could be done in the main thread and we would avoid communications between the main and
+        compositing thread in both directions. The main thread needs the visible contents rect to notify the compositing
+        coordinator and the page cale to scale the page in case of pixed layout. But the compositing thread only needs
+        to know the effective scale and scroll position. So, instead of going to the compositing thread after every
+        change that might update the visible contents rect and page scale factor, we could do those calculations in the
+        main thread and only notify the compositing thread about the actual changes in the scroll position and effective scale.
+
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
+        (WebKit::CoordinatedGraphicsScene::createTilesIfNeeded): Return early if backingStore is nullptr, which can
+        happen if the layer shouldn't have a backing store and was removed by the previous call to prepareContentBackingStore().
+        (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded): Ditto.
+        * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
+        (WebKit::SimpleViewportController::SimpleViewportController): Remove the client since we no longer need to
+        notify about changes.
+        (WebKit::SimpleViewportController::didChangeViewportSize): Remove call to syncVisibleContents().
+        (WebKit::SimpleViewportController::didChangeContentsSize): Ditto.
+        (WebKit::SimpleViewportController::didChangeViewportAttributes): Ditto.
+        (WebKit::SimpleViewportController::didScroll): Removed unused scrollBy methods and renamed scrollTo as
+        didiScroll for consistency. Save the position without calling boundContentsPosition, because that's already
+        donde when the position is used to compute the contents visible rectangle.
+        (WebKit::SimpleViewportController::visibleContentsRect): No need to notify about the changes.
+        (WebKit::SimpleViewportController::visibleContentsSize): Deleted.
+        * Shared/CoordinatedGraphics/SimpleViewportController.h:
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::create): Pass a reference to the client instead of a pointer. It's no longer
+        possible to have a valid pointer when the object has been destroyed, so we can better use a reference now.
+        (WebKit::ThreadedCompositor::ThreadedCompositor): Ditto.
+        (WebKit::ThreadedCompositor::~ThreadedCompositor): Remove assert.
+        (WebKit::ThreadedCompositor::invalidate): No need to invalidate the client.
+        (WebKit::ThreadedCompositor::setScaleFactor): Set the effective scale factor that should be used for rendering.
+        (WebKit::ThreadedCompositor::setScrollPosition): Set the current scroll position and effective scale factor.
+        (WebKit::ThreadedCompositor::setViewportSize): Set the viewport size and effective scale factor.
+        (WebKit::ThreadedCompositor::renderNextFrame): Update m_client use that is no longer a pointer.
+        (WebKit::ThreadedCompositor::commitScrollOffset): Ditto.
+        (WebKit::ThreadedCompositor::renderLayerTree): Call glViewport after a resize and use m_viewportSize,
+        m_scrollPosition and m_scaleFactor members.
+        (WebKit::ThreadedCompositor::didChangeVisibleRect): Deleted.
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
+        (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Pass the compositor client as a
+        reference to ThreadedCompositor constructor.
+        (WebKit::ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents): Update the viewport and call didChangeViewport().
+        (WebKit::ThreadedCoordinatedLayerTreeHost::contentsSizeChanged): Ditto.
+        (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): Pass the effective scale factor to
+        the compositor.
+        (WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange): Update the viewport, the compositor and call didChangeViewport().
+        (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Update the viewport and call didChangeViewport().
+        (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewport): Notify the compositing coordinator about the new
+        visible contents rectangle, and update the threaded compositor if needed.
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
+
</ins><span class="cx"> 2016-09-02  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed GTK+ build fix when compiling with Clang.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsCoordinatedGraphicsScenecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -445,7 +445,9 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
</span><del>-    ASSERT(backingStore);
</del><ins>+    ASSERT(backingStore || !layerShouldHaveBackingStore(layer));
+    if (!backingStore)
+        return;
</ins><span class="cx"> 
</span><span class="cx">     for (auto&amp; tile : state.tilesToCreate)
</span><span class="cx">         backingStore-&gt;createTile(tile.tileID, tile.scale);
</span><span class="lines">@@ -472,7 +474,9 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
</span><del>-    ASSERT(backingStore);
</del><ins>+    ASSERT(backingStore || !layerShouldHaveBackingStore(layer));
+    if (!backingStore)
+        return;
</ins><span class="cx"> 
</span><span class="cx">     for (auto&amp; tile : state.tilesToUpdate) {
</span><span class="cx">         const SurfaceUpdateInfo&amp; surfaceUpdateInfo = tile.updateInfo;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsSimpleViewportControllercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -20,27 +20,20 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+#include &quot;SimpleViewportController.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_THREADED)
</span><del>-#include &quot;SimpleViewportController.h&quot;
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-SimpleViewportController::SimpleViewportController(Client* client)
-    : m_client(client)
-    , m_contentsPosition(FloatPoint())
-    , m_contentsSize(FloatSize())
-    , m_viewportSize(FloatSize())
-    , m_allowsUserScaling(false)
-    , m_initiallyFitToViewport(true)
-    , m_hasViewportAttribute(false)
</del><ins>+SimpleViewportController::SimpleViewportController()
</ins><span class="cx"> {
</span><span class="cx">     resetViewportToDefaultState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SimpleViewportController::didChangeViewportSize(const FloatSize&amp; newSize)
</del><ins>+void SimpleViewportController::didChangeViewportSize(const IntSize&amp; newSize)
</ins><span class="cx"> {
</span><span class="cx">     if (newSize.isEmpty())
</span><span class="cx">         return;
</span><span class="lines">@@ -47,7 +40,6 @@
</span><span class="cx"> 
</span><span class="cx">     m_viewportSize = newSize;
</span><span class="cx">     updateMinimumScaleToFit();
</span><del>-    syncVisibleContents();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SimpleViewportController::didChangeContentsSize(const IntSize&amp; newSize)
</span><span class="lines">@@ -62,11 +54,9 @@
</span><span class="cx">         m_rawAttributes.initialScale = m_minimumScaleToFit;
</span><span class="cx">         restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes);
</span><span class="cx">     }
</span><del>-
-    syncVisibleContents();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SimpleViewportController::didChangeViewportAttribute(const ViewportAttributes&amp; newAttributes)
</del><ins>+void SimpleViewportController::didChangeViewportAttributes(const ViewportAttributes&amp; newAttributes)
</ins><span class="cx"> {
</span><span class="cx">     if (newAttributes.layoutSize.isEmpty()) {
</span><span class="cx">         resetViewportToDefaultState();
</span><span class="lines">@@ -83,40 +73,20 @@
</span><span class="cx">         restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes);
</span><span class="cx"> 
</span><span class="cx">     updateMinimumScaleToFit();
</span><del>-
-    syncVisibleContents();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SimpleViewportController::scrollBy(const IntSize&amp; scrollOffset)
</del><ins>+void SimpleViewportController::didScroll(const IntPoint&amp; position)
</ins><span class="cx"> {
</span><del>-    m_contentsPosition.move(scrollOffset);
-    m_contentsPosition = boundContentsPosition(m_contentsPosition);
-
-    syncVisibleContents();
</del><ins>+    m_contentsPosition = position;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SimpleViewportController::scrollTo(const IntPoint&amp; position)
</del><ins>+FloatRect SimpleViewportController::visibleContentsRect() const
</ins><span class="cx"> {
</span><del>-    if (m_contentsPosition == boundContentsPosition(position))
-        return;
-
-    m_contentsPosition = boundContentsPosition(position);
-    syncVisibleContents();
-}
-
-void SimpleViewportController::syncVisibleContents()
-{
</del><span class="cx">     if (m_viewportSize.isEmpty() || m_contentsSize.isEmpty())
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx"> 
</span><del>-    m_client-&gt;didChangeVisibleRect();
-}
-
-FloatRect SimpleViewportController::visibleContentsRect() const
-{
</del><span class="cx">     FloatRect visibleContentsRect(boundContentsPosition(m_contentsPosition), visibleContentsSize());
</span><span class="cx">     visibleContentsRect.intersect(FloatRect(FloatPoint::zero(), m_contentsSize));
</span><del>-
</del><span class="cx">     return visibleContentsRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsSimpleViewportControllerh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -37,29 +37,19 @@
</span><span class="cx"> class SimpleViewportController {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(SimpleViewportController);
</span><span class="cx"> public:
</span><del>-    class Client {
-    public:
-        virtual void didChangeVisibleRect() = 0;
-    };
</del><ins>+    SimpleViewportController();
</ins><span class="cx"> 
</span><del>-    explicit SimpleViewportController(Client*);
-
-    void didChangeViewportSize(const WebCore::FloatSize&amp;);
</del><ins>+    void didChangeViewportSize(const WebCore::IntSize&amp;);
</ins><span class="cx">     void didChangeContentsSize(const WebCore::IntSize&amp;);
</span><del>-    void didChangeViewportAttribute(const WebCore::ViewportAttributes&amp;);
</del><ins>+    void didChangeViewportAttributes(const WebCore::ViewportAttributes&amp;);
+    void didScroll(const WebCore::IntPoint&amp;);
</ins><span class="cx"> 
</span><del>-    void scrollBy(const WebCore::IntSize&amp;);
-    void scrollTo(const WebCore::IntPoint&amp;);
-
</del><span class="cx">     WebCore::FloatRect visibleContentsRect() const;
</span><span class="cx">     float pageScaleFactor() const { return m_pageScaleFactor; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-
</del><span class="cx">     WebCore::FloatSize visibleContentsSize() const;
</span><span class="cx"> 
</span><del>-    void syncVisibleContents();
-
</del><span class="cx">     void applyScaleAfterRenderingContents(float scale);
</span><span class="cx">     void applyPositionAfterRenderingContents(const WebCore::FloatPoint&amp; pos);
</span><span class="cx"> 
</span><span class="lines">@@ -71,18 +61,16 @@
</span><span class="cx"> 
</span><span class="cx">     void resetViewportToDefaultState();
</span><span class="cx"> 
</span><del>-    Client* m_client;
-
-    WebCore::FloatPoint m_contentsPosition;
</del><ins>+    WebCore::IntPoint m_contentsPosition;
</ins><span class="cx">     WebCore::FloatSize m_contentsSize;
</span><span class="cx">     WebCore::FloatSize m_viewportSize;
</span><del>-    float m_pageScaleFactor;
</del><ins>+    float m_pageScaleFactor { 1 };
</ins><span class="cx"> 
</span><del>-    bool m_allowsUserScaling;
-    float m_minimumScaleToFit;
-    bool m_initiallyFitToViewport;
</del><ins>+    bool m_allowsUserScaling { false };
+    float m_minimumScaleToFit { 1 };
+    bool m_initiallyFitToViewport { false };
</ins><span class="cx"> 
</span><del>-    bool m_hasViewportAttribute;
</del><ins>+    bool m_hasViewportAttribute { false };
</ins><span class="cx">     WebCore::ViewportAttributes m_rawAttributes;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsthreadedcompositorThreadedCompositorcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -42,12 +42,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-Ref&lt;ThreadedCompositor&gt; ThreadedCompositor::create(Client* client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync)
</del><ins>+Ref&lt;ThreadedCompositor&gt; ThreadedCompositor::create(Client&amp; client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync)
</ins><span class="cx"> {
</span><span class="cx">     return adoptRef(*new ThreadedCompositor(client, nativeSurfaceHandle, doFrameSync));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ThreadedCompositor::ThreadedCompositor(Client* client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync)
</del><ins>+ThreadedCompositor::ThreadedCompositor(Client&amp; client, uint64_t nativeSurfaceHandle, ShouldDoFrameSync doFrameSync)
</ins><span class="cx">     : m_client(client)
</span><span class="cx">     , m_nativeSurfaceHandle(nativeSurfaceHandle)
</span><span class="cx">     , m_doFrameSync(doFrameSync)
</span><span class="lines">@@ -55,7 +55,6 @@
</span><span class="cx"> {
</span><span class="cx">     m_compositingRunLoop-&gt;performTaskSync([this, protectedThis = makeRef(*this)] {
</span><span class="cx">         m_scene = adoptRef(new CoordinatedGraphicsScene(this));
</span><del>-        m_viewportController = std::make_unique&lt;SimpleViewportController&gt;(this);
</del><span class="cx">         m_scene-&gt;setActive(!!m_nativeSurfaceHandle);
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="lines">@@ -62,7 +61,6 @@
</span><span class="cx"> 
</span><span class="cx"> ThreadedCompositor::~ThreadedCompositor()
</span><span class="cx"> {
</span><del>-    ASSERT(!m_client);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedCompositor::invalidate()
</span><span class="lines">@@ -73,10 +71,8 @@
</span><span class="cx">         m_scene-&gt;purgeGLResources();
</span><span class="cx">         m_context = nullptr;
</span><span class="cx">         m_scene = nullptr;
</span><del>-        m_viewportController = nullptr;
</del><span class="cx">     });
</span><span class="cx">     m_compositingRunLoop = nullptr;
</span><del>-    m_client = nullptr;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
</span><span class="lines">@@ -93,67 +89,51 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCompositor::setDeviceScaleFactor(float scale)
</del><ins>+void ThreadedCompositor::setScaleFactor(float scale)
</ins><span class="cx"> {
</span><span class="cx">     m_compositingRunLoop-&gt;performTask([this, protectedThis = makeRef(*this), scale] {
</span><del>-        m_deviceScaleFactor = scale;
</del><ins>+        m_scaleFactor = scale;
</ins><span class="cx">         scheduleDisplayImmediately();
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCompositor::setDrawsBackground(bool drawsBackground)
</del><ins>+void ThreadedCompositor::setScrollPosition(const IntPoint&amp; scrollPosition, float scale)
</ins><span class="cx"> {
</span><del>-    m_compositingRunLoop-&gt;performTask([this, protectedThis = Ref&lt;ThreadedCompositor&gt;(*this), drawsBackground] {
-        m_drawsBackground = drawsBackground;
</del><ins>+    m_compositingRunLoop-&gt;performTask([this, protectedThis = makeRef(*this), scrollPosition, scale] {
+        m_scrollPosition = scrollPosition;
+        m_scaleFactor = scale;
</ins><span class="cx">         scheduleDisplayImmediately();
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCompositor::didChangeViewportSize(const IntSize&amp; size)
</del><ins>+void ThreadedCompositor::setViewportSize(const IntSize&amp; viewportSize, float scale)
</ins><span class="cx"> {
</span><del>-    m_compositingRunLoop-&gt;performTaskSync([this, protectedThis = makeRef(*this), size] {
-        m_viewportController-&gt;didChangeViewportSize(size);
</del><ins>+    m_compositingRunLoop-&gt;performTaskSync([this, protectedThis = makeRef(*this), viewportSize, scale] {
+        m_viewportSize = viewportSize;
+        m_scaleFactor = scale;
+        m_needsResize = true;
+        scheduleDisplayImmediately();
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCompositor::didChangeViewportAttribute(const ViewportAttributes&amp; attr)
</del><ins>+void ThreadedCompositor::setDrawsBackground(bool drawsBackground)
</ins><span class="cx"> {
</span><del>-    m_compositingRunLoop-&gt;performTask([this, protectedThis = makeRef(*this), attr] {
-        m_viewportController-&gt;didChangeViewportAttribute(attr);
</del><ins>+    m_compositingRunLoop-&gt;performTask([this, protectedThis = Ref&lt;ThreadedCompositor&gt;(*this), drawsBackground] {
+        m_drawsBackground = drawsBackground;
+        scheduleDisplayImmediately();
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCompositor::didChangeContentsSize(const IntSize&amp; size)
-{
-    m_compositingRunLoop-&gt;performTask([this, protectedThis = makeRef(*this), size] {
-        m_viewportController-&gt;didChangeContentsSize(size);
-    });
-}
-
-void ThreadedCompositor::scrollTo(const IntPoint&amp; position)
-{
-    m_compositingRunLoop-&gt;performTask([this, protectedThis = makeRef(*this), position] {
-        m_viewportController-&gt;scrollTo(position);
-    });
-}
-
-void ThreadedCompositor::scrollBy(const IntSize&amp; delta)
-{
-    m_compositingRunLoop-&gt;performTask([this, protectedThis = makeRef(*this), delta] {
-        m_viewportController-&gt;scrollBy(delta);
-    });
-}
-
</del><span class="cx"> void ThreadedCompositor::renderNextFrame()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    m_client-&gt;renderNextFrame();
</del><ins>+    m_client.renderNextFrame();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedCompositor::commitScrollOffset(uint32_t layerID, const IntSize&amp; offset)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    m_client-&gt;commitScrollOffset(layerID, offset);
</del><ins>+    m_client.commitScrollOffset(layerID, offset);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedCompositor::updateViewport()
</span><span class="lines">@@ -194,16 +174,6 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCompositor::didChangeVisibleRect()
-{
-    RunLoop::main().dispatch([this, protectedThis = makeRef(*this), visibleRect = m_viewportController-&gt;visibleContentsRect(), scale = m_viewportController-&gt;pageScaleFactor()] {
-        if (m_client)
-            m_client-&gt;setVisibleContentsRect(visibleRect, FloatPoint::zero(), scale);
-    });
-
-    scheduleDisplayImmediately();
-}
-
</del><span class="cx"> void ThreadedCompositor::renderLayerTree()
</span><span class="cx"> {
</span><span class="cx">     if (!m_scene || !m_scene-&gt;isActive())
</span><span class="lines">@@ -212,27 +182,21 @@
</span><span class="cx">     if (!makeContextCurrent())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // The window size may be out of sync with the page size at this point, and getting
-    // the viewport parameters incorrect, means that the content will be misplaced. Thus,
-    // we set the viewport parameters directly from the window size.
-    IntSize contextSize = m_context-&gt;defaultFrameBufferSize();
-    if (m_viewportSize != contextSize) {
-        glViewport(0, 0, contextSize.width(), contextSize.height());
-        m_viewportSize = contextSize;
</del><ins>+    if (m_needsResize) {
+        glViewport(0, 0, m_viewportSize.width(), m_viewportSize.height());
+        m_needsResize = false;
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     FloatRect clipRect(0, 0, m_viewportSize.width(), m_viewportSize.height());
</span><span class="cx"> 
</span><span class="cx">     TransformationMatrix viewportTransform;
</span><del>-    FloatPoint scrollPostion = m_viewportController-&gt;visibleContentsRect().location();
-    viewportTransform.scale(m_viewportController-&gt;pageScaleFactor() * m_deviceScaleFactor);
-    viewportTransform.translate(-scrollPostion.x(), -scrollPostion.y());
</del><ins>+    viewportTransform.scale(m_scaleFactor);
+    viewportTransform.translate(-m_scrollPosition.x(), -m_scrollPosition.y());
</ins><span class="cx"> 
</span><span class="cx">     if (!m_drawsBackground) {
</span><span class="cx">         glClearColor(0, 0, 0, 0);
</span><span class="cx">         glClear(GL_COLOR_BUFFER_BIT);
</span><span class="cx">     }
</span><del>-    m_scene-&gt;paintToCurrentGLContext(viewportTransform, 1, clipRect, Color::transparent, !m_drawsBackground, scrollPostion);
</del><ins>+    m_scene-&gt;paintToCurrentGLContext(viewportTransform, 1, clipRect, Color::transparent, !m_drawsBackground, m_scrollPosition);
</ins><span class="cx"> 
</span><span class="cx">     m_context-&gt;swapBuffers();
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2SharedCoordinatedGraphicsthreadedcompositorThreadedCompositorh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CompositingRunLoop.h&quot;
</span><span class="cx"> #include &quot;CoordinatedGraphicsScene.h&quot;
</span><del>-#include &quot;SimpleViewportController.h&quot;
</del><span class="cx"> #include &lt;WebCore/GLContext.h&gt;
</span><span class="cx"> #include &lt;WebCore/IntSize.h&gt;
</span><span class="cx"> #include &lt;wtf/FastMalloc.h&gt;
</span><span class="lines">@@ -46,13 +45,12 @@
</span><span class="cx"> class CoordinatedGraphicsScene;
</span><span class="cx"> class CoordinatedGraphicsSceneClient;
</span><span class="cx"> 
</span><del>-class ThreadedCompositor : public SimpleViewportController::Client, public CoordinatedGraphicsSceneClient, public ThreadSafeRefCounted&lt;ThreadedCompositor&gt; {
</del><ins>+class ThreadedCompositor : public CoordinatedGraphicsSceneClient, public ThreadSafeRefCounted&lt;ThreadedCompositor&gt; {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(ThreadedCompositor);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     class Client {
</span><span class="cx">     public:
</span><del>-        virtual void setVisibleContentsRect(const WebCore::FloatRect&amp;, const WebCore::FloatPoint&amp;, float) = 0;
</del><span class="cx">         virtual void renderNextFrame() = 0;
</span><span class="cx">         virtual void commitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset) = 0;
</span><span class="cx">     };
</span><span class="lines">@@ -59,27 +57,23 @@
</span><span class="cx"> 
</span><span class="cx">     enum class ShouldDoFrameSync { No, Yes };
</span><span class="cx"> 
</span><del>-    static Ref&lt;ThreadedCompositor&gt; create(Client*, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes);
</del><ins>+    static Ref&lt;ThreadedCompositor&gt; create(Client&amp;, uint64_t nativeSurfaceHandle = 0, ShouldDoFrameSync = ShouldDoFrameSync::Yes);
</ins><span class="cx">     virtual ~ThreadedCompositor();
</span><span class="cx"> 
</span><span class="cx">     void setNativeSurfaceHandleForCompositing(uint64_t);
</span><del>-    void setDeviceScaleFactor(float);
</del><ins>+    void setScaleFactor(float);
+    void setScrollPosition(const WebCore::IntPoint&amp;, float scale);
+    void setViewportSize(const WebCore::IntSize&amp;, float scale);
</ins><span class="cx">     void setDrawsBackground(bool);
</span><span class="cx"> 
</span><span class="cx">     void updateSceneState(const WebCore::CoordinatedGraphicsState&amp;);
</span><span class="cx"> 
</span><del>-    void didChangeViewportSize(const WebCore::IntSize&amp;);
-    void didChangeViewportAttribute(const WebCore::ViewportAttributes&amp;);
-    void didChangeContentsSize(const WebCore::IntSize&amp;);
-    void scrollTo(const WebCore::IntPoint&amp;);
-    void scrollBy(const WebCore::IntSize&amp;);
-
</del><span class="cx">     void invalidate();
</span><span class="cx"> 
</span><span class="cx">     void forceRepaint();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    ThreadedCompositor(Client*, uint64_t nativeSurfaceHandle, ShouldDoFrameSync);
</del><ins>+    ThreadedCompositor(Client&amp;, uint64_t nativeSurfaceHandle, ShouldDoFrameSync);
</ins><span class="cx"> 
</span><span class="cx">     // CoordinatedGraphicsSceneClient
</span><span class="cx">     void renderNextFrame() override;
</span><span class="lines">@@ -86,24 +80,22 @@
</span><span class="cx">     void updateViewport() override;
</span><span class="cx">     void commitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset) override;
</span><span class="cx"> 
</span><del>-    // SimpleViewportController::Client.
-    void didChangeVisibleRect() override;
-
</del><span class="cx">     void renderLayerTree();
</span><span class="cx">     void scheduleDisplayImmediately();
</span><span class="cx"> 
</span><span class="cx">     bool makeContextCurrent();
</span><span class="cx"> 
</span><del>-    Client* m_client { nullptr };
</del><ins>+    Client&amp; m_client;
</ins><span class="cx">     RefPtr&lt;CoordinatedGraphicsScene&gt; m_scene;
</span><del>-    std::unique_ptr&lt;SimpleViewportController&gt; m_viewportController;
</del><span class="cx">     std::unique_ptr&lt;WebCore::GLContext&gt; m_context;
</span><span class="cx"> 
</span><span class="cx">     WebCore::IntSize m_viewportSize;
</span><del>-    float m_deviceScaleFactor { 1 };
</del><ins>+    WebCore::IntPoint m_scrollPosition;
+    float m_scaleFactor { 1 };
</ins><span class="cx">     bool m_drawsBackground { true };
</span><span class="cx">     uint64_t m_nativeSurfaceHandle;
</span><span class="cx">     ShouldDoFrameSync m_doFrameSync;
</span><ins>+    bool m_needsResize { false };
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;CompositingRunLoop&gt; m_compositingRunLoop;
</span><span class="cx"> };
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHostcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -58,10 +58,10 @@
</span><span class="cx">         // Do not do frame sync when rendering offscreen in the web process to ensure that SwapBuffers never blocks.
</span><span class="cx">         // Rendering to the actual screen will happen later anyway since the UI process schedules a redraw for every update,
</span><span class="cx">         // the compositor will take care of syncing to vblank.
</span><del>-        m_compositor = ThreadedCompositor::create(&amp;m_compositorClient, m_surface-&gt;window(), ThreadedCompositor::ShouldDoFrameSync::No);
</del><ins>+        m_compositor = ThreadedCompositor::create(m_compositorClient, m_surface-&gt;window(), ThreadedCompositor::ShouldDoFrameSync::No);
</ins><span class="cx">         m_layerTreeContext.contextID = m_surface-&gt;surfaceID();
</span><span class="cx">     } else
</span><del>-        m_compositor = ThreadedCompositor::create(&amp;m_compositorClient);
</del><ins>+        m_compositor = ThreadedCompositor::create(m_compositorClient);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedCoordinatedLayerTreeHost::invalidate()
</span><span class="lines">@@ -77,15 +77,16 @@
</span><span class="cx">     m_compositor-&gt;forceRepaint();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const WebCore::IntRect&amp; rect)
</del><ins>+void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const IntRect&amp; rect)
</ins><span class="cx"> {
</span><del>-    m_compositor-&gt;scrollTo(rect.location());
-    scheduleLayerFlush();
</del><ins>+    m_viewportController.didScroll(rect.location());
+    didChangeViewport();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCoordinatedLayerTreeHost::contentsSizeChanged(const WebCore::IntSize&amp; newSize)
</del><ins>+void ThreadedCoordinatedLayerTreeHost::contentsSizeChanged(const IntSize&amp; newSize)
</ins><span class="cx"> {
</span><del>-    m_compositor-&gt;didChangeContentsSize(newSize);
</del><ins>+    m_viewportController.didChangeContentsSize(newSize);
+    didChangeViewport();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
</span><span class="lines">@@ -94,7 +95,7 @@
</span><span class="cx">         m_layerTreeContext.contextID = m_surface-&gt;surfaceID();
</span><span class="cx"> 
</span><span class="cx">     CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged();
</span><del>-    m_compositor-&gt;setDeviceScaleFactor(m_webPage.deviceScaleFactor());
</del><ins>+    m_compositor-&gt;setScaleFactor(m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedCoordinatedLayerTreeHost::pageBackgroundTransparencyChanged()
</span><span class="lines">@@ -109,19 +110,19 @@
</span><span class="cx">         m_layerTreeContext.contextID = m_surface-&gt;surfaceID();
</span><span class="cx"> 
</span><span class="cx">     CoordinatedLayerTreeHost::sizeDidChange(size);
</span><del>-    m_compositor-&gt;didChangeViewportSize(size);
</del><ins>+    m_viewportController.didChangeViewportSize(size);
+    IntSize scaledSize(size);
+    scaledSize.scale(m_webPage.deviceScaleFactor());
+    m_compositor-&gt;setViewportSize(scaledSize, m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor());
+    didChangeViewport();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties(const WebCore::ViewportAttributes&amp; attr)
</del><ins>+void ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties(const ViewportAttributes&amp; attr)
</ins><span class="cx"> {
</span><del>-    m_compositor-&gt;didChangeViewportAttribute(attr);
</del><ins>+    m_viewportController.didChangeViewportAttributes(attr);
+    didChangeViewport();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCoordinatedLayerTreeHost::didScaleFactorChanged(float scale, const IntPoint&amp; origin)
-{
-    m_webPage.scalePage(scale, origin);
-}
-
</del><span class="cx"> #if PLATFORM(GTK) &amp;&amp; !USE(REDIRECTED_XCOMPOSITE_WINDOW)
</span><span class="cx"> void ThreadedCoordinatedLayerTreeHost::setNativeSurfaceHandleForCompositing(uint64_t handle)
</span><span class="cx"> {
</span><span class="lines">@@ -131,9 +132,11 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void ThreadedCoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect&amp; rect, const FloatPoint&amp; trajectoryVector, float scale)
</del><ins>+void ThreadedCoordinatedLayerTreeHost::didChangeViewport()
</ins><span class="cx"> {
</span><del>-    FloatRect visibleRect(rect);
</del><ins>+    FloatRect visibleRect(m_viewportController.visibleContentsRect());
+    if (visibleRect.isEmpty())
+        return;
</ins><span class="cx"> 
</span><span class="cx">     // When using non overlay scrollbars, the contents size doesn't include the scrollbars, but we need to include them
</span><span class="cx">     // in the visible area used by the compositor to ensure that the scrollbar layers are also updated.
</span><span class="lines">@@ -146,17 +149,21 @@
</span><span class="cx">     if (scrollbar &amp;&amp; !scrollbar-&gt;isOverlayScrollbar())
</span><span class="cx">         visibleRect.expand(0, scrollbar-&gt;height());
</span><span class="cx"> 
</span><del>-    CoordinatedLayerTreeHost::setVisibleContentsRect(visibleRect, trajectoryVector);
-    if (m_lastScrollPosition != roundedIntPoint(visibleRect.location())) {
-        m_lastScrollPosition = roundedIntPoint(visibleRect.location());
</del><ins>+    CoordinatedLayerTreeHost::setVisibleContentsRect(visibleRect, FloatPoint::zero());
</ins><span class="cx"> 
</span><ins>+    float pageScale = m_viewportController.pageScaleFactor();
+    IntPoint scrollPosition = roundedIntPoint(visibleRect.location());
+    if (m_lastScrollPosition != scrollPosition) {
+        m_lastScrollPosition = scrollPosition;
+        m_compositor-&gt;setScrollPosition(m_lastScrollPosition, m_webPage.deviceScaleFactor() * pageScale);
+
</ins><span class="cx">         if (!view-&gt;useFixedLayout())
</span><span class="cx">             view-&gt;notifyScrollPositionChanged(m_lastScrollPosition);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_lastScaleFactor != scale) {
-        m_lastScaleFactor = scale;
-        didScaleFactorChanged(m_lastScaleFactor, m_lastScrollPosition);
</del><ins>+    if (m_lastPageScaleFactor != pageScale) {
+        m_lastPageScaleFactor = pageScale;
+        m_webPage.scalePage(pageScale, m_lastScrollPosition);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHosth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (205640 => 205641)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h        2016-09-08 15:19:25 UTC (rev 205640)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h        2016-09-08 15:21:57 UTC (rev 205641)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_THREADED)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CoordinatedLayerTreeHost.h&quot;
</span><ins>+#include &quot;SimpleViewportController.h&quot;
</ins><span class="cx"> #include &quot;ThreadedCompositor.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -78,11 +79,6 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        void setVisibleContentsRect(const WebCore::FloatRect&amp; rect, const WebCore::FloatPoint&amp; trajectoryVector, float scale) override
-        {
-            m_layerTreeHost.setVisibleContentsRect(rect, trajectoryVector, scale);
-        }
-
</del><span class="cx">         void renderNextFrame() override
</span><span class="cx">         {
</span><span class="cx">             m_layerTreeHost.renderNextFrame();
</span><span class="lines">@@ -96,10 +92,8 @@
</span><span class="cx">         ThreadedCoordinatedLayerTreeHost&amp; m_layerTreeHost;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    void didScaleFactorChanged(float scale, const WebCore::IntPoint&amp; origin);
</del><ins>+    void didChangeViewport();
</ins><span class="cx"> 
</span><del>-    void setVisibleContentsRect(const WebCore::FloatRect&amp;, const WebCore::FloatPoint&amp;, float);
-
</del><span class="cx">     // CompositingCoordinator::Client
</span><span class="cx">     void didFlushRootLayer(const WebCore::FloatRect&amp;) override { }
</span><span class="cx">     void commitSceneState(const WebCore::CoordinatedGraphicsState&amp;) override;
</span><span class="lines">@@ -107,8 +101,8 @@
</span><span class="cx">     CompositorClient m_compositorClient;
</span><span class="cx">     std::unique_ptr&lt;AcceleratedSurface&gt; m_surface;
</span><span class="cx">     RefPtr&lt;ThreadedCompositor&gt; m_compositor;
</span><del>-    float m_lastScaleFactor { 1 };
-    WebCore::IntPoint m_prevScrollPosition;
</del><ins>+    SimpleViewportController m_viewportController;
+    float m_lastPageScaleFactor { 1 };
</ins><span class="cx">     WebCore::IntPoint m_lastScrollPosition;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>