<!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>[182203] trunk/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/182203">182203</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-03-31 13:53:32 -0700 (Tue, 31 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebKit briefly shows wrong webpage after swiping back (gigaom.com, or any site on a slow network)
https://bugs.webkit.org/show_bug.cgi?id=143256
&lt;rdar://problem/19458648&gt;

Reviewed by Dan Bernstein.

Instead of allowing a flash of the previous page when the swipe snapshot
timeouts fire (removing the snapshot before the new page is loaded), show
the snapshotted background color.

This fixes the problem on iOS, where UI-side compositing makes it easy to fix,
but not yet on OS X.

* UIProcess/API/Cocoa/WKWebView.mm:
(baseScrollViewBackgroundColor):
(scrollViewBackgroundColor):
If the ViewGestureController returns a valid background color, use that
instead of the page's background color.

* UIProcess/API/Cocoa/WKWebViewInternal.h:
Expose _updateScrollViewBackground.

* UIProcess/PageClient.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didChangeBackgroundColor):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didChangeBackgroundColor):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChangeBackgroundColor):
* UIProcess/WebPageProxy.h:
Add and plumb didChangeBackgroundColor, which calls
_updateScrollViewBackground on iOS.

* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::endSwipeGesture):
Hide the content of the drawing area until the next commit. This way,
even if the snapshot is removed (say, because a timeout fired), we won't
ever show the old page content (but we will show background color).

Store the background color associated with the current snapshot.

Let WKWebView know that it needs to recompute the background color.

(WebKit::ViewGestureController::removeSwipeSnapshot):
Clear the background color so that the next time we commit, WKWebView
will get an invalid color from ViewGestureController and fall back
to the page's extended background color instead.

