[GTK] Build fix for Accelerated Compositing with Clutter
authorjoone.hur@collabora.co.uk <joone.hur@collabora.co.uk@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 19:41:38 +0000 (19:41 +0000)
committerjoone.hur@collabora.co.uk <joone.hur@collabora.co.uk@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 19:41:38 +0000 (19:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81785

Reviewed by Martin Robinson.

Source/WebCore:

AcceleratedCompositingContext was introduced to isolate different accelerated
compositing implementations(r104194), but the Clutter implementation doesn't
build with it. This includes an initial implementation of GraphicsContext3D
and fixes the build error.

* GNUmakefile.list.am:
* platform/graphics/clutter/DrawingBufferClutter.cpp: Added.
(WebCore):
(WebCore::DrawingBuffer::DrawingBuffer):
(WebCore::DrawingBuffer::~DrawingBuffer):
(WebCore::DrawingBuffer::platformColorBuffer):
(WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
* platform/graphics/clutter/GraphicsContext3DClutter.cpp: Added.
(WebCore):
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::~GraphicsContext3D):
(WebCore::GraphicsContext3D::getImageData):
(WebCore::GraphicsContext3D::paintToCanvas):
(WebCore::GraphicsContext3D::setContextLostCallback):
(WebCore::GraphicsContext3D::setErrorMessageCallback):
(WebCore::GraphicsContext3D::makeContextCurrent):
(WebCore::GraphicsContext3D::platformGraphicsContext3D):
(WebCore::GraphicsContext3D::isGLES2Compliant):
(WebCore::GraphicsContext3D::platformLayer):
* platform/graphics/clutter/GraphicsContext3DPrivate.cpp: Added.
(WebCore):
(WebCore::GraphicsContext3DPrivate::create):
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::makeContextCurrent):
(WebCore::GraphicsContext3DPrivate::platformContext):
(WebCore::GraphicsContext3DPrivate::paintToGraphicsLayerActor):
* platform/graphics/clutter/GraphicsContext3DPrivate.h: Added.
(WebCore):
(GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::platformLayer):

Source/WebKit/gtk:

AcceleratedCompositingContext was introduced to isolate different accelerated
compositing implementations(r104194), but the Clutter implementation doesn't
build with it. This fixes the build error.

* WebCoreSupport/AcceleratedCompositingContext.h:
(AcceleratedCompositingContext):
* WebCoreSupport/AcceleratedCompositingContextClutter.cpp:
(WebKit::AcceleratedCompositingContext::AcceleratedCompositingContext):
(WebKit::AcceleratedCompositingContext::renderLayersToWindow):
(WebKit::AcceleratedCompositingContext::resizeRootLayer):
(WebKit::AcceleratedCompositingContext::syncLayersNow):
(WebKit::AcceleratedCompositingContext::syncLayersTimeout):
(WebKit):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/platform/graphics/clutter/DrawingBufferClutter.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/clutter/GraphicsContext3DClutter.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.h [new file with mode: 0644]
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp

index f585720..a3ce040 100644 (file)
@@ -1,3 +1,48 @@
+2012-03-26  Joone Hur  <joone.hur@collabora.co.uk>
+
+        [GTK] Build fix for Accelerated Compositing with Clutter
+        https://bugs.webkit.org/show_bug.cgi?id=81785
+
+        Reviewed by Martin Robinson.
+
+        AcceleratedCompositingContext was introduced to isolate different accelerated 
+        compositing implementations(r104194), but the Clutter implementation doesn't 
+        build with it. This includes an initial implementation of GraphicsContext3D 
+        and fixes the build error.
+
+        * GNUmakefile.list.am:
+        * platform/graphics/clutter/DrawingBufferClutter.cpp: Added.
+        (WebCore):
+        (WebCore::DrawingBuffer::DrawingBuffer):
+        (WebCore::DrawingBuffer::~DrawingBuffer):
+        (WebCore::DrawingBuffer::platformColorBuffer):
+        (WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
+        * platform/graphics/clutter/GraphicsContext3DClutter.cpp: Added.
+        (WebCore):
+        (WebCore::GraphicsContext3D::create):
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        (WebCore::GraphicsContext3D::~GraphicsContext3D):
+        (WebCore::GraphicsContext3D::getImageData):
+        (WebCore::GraphicsContext3D::paintToCanvas):
+        (WebCore::GraphicsContext3D::setContextLostCallback):
+        (WebCore::GraphicsContext3D::setErrorMessageCallback):
+        (WebCore::GraphicsContext3D::makeContextCurrent):
+        (WebCore::GraphicsContext3D::platformGraphicsContext3D):
+        (WebCore::GraphicsContext3D::isGLES2Compliant):
+        (WebCore::GraphicsContext3D::platformLayer):
+        * platform/graphics/clutter/GraphicsContext3DPrivate.cpp: Added.
+        (WebCore):
+        (WebCore::GraphicsContext3DPrivate::create):
+        (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+        (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+        (WebCore::GraphicsContext3DPrivate::makeContextCurrent):
+        (WebCore::GraphicsContext3DPrivate::platformContext):
+        (WebCore::GraphicsContext3DPrivate::paintToGraphicsLayerActor):
+        * platform/graphics/clutter/GraphicsContext3DPrivate.h: Added.
+        (WebCore):
+        (GraphicsContext3DPrivate):
+        (WebCore::GraphicsContext3DPrivate::platformLayer):
+
 2012-03-26  Peter Rybin  <prybin@chromium.org>
 
         Web Inspector: Expose InspectorTypeBuilder.h to other components
index 9adbd22..dbad014 100644 (file)
@@ -5805,10 +5805,6 @@ webcore_sources += \
        Source/WebCore/html/canvas/OESVertexArrayObject.h \
        Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp \
        Source/WebCore/platform/graphics/ANGLEWebKitBridge.h \
-       Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp \
-       Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp \
-       Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp \
-       Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h \
        Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp \
        Source/WebCore/platform/graphics/gpu/DrawingBuffer.h \
        Source/WebCore/platform/graphics/GraphicsContext3D.cpp \
@@ -5819,6 +5815,20 @@ webcore_sources += \
        Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h \
        Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp \
        Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
+if USE_CLUTTER
+webcore_sources += \
+       Source/WebCore/platform/graphics/clutter/DrawingBufferClutter.cpp \
+       Source/WebCore/platform/graphics/clutter/GraphicsContext3DClutter.cpp \
+       Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.cpp \
+       Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.h
+else
+webcore_sources += \
+       Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp \
+       Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp \
+       Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.cpp \
+       Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h
+endif  # END USE_CLUTTER
+
 endif  # END ENABLE_WEBGL
 
 # ---
diff --git a/Source/WebCore/platform/graphics/clutter/DrawingBufferClutter.cpp b/Source/WebCore/platform/graphics/clutter/DrawingBufferClutter.cpp
new file mode 100644 (file)
index 0000000..1f332c1
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ * Copyright (c) 2012, Collabora Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(ACCELERATED_2D_CANVAS) || ENABLE(WEBGL)
+
+#include "DrawingBuffer.h"
+
+#include "Extensions3D.h"
+
+namespace WebCore {
+
+DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
+                             const IntSize& size,
+                             bool multisampleExtensionSupported,
+                             bool packedDepthStencilExtensionSupported,
+                             bool separateBackingTexture)
+{
+}
+
+DrawingBuffer::~DrawingBuffer()
+{
+}
+
+Platform3DObject DrawingBuffer::platformColorBuffer() const
+{
+    return m_colorBuffer;
+}
+
+#if USE(ACCELERATED_COMPOSITING)
+void DrawingBuffer::paintCompositedResultsToCanvas(CanvasRenderingContext* context)
+{
+}
+#endif
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/clutter/GraphicsContext3DClutter.cpp b/Source/WebCore/platform/graphics/clutter/GraphicsContext3DClutter.cpp
new file mode 100644 (file)
index 0000000..ca0ffdc
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2012 Collabora Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "GraphicsContext3D.h"
+
+#if ENABLE(WEBGL)
+
+#include "Extensions3DOpenGL.h"
+#include "GraphicsContext3DPrivate.h"
+#include "NotImplemented.h"
+#include <wtf/NotFound.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+{
+    RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attributes, hostWindow, false));
+    return context.release();
+}
+
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, bool)
+{
+    notImplemented();
+}
+
+GraphicsContext3D::~GraphicsContext3D()
+{
+    notImplemented();
+}
+
+bool GraphicsContext3D::getImageData(Image* image, unsigned int format, unsigned int type, bool premultiplyAlpha, bool ignoreGammaAndColorProfile, Vector<uint8_t>& outputVector)
+{
+    notImplemented();
+    return false;
+}
+
+void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, PlatformContextCairo* context)
+{
+    notImplemented();
+}
+
+void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
+{
+}
+
+void GraphicsContext3D::setErrorMessageCallback(PassOwnPtr<ErrorMessageCallback>)
+{
+}
+
+bool GraphicsContext3D::makeContextCurrent()
+{
+    if (!m_private)
+        return false;
+    return m_private->makeContextCurrent();
+}
+PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D()
+{
+    return m_private->platformContext();
+}
+
+bool GraphicsContext3D::isGLES2Compliant() const
+{
+    return false;
+}
+
+#if USE(ACCELERATED_COMPOSITING)
+PlatformLayer* GraphicsContext3D::platformLayer() const
+{
+    return m_private->platformLayer();
+}
+#endif
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.cpp b/Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.cpp
new file mode 100644 (file)
index 0000000..cad170f
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011, 2012 Igalia S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "GraphicsContext3DPrivate.h"
+
+#if ENABLE(WEBGL)
+
+#include "HostWindow.h"
+#include "NotImplemented.h"
+
+
+namespace WebCore {
+
+PassOwnPtr<GraphicsContext3DPrivate> GraphicsContext3DPrivate::create(GraphicsContext3D* context, HostWindow* window)
+{
+    return adoptPtr(new GraphicsContext3DPrivate(context, window));
+}
+
+GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, HostWindow* window)
+    : m_context(context)
+    , m_window(window)
+{
+}
+
+GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
+{
+}
+
+bool GraphicsContext3DPrivate::makeContextCurrent()
+{
+    return false;
+}
+
+PlatformGraphicsContext3D GraphicsContext3DPrivate::platformContext()
+{
+    return 0;
+}
+
+#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
+void GraphicsContext3DPrivate::paintToGraphicsLayerActor(ClutterActor*, const FloatRect& target, const TransformationMatrix& matrix, float opacity)
+{
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+} // namespace WebCore
+
+#endif // ENABLE_WEBGL
diff --git a/Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.h b/Source/WebCore/platform/graphics/clutter/GraphicsContext3DPrivate.h
new file mode 100644 (file)
index 0000000..570f82f
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2012 Collabora Ltd.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301 USA
+ */
+
+#ifndef GraphicsContext3DPrivate_h
+#define GraphicsContext3DPrivate_h
+
+#include "GraphicsContext3D.h"
+#include <wtf/PassOwnPtr.h>
+
+#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
+#include <clutter/clutter.h>
+#endif
+
+namespace WebCore {
+
+class GraphicsContext3DPrivate {
+public:
+    static PassOwnPtr<GraphicsContext3DPrivate> create(GraphicsContext3D*, HostWindow*);
+    ~GraphicsContext3DPrivate();
+    bool makeContextCurrent();
+    PlatformGraphicsContext3D platformContext();
+    ClutterActor* platformLayer() { return m_layer; }
+
+#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
+    virtual void paintToGraphicsLayerActor(ClutterActor*, const FloatRect& target, const TransformationMatrix&, float opacity);
+#endif
+
+private:
+    GraphicsContext3DPrivate(GraphicsContext3D*, HostWindow*);
+
+    GraphicsContext3D* m_context;
+    HostWindow* m_window;
+    ClutterActor* m_layer;
+};
+
+}
+
+#endif // GraphicsContext3DPrivate_h
index 48a83d5..3cc336f 100644 (file)
@@ -1,3 +1,24 @@
+2012-03-26  Joone Hur  <joone.hur@collabora.co.uk>
+
+        [GTK] Build fix for Accelerated Compositing with Clutter
+        https://bugs.webkit.org/show_bug.cgi?id=81785
+
+        Reviewed by Martin Robinson.
+
+        AcceleratedCompositingContext was introduced to isolate different accelerated 
+        compositing implementations(r104194), but the Clutter implementation doesn't
+        build with it. This fixes the build error.
+
+        * WebCoreSupport/AcceleratedCompositingContext.h:
+        (AcceleratedCompositingContext):
+        * WebCoreSupport/AcceleratedCompositingContextClutter.cpp:
+        (WebKit::AcceleratedCompositingContext::AcceleratedCompositingContext):
+        (WebKit::AcceleratedCompositingContext::renderLayersToWindow):
+        (WebKit::AcceleratedCompositingContext::resizeRootLayer):
+        (WebKit::AcceleratedCompositingContext::syncLayersNow):
+        (WebKit::AcceleratedCompositingContext::syncLayersTimeout):
+        (WebKit):
+
 2012-03-26  Gary Kramlich  <grim@reaperworld.com>
 
         WebKitWebView signals with GError parameters cause crashes when using GObject Introspection
index b2567eb..1120d86 100644 (file)
@@ -63,14 +63,15 @@ public:
 
 private:
     WebKitWebView* m_webView;
-    OwnPtr<WebCore::GraphicsLayer> m_rootGraphicsLayer;
     unsigned int m_syncTimerCallbackId;
 
 #if USE(CLUTTER)
+    WebCore::GraphicsLayer* m_rootGraphicsLayer;
     GtkWidget* m_rootLayerEmbedder;
 #elif USE(TEXTURE_MAPPER_GL)
     WebCore::GLContext* glContext();
     WebCore::TextureMapperLayer* m_rootTextureMapperLayer;
+    OwnPtr<WebCore::GraphicsLayer> m_rootGraphicsLayer;
     OwnPtr<WebCore::TextureMapper> m_textureMapper;
 #endif
 
index 2e95fc5..00a191a 100644 (file)
@@ -25,6 +25,7 @@
 #include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsLayer.h"
+#include "NotImplemented.h"
 #include "webkitwebviewprivate.h"
 #include <clutter-gtk/clutter-gtk.h>
 #include <clutter/clutter.h>
@@ -35,8 +36,8 @@ namespace WebKit {
 
 AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView)
     : m_webView(webView)
-    , m_rootGraphicsLayer(0)
     , m_syncTimerCallbackId(0)
+    , m_rootGraphicsLayer(0)
     , m_rootLayerEmbedder(0)
 {
 }
@@ -52,7 +53,7 @@ bool AcceleratedCompositingContext::enabled()
     return m_rootGraphicsLayer;
 }
 
-bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* widgetCr, const IntRect& clipRect)
+bool AcceleratedCompositingContext::renderLayersToWindow(const IntRect& clipRect)
 {
     notImplemented();
     return false;
@@ -108,7 +109,7 @@ void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size)
     allocation.y = 0;
     allocation.width = size.width();
     allocation.height = size.height();
-    gtk_widget_size_allocate(GTK_WIDGET(m_webView->priv->rootLayerEmbedder), &allocation);
+    gtk_widget_size_allocate(GTK_WIDGET(m_rootLayerEmbedder), &allocation);
 }
 
 static gboolean syncLayersTimeoutCallback(AcceleratedCompositingContext* context)
@@ -127,11 +128,24 @@ void AcceleratedCompositingContext::markForSync()
     m_syncTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(syncLayersTimeoutCallback), this, 0);
 }
 
-void AcceleratedCompositingContext::syncLayersTimeout()
+void AcceleratedCompositingContext::syncLayersNow()
 {
+    if (m_rootGraphicsLayer)
+        m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly();
+
     core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
 }
 
+void AcceleratedCompositingContext::syncLayersTimeout()
+{
+    m_syncTimerCallbackId = 0;
+    syncLayersNow();
+    if (!m_rootGraphicsLayer)
+        return;
+
+    renderLayersToWindow(IntRect());
+}
+
 void AcceleratedCompositingContext::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
 {
     ASSERT_NOT_REACHED();