Title: [129131] releases/WebKitGTK/webkit-1.10/Source
Revision
129131
Author
[email protected]
Date
2012-09-20 07:33:00 -0700 (Thu, 20 Sep 2012)

Log Message

Merge r128907 - [GTK] [WebKit2] Use XComposite window for accelerated compositing
https://bugs.webkit.org/show_bug.cgi?id=94417

Reviewed by Carlos Garcia Campos.

Instead of rendering directly to the widget's native window, render to an
offscreen window redirected to a Pixmap with XComposite.

Source/WebCore:

No new tests. This will be covered by the existing accelerated compositing tests,
which should now give correct pixel results.

* platform/gtk/RedirectedXCompositeWindow.cpp:
(WebCore::RedirectedXCompositeWindow::resize): Add a call to XFlush which ensures
that pending X11 operations complete.
* platform/gtk/RedirectedXCompositeWindow.h:
(WebCore::RedirectedXCompositeWindow::windowId): Added this accessor.

Source/WebKit2:

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate): Added a few members necessary to track the
offscreen window.
(webkit_web_view_base_init):
(renderAcceleratedCompositingResults): Added this helper functions which renders
the results of the accelerated compositing operations during the GTK+ draw loop.
(webkitWebViewBaseDraw): Call renderAcceleratedCompositingResults when appropriate.
(resizeWebKitWebViewBaseFromAllocation): Resize the offscreen window when appropriate.
(webkitWebViewBaseSizeAllocate): Do not call resizeWebKitWebViewBaseFromAllocation when
the actual size of the widget does not change. This prevents destroying and recreating
the offscreen window pixmap when it isn't necessary.
(webkitWebViewBaseMap): We no longer send the window id during map, instead it's sent
as soon as there is WebPageProxy.
(webkitWebViewBaseCreateWebPage): Send the window id of the redirected window to
the WebProcess.
(queueAnotherDrawOfAcceleratedCompositingResults): Added this helper which works
around the issue of slow updates of the pixmap backing the redirected XComposite window.
(webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults): Added this method which
is what the WebProcess uses to force a redraw on the UIProcess side.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Added new method to the list of private methods.
* UIProcess/DrawingAreaProxyImpl.h:
(DrawingAreaProxyImpl):
(WebKit::DrawingAreaProxyImpl::isInAcceleratedCompositingMode): Exposed this method publically
so that it can be used from WebKitWebViewBase.
* UIProcess/WebPageProxy.h:
(WebPageProxy): Renamed widgetMapped to setAcceleratedCompositingWindowId.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/gtk/WebPageProxyGtk.cpp: Ditto.
(WebKit::WebPageProxy::setAcceleratedCompositingWindowId):
* WebProcess/WebPage/WebPage.h:
(WebPage): Ditto.
* WebProcess/WebPage/WebPage.messages.in: Ditto.
* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::sizeDidChange): Force a composite to the resized window right
away so that the new window pixmap is updated before the first draw.
(WebKit::LayerTreeHostGtk::compositeLayersToContext): If the composition is for a resize,
first clear the entire GL context so that we don't see black artifacts during resize.
* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
(LayerTreeHostGtk): Update the signature of  compositeLayersToContext.
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::setAcceleratedCompositingWindowId): Added.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-20 14:33:00 UTC (rev 129131)
@@ -1,3 +1,22 @@
+2012-09-18  Martin Robinson  <[email protected]>
+
+        [GTK] [WebKit2] Use XComposite window for accelerated compositing
+        https://bugs.webkit.org/show_bug.cgi?id=94417
+
+        Reviewed by Carlos Garcia Campos.
+
+        Instead of rendering directly to the widget's native window, render to an
+        offscreen window redirected to a Pixmap with XComposite.
+
+        No new tests. This will be covered by the existing accelerated compositing tests,
+        which should now give correct pixel results.
+
+        * platform/gtk/RedirectedXCompositeWindow.cpp:
+        (WebCore::RedirectedXCompositeWindow::resize): Add a call to XFlush which ensures
+        that pending X11 operations complete.
+        * platform/gtk/RedirectedXCompositeWindow.h:
+        (WebCore::RedirectedXCompositeWindow::windowId): Added this accessor.
+
 2012-09-10  Joanmarie Diggs  <[email protected]>
 
         Properly expose <legend> elements to ATs

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp	2012-09-20 14:33:00 UTC (rev 129131)
@@ -136,6 +136,8 @@
 
     Display* display = GLContextGLX::sharedDisplay();
     XResizeWindow(display, m_window, size.width(), size.height());