* UIProcess/mac/ViewGestureController.h:
(WebKit::ViewGestureController::backgroundColorForCurrentSnapshot):
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::removeSwipeSnapshot):
Keep backgroundColorForCurrentSnapshot up to date on Mac too, even
though we don't use it yet.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</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="#trunkSourceWebKit2UIProcessAPIgtkPageClientImplcpp">trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkPageClientImplh">trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCoordinatedGraphicsWebViewh">trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h</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="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm">trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerh">trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm">trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/ChangeLog        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -1,5 +1,65 @@
</span><span class="cx"> 2015-03-31  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        WebKit briefly shows wrong webpage after swiping back (gigaom.com, or any site on a slow network)
+        https://bugs.webkit.org/show_bug.cgi?id=143256
+        &lt;rdar://problem/19458648&gt;
+
+        Reviewed by Dan Bernstein.
+
+        Instead of allowing a flash of the previous page when the swipe snapshot
+        timeouts fire (removing the snapshot before the new page is loaded), show
+        the snapshotted background color.
+
+        This fixes the problem on iOS, where UI-side compositing makes it easy to fix,
+        but not yet on OS X.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (baseScrollViewBackgroundColor):
+        (scrollViewBackgroundColor):
+        If the ViewGestureController returns a valid background color, use that
+        instead of the page's background color.
+
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        Expose _updateScrollViewBackground.
+
+        * UIProcess/PageClient.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::didChangeBackgroundColor):
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::didChangeBackgroundColor):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didChangeBackgroundColor):
+        * UIProcess/WebPageProxy.h:
+        Add and plumb didChangeBackgroundColor, which calls
+        _updateScrollViewBackground on iOS.
+        
+        * UIProcess/ios/ViewGestureControllerIOS.mm:
+        (WebKit::ViewGestureController::endSwipeGesture):
+        Hide the content of the drawing area until the next commit. This way,
+        even if the snapshot is removed (say, because a timeout fired), we won't
+        ever show the old page content (but we will show background color).
+
+        Store the background color associated with the current snapshot.
+
+        Let WKWebView know that it needs to recompute the background color.
+
+        (WebKit::ViewGestureController::removeSwipeSnapshot):
+        Clear the background color so that the next time we commit, WKWebView
+        will get an invalid color from ViewGestureController and fall back
+        to the page's extended background color instead.
+
+        * UIProcess/mac/ViewGestureController.h:
+        (WebKit::ViewGestureController::backgroundColorForCurrentSnapshot):
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        (WebKit::ViewGestureController::removeSwipeSnapshot):
+        Keep backgroundColorForCurrentSnapshot up to date on Mac too, even
+        though we don't use it yet.
+
+2015-03-31  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
</ins><span class="cx">         [iOS] Rotating PDF in Safari scrolls to the wrong position
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=143259
</span><span class="cx">         &lt;rdar://problem/19872693&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -740,18 +740,27 @@
</span><span class="cx">     return scale;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static WebCore::Color baseScrollViewBackgroundColor(WKWebView *webView)
+{
+    if (webView-&gt;_customContentView)
+        return [webView-&gt;_customContentView backgroundColor].CGColor;
+
+    if (webView-&gt;_gestureController) {
+        WebCore::Color color = webView-&gt;_gestureController-&gt;backgroundColorForCurrentSnapshot();
+        if (color.isValid())
+            return color;
+    }
+
+    return webView-&gt;_page-&gt;pageExtendedBackgroundColor();
+}
+
</ins><span class="cx"> static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
</span><span class="cx"> {
</span><span class="cx">     if (!webView.opaque)
</span><span class="cx">         return WebCore::Color::transparent;
</span><span class="cx"> 
</span><del>-    WebCore::Color color;
</del><ins>+    WebCore::Color color = baseScrollViewBackgroundColor(webView);
</ins><span class="cx"> 
</span><del>-    if (webView-&gt;_customContentView)
-        color = [webView-&gt;_customContentView backgroundColor].CGColor;
-    else
-        color = webView-&gt;_page-&gt;pageExtendedBackgroundColor();
-
</del><span class="cx">     if (!color.isValid())
</span><span class="cx">         color = WebCore::Color::white;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -99,6 +99,8 @@
</span><span class="cx"> - (BOOL)_isShowingVideoOptimized;
</span><span class="cx"> - (BOOL)_mayAutomaticallyShowVideoOptimized;
</span><span class="cx"> 
</span><ins>+- (void)_updateScrollViewBackground;
+
</ins><span class="cx"> @property (nonatomic, readonly) UIEdgeInsets _computedContentInset;
</span><span class="cx"> #else
</span><span class="cx"> @property (nonatomic, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkPageClientImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -430,4 +430,8 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::didChangeBackgroundColor()
+{
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -132,6 +132,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void doneWithTouchEvent(const NativeWebTouchEvent&amp;, bool wasEventHandled) override;
</span><span class="cx"> 
</span><ins>+    virtual void didChangeBackgroundColor() override;
+
</ins><span class="cx">     // Members of PageClientImpl class
</span><span class="cx">     GtkWidget* m_viewWidget;
</span><span class="cx">     DefaultUndoController m_undoController;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCoordinatedGraphicsWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -204,6 +204,8 @@
</span><span class="cx">     virtual void navigationGestureDidEnd(bool, WebBackForwardListItem&amp;) override { };
</span><span class="cx">     virtual void willRecordNavigationSnapshot(WebBackForwardListItem&amp;) override { };
</span><span class="cx"> 
</span><ins>+    virtual void didChangeBackgroundColor() override { }
+
</ins><span class="cx">     WebViewClient m_client;
</span><span class="cx">     RefPtr&lt;WebPageProxy&gt; m_page;
</span><span class="cx">     DefaultUndoController m_undoController;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -319,6 +319,8 @@
</span><span class="cx">     virtual void didFinishLoadForMainFrame() = 0;
</span><span class="cx">     virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) = 0;
</span><span class="cx"> 
</span><ins>+    virtual void didChangeBackgroundColor() = 0;
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     virtual void didPerformActionMenuHitTest(const ActionMenuHitTestResult&amp;, bool forImmediateAction, API::Object*) = 0;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -5671,4 +5671,9 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void WebPageProxy::didChangeBackgroundColor()
+{
+    m_pageClient.didChangeBackgroundColor();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -1025,6 +1025,8 @@
</span><span class="cx">     virtual void externalOutputDeviceAvailableDidChange(bool) override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void didChangeBackgroundColor();
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, uint64_t pageID, const WebPageConfiguration&amp;);
</span><span class="cx">     void platformInitialize();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -180,6 +180,8 @@
</span><span class="cx">     virtual void didFinishLoadForMainFrame() override;
</span><span class="cx">     virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
</span><span class="cx"> 
</span><ins>+    virtual void didChangeBackgroundColor() override;
+
</ins><span class="cx">     WKContentView *m_contentView;
</span><span class="cx">     WKWebView *m_webView;
</span><span class="cx">     WKView *m_wkView;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -713,6 +713,11 @@
</span><span class="cx">     [m_webView _didSameDocumentNavigationForMainFrame:navigationType];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::didChangeBackgroundColor()
+{
+    [m_webView _updateScrollViewBackground];
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -294,6 +294,7 @@
</span><span class="cx">             if (gestureControllerIter != viewGestureControllersForAllPages().end() &amp;&amp; gestureControllerIter-&gt;value-&gt;m_gesturePendingSnapshotRemoval == gesturePendingSnapshotRemoval)
</span><span class="cx">                 gestureControllerIter-&gt;value-&gt;willCommitPostSwipeTransitionLayerTree(error == CallbackBase::Error::None);
</span><span class="cx">         });
</span><ins>+        drawingArea-&gt;hideContentUntilNextUpdate();
</ins><span class="cx">     } else {
</span><span class="cx">         removeSwipeSnapshot();
</span><span class="cx">         return;
</span><span class="lines">@@ -306,6 +307,11 @@
</span><span class="cx">     m_swipeWaitingForScrollPositionRestoration = true;
</span><span class="cx"> 
</span><span class="cx">     m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
</span><ins>+
+    if (ViewSnapshot* snapshot = targetItem-&gt;snapshot()) {
+        m_backgroundColorForCurrentSnapshot = snapshot-&gt;backgroundColor();
+        m_webPageProxy.didChangeBackgroundColor();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ViewGestureController::willCommitPostSwipeTransitionLayerTree(bool successful)
</span><span class="lines">@@ -432,6 +438,8 @@
</span><span class="cx">     m_webPageProxyForBackForwardListForCurrentSwipe = nullptr;
</span><span class="cx"> 
</span><span class="cx">     m_swipeTransitionContext = nullptr;
</span><ins>+
+    m_backgroundColorForCurrentSnapshot = Color();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -198,6 +198,8 @@
</span><span class="cx">     virtual void didPerformActionMenuHitTest(const ActionMenuHitTestResult&amp;, bool forImmediateAction, API::Object*) override;
</span><span class="cx">     virtual void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) override;
</span><span class="cx"> 
</span><ins>+    virtual void didChangeBackgroundColor() override;
+
</ins><span class="cx">     WKView *m_wkView;
</span><span class="cx">     WKWebView *m_webView;
</span><span class="cx">     RetainPtr&lt;WKEditorUndoTargetObjC&gt; m_undoTarget;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -779,6 +779,11 @@
</span><span class="cx">     [m_wkView _removeNavigationGestureSnapshot];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::didChangeBackgroundColor()
+{
+    notImplemented();
+}
+
</ins><span class="cx"> CGRect PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const
</span><span class="cx"> {
</span><span class="cx">     CALayer *windowContentLayer = static_cast&lt;NSView *&gt;(m_wkView.window.contentView).layer;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;MessageReceiver.h&quot;
</span><span class="cx"> #include &quot;SameDocumentNavigationType.h&quot;
</span><span class="cx"> #include &quot;WeakObjCPtr.h&quot;
</span><ins>+#include &lt;WebCore/Color.h&gt;
</ins><span class="cx"> #include &lt;WebCore/FloatRect.h&gt;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><span class="lines">@@ -124,6 +125,8 @@
</span><span class="cx">     void removeSwipeSnapshot();
</span><span class="cx">     void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType);
</span><span class="cx"> 
</span><ins>+    WebCore::Color backgroundColorForCurrentSnapshot() const { return m_backgroundColorForCurrentSnapshot; }
+
</ins><span class="cx"> private:
</span><span class="cx">     // IPC::MessageReceiver.
</span><span class="cx">     virtual void didReceiveMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
</span><span class="lines">@@ -163,6 +166,8 @@
</span><span class="cx">     RunLoop::Timer&lt;ViewGestureController&gt; m_swipeWatchdogTimer;
</span><span class="cx">     RunLoop::Timer&lt;ViewGestureController&gt; m_swipeActiveLoadMonitoringTimer;
</span><span class="cx"> 
</span><ins>+    WebCore::Color m_backgroundColorForCurrentSnapshot;
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     RefPtr&lt;ViewSnapshot&gt; m_currentSwipeSnapshot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (182202 => 182203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2015-03-31 20:50:12 UTC (rev 182202)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2015-03-31 20:53:32 UTC (rev 182203)
</span><span class="lines">@@ -661,7 +661,12 @@
</span><span class="cx">     m_webPageProxy.navigationGestureDidEnd(true, *targetItem);
</span><span class="cx">     m_webPageProxy.goToBackForwardItem(targetItem);
</span><span class="cx"> 
</span><ins>+    // FIXME: Like on iOS, we should ensure that even if one of the timeouts fires,
+    // we never show the old page content, instead showing white (or the snapshot background color).
</ins><span class="cx">     m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
</span><ins>+
+    if (ViewSnapshot* snapshot = targetItem-&gt;snapshot())
+        m_backgroundColorForCurrentSnapshot = snapshot-&gt;backgroundColor();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ViewGestureController::didHitRenderTreeSizeThreshold()
</span><span class="lines">@@ -778,6 +783,8 @@
</span><span class="cx">     m_activeGestureType = ViewGestureType::None;
</span><span class="cx"> 
</span><span class="cx">     m_webPageProxy.navigationGestureSnapshotWasRemoved();
</span><ins>+
+    m_backgroundColorForCurrentSnapshot = Color();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ViewGestureController::endActiveGesture()
</span></span></pre>
</div>
</div>

</body>
</html>