Title: [203500] trunk/Source/WebKit2
Revision
203500
Author
[email protected]
Date
2016-07-21 00:35:49 -0700 (Thu, 21 Jul 2016)

Log Message

[GTK] White page when loaded tab is visited until it's hovered when AC mode is always on
https://bugs.webkit.org/show_bug.cgi?id=159512

Reviewed by Michael Catanzaro.

The redirected window is always mapped, but offscreen, to ensure that the web process can always render
there. When the web process renders something into the offscreen window, we receive a damage event in the UI
process and queue a redraw of the web view. However, when the web view is not mapped, even if we still receive
the damage events, the web view redraws are ignored until the view is mapped again (gtk_widget_queue_draw()
returns early when the widget is not visible). The redirected window updates its pixmap on demand when the
surface is requested, which happens when the web view draws its contents. So when the web view becames visible,
the redirected window creates a new pixmap and surface (the first time or if the web view was resized), that we
initialize to avoid artifacts when the web process hasn't render anything yet. That initialization is actually
overwriting anything rendered into the redirected window while the view was unmapped. That's why see white pages
the first time, and previous contents after a resize, and we don't see the actual contents until the web process
renders again and we reuse the existing pixmap. The white page didn't happen for tabs with accelerated content,
because in those cases the web process was rendering a new frame every 16ms, but instead there was a flickering
effect due to the current frame being overwritten when the view is mapped until the next frame.
So, instead of lazily create and initialize the redirected window pixmap and surface, we should always create
the new pixmap as soon as the window is created or resized (and not empty) This fixes the issues but also makes
resizing the window a bit smoother when AC mode is enabled.

* UIProcess/gtk/RedirectedXCompositeWindow.cpp:
(WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Create the pixmap and surface if the window is
not empty.
(WebKit::RedirectedXCompositeWindow::resize): Ditto.
(WebKit::RedirectedXCompositeWindow::createNewPixampAndPixampSurface): Create the pixmap and surface.
(WebKit::RedirectedXCompositeWindow::surface): Deleted.
* UIProcess/gtk/RedirectedXCompositeWindow.h:
(WebKit::RedirectedXCompositeWindow::surface):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (203499 => 203500)


--- trunk/Source/WebKit2/ChangeLog	2016-07-21 07:33:28 UTC (rev 203499)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-21 07:35:49 UTC (rev 203500)
@@ -1,5 +1,38 @@
 2016-07-21  Carlos Garcia Campos  <[email protected]>
 
+        [GTK] White page when loaded tab is visited until it's hovered when AC mode is always on
+        https://bugs.webkit.org/show_bug.cgi?id=159512
+
+        Reviewed by Michael Catanzaro.
+
+        The redirected window is always mapped, but offscreen, to ensure that the web process can always render
+        there. When the web process renders something into the offscreen window, we receive a damage event in the UI
+        process and queue a redraw of the web view. However, when the web view is not mapped, even if we still receive
+        the damage events, the web view redraws are ignored until the view is mapped again (gtk_widget_queue_draw()
+        returns early when the widget is not visible). The redirected window updates its pixmap on demand when the
+        surface is requested, which happens when the web view draws its contents. So when the web view becames visible,
+        the redirected window creates a new pixmap and surface (the first time or if the web view was resized), that we
+        initialize to avoid artifacts when the web process hasn't render anything yet. That initialization is actually
+        overwriting anything rendered into the redirected window while the view was unmapped. That's why see white pages
+        the first time, and previous contents after a resize, and we don't see the actual contents until the web process
+        renders again and we reuse the existing pixmap. The white page didn't happen for tabs with accelerated content,
+        because in those cases the web process was rendering a new frame every 16ms, but instead there was a flickering
+        effect due to the current frame being overwritten when the view is mapped until the next frame.
+        So, instead of lazily create and initialize the redirected window pixmap and surface, we should always create
+        the new pixmap as soon as the window is created or resized (and not empty) This fixes the issues but also makes
+        resizing the window a bit smoother when AC mode is enabled.
+
+        * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
+        (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Create the pixmap and surface if the window is
+        not empty.
+        (WebKit::RedirectedXCompositeWindow::resize): Ditto.
+        (WebKit::RedirectedXCompositeWindow::createNewPixampAndPixampSurface): Create the pixmap and surface.
+        (WebKit::RedirectedXCompositeWindow::surface): Deleted.
+        * UIProcess/gtk/RedirectedXCompositeWindow.h:
+        (WebKit::RedirectedXCompositeWindow::surface):
+
+2016-07-21  Carlos Garcia Campos  <[email protected]>
+
         [GTK][Threaded Compositor] Web view background colors don't work
         https://bugs.webkit.org/show_bug.cgi?id=159465
 

Modified: trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp (203499 => 203500)


--- trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp	2016-07-21 07:33:28 UTC (rev 203499)
+++ trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp	2016-07-21 07:35:49 UTC (rev 203500)
@@ -204,6 +204,8 @@
     }
     XSelectInput(m_display, m_window.get(), NoEventMask);
     XCompositeRedirectWindow(m_display, m_window.get(), CompositeRedirectManual);
+    if (!m_size.isEmpty())
+        createNewPixampAndPixampSurface();
     m_damage = XDamageCreate(m_display, m_window.get(), XDamageReportNonEmpty);
 }
 
@@ -234,9 +236,10 @@
     XFlush(m_display);
 
     m_size = scaledSize;
-    m_needsNewPixmapAfterResize = true;
     if (m_size.isEmpty())
         cleanupPixmapAndPixmapSurface();
+    else
+        createNewPixampAndPixampSurface();
 }
 
 void RedirectedXCompositeWindow::cleanupPixmapAndPixmapSurface()
@@ -248,26 +251,20 @@
     m_pixmap.reset();
 }
 
-cairo_surface_t* RedirectedXCompositeWindow::surface()
+void RedirectedXCompositeWindow::createNewPixampAndPixampSurface()
 {
     // This should never be called with an empty size (not in Accelerated Compositing mode).
     ASSERT(!m_size.isEmpty());
-
-    if (!m_needsNewPixmapAfterResize && m_surface)
-        return m_surface.get();
-
-    m_needsNewPixmapAfterResize = false;
-
     XUniquePixmap newPixmap(XCompositeNameWindowPixmap(m_display, m_window.get()));
     if (!newPixmap) {
         cleanupPixmapAndPixmapSurface();
-        return nullptr;
+        return;
     }
 
     XWindowAttributes windowAttributes;
     if (!XGetWindowAttributes(m_display, m_window.get(), &windowAttributes)) {
         cleanupPixmapAndPixmapSurface();
-        return nullptr;
+        return;
     }
 
     RefPtr<cairo_surface_t> newSurface = adoptRef(cairo_xlib_surface_create(m_display, newPixmap.get(), windowAttributes.visual, m_size.width(), m_size.height()));
@@ -292,8 +289,7 @@
 
     cleanupPixmapAndPixmapSurface();
     m_pixmap = WTFMove(newPixmap);
-    m_surface = newSurface;
-    return m_surface.get();
+    m_surface = WTFMove(newSurface);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h (203499 => 203500)


--- trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h	2016-07-21 07:33:28 UTC (rev 203499)
+++ trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h	2016-07-21 07:35:49 UTC (rev 203500)
@@ -50,10 +50,11 @@
 
     Window windowID() const { return m_window.get(); }
     void resize(const WebCore::IntSize&);
-    cairo_surface_t* surface();
+    cairo_surface_t* surface() const { return m_surface.get(); };
 
 private:
     RedirectedXCompositeWindow(WebPageProxy&, const WebCore::IntSize&, std::function<void ()>&& damageNotify);
+    void createNewPixampAndPixampSurface();
     void cleanupPixmapAndPixmapSurface();
 
     WebPageProxy& m_webPage;
@@ -64,7 +65,6 @@
     WebCore::XUniquePixmap m_pixmap;
     WebCore::XUniqueDamage m_damage;
     RefPtr<cairo_surface_t> m_surface;
-    bool m_needsNewPixmapAfterResize { false };
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to