[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

andersca at apple.com andersca at apple.com
Mon Feb 21 00:36:10 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 94c1770f225dc457ff22d331ca147038227b31da
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 2 01:45:48 2011 +0000

    2011-02-01  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Attach the layer tree in the UI process
            https://bugs.webkit.org/show_bug.cgi?id=53560
    
            * UIProcess/API/mac/WKView.mm:
            (-[WKView _enterAcceleratedCompositingMode:]):
            Make a render layer and add it as a sublayer of our root layer.
    
            * WebProcess/WebPage/mac/LayerTreeHostMac.h:
            Make LayerTreeHostMac a GraphicsLayerClient.
    
            * WebProcess/WebPage/mac/LayerTreeHostMac.mm:
            (WebKit::LayerTreeHostMac::LayerTreeHostMac):
            Create a root layer, add the layer subtree as a child of the root layer.
    
            (WebKit::LayerTreeHostMac::~LayerTreeHostMac):
            Assert that m_rootLayer is null.
    
            (WebKit::LayerTreeHostMac::invalidate):
            Null out m_rootLayer.
    
            (WebKit::LayerTreeHostMac::notifyAnimationStarted):
            (WebKit::LayerTreeHostMac::notifySyncRequired):
            (WebKit::LayerTreeHostMac::paintContents):
            Add stubs.
    
            (WebKit::LayerTreeHostMac::showDebugBorders):
            (WebKit::LayerTreeHostMac::showRepaintCounter):
            Return the correct settings.
    
            (WebKit::LayerTreeHostMac::flushPendingLayerChanges):
            Flush the root layer changes.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77345 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 403f90d..6174149 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,5 +1,41 @@
 2011-02-01  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Dan Bernstein.
+
+        Attach the layer tree in the UI process
+        https://bugs.webkit.org/show_bug.cgi?id=53560
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _enterAcceleratedCompositingMode:]):
+        Make a render layer and add it as a sublayer of our root layer.
+
+        * WebProcess/WebPage/mac/LayerTreeHostMac.h:
+        Make LayerTreeHostMac a GraphicsLayerClient.
+
+        * WebProcess/WebPage/mac/LayerTreeHostMac.mm:
+        (WebKit::LayerTreeHostMac::LayerTreeHostMac):
+        Create a root layer, add the layer subtree as a child of the root layer.
+
+        (WebKit::LayerTreeHostMac::~LayerTreeHostMac):
+        Assert that m_rootLayer is null.
+
+        (WebKit::LayerTreeHostMac::invalidate):
+        Null out m_rootLayer.
+
+        (WebKit::LayerTreeHostMac::notifyAnimationStarted):
+        (WebKit::LayerTreeHostMac::notifySyncRequired):
+        (WebKit::LayerTreeHostMac::paintContents):
+        Add stubs.
+
+        (WebKit::LayerTreeHostMac::showDebugBorders):
+        (WebKit::LayerTreeHostMac::showRepaintCounter):
+        Return the correct settings.
+
+        (WebKit::LayerTreeHostMac::flushPendingLayerChanges):
+        Flush the root layer changes.
+
+2011-02-01  Anders Carlsson  <andersca at apple.com>
+
         Fix Windows build.
 
         * UIProcess/win/WebView.cpp:
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index 991f405..f1a9f90 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -1862,6 +1862,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
 - (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext
 {
     ASSERT(!_data->_layerHostingView);
+    ASSERT(!layerTreeContext.isEmpty());
 
     // Create an NSView that will host our layer tree.
     _data->_layerHostingView.adoptNS([[NSView alloc] initWithFrame:[self bounds]]);
@@ -1869,12 +1870,15 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
     [self addSubview:_data->_layerHostingView.get()];
 
     // Create a root layer that will back the NSView.
-    CALayer *rootLayer = [CALayer layer];
+    RetainPtr<CALayer> rootLayer(AdoptNS, [[CALayer alloc] init]);
 #ifndef NDEBUG
-    [rootLayer setName:@"Hosting root layer"];
+    [rootLayer.get() setName:@"Hosting root layer"];
 #endif
 
-    [_data->_layerHostingView.get() setLayer:rootLayer];
+    CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+    [rootLayer.get() addSublayer:renderLayer];
+
+    [_data->_layerHostingView.get() setLayer:rootLayer.get()];
     [_data->_layerHostingView.get() setWantsLayer:YES];
 }
 
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
index d14e5f8..8648aba 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
@@ -27,13 +27,15 @@
 #define LayerTreeHostMac_h
 
 #include "LayerTreeHost.h"
+#include <WebCore/GraphicsLayerClient.h>
+#include <wtf/OwnPtr.h>
 #include <wtf/RetainPtr.h>
 
 typedef struct __WKCARemoteLayerClientRef* WKCARemoteLayerClientRef;
 
 namespace WebKit {
 
-class LayerTreeHostMac : public LayerTreeHost {
+class LayerTreeHostMac : public LayerTreeHost, WebCore::GraphicsLayerClient {
 public:
     static PassRefPtr<LayerTreeHostMac> create(WebPage*, WebCore::GraphicsLayer*);
     ~LayerTreeHostMac();
@@ -45,12 +47,22 @@ private:
     virtual void scheduleLayerFlush();
     virtual void invalidate();
 
+    // GraphicsLayerClient
+    virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
+    virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
+    virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
+    virtual bool showDebugBorders() const;
+    virtual bool showRepaintCounter() const;
+
     static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
     void flushPendingLayerChangesRunLoopObserverCallback();
     bool flushPendingLayerChanges();
 
     bool m_isValid;
 
+    // The root layer.
+    OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
+
     RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
     RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver;
 };
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
index d08c462..f40abac 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
@@ -33,6 +33,7 @@
 #import <WebCore/Frame.h>
 #import <WebCore/FrameView.h>
 #import <WebCore/Page.h>
+#import <WebCore/Settings.h>
 #import <WebKitSystemInterface.h>
 
 using namespace WebCore;
@@ -49,13 +50,22 @@ LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage, GraphicsLayer* graphicsLaye
     , m_isValid(true)
 {
     mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
-
     m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
 
-    // FIXME: Create a real layer instead of just a placeholder.
-    CALayer *layer = [CALayer layer];
+    // Create a root layer.
+    m_rootLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+    m_rootLayer->setName("LayerTreeHost root layer");
+#endif
+    m_rootLayer->setDrawsContent(false);
+    m_rootLayer->setSize(webPage->size());
+
+    // Add the accelerated layer tree hierarchy.
+    m_rootLayer->addChild(graphicsLayer);
+    
+    WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer->platformLayer());
 
-    WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), layer);
+    scheduleLayerFlush();
 
     LayerTreeContext layerTreeContext;
     layerTreeContext.contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get());
@@ -69,6 +79,7 @@ LayerTreeHostMac::~LayerTreeHostMac()
     ASSERT(!m_isValid);
     ASSERT(!m_flushPendingLayerChangesRunLoopObserver);
     ASSERT(!m_remoteLayerClient);
+    ASSERT(!m_rootLayer);
 }
 
 void LayerTreeHostMac::scheduleLayerFlush()
@@ -100,13 +111,35 @@ void LayerTreeHostMac::invalidate()
 
     WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get());
     m_remoteLayerClient = nullptr;
-
+    m_rootLayer = nullptr;
     m_isValid = false;
 
     // FIXME: Don't send this if we enter accelerated compositing as a result of setSize.
     m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode());
 }
 
+void LayerTreeHostMac::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+{
+}
+
+void LayerTreeHostMac::notifySyncRequired(const WebCore::GraphicsLayer*)
+{
+}
+
+void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+{
+}
+
+bool LayerTreeHostMac::showDebugBorders() const
+{
+    return m_webPage->corePage()->settings()->showDebugBorders();
+}
+
+bool LayerTreeHostMac::showRepaintCounter() const
+{
+    return m_webPage->corePage()->settings()->showRepaintCounter();
+}
+
 void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
 {
     static_cast<LayerTreeHostMac*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
@@ -125,6 +158,8 @@ void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
 
 bool LayerTreeHostMac::flushPendingLayerChanges()
 {
+    m_rootLayer->syncCompositingStateForThisLayerOnly();
+
     return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list