+
+    XFlush(display);
     glXWaitX();
 
     // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h	2012-09-20 14:33:00 UTC (rev 129131)
@@ -47,6 +47,7 @@
     void resize(const IntSize& newSize);
     GLContext* context();
     cairo_surface_t* cairoSurfaceForWidget(GtkWidget*);
+    Window windowId() { return m_window; }
 
 private:
     RedirectedXCompositeWindow(const IntSize&);

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/ChangeLog (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/ChangeLog	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/ChangeLog	2012-09-20 14:33:00 UTC (rev 129131)
@@ -1,3 +1,55 @@
+2012-09-18  Martin Robinson  <[email protected]>
+
+        [GTK] [WebKit2] Use XComposite window for accelerated compositing
+        https://bugs.webkit.org/show_bug.cgi?id=94417
+
+        Reviewed by Carlos Garcia Campos.
+
+        Instead of rendering directly to the widget's native window, render to an
+        offscreen window redirected to a Pixmap with XComposite.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (_WebKitWebViewBasePrivate): Added a few members necessary to track the 
+        offscreen window.
+        (webkit_web_view_base_init):
+        (renderAcceleratedCompositingResults): Added this helper functions which renders
+        the results of the accelerated compositing operations during the GTK+ draw loop.
+        (webkitWebViewBaseDraw): Call renderAcceleratedCompositingResults when appropriate.
+        (resizeWebKitWebViewBaseFromAllocation): Resize the offscreen window when appropriate.
+        (webkitWebViewBaseSizeAllocate): Do not call resizeWebKitWebViewBaseFromAllocation when
+        the actual size of the widget does not change. This prevents destroying and recreating
+        the offscreen window pixmap when it isn't necessary.
+        (webkitWebViewBaseMap): We no longer send the window id during map, instead it's sent
+        as soon as there is WebPageProxy.
+        (webkitWebViewBaseCreateWebPage): Send the window id of the redirected window to
+        the WebProcess.
+        (queueAnotherDrawOfAcceleratedCompositingResults): Added this helper which works
+        around the issue of slow updates of the pixmap backing the redirected XComposite window.
+        (webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults): Added this method which
+        is what the WebProcess uses to force a redraw on the UIProcess side.
+        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Added new method to the list of private methods.
+        * UIProcess/DrawingAreaProxyImpl.h:
+        (DrawingAreaProxyImpl):
+        (WebKit::DrawingAreaProxyImpl::isInAcceleratedCompositingMode): Exposed this method publically
+        so that it can be used from WebKitWebViewBase.
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy): Renamed widgetMapped to setAcceleratedCompositingWindowId.
+        * UIProcess/WebPageProxy.messages.in: Ditto.
+        * UIProcess/gtk/WebPageProxyGtk.cpp: Ditto.
+        (WebKit::WebPageProxy::setAcceleratedCompositingWindowId):
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage): Ditto.
+        * WebProcess/WebPage/WebPage.messages.in: Ditto.
+        * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
+        (WebKit::LayerTreeHostGtk::sizeDidChange): Force a composite to the resized window right
+        away so that the new window pixmap is updated before the first draw.
+        (WebKit::LayerTreeHostGtk::compositeLayersToContext): If the composition is for a resize,
+        first clear the entire GL context so that we don't see black artifacts during resize.
+        * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
+        (LayerTreeHostGtk): Update the signature of  compositeLayersToContext.
+        * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+        (WebKit::WebPage::setAcceleratedCompositingWindowId): Added.
+
 2012-09-10  Carlos Garcia Campos  <[email protected]>
 
         [SOUP] Don't convert to UTF-8 the suggestedFilename passed to Download::decideDestinationWithSuggestedFilename()

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2012-09-20 14:33:00 UTC (rev 129131)
@@ -67,7 +67,7 @@
 #endif
 
 #if USE(TEXTURE_MAPPER_GL) && defined(GDK_WINDOWING_X11)
-#include <gdk/gdkx.h>
+#include <WebCore/RedirectedXCompositeWindow.h>
 #endif
 
 using namespace WebKit;
@@ -89,14 +89,20 @@
     IntSize resizerSize;
     GRefPtr<AtkObject> accessible;
     bool needsResizeOnMap;
+    GtkWidget* inspectorView;
+    unsigned inspectorViewHeight;
+    GOwnPtr<GdkEvent> contextMenuEvent;
+    WebContextMenuProxyGtk* activeContextMenuProxy;
+
 #if ENABLE(FULLSCREEN_API)
     bool fullScreenModeActive;
     WebFullScreenClientGtk fullScreenClient;
 #endif
-    GtkWidget* inspectorView;
-    unsigned inspectorViewHeight;
-    GOwnPtr<GdkEvent> contextMenuEvent;
-    WebContextMenuProxyGtk* activeContextMenuProxy;
+
+#if USE(TEXTURE_MAPPER_GL)
+    OwnPtr<RedirectedXCompositeWindow> redirectedWindow;
+    bool readyToRenderAcceleratedCompositingResults;
+#endif
 };
 
 G_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER)
@@ -161,9 +167,6 @@
     gint attributesMask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
 
     GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributesMask);
-#if USE(TEXTURE_MAPPER_GL)
-    gdk_window_ensure_native(window);
-#endif
     gtk_widget_set_window(widget, window);
     gdk_window_set_user_data(window, widget);
 
@@ -263,7 +266,6 @@
     priv->shouldForwardNextKeyEvent = FALSE;
 
     GtkWidget* viewWidget = GTK_WIDGET(webkitWebViewBase);
-    gtk_widget_set_double_buffered(viewWidget, FALSE);
     gtk_widget_set_can_focus(viewWidget, TRUE);
     priv->imContext = adoptGRef(gtk_im_multicontext_new());
 
@@ -274,11 +276,38 @@
     gtk_drag_dest_set(viewWidget, static_cast<GtkDestDefaults>(0), 0, 0,
                       static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE));
     gtk_drag_dest_set_target_list(viewWidget, PasteboardHelper::defaultPasteboardHelper()->targetList());
+
+#if USE(TEXTURE_MAPPER_GL)
+    priv->redirectedWindow = RedirectedXCompositeWindow::create(IntSize(1, 1));
+    priv->readyToRenderAcceleratedCompositingResults = false;
+#endif
 }
 
+#if USE(TEXTURE_MAPPER_GL)
+static bool webkitWebViewRenderAcceleratedCompositingResults(WebKitWebViewBase* webViewBase, DrawingAreaProxyImpl* drawingArea, cairo_t* cr, GdkRectangle* clipRect)
+{
+    if (!drawingArea->isInAcceleratedCompositingMode())
+        return false;
+
+    // To avoid flashes when initializing accelerated compositing for the first
+    // time, we wait until we know there's a frame ready before rendering.
+    WebKitWebViewBasePrivate* priv = webViewBase->priv;
+    if (!priv->readyToRenderAcceleratedCompositingResults)
+        return false;
+
+    ASSERT(priv->redirectedWindow);
+    cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
+    cairo_surface_t* surface = priv->redirectedWindow->cairoSurfaceForWidget(GTK_WIDGET(webViewBase));
+    cairo_set_source_surface(cr, surface, 0, 0);
+    cairo_fill(cr);
+    return true;
+}
+#endif
+
 static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr)
 {
-    DrawingAreaProxy* drawingArea = WEBKIT_WEB_VIEW_BASE(widget)->priv->pageProxy->drawingArea();
+    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
+    DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(webViewBase->priv->pageProxy->drawingArea());
     if (!drawingArea)
         return FALSE;
 
@@ -286,8 +315,13 @@
     if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
         return FALSE;
 
+#if USE(TEXTURE_MAPPER_GL)
+    if (webkitWebViewRenderAcceleratedCompositingResults(webViewBase, drawingArea, cr, &clipRect))
+        return FALSE;
+#endif
+
     WebCore::Region unpaintedRegion; // This is simply unused.
-    static_cast<DrawingAreaProxyImpl*>(drawingArea)->paint(cr, clipRect, unpaintedRegion);
+    drawingArea->paint(cr, clipRect, unpaintedRegion);
 
     return FALSE;
 }
@@ -308,7 +342,7 @@
     priv->children.set(child, IntRect());
 }
 
-static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase, GtkAllocation* allocation)
+static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase, GtkAllocation* allocation, bool sizeChanged)
 {
     gtk_container_foreach(GTK_CONTAINER(webViewBase), webkitWebViewBaseChildAllocate, webViewBase);
 
@@ -323,6 +357,11 @@
         viewRect.setHeight(allocation->height - priv->inspectorViewHeight);
     }
 
+#if USE(TEXTURE_MAPPER_GL)
+    if (sizeChanged)
+        webViewBase->priv->redirectedWindow->resize(viewRect.size());
+#endif
+
     if (priv->pageProxy->drawingArea())
         priv->pageProxy->drawingArea()->setSize(viewRect.size(), IntSize());
 
@@ -333,14 +372,18 @@
 
 static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation)
 {
+    bool sizeChanged = gtk_widget_get_allocated_width(widget) != allocation->width
+                       || gtk_widget_get_allocated_height(widget) != allocation->height;
+
     GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation);
 
     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
-    if (!gtk_widget_get_mapped(GTK_WIDGET(webViewBase)) && !webViewBase->priv->pageProxy->drawingArea()->size().isEmpty()) {
+    if (sizeChanged && !gtk_widget_get_mapped(widget) && !webViewBase->priv->pageProxy->drawingArea()->size().isEmpty()) {
         webViewBase->priv->needsResizeOnMap = true;
         return;
     }
-    resizeWebKitWebViewBaseFromAllocation(webViewBase, allocation);
+
+    resizeWebKitWebViewBaseFromAllocation(webViewBase, allocation, sizeChanged);
 }
 
 static void webkitWebViewBaseMap(GtkWidget* widget)
@@ -348,19 +391,12 @@
     GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->map(widget);
 
     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
-#if USE(TEXTURE_MAPPER_GL) && defined(GDK_WINDOWING_X11)
-    GdkWindow* gdkWindow = gtk_widget_get_window(widget);
-    ASSERT(gdkWindow);
-    if (gdk_window_has_native(gdkWindow))
-        webViewBase->priv->pageProxy->widgetMapped(GDK_WINDOW_XID(gdkWindow));
-#endif
-
     if (!webViewBase->priv->needsResizeOnMap)
         return;
 
     GtkAllocation allocation;
     gtk_widget_get_allocation(widget, &allocation);
-    resizeWebKitWebViewBaseFromAllocation(webViewBase, &allocation);
+    resizeWebKitWebViewBaseFromAllocation(webViewBase, &allocation, true /* sizeChanged */);
     webViewBase->priv->needsResizeOnMap = false;
 }
 
@@ -675,6 +711,10 @@
 #if ENABLE(FULLSCREEN_API)
     priv->pageProxy->fullScreenManager()->setWebView(webkitWebViewBase);
 #endif
+
+#if USE(TEXTURE_MAPPER_GL)
+    priv->pageProxy->setAcceleratedCompositingWindowId(priv->redirectedWindow->windowId());
+#endif
 }
 
 void webkitWebViewBaseSetTooltipText(WebKitWebViewBase* webViewBase, const char* tooltip)
@@ -793,3 +833,38 @@
 {
     return webkitWebViewBase->priv->contextMenuEvent.release();
 }
+
+#if USE(TEXTURE_MAPPER_GL)
+static gboolean queueAnotherDrawOfAcceleratedCompositingResults(gpointer* webViewBasePointer)
+{
+    // The WebViewBase may have been destroyed in the time since we queued this
+    // draw and the time we are actually executing.
+    if (!*webViewBasePointer) {
+        fastFree(webViewBasePointer);
+        return FALSE;
+    }
+
+    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(*webViewBasePointer);
+    gtk_widget_queue_draw(GTK_WIDGET(webViewBase));
+    webViewBase->priv->readyToRenderAcceleratedCompositingResults = true;
+
+    g_object_remove_weak_pointer(G_OBJECT(webViewBase), webViewBasePointer);
+    fastFree(webViewBasePointer);
+
+    return FALSE;
+}
+
+void webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WebKitWebViewBase* webViewBase)
+{
+    gtk_widget_queue_draw(GTK_WIDGET(webViewBase));
+
+    // Redraw again, one frame later, as it might take some time for the new GL frame to be available.
+    // This prevents the display from always being one frame behind in the case GL hasn't yet finished
+    // rendering to the window.
+    // TODO: Add XDamage support to RedirectedXCompositeWindow to accomplish this.
+    gpointer* webViewBasePointer = static_cast<gpointer*>(fastMalloc(sizeof(gpointer)));
+    g_object_add_weak_pointer(G_OBJECT(webViewBase), webViewBasePointer);
+    *webViewBasePointer = webViewBase;
+    g_timeout_add(1000 / 60, reinterpret_cast<GSourceFunc>(queueAnotherDrawOfAcceleratedCompositingResults), webViewBasePointer);
+}
+#endif

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h	2012-09-20 14:33:00 UTC (rev 129131)
@@ -51,4 +51,8 @@
 WebContextMenuProxyGtk* webkitWebViewBaseGetActiveContextMenuProxy(WebKitWebViewBase*);
 GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase*);
 
+#if USE(TEXTURE_MAPPER_GL)
+void webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WebKitWebViewBase*);
+#endif
+
 #endif // WebKitWebViewBasePrivate_h

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2012-09-20 14:33:00 UTC (rev 129131)
@@ -48,6 +48,10 @@
 
     void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion);
 
+#if USE(ACCELERATED_COMPOSITING)
+    bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
+#endif
+
 private:
     explicit DrawingAreaProxyImpl(WebPageProxy*);
 
@@ -78,9 +82,6 @@
     void enterAcceleratedCompositingMode(const LayerTreeContext&);
     void exitAcceleratedCompositingMode();
     void updateAcceleratedCompositingMode(const LayerTreeContext&);
-
-    bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
-
 #if USE(COORDINATED_GRAPHICS)
     virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectory);
     void didReceiveLayerTreeCoordinatorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/WebPageProxy.h (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/WebPageProxy.h	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/WebPageProxy.h	2012-09-20 14:33:00 UTC (rev 129131)
@@ -709,7 +709,8 @@
     virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
 
 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
-    void widgetMapped(uint64_t nativeWindowId);
+    void setAcceleratedCompositingWindowId(uint64_t nativeWindowId);
+    void invalidateWidget();
 #endif
 
     void setSuppressVisibilityUpdates(bool flag) { m_suppressVisibilityUpdates = flag; }

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/WebPageProxy.messages.in (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-09-20 14:33:00 UTC (rev 129131)
@@ -177,6 +177,10 @@
     BindAccessibilityTree(WTF::String plugID)
 #endif
 
+#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
+    InvalidateWidget()
+#endif
+
     # BackForward messages
     BackForwardAddItem(uint64_t itemID)
     BackForwardGoToItem(uint64_t itemID) -> (WebKit::SandboxExtension::Handle sandboxExtensionHandle)

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp	2012-09-20 14:33:00 UTC (rev 129131)
@@ -110,10 +110,15 @@
 }
 
 #if USE(TEXTURE_MAPPER_GL)
-void WebPageProxy::widgetMapped(uint64_t nativeWindowId)
+void WebPageProxy::setAcceleratedCompositingWindowId(uint64_t nativeWindowId)
 {
-    process()->send(Messages::WebPage::WidgetMapped(nativeWindowId), m_pageID);
+    process()->send(Messages::WebPage::SetAcceleratedCompositingWindowId(nativeWindowId), m_pageID);
 }
+
+void WebPageProxy::invalidateWidget()
+{
+    webkitWebViewBaseQueueDrawOfAcceleratedCompositingResults(WEBKIT_WEB_VIEW_BASE(static_cast<PageClientImpl*>(m_pageClient)->viewWidget()));
+}
 #endif
 
 } // namespace WebKit

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/WebPage.h (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-09-20 14:33:00 UTC (rev 129131)
@@ -456,7 +456,8 @@
     void updateAccessibilityTree();
     bool handleMousePressedEvent(const WebCore::PlatformMouseEvent&);
 #if USE(TEXTURE_MAPPER_GL)
-    void widgetMapped(int64_t nativeWindowHandle);
+    void setAcceleratedCompositingWindowId(int64_t nativeWindowHandle);
+    void invalidateWidget();
 #endif
 #endif
 

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2012-09-20 14:33:00 UTC (rev 129131)
@@ -297,6 +297,6 @@
 #endif
 
 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
-    WidgetMapped(int64_t id)
+    SetAcceleratedCompositingWindowId(int64_t id)
 #endif
 }

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp	2012-09-20 14:33:00 UTC (rev 129131)
@@ -201,6 +201,8 @@
 
     if (m_pageOverlayLayer)
         m_pageOverlayLayer->setSize(newSize);
+
+    compositeLayersToContext(ForResize);
 }
 
 void LayerTreeHostGtk::deviceScaleFactorDidChange()
@@ -291,7 +293,7 @@
     return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
 }
 
-void LayerTreeHostGtk::compositeLayersToContext()
+void LayerTreeHostGtk::compositeLayersToContext(CompositePurpose purpose)
 {
     GLContext* context = glContext();
     if (!context || !context->makeContextCurrent())
@@ -303,11 +305,17 @@
     IntSize contextSize = m_context->defaultFrameBufferSize();
     glViewport(0, 0, contextSize.width(), contextSize.height());
 
+    if (purpose == ForResize) {
+        glClearColor(1, 1, 1, 0);
+        glClear(GL_COLOR_BUFFER_BIT);
+    }
+
     m_textureMapper->beginPainting();
     toTextureMapperLayer(m_rootLayer.get())->paint();
     m_textureMapper->endPainting();
 
     context->swapBuffers();
+    m_webPage->invalidateWidget();
 }
 
 void LayerTreeHostGtk::flushAndRenderLayers()

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h	2012-09-20 14:33:00 UTC (rev 129131)
@@ -83,7 +83,10 @@
 
     void createPageOverlayLayer();
     void destroyPageOverlayLayer();
-    void compositeLayersToContext();
+
+    enum CompositePurpose { ForResize, NotForResize };
+    void compositeLayersToContext(CompositePurpose = NotForResize);
+
     void flushAndRenderLayers();
     void cancelPendingLayerFlush();
 

Modified: releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp (129130 => 129131)


--- releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp	2012-09-20 14:25:28 UTC (rev 129130)
+++ releases/WebKitGTK/webkit-1.10/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp	2012-09-20 14:33:00 UTC (rev 129131)
@@ -156,10 +156,15 @@
 }
 
 #if USE(TEXTURE_MAPPER_GL)
-void WebPage::widgetMapped(int64_t nativeWindowHandle)
+void WebPage::setAcceleratedCompositingWindowId(int64_t nativeWindowHandle)
 {
     m_nativeWindowHandle = nativeWindowHandle;
 }
+
+void WebPage::invalidateWidget()
+{
+    send(Messages::WebPageProxy::InvalidateWidget());
+}
 #endif
 
 bool WebPage::handleMousePressedEvent(const PlatformMouseEvent& platformMouseEvent)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to