<!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>[197062] 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/197062">197062</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-02-24 23:37:40 -0800 (Wed, 24 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Tearing when entering AC mode
https://bugs.webkit.org/show_bug.cgi?id=150955

Reviewed by Michael Catanzaro.

Source/WebCore:

* platform/gtk/GtkUtilities.cpp:
(WebCore::widgetIsOnscreenToplevelWindow): Allow passing nullptr.

Source/WebKit2:

When entering accelerated compositing mode, we keep rendering the
non accelerated contents until we have the first frame of
accelerated compositing contents. When the view is created hidden,
for example when the browser opens a link in a new tab, the view
is not realized until it is mapped. The native surface handle for
compositing, needed by the web process to render accelerated
compositing contents, is not available until the view is realized,
because it depends on the properties of the parent. When a web
view is mapped for the first time, and then realized, we send the
native surface handle for compositing to the web process, and keep
rendering the non composited contents until we get the first
frame, but in this case we never had non composited contents and
we end up rendering an untinitalized surface. This sometimes just
produces flickering and sometimes rendering artifacts.
We can prevent this from happening by realizing the web view as
soon as possible. A GtkWidget can't be realized until it has been
added to a toplevel, so we can realize our view right after it is
added to a toplevel window, and wait until the view is actually
mapped to notify the web process that it has been added to a
window. This way can we enter accelerated compositing mode before
the web view is mapped, so that when mapped we don't try to paint
the previous contents and don't need to wait for the first frame.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(toplevelWindowFocusInEvent): Handle the case of the window being
hidden when receiving focus in. According to
gtk_window_focus_in_event, this can happen.
(webkitWebViewBaseSetToplevelOnScreenWindow): When the web view is
removed from its toplevel parent, update the IsInWindow and
WindowIsActive flags accordingly. When the view is added to a
toplevel, realize it and don't update the window flags, they will be
updated when the view is mapped the first time.
(webkitWebViewBaseMap): Also update IsInWindow and WindowIsActive
flags if needed. This way, if for example you open a youtube video
in a new tab, the video won't start playing until you visit the
tab, like we did when the view was realized on map.
(webkitWebViewBaseHierarchyChanged): Use hierarchy-changed signal
instead of parent-set to be notified when the view is added to or
removed from a toplevel.
(webkit_web_view_base_class_init): Implement hierarchy-changed
instead of parent-set.
(webkitWebViewBaseRealize): Do not call
webkitWebViewBaseSetToplevelOnScreenWindow on realize, it's now
webkitWebViewBaseSetToplevelOnScreenWindow the one realizing the view.
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::BackingStore::createBackend): Do not realize the view
here, it should be realized already at this point. If it's not
realized at this point is because it hasn't been added to a
toplevel and gtk_widget_realize will not work anyway.
(WebKit::BackingStore::paint): This is changing the cairo source
operator, so save/restore the cairo context to ensure it doesn't
affect other drawing done after this.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGtkUtilitiescpp">trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcesscairoBackingStoreCairocpp">trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197061 => 197062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-25 04:59:18 UTC (rev 197061)
+++ trunk/Source/WebCore/ChangeLog        2016-02-25 07:37:40 UTC (rev 197062)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-02-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Tearing when entering AC mode
+        https://bugs.webkit.org/show_bug.cgi?id=150955
+
+        Reviewed by Michael Catanzaro.
+
+        * platform/gtk/GtkUtilities.cpp:
+        (WebCore::widgetIsOnscreenToplevelWindow): Allow passing nullptr.
+
</ins><span class="cx"> 2016-02-24  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Drop [TreatReturnedNullStringAs=Null] WebKit-specific IDL attribute
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGtkUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp (197061 => 197062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp        2016-02-25 04:59:18 UTC (rev 197061)
+++ trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp        2016-02-25 07:37:40 UTC (rev 197062)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool widgetIsOnscreenToplevelWindow(GtkWidget* widget)
</span><span class="cx"> {
</span><del>-    return gtk_widget_is_toplevel(widget) &amp;&amp; GTK_IS_WINDOW(widget) &amp;&amp; !GTK_IS_OFFSCREEN_WINDOW(widget);
</del><ins>+    return widget &amp;&amp; gtk_widget_is_toplevel(widget) &amp;&amp; GTK_IS_WINDOW(widget) &amp;&amp; !GTK_IS_OFFSCREEN_WINDOW(widget);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DEVELOPER_MODE)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (197061 => 197062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-02-25 04:59:18 UTC (rev 197061)
+++ trunk/Source/WebKit2/ChangeLog        2016-02-25 07:37:40 UTC (rev 197062)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2016-02-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Tearing when entering AC mode
+        https://bugs.webkit.org/show_bug.cgi?id=150955
+
+        Reviewed by Michael Catanzaro.
+
+        When entering accelerated compositing mode, we keep rendering the
+        non accelerated contents until we have the first frame of
+        accelerated compositing contents. When the view is created hidden,
+        for example when the browser opens a link in a new tab, the view
+        is not realized until it is mapped. The native surface handle for
+        compositing, needed by the web process to render accelerated
+        compositing contents, is not available until the view is realized,
+        because it depends on the properties of the parent. When a web
+        view is mapped for the first time, and then realized, we send the
+        native surface handle for compositing to the web process, and keep
+        rendering the non composited contents until we get the first
+        frame, but in this case we never had non composited contents and
+        we end up rendering an untinitalized surface. This sometimes just
+        produces flickering and sometimes rendering artifacts.
+        We can prevent this from happening by realizing the web view as
+        soon as possible. A GtkWidget can't be realized until it has been
+        added to a toplevel, so we can realize our view right after it is
+        added to a toplevel window, and wait until the view is actually
+        mapped to notify the web process that it has been added to a
+        window. This way can we enter accelerated compositing mode before
+        the web view is mapped, so that when mapped we don't try to paint
+        the previous contents and don't need to wait for the first frame.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (toplevelWindowFocusInEvent): Handle the case of the window being
+        hidden when receiving focus in. According to
+        gtk_window_focus_in_event, this can happen.
+        (webkitWebViewBaseSetToplevelOnScreenWindow): When the web view is
+        removed from its toplevel parent, update the IsInWindow and
+        WindowIsActive flags accordingly. When the view is added to a
+        toplevel, realize it and don't update the window flags, they will be
+        updated when the view is mapped the first time.
+        (webkitWebViewBaseMap): Also update IsInWindow and WindowIsActive
+        flags if needed. This way, if for example you open a youtube video
+        in a new tab, the video won't start playing until you visit the
+        tab, like we did when the view was realized on map.
+        (webkitWebViewBaseHierarchyChanged): Use hierarchy-changed signal
+        instead of parent-set to be notified when the view is added to or
+        removed from a toplevel.
+        (webkit_web_view_base_class_init): Implement hierarchy-changed
+        instead of parent-set.
+        (webkitWebViewBaseRealize): Do not call
+        webkitWebViewBaseSetToplevelOnScreenWindow on realize, it's now
+        webkitWebViewBaseSetToplevelOnScreenWindow the one realizing the view.
+        * UIProcess/cairo/BackingStoreCairo.cpp:
+        (WebKit::BackingStore::createBackend): Do not realize the view
+        here, it should be realized already at this point. If it's not
+        realized at this point is because it hasn't been added to a
+        toplevel and gtk_widget_realize will not work anyway.
+        (WebKit::BackingStore::paint): This is changing the cairo source
+        operator, so save/restore the cairo context to ensure it doesn't
+        affect other drawing done after this.
+
</ins><span class="cx"> 2016-02-24  Nikos Andronikos  &lt;nikos.andronikos-webkit@cisra.canon.com.au&gt;
</span><span class="cx"> 
</span><span class="cx">         [web-animations] Add AnimationTimeline, DocumentTimeline and add extensions to Document interface
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (197061 => 197062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2016-02-25 04:59:18 UTC (rev 197061)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2016-02-25 07:37:40 UTC (rev 197062)
</span><span class="lines">@@ -237,8 +237,12 @@
</span><span class="cx">     priv-&gt;updateViewStateTimer.startOneShot(0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static gboolean toplevelWindowFocusInEvent(GtkWidget*, GdkEventFocus*, WebKitWebViewBase* webViewBase)
</del><ins>+static gboolean toplevelWindowFocusInEvent(GtkWidget* widget, GdkEventFocus*, WebKitWebViewBase* webViewBase)
</ins><span class="cx"> {
</span><ins>+    // Spurious focus in events can occur when the window is hidden.
+    if (!gtk_widget_get_visible(widget))
+        return FALSE;
+
</ins><span class="cx">     WebKitWebViewBasePrivate* priv = webViewBase-&gt;priv;
</span><span class="cx">     if (priv-&gt;viewState &amp; ViewState::WindowIsActive)
</span><span class="cx">         return FALSE;
</span><span class="lines">@@ -300,12 +304,22 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     priv-&gt;toplevelOnScreenWindow = window;
</span><del>-    if (!(priv-&gt;viewState &amp; ViewState::IsInWindow)) {
-        priv-&gt;viewState |= ViewState::IsInWindow;
-        webkitWebViewBaseScheduleUpdateViewState(webViewBase, ViewState::IsInWindow);
</del><ins>+
+    if (!priv-&gt;toplevelOnScreenWindow) {
+        ViewState::Flags flagsToUpdate = 0;
+        if (priv-&gt;viewState &amp; ViewState::IsInWindow) {
+            priv-&gt;viewState &amp;= ~ViewState::IsInWindow;
+            flagsToUpdate |= ViewState::IsInWindow;
+        }
+        if (priv-&gt;viewState &amp; ViewState::WindowIsActive) {
+            priv-&gt;viewState &amp;= ~ViewState::WindowIsActive;
+            flagsToUpdate |= ViewState::IsInWindow;
+        }
+        if (flagsToUpdate)
+            webkitWebViewBaseScheduleUpdateViewState(webViewBase, flagsToUpdate);
+
+        return;
</ins><span class="cx">     }
</span><del>-    if (!priv-&gt;toplevelOnScreenWindow)
-        return;
</del><span class="cx"> 
</span><span class="cx">     priv-&gt;toplevelFocusInEventID =
</span><span class="cx">         g_signal_connect(priv-&gt;toplevelOnScreenWindow, &quot;focus-in-event&quot;,
</span><span class="lines">@@ -315,6 +329,7 @@
</span><span class="cx">                          G_CALLBACK(toplevelWindowFocusOutEvent), webViewBase);
</span><span class="cx">     priv-&gt;toplevelWindowStateEventID =
</span><span class="cx">         g_signal_connect(priv-&gt;toplevelOnScreenWindow, &quot;window-state-event&quot;, G_CALLBACK(toplevelWindowStateEvent), webViewBase);
</span><ins>+    gtk_widget_realize(GTK_WIDGET(webViewBase));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebViewBaseRealize(GtkWidget* widget)
</span><span class="lines">@@ -383,10 +398,6 @@
</span><span class="cx">     gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
</span><span class="cx"> 
</span><span class="cx">     gtk_im_context_set_client_window(priv-&gt;inputMethodFilter.context(), window);
</span><del>-
-    GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
-    if (widgetIsOnscreenToplevelWindow(toplevel))
-        webkitWebViewBaseSetToplevelOnScreenWindow(webView, GTK_WINDOW(toplevel));
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebViewBaseUnrealize(GtkWidget* widget)
</span><span class="lines">@@ -670,11 +681,20 @@
</span><span class="cx"> 
</span><span class="cx">     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
</span><span class="cx">     WebKitWebViewBasePrivate* priv = webViewBase-&gt;priv;
</span><del>-    if (priv-&gt;viewState &amp; ViewState::IsVisible)
</del><ins>+    ViewState::Flags flagsToUpdate = 0;
+    if (!(priv-&gt;viewState &amp; ViewState::IsVisible))
+        flagsToUpdate |= ViewState::IsVisible;
+    if (priv-&gt;toplevelOnScreenWindow) {
+        if (!(priv-&gt;viewState &amp; ViewState::IsInWindow))
+            flagsToUpdate |= ViewState::IsInWindow;
+        if (gtk_window_is_active(GTK_WINDOW(priv-&gt;toplevelOnScreenWindow)) &amp;&amp; !(priv-&gt;viewState &amp; ViewState::WindowIsActive))
+            flagsToUpdate |= ViewState::WindowIsActive;
+    }
+    if (!flagsToUpdate)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    priv-&gt;viewState |= ViewState::IsVisible;
-    webkitWebViewBaseScheduleUpdateViewState(webViewBase, ViewState::IsVisible);
</del><ins>+    priv-&gt;viewState |= flagsToUpdate;
+    webkitWebViewBaseScheduleUpdateViewState(webViewBase, flagsToUpdate);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebViewBaseUnmap(GtkWidget* widget)
</span><span class="lines">@@ -1072,10 +1092,19 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(DRAG_SUPPORT)
</span><span class="cx"> 
</span><del>-static void webkitWebViewBaseParentSet(GtkWidget* widget, GtkWidget* /* oldParent */)
</del><ins>+static void webkitWebViewBaseHierarchyChanged(GtkWidget* widget, GtkWidget* oldToplevel)
</ins><span class="cx"> {
</span><del>-    if (!gtk_widget_get_parent(widget))
-        webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), 0);
</del><ins>+    WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv;
+    if (widgetIsOnscreenToplevelWindow(oldToplevel) &amp;&amp; GTK_WINDOW(oldToplevel) == priv-&gt;toplevelOnScreenWindow) {
+        webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), nullptr);
+        return;
+    }
+
+    if (!oldToplevel) {
+        GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
+        if (widgetIsOnscreenToplevelWindow(toplevel))
+            webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), GTK_WINDOW(toplevel));
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static gboolean webkitWebViewBaseFocus(GtkWidget* widget, GtkDirectionType direction)
</span><span class="lines">@@ -1134,7 +1163,7 @@
</span><span class="cx">     widgetClass-&gt;drag_data_received = webkitWebViewBaseDragDataReceived;
</span><span class="cx"> #endif // ENABLE(DRAG_SUPPORT)
</span><span class="cx">     widgetClass-&gt;get_accessible = webkitWebViewBaseGetAccessible;
</span><del>-    widgetClass-&gt;parent_set = webkitWebViewBaseParentSet;
</del><ins>+    widgetClass-&gt;hierarchy_changed = webkitWebViewBaseHierarchyChanged;
</ins><span class="cx">     widgetClass-&gt;destroy = webkitWebViewBaseDestroy;
</span><span class="cx"> 
</span><span class="cx">     GObjectClass* gobjectClass = G_OBJECT_CLASS(webkitWebViewBaseClass);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesscairoBackingStoreCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp (197061 => 197062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2016-02-25 04:59:18 UTC (rev 197061)
+++ trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2016-02-25 07:37:40 UTC (rev 197062)
</span><span class="lines">@@ -67,9 +67,7 @@
</span><span class="cx">     scaledSize.scale(m_deviceScaleFactor);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-    GtkWidget* viewWidget = m_webPageProxy.viewWidget();
-    gtk_widget_realize(viewWidget);
-    RefPtr&lt;cairo_surface_t&gt; surface = adoptRef(gdk_window_create_similar_surface(gtk_widget_get_window(viewWidget),
</del><ins>+    RefPtr&lt;cairo_surface_t&gt; surface = adoptRef(gdk_window_create_similar_surface(gtk_widget_get_window(m_webPageProxy.viewWidget()),
</ins><span class="cx">         CAIRO_CONTENT_COLOR_ALPHA, scaledSize.width(), scaledSize.height()));
</span><span class="cx"> #else
</span><span class="cx">     RefPtr&lt;cairo_surface_t&gt; surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, scaledSize.width(), scaledSize.height()));
</span><span class="lines">@@ -83,10 +81,12 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_backend);
</span><span class="cx"> 
</span><ins>+    cairo_save(context);
</ins><span class="cx">     cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
</span><span class="cx">     cairo_set_source_surface(context, m_backend-&gt;surface(), 0, 0);
</span><span class="cx">     cairo_rectangle(context, rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx">     cairo_fill(context);
</span><ins>+    cairo_restore(context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo&amp; updateInfo)
</span></span></pre>
</div>
</div>

</body>
</html>