Changeset 104194 in webkit


Ignore:
Timestamp:
Jan 5, 2012 12:18:59 PM (12 years ago)
Author:
Martin Robinson
Message:

[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.
Location:
trunk/Source/WebKit/gtk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/gtk/ChangeLog

    r103929 r104194  
     12012-01-05  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] [AC] Introduce AcceleratedCompositingContext to isolate different accelerated compositing implementations
     4        https://bugs.webkit.org/show_bug.cgi?id=75519
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        Add an AcceleratedCompositingContext which will isolate all the different accelerated compositing
     9        implementations from one another. For right now this just includes the Clutter version.
     10
     11        * GNUmakefile.am: Add the new files to the source list.
     12        * WebCoreSupport/AcceleratedCompositingContext.h: Added.
     13        * WebCoreSupport/AcceleratedCompositingContextClutter.cpp: Added. Existing
     14        clutter AC code has moved here.
     15        * WebCoreSupport/ChromeClientGtk.cpp:
     16        (WebKit::ChromeClient::attachRootGraphicsLayer): Use the new AccleratedCompositingContext now
     17        instead of calling into the WebView.
     18        (WebKit::ChromeClient::setNeedsOneShotDrawingSynchronization):Ditto.
     19        (WebKit::ChromeClient::scheduleCompositingLayerSync): Ditto.
     20        * webkit/webkitwebview.cpp:
     21        (webkit_web_view_size_allocate): Call in the ACContext.
     22        (webkit_web_view_init): Initialize the ACContext.
     23        * webkit/webkitwebviewprivate.h: Add the ACContext as a private member.
     24
    1252012-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
    226
  • trunk/Source/WebKit/gtk/GNUmakefile.am

    r103929 r104194  
    185185        Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp \
    186186        Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \
     187        Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h \
     188        Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp \
    187189        Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp \
    188190        Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
  • trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

    r102874 r104194  
    928928void ChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* rootLayer)
    929929{
    930     if (rootLayer)
    931         webViewSetRootGraphicsLayer(m_webView, rootLayer);
    932     else
    933         webViewDetachRootGraphicsLayer(m_webView);
     930    m_webView->priv->acceleratedCompositingContext->attachRootGraphicsLayer(rootLayer);
    934931}
    935932
    936933void ChromeClient::setNeedsOneShotDrawingSynchronization()
    937934{
    938     webViewMarkForSync(m_webView, FALSE);
     935    m_webView->priv->acceleratedCompositingContext->markForSync();
    939936}
    940937
    941938void ChromeClient::scheduleCompositingLayerSync()
    942939{
    943     webViewMarkForSync(m_webView, TRUE);
     940    m_webView->priv->acceleratedCompositingContext->markForSync();
    944941}
    945942
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r103321 r104194  
    88 *  Copyright (C) 2008 Nuanti Ltd.
    99 *  Copyright (C) 2008, 2009, 2010 Collabora Ltd.
    10  *  Copyright (C) 2009, 2010 Igalia S.L.
     10 *  Copyright (C) 2009, 2010, 2012 Igalia S.L.
    1111 *  Copyright (C) 2009 Movial Creative Technologies Inc.
    1212 *  Copyright (C) 2009 Bobby Powers
     
    873873    chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
    874874
    875 #if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
    876     if (webView->priv->rootLayerEmbedder) {
    877         allocation->x = 0;
    878         allocation->y = 0;
    879         gtk_widget_size_allocate(GTK_WIDGET(webView->priv->rootLayerEmbedder), allocation);
    880     }
     875#if USE(ACCELERATED_COMPOSITING)
     876    WEBKIT_WEB_VIEW(widget)->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
    881877#endif
    882878}
     
    33383334
    33393335    priv->selfScrolling = false;
     3336
     3337#if USE(ACCELERATED_COMPOSITING)
     3338    priv->acceleratedCompositingContext = AcceleratedCompositingContext::create(webView);
     3339#endif
    33403340}
    33413341
     
    49104910}
    49114911
    4912 #if USE(ACCELERATED_COMPOSITING)
    4913 void webViewSetRootGraphicsLayer(WebKitWebView* webView, GraphicsLayer* graphicsLayer)
    4914 {
    4915 #if USE(CLUTTER)
    4916     WebKitWebViewPrivate* priv = webView->priv;
    4917 
    4918     // Create an instance of GtkClutterEmbed to host actors as web layers.
    4919     if (!priv->rootLayerEmbedder) {
    4920         priv->rootLayerEmbedder = gtk_clutter_embed_new();
    4921         gtk_container_add(GTK_CONTAINER(webView), priv->rootLayerEmbedder);
    4922         gtk_widget_show(priv->rootLayerEmbedder);
    4923     }
    4924 
    4925     // Add a root layer to the stage.
    4926     if (graphicsLayer) {
    4927         priv->rootGraphicsLayer = graphicsLayer;
    4928         // set white background
    4929         ClutterColor stageColor = { 0xFF, 0xFF, 0xFF, 0xFF };
    4930         ClutterActor* stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(priv->rootLayerEmbedder));
    4931         clutter_stage_set_color(CLUTTER_STAGE (stage), &stageColor);
    4932         clutter_container_add_actor(CLUTTER_CONTAINER(stage), priv->rootGraphicsLayer->platformLayer());
    4933         clutter_actor_show_all(stage);
    4934     }
    4935 #else
    4936     notImplemented();
    4937 #endif
    4938 }
    4939 
    4940 void webViewDetachRootGraphicsLayer(WebKitWebView* webView)
    4941 {
    4942 #if USE(CLUTTER)
    4943     WebKitWebViewPrivate* priv = webView->priv;
    4944     // Detach the root layer from the hosting view.
    4945     gtk_container_remove(GTK_CONTAINER(webView), priv->rootLayerEmbedder);
    4946     priv->rootLayerEmbedder = 0;
    4947     priv->rootGraphicsLayer = 0;
    4948 #else
    4949     notImplemented();
    4950 #endif
    4951 }
    4952 
    4953 #if USE(CLUTTER)
    4954 static gboolean webViewSyncLayers(gpointer data)
    4955 {
    4956     WebKitWebView* webView = WEBKIT_WEB_VIEW(data);
    4957     core(webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
    4958 
    4959     return FALSE;
    4960 }
    4961 #endif
    4962 
    4963 void webViewMarkForSync(WebKitWebView* webView, gboolean scheduleSync)
    4964 {
    4965 #if USE(CLUTTER)
    4966     g_timeout_add(0, webViewSyncLayers, webView);
    4967 #else
    4968     notImplemented();
    4969 #endif
    4970 }
    4971 
    4972 #endif
    4973 
    49744912namespace WebKit {
    49754913
  • trunk/Source/WebKit/gtk/webkit/webkitwebviewprivate.h

    r102448 r104194  
    2424#define webkitwebviewprivate_h
    2525
     26#include "AcceleratedCompositingContext.h"
    2627#include "FullscreenVideoController.h"
    2728#include "GtkClickCounter.h"
     
    3233#include "WidgetBackingStore.h"
    3334#include <webkit/webkitwebview.h>
    34 
    35 #if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
    36 #include <clutter-gtk/clutter-gtk.h>
    37 #include <clutter/clutter.h>
    38 #endif
    3935
    4036namespace WebKit {
     
    9894    WebCore::GtkDragAndDropHelper dragAndDropHelper;
    9995    bool selfScrolling;
    100 #if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
    101     WebCore::GraphicsLayer* rootGraphicsLayer;
    102     GtkWidget* rootLayerEmbedder;
     96
     97#if USE(ACCELERATED_COMPOSITING)
     98    OwnPtr<WebKit::AcceleratedCompositingContext> acceleratedCompositingContext;
    10399#endif
    104100};
     
    121117void webViewEnterFullscreen(WebKitWebView* webView, WebCore::Node*);
    122118void webViewExitFullscreen(WebKitWebView* webView);
    123 
    124 #if USE(ACCELERATED_COMPOSITING)
    125 void webViewSetRootGraphicsLayer(WebKitWebView*, WebCore::GraphicsLayer*);
    126 void webViewDetachRootGraphicsLayer(WebKitWebView*);
    127 void webViewMarkForSync(WebKitWebView*, gboolean);
    128 #endif
    129119}
    130120
Note: See TracChangeset for help on using the changeset viewer.