Diff
Modified: trunk/Source/WebKit/gtk/ChangeLog (104193 => 104194)
--- trunk/Source/WebKit/gtk/ChangeLog 2012-01-05 20:04:33 UTC (rev 104193)
+++ trunk/Source/WebKit/gtk/ChangeLog 2012-01-05 20:18:59 UTC (rev 104194)
@@ -1,3 +1,27 @@
+2012-01-05 Martin Robinson <[email protected]>
+
+ [GTK] [AC] Introduce AcceleratedCompositingContext to isolate different accelerated compositing implementations
+ https://bugs.webkit.org/show_bug.cgi?id=75519
+
+ Reviewed by Alejandro G. Castro.
+
+ Add an AcceleratedCompositingContext which will isolate all the different accelerated compositing
+ implementations from one another. For right now this just includes the Clutter version.
+
+ * GNUmakefile.am: Add the new files to the source list.
+ * WebCoreSupport/AcceleratedCompositingContext.h: Added.
+ * WebCoreSupport/AcceleratedCompositingContextClutter.cpp: Added. Existing
+ clutter AC code has moved here.
+ * WebCoreSupport/ChromeClientGtk.cpp:
+ (WebKit::ChromeClient::attachRootGraphicsLayer): Use the new AccleratedCompositingContext now
+ instead of calling into the WebView.
+ (WebKit::ChromeClient::setNeedsOneShotDrawingSynchronization):Ditto.
+ (WebKit::ChromeClient::scheduleCompositingLayerSync): Ditto.
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_size_allocate): Call in the ACContext.
+ (webkit_web_view_init): Initialize the ACContext.
+ * webkit/webkitwebviewprivate.h: Add the ACContext as a private member.
+
2012-01-03 Carlos Garcia Campos <[email protected]>
[GTK] Use gdk_screen_get_monitor_workarea() when available for screenAvailableRect()
Modified: trunk/Source/WebKit/gtk/GNUmakefile.am (104193 => 104194)
--- trunk/Source/WebKit/gtk/GNUmakefile.am 2012-01-05 20:04:33 UTC (rev 104193)
+++ trunk/Source/WebKit/gtk/GNUmakefile.am 2012-01-05 20:18:59 UTC (rev 104194)
@@ -184,6 +184,8 @@
Source/WebCore/bindings/gobject/WebKitDOMObject.h \
Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp \
Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \
+ Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h \
+ Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp \
Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp \
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
Added: trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h (0 => 104194)
--- trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h (rev 0)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h 2012-01-05 20:18:59 UTC (rev 104194)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 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
+ */
+
+#ifndef AcceleratedCompositingContext_h
+#define AcceleratedCompositingContext_h
+
+#include "GraphicsLayerClient.h"
+#include "IntRect.h"
+#include "IntSize.h"
+#include "Timer.h"
+#include "webkitwebview.h"
+#include <wtf/PassOwnPtr.h>
+
+#if USE(ACCELERATED_COMPOSITING)
+
+namespace WebCore {
+class GraphicsLayer;
+}
+
+namespace WebKit {
+
+class AcceleratedCompositingContext {
+ WTF_MAKE_NONCOPYABLE(AcceleratedCompositingContext);
+public:
+ static PassOwnPtr<AcceleratedCompositingContext> create(WebKitWebView* webView)
+ {
+ return adoptPtr(new AcceleratedCompositingContext(webView));
+ }
+
+ virtual ~AcceleratedCompositingContext();
+ void attachRootGraphicsLayer(WebCore::GraphicsLayer*);
+ void scheduleRootLayerRepaint(const WebCore::IntRect&);
+ void markForSync();
+ void syncLayersTimeout(WebCore::Timer<AcceleratedCompositingContext>*);
+ void resizeRootLayer(const WebCore::IntSize&);
+
+private:
+ WebKitWebView* m_webView;
+ OwnPtr<WebCore::GraphicsLayer> m_rootGraphicsLayer;
+ WebCore::Timer<AcceleratedCompositingContext> m_syncTimer;
+
+#if USE(CLUTTER)
+ GtkWidget* m_rootLayerEmbedder;
+#endif
+
+ AcceleratedCompositingContext(WebKitWebView*);
+};
+
+} // namespace WebKit
+
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // AcceleratedCompositingContext_h
Property changes on: trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
___________________________________________________________________
Added: svn:eol-style
Added: trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp (0 => 104194)
--- trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp (rev 0)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp 2012-01-05 20:18:59 UTC (rev 104194)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2011 Collabora Ltd.
+ * Copyright (C) 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 "AcceleratedCompositingContext.h"
+
+#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "GraphicsLayer.h"
+#include "webkitwebviewprivate.h"
+#include <clutter-gtk/clutter-gtk.h>
+#include <clutter/clutter.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView)
+ : m_webView(webView)
+ , m_rootGraphicsLayer(0)
+ , m_syncTimer(this, &AcceleratedCompositingContext::syncLayersTimeout)
+ , m_rootLayerEmbedder(0)
+{
+}
+
+AcceleratedCompositingContext::~AcceleratedCompositingContext()
+{
+}
+
+bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* widgetCr, const IntRect& clipRect)
+{
+ notImplemented();
+ return false;
+}
+
+void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* graphicsLayer)
+{
+ if (!graphicsLayer) {
+ gtk_container_remove(GTK_CONTAINER(m_webView), m_rootLayerEmbedder);
+ m_rootLayerEmbedder = 0;
+ m_rootGraphicsLayer = 0;
+ return;
+ }
+
+ // Create an instance of GtkClutterEmbed to host actors as web layers.
+ if (!m_rootLayerEmbedder) {
+ m_rootLayerEmbedder = gtk_clutter_embed_new();
+ gtk_container_add(GTK_CONTAINER(m_webView), m_rootLayerEmbedder);
+ gtk_widget_show(m_rootLayerEmbedder);
+ }
+
+ // Add a root layer to the stage.
+ if (graphicsLayer) {
+ m_rootGraphicsLayer = graphicsLayer;
+ ClutterColor stageColor = { 0xFF, 0xFF, 0xFF, 0xFF };
+ ClutterActor* stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(m_rootLayerEmbedder));
+ clutter_stage_set_color(CLUTTER_STAGE(stage), &stageColor);
+ clutter_container_add_actor(CLUTTER_CONTAINER(stage), m_rootGraphicsLayer->platformLayer());
+ clutter_actor_show_all(stage);
+ }
+}
+
+void AcceleratedCompositingContext::scheduleRootLayerRepaint(const IntRect& rect)
+{
+ if (!m_rootGraphicsLayer)
+ return;
+
+ if (rect.isEmpty()) {
+ m_rootGraphicsLayer->setNeedsDisplay();
+ return;
+ }
+
+ m_rootGraphicsLayer->setNeedsDisplayInRect(rect);
+}
+
+void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size)
+{
+ if (!m_rootLayerEmbedder)
+ return;
+
+ GtkAllocation allocation;
+ allocation.x = 0;
+ allocation.y = 0;
+ allocation.width = size.width();
+ allocation.height = size.height();
+ gtk_widget_size_allocate(GTK_WIDGET(m_webView->priv->rootLayerEmbedder), &allocation);
+}
+
+void AcceleratedCompositingContext::markForSync()
+{
+ if (m_syncTimer.isActive())
+ return;
+ m_syncTimer.startOneShot(0);
+}
+
+void AcceleratedCompositingContext::syncLayersTimeout(Timer<AcceleratedCompositingContext>*)
+{
+ core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
+}
+
+} // namespace WebKit
+
+#endif // USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
Property changes on: trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp (104193 => 104194)
--- trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp 2012-01-05 20:04:33 UTC (rev 104193)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp 2012-01-05 20:18:59 UTC (rev 104194)
@@ -927,20 +927,17 @@
#if USE(ACCELERATED_COMPOSITING)
void ChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* rootLayer)
{
- if (rootLayer)
- webViewSetRootGraphicsLayer(m_webView, rootLayer);
- else
- webViewDetachRootGraphicsLayer(m_webView);
+ m_webView->priv->acceleratedCompositingContext->attachRootGraphicsLayer(rootLayer);
}
void ChromeClient::setNeedsOneShotDrawingSynchronization()
{
- webViewMarkForSync(m_webView, FALSE);
+ m_webView->priv->acceleratedCompositingContext->markForSync();
}
void ChromeClient::scheduleCompositingLayerSync()
{
- webViewMarkForSync(m_webView, TRUE);
+ m_webView->priv->acceleratedCompositingContext->markForSync();
}
ChromeClient::CompositingTriggerFlags ChromeClient::allowedCompositingTriggers() const
Modified: trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp (104193 => 104194)
--- trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2012-01-05 20:04:33 UTC (rev 104193)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2012-01-05 20:18:59 UTC (rev 104194)
@@ -7,7 +7,7 @@
* Copyright (C) 2008 Gustavo Noronha Silva <[email protected]>
* Copyright (C) 2008 Nuanti Ltd.
* Copyright (C) 2008, 2009, 2010 Collabora Ltd.
- * Copyright (C) 2009, 2010 Igalia S.L.
+ * Copyright (C) 2009, 2010, 2012 Igalia S.L.
* Copyright (C) 2009 Movial Creative Technologies Inc.
* Copyright (C) 2009 Bobby Powers
* Copyright (C) 2010 Joone Hur <[email protected]>
@@ -872,12 +872,8 @@
chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height));
chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
-#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
- if (webView->priv->rootLayerEmbedder) {
- allocation->x = 0;
- allocation->y = 0;
- gtk_widget_size_allocate(GTK_WIDGET(webView->priv->rootLayerEmbedder), allocation);
- }
+#if USE(ACCELERATED_COMPOSITING)
+ WEBKIT_WEB_VIEW(widget)->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
#endif
}
@@ -3337,6 +3333,10 @@
gtk_drag_dest_set_target_list(GTK_WIDGET(webView), PasteboardHelper::defaultPasteboardHelper()->targetList());
priv->selfScrolling = false;
+
+#if USE(ACCELERATED_COMPOSITING)
+ priv->acceleratedCompositingContext = AcceleratedCompositingContext::create(webView);
+#endif
}
GtkWidget* webkit_web_view_new(void)
@@ -4909,68 +4909,6 @@
#endif
}
-#if USE(ACCELERATED_COMPOSITING)
-void webViewSetRootGraphicsLayer(WebKitWebView* webView, GraphicsLayer* graphicsLayer)
-{
-#if USE(CLUTTER)
- WebKitWebViewPrivate* priv = webView->priv;
-
- // Create an instance of GtkClutterEmbed to host actors as web layers.
- if (!priv->rootLayerEmbedder) {
- priv->rootLayerEmbedder = gtk_clutter_embed_new();
- gtk_container_add(GTK_CONTAINER(webView), priv->rootLayerEmbedder);
- gtk_widget_show(priv->rootLayerEmbedder);
- }
-
- // Add a root layer to the stage.
- if (graphicsLayer) {
- priv->rootGraphicsLayer = graphicsLayer;
- // set white background
- ClutterColor stageColor = { 0xFF, 0xFF, 0xFF, 0xFF };
- ClutterActor* stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(priv->rootLayerEmbedder));
- clutter_stage_set_color(CLUTTER_STAGE (stage), &stageColor);
- clutter_container_add_actor(CLUTTER_CONTAINER(stage), priv->rootGraphicsLayer->platformLayer());
- clutter_actor_show_all(stage);
- }
-#else
- notImplemented();
-#endif
-}
-
-void webViewDetachRootGraphicsLayer(WebKitWebView* webView)
-{
-#if USE(CLUTTER)
- WebKitWebViewPrivate* priv = webView->priv;
- // Detach the root layer from the hosting view.
- gtk_container_remove(GTK_CONTAINER(webView), priv->rootLayerEmbedder);
- priv->rootLayerEmbedder = 0;
- priv->rootGraphicsLayer = 0;
-#else
- notImplemented();
-#endif
-}
-
-#if USE(CLUTTER)
-static gboolean webViewSyncLayers(gpointer data)
-{
- WebKitWebView* webView = WEBKIT_WEB_VIEW(data);
- core(webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
-
- return FALSE;
-}
-#endif
-
-void webViewMarkForSync(WebKitWebView* webView, gboolean scheduleSync)
-{
-#if USE(CLUTTER)
- g_timeout_add(0, webViewSyncLayers, webView);
-#else
- notImplemented();
-#endif
-}
-
-#endif
-
namespace WebKit {
WebCore::Page* core(WebKitWebView* webView)
Modified: trunk/Source/WebKit/gtk/webkit/webkitwebviewprivate.h (104193 => 104194)
--- trunk/Source/WebKit/gtk/webkit/webkitwebviewprivate.h 2012-01-05 20:04:33 UTC (rev 104193)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebviewprivate.h 2012-01-05 20:18:59 UTC (rev 104194)
@@ -23,6 +23,7 @@
#ifndef webkitwebviewprivate_h
#define webkitwebviewprivate_h
+#include "AcceleratedCompositingContext.h"
#include "FullscreenVideoController.h"
#include "GtkClickCounter.h"
#include "GtkDragAndDropHelper.h"
@@ -32,11 +33,6 @@
#include "WidgetBackingStore.h"
#include <webkit/webkitwebview.h>
-#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
-#include <clutter-gtk/clutter-gtk.h>
-#include <clutter/clutter.h>
-#endif
-
namespace WebKit {
WebCore::Page* core(WebKitWebView*);
WebKitWebView* kit(WebCore::Page*);
@@ -97,9 +93,9 @@
WebCore::GtkClickCounter clickCounter;
WebCore::GtkDragAndDropHelper dragAndDropHelper;
bool selfScrolling;
-#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
- WebCore::GraphicsLayer* rootGraphicsLayer;
- GtkWidget* rootLayerEmbedder;
+
+#if USE(ACCELERATED_COMPOSITING)
+ OwnPtr<WebKit::AcceleratedCompositingContext> acceleratedCompositingContext;
#endif
};
@@ -120,12 +116,6 @@
void webViewEnterFullscreen(WebKitWebView* webView, WebCore::Node*);
void webViewExitFullscreen(WebKitWebView* webView);
-
-#if USE(ACCELERATED_COMPOSITING)
-void webViewSetRootGraphicsLayer(WebKitWebView*, WebCore::GraphicsLayer*);
-void webViewDetachRootGraphicsLayer(WebKitWebView*);
-void webViewMarkForSync(WebKitWebView*, gboolean);
-#endif
}
#endif