2011-01-06 Chris Marrin <cmarrin@apple.com>
authorcmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Jan 2011 04:53:08 +0000 (04:53 +0000)
committercmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Jan 2011 04:53:08 +0000 (04:53 +0000)
        Unreviewed.

        Back out changes in http://trac.webkit.org/changeset/75199
        This breaks the Windows build. Fixing it on that side. Until
        then I'll back this out.

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

16 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/config.h
WebCore/platform/graphics/GraphicsLayer.h
WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
WebCore/platform/graphics/ca/GraphicsLayerCA.h
WebCore/platform/graphics/ca/PlatformCALayer.h
WebCore/platform/graphics/ca/PlatformCALayerClient.h [deleted file]
WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
WebCore/platform/graphics/mac/WebGLLayer.mm
WebCore/platform/graphics/mac/WebLayer.h
WebCore/platform/graphics/mac/WebLayer.mm
WebCore/platform/graphics/mac/WebTiledLayer.mm
WebCore/rendering/RenderLayerBacking.cpp
WebCore/rendering/RenderLayerCompositor.cpp
WebCore/rendering/RenderLayerCompositor.h

index d6dd6eb..b5a19bd 100644 (file)
@@ -1,3 +1,11 @@
+2011-01-06  Chris Marrin  <cmarrin@apple.com>
+
+        Unreviewed.
+
+        Back out changes in http://trac.webkit.org/changeset/75199
+        This breaks the Windows build. Fixing it on that side. Until
+        then I'll back this out.
+
 2011-01-06  Jenn Braithwaite  <jennb@chromium.org>
 
         Reviewed by Dmitry Titov.
index 783e1d2..0c53e09 100644 (file)
                490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; };
                490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; };
                492863991253B8FC00F792D6 /* ResourceLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               493E5E0912D6420500020081 /* PlatformCALayerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 493E5E0812D6420500020081 /* PlatformCALayerClient.h */; };
                49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */; };
                49484FC2102CF23C00187DD3 /* CanvasGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 49484FB4102CF23C00187DD3 /* CanvasGradient.h */; };
                49484FC4102CF23C00187DD3 /* CanvasPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49484FB6102CF23C00187DD3 /* CanvasPattern.cpp */; };
                490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
                490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; };
                492863981253B8FC00F792D6 /* ResourceLoadInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadInfo.h; sourceTree = "<group>"; };
-               493E5E0812D6420500020081 /* PlatformCALayerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformCALayerClient.h; path = ca/PlatformCALayerClient.h; sourceTree = "<group>"; };
                49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CanvasGradient.cpp; path = canvas/CanvasGradient.cpp; sourceTree = "<group>"; };
                49484FB4102CF23C00187DD3 /* CanvasGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasGradient.h; path = canvas/CanvasGradient.h; sourceTree = "<group>"; };
                49484FB5102CF23C00187DD3 /* CanvasGradient.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CanvasGradient.idl; path = canvas/CanvasGradient.idl; sourceTree = "<group>"; };
                                499B3ED5128CD31400E726C2 /* GraphicsLayerCA.h */,
                                499B3EDC128DB50100E726C2 /* PlatformCAAnimation.h */,
                                499B3EC3128CCC4700E726C2 /* PlatformCALayer.h */,
-                               493E5E0812D6420500020081 /* PlatformCALayerClient.h */,
                                494BC40C12AEDD9E00743BD2 /* TransformationMatrixCA.cpp */,
                        );
                        name = ca;
                                7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */,
                                7EE6846F12D26E3800E79415 /* ResourceRequestCFNet.h in Headers */,
                                7EE6847012D26E3800E79415 /* ResourceResponse.h in Headers */,
-                               493E5E0912D6420500020081 /* PlatformCALayerClient.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 49eee8a..404fa95 100644 (file)
@@ -220,11 +220,6 @@ typedef float CGFloat;
 #define WTF_USE_SAFARI_THEME 1
 #endif
 
-// CoreAnimation is available to IOS, Mac and Windows if using CG
-#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && PLATFORM(CG))
-#define WTF_PLATFORM_CA 1
-#endif
-
 #if PLATFORM(QT) && USE(V8) && defined(Q_WS_X11)
 /* protect ourselves from evil X11 defines */
 #include <bridge/npruntime_internal.h>
index fdc8811..60638e7 100644 (file)
@@ -53,7 +53,10 @@ typedef CALayer PlatformLayer;
 typedef void* PlatformLayer;
 #endif
 #elif PLATFORM(WIN)
-typedef struct _CACFLayer PlatformLayer;
+namespace WebCore {
+class WKCACFLayer;
+typedef WKCACFLayer PlatformLayer;
+}
 #elif PLATFORM(QT)
 #if USE(TEXTURE_MAPPER)
 namespace WebCore {
@@ -311,7 +314,7 @@ public:
     // Callback from the underlying graphics system to draw layer contents.
     void paintGraphicsLayerContents(GraphicsContext&, const IntRect& clip);
     // Callback from the underlying graphics system when the layer has been displayed
-    virtual void layerDidDisplay(PlatformLayer*) { }
+    virtual void didDisplay(PlatformLayer*) { }
     
     // For hosting this GraphicsLayer in a native layer hierarchy.
     virtual PlatformLayer* platformLayer() const { return 0; }
@@ -327,8 +330,8 @@ public:
     virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
     CompositingCoordinatesOrientation contentsOrientation() const { return m_contentsOrientation; }
 
-    bool showDebugBorders() const { return m_client ? m_client->showDebugBorders() : false; }
-    bool showRepaintCounter() const { return m_client ? m_client->showRepaintCounter() : false; }
+    bool showDebugBorders() { return m_client ? m_client->showDebugBorders() : false; }
+    bool showRepaintCounter() { return m_client ? m_client->showRepaintCounter() : false; }
     
     void updateDebugIndicators();
     
index c3c58fd..06441d2 100644 (file)
@@ -640,7 +640,7 @@ void GraphicsLayerCA::removeAnimation(const String& animationName)
     noteLayerPropertyChanged(AnimationChanged);
 }
 
-void GraphicsLayerCA::platformCALayerAnimationStarted(CFTimeInterval startTime)
+void GraphicsLayerCA::animationStarted(CFTimeInterval startTime)
 {
     if (m_client)
         m_client->notifyAnimationStarted(this, startTime);
@@ -660,8 +660,6 @@ void GraphicsLayerCA::setContentsToImage(Image* image)
         
         m_uncorrectedContentsImage = newImage;
         m_pendingContentsImage = newImage;
-
-#if !PLATFORM(WIN)
         CGColorSpaceRef colorSpace = CGImageGetColorSpace(m_pendingContentsImage.get());
 
         static CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
@@ -671,7 +669,6 @@ void GraphicsLayerCA::setContentsToImage(Image* image)
             static CGColorSpaceRef genericRGB = CGDisplayCopyColorSpace(kCGDirectMainDisplay);
             m_pendingContentsImage.adoptCF(CGImageCreateCopyWithColorSpace(m_pendingContentsImage.get(), genericRGB));
         }
-#endif
         m_contentsLayerPurpose = ContentsLayerForImage;
         if (!m_contentsLayer)
             noteSublayersChanged();
@@ -691,15 +688,9 @@ void GraphicsLayerCA::setContentsToMedia(PlatformLayer* mediaLayer)
     if (m_contentsLayer && mediaLayer == m_contentsLayer->platformLayer())
         return;
         
-    // FIXME: The passed in layer might be a raw layer or an externally created 
-    // PlatformCALayer. To determine this we attempt to get the
-    // PlatformCALayer pointer. If this returns a null pointer we assume it's
-    // raw. This test might be invalid if the raw layer is, for instance, the
-    // PlatformCALayer is using a user data pointer in the raw layer, and
-    // the creator of the raw layer is using it for some other purpose.
-    // For now we don't support such a case.
-    PlatformCALayer* platformCALayer = PlatformCALayer::platformCALayer(mediaLayer);
-    m_contentsLayer = mediaLayer ? (platformCALayer ? platformCALayer : PlatformCALayer::create(mediaLayer, this)) : 0;
+    // Create the PlatformCALayer to wrap the incoming layer
+    m_contentsLayer = mediaLayer ? PlatformCALayer::create(mediaLayer, this) : 0;
+
     m_contentsLayerPurpose = mediaLayer ? ContentsLayerForMedia : NoContentsLayer;
 
     noteSublayersChanged();
@@ -720,7 +711,7 @@ void GraphicsLayerCA::setContentsToCanvas(PlatformLayer* canvasLayer)
     noteLayerPropertyChanged(ContentsCanvasLayerChanged);
 }
     
-void GraphicsLayerCA::layerDidDisplay(PlatformLayer* layer)
+void GraphicsLayerCA::didDisplay(PlatformLayer* layer)
 {
     PlatformCALayer* currentLayer = PlatformCALayer::platformCALayer(layer);
     PlatformCALayer* sourceLayer;
@@ -912,7 +903,7 @@ void GraphicsLayerCA::updateSublayerList()
             newSublayers.append(childLayer);
         }
 
-        for (size_t i = 0; i < newSublayers.size(); --i)
+        for (size_t i = 0; i < newSublayers.size(); ++i)
             newSublayers[i]->removeFromSuperlayer();
     }
 
index 13cbdd1..22921c1 100644 (file)
@@ -31,7 +31,6 @@
 #include "GraphicsLayer.h"
 #include "Image.h"
 #include "PlatformCAAnimation.h"
-#include "PlatformCALayerClient.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/RetainPtr.h>
@@ -41,7 +40,7 @@ namespace WebCore {
 
 class PlatformCALayer;
 
-class GraphicsLayerCA : public GraphicsLayer, public PlatformCALayerClient {
+class GraphicsLayerCA : public GraphicsLayer {
 public:
     // The width and height of a single tile in a tiled layer. Should be large enough to
     // avoid lots of small tiles (and therefore lots of drawing callbacks), but small enough
@@ -50,11 +49,12 @@ public:
 
     GraphicsLayerCA(GraphicsLayerClient*);
     virtual ~GraphicsLayerCA();
+    
+    virtual void animationStarted(CFTimeInterval beginTime);
 
     virtual void setName(const String&);
 
     virtual PlatformLayer* platformLayer() const;
-    virtual PlatformCALayer* platformCALayer() const { return primaryLayer(); }
 
     virtual bool setChildren(const Vector<GraphicsLayer*>&);
     virtual void addChild(GraphicsLayer*);
@@ -112,7 +112,7 @@ public:
     virtual void setDebugBackgroundColor(const Color&);
     virtual void setDebugBorder(const Color&, float borderWidth);
 
-    virtual void layerDidDisplay(PlatformLayer*);
+    virtual void didDisplay(PlatformLayer*);
 
     void recursiveCommitChanges();
 
@@ -123,21 +123,6 @@ protected:
     virtual void setOpacityInternal(float);
 
 private:
-    // PlatformCALayerClient overrides
-    virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*) { }
-    virtual bool platformCALayerRespondsToLayoutChanges() const { return false; }
-
-    virtual void platformCALayerAnimationStarted(CFTimeInterval beginTime);
-    virtual CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return contentsOrientation(); }
-    virtual void platformCALayerPaintContents(GraphicsContext& context, const IntRect& clip) { paintGraphicsLayerContents(context, clip); }
-    virtual bool platformCALayerShowDebugBorders() const { return showDebugBorders(); }
-    virtual bool platformCALayerShowRepaintCounter() const { return showRepaintCounter(); }
-    virtual int platformCALayerIncrementRepaintCount() { return incrementRepaintCount(); }
-
-    virtual bool platformCALayerContentsOpaque() const { return contentsOpaque(); }
-    virtual bool platformCALayerDrawsContent() const { return drawsContent(); }
-    virtual void platformCALayerLayerDidDisplay(PlatformLayer* layer) { return layerDidDisplay(layer); }
-
     void updateOpacityOnLayer();
 
     PlatformCALayer* primaryLayer() const { return m_structuralLayer.get() ? m_structuralLayer.get() : m_layer.get(); }
index 46f4bbf..9cf0ccb 100644 (file)
@@ -29,8 +29,8 @@
 #if USE(ACCELERATED_COMPOSITING)
 
 #include "GraphicsContext.h"
+#include "GraphicsLayerCA.h"
 #include "PlatformCAAnimation.h"
-#include "PlatformCALayerClient.h"
 #include "PlatformString.h"
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
@@ -47,17 +47,27 @@ typedef Vector<RefPtr<PlatformCALayer> > PlatformCALayerList;
 
 class PlatformCALayer : public RefCounted<PlatformCALayer> {
 public:
-    // LayerTypeRootLayer is used on some platforms. It has no backing store, so setNeedsDisplay
-    // should not call CACFLayerSetNeedsDisplay, but rather just notify the renderer that it
-    // has changed and should be re-rendered.
-    enum LayerType { LayerTypeLayer, LayerTypeWebLayer, LayerTypeTransformLayer, LayerTypeWebTiledLayer, LayerTypeRootLayer, LayerTypeCustom };
+    // TiledLayer used in GraphicsLayer has constant settings:
+    //      cTiledLayerTileSize = 512
+    //      setTileSize:(cTiledLayerTileSize, cTiledLayerTileSize)
+    //      setLevelsOfDetail:1
+    //      setLevelsOfDetailBias:0
+    //      setContentsGravity:@"bottomLeft"
+    //
+    // TiledLayer also has drawing functions like WebLayer
+    //
+    // WebLayer is a CALayer with drawing functions specific to WebKit
+    //
+    // Layer and TransformLayer are used as is
+
+    enum LayerType { LayerTypeLayer, LayerTypeWebLayer, LayerTypeTransformLayer, LayerTypeWebTiledLayer, LayerTypeCustom };
     enum FilterType { Linear, Nearest, Trilinear };
 
-    static PassRefPtr<PlatformCALayer> create(LayerType, PlatformCALayerClient*);
+    static PassRefPtr<PlatformCALayer> create(LayerType, GraphicsLayerCA*);
     
     // This function passes the layer as a void* rather than a PlatformLayer because PlatformLayer
     // is defined differently for Obj C and C++. This allows callers from both languages.
-    static PassRefPtr<PlatformCALayer> create(void* platformLayer, PlatformCALayerClient*);
+    static PassRefPtr<PlatformCALayer> create(void* platformLayer, GraphicsLayerCA*);
 
     ~PlatformCALayer();
     
@@ -66,29 +76,20 @@ public:
     static PlatformCALayer* platformCALayer(void* platformLayer);
     
     PlatformLayer* platformLayer() const;
-
-    PlatformCALayer* rootLayer() const;
     
     static bool isValueFunctionSupported();
     
-    PlatformCALayerClient* owner() const { return m_owner; }
-    void setOwner(PlatformCALayerClient*);
+    GraphicsLayerCA* owner() const { return m_owner; }
+    void setOwner(GraphicsLayerCA* owner);
 
     void animationStarted(CFTimeInterval beginTime)
     {
         if (m_owner)
-            m_owner->platformCALayerAnimationStarted(beginTime);
+            m_owner->animationStarted(beginTime);
     }
 
-    // Layout support
-    void setNeedsLayout();
-
-
     void setNeedsDisplay(const FloatRect* dirtyRect = 0);
     
-    // This tells the layer tree to commit changes and perform a render, without do a setNeedsDisplay on any layer.
-    void setNeedsCommit();
-
     void setContentsChanged();
     
     LayerType layerType() const { return m_layerType; }
@@ -103,7 +104,6 @@ public:
     size_t sublayerCount() const;
 
     // This method removes the sublayers from the source and reparents them to the current layer.
-    // Any sublayers previously in the current layer are removed.
     void adoptSublayers(PlatformCALayer* source);
     
     void addAnimationForKey(const String& key, PlatformCAAnimation* animation);    
@@ -150,8 +150,8 @@ public:
     bool acceleratesDrawing() const;
     void setAcceleratesDrawing(bool);
 
-    CFTypeRef contents() const;
-    void setContents(CFTypeRef);
+    void* contents() const;
+    void setContents(void*);
 
     FloatRect contentsRect() const;
     void setContentsRect(const FloatRect&);
@@ -183,25 +183,18 @@ public:
     CFTimeInterval timeOffset() const;
     void setTimeOffset(CFTimeInterval);
 
-#if PLATFORM(WIN) && !defined(NDEBUG)
-    void printTree() const;
-#endif
-
 protected:
-    PlatformCALayer(LayerType, PlatformLayer*, PlatformCALayerClient*);
+    PlatformCALayer(LayerType, PlatformLayer*, GraphicsLayerCA*);
     
 private:
-    PlatformCALayerClient* m_owner;
+    
+    GraphicsLayerCA* m_owner;
     LayerType m_layerType;
     
 #if PLATFORM(MAC) || PLATFORM(WIN)
     RetainPtr<PlatformLayer> m_layer;
 #endif
 
-#if PLATFORM(WIN)
-    HashMap<String, RefPtr<PlatformCAAnimation> > m_animations;
-#endif
-
 #if PLATFORM(MAC)
 #ifdef __OBJC__
     RetainPtr<NSObject> m_delegate;
diff --git a/WebCore/platform/graphics/ca/PlatformCALayerClient.h b/WebCore/platform/graphics/ca/PlatformCALayerClient.h
deleted file mode 100644 (file)
index ae1815c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * 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 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. 
- */
-
-#ifndef PlatformCALayerClient_h
-#define PlatformCALayerClient_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "GraphicsContext.h"
-#include "GraphicsLayer.h"
-#include "PlatformCAAnimation.h"
-#include "PlatformString.h"
-#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-class PlatformCALayer;
-
-class PlatformCALayerClient {
-public:
-    virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*) = 0;
-    virtual bool platformCALayerRespondsToLayoutChanges() const = 0;
-
-    virtual void platformCALayerAnimationStarted(CFTimeInterval beginTime) = 0;
-    virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const = 0;
-    virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) = 0;
-    virtual bool platformCALayerShowDebugBorders() const = 0;
-    virtual bool platformCALayerShowRepaintCounter() const = 0;
-    virtual int platformCALayerIncrementRepaintCount() = 0;
-    
-    virtual bool platformCALayerContentsOpaque() const = 0;
-    virtual bool platformCALayerDrawsContent() const = 0;
-    virtual void platformCALayerLayerDidDisplay(PlatformLayer*) = 0;
-
-protected:
-    virtual ~PlatformCALayerClient() {}
-};
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif // PlatformCALayerClient_h
index 28460a7..0aecf14 100644 (file)
@@ -105,7 +105,7 @@ bool PlatformCALayer::isValueFunctionSupported()
     return sHaveValueFunction;
 }
 
-void PlatformCALayer::setOwner(PlatformCALayerClient* owner)
+void PlatformCALayer::setOwner(GraphicsLayerCA* owner)
 {
     m_owner = owner;
     
@@ -145,17 +145,17 @@ static NSString* toCAFilterType(PlatformCALayer::FilterType type)
 }
 #endif
 
-PassRefPtr<PlatformCALayer> PlatformCALayer::create(LayerType layerType, PlatformCALayerClient* owner)
+PassRefPtr<PlatformCALayer> PlatformCALayer::create(LayerType layerType, GraphicsLayerCA* owner)
 {
     return adoptRef(new PlatformCALayer(layerType, 0, owner));
 }
 
-PassRefPtr<PlatformCALayer> PlatformCALayer::create(void* platformLayer, PlatformCALayerClient* owner)
+PassRefPtr<PlatformCALayer> PlatformCALayer::create(void* platformLayer, GraphicsLayerCA* owner)
 {
     return adoptRef(new PlatformCALayer(LayerTypeCustom, static_cast<PlatformLayer*>(platformLayer), owner));
 }
 
-PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
+PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, GraphicsLayerCA* owner)
     : m_owner(owner)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
@@ -168,7 +168,6 @@ PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, Plat
         Class layerClass = Nil;
         switch(layerType) {
             case LayerTypeLayer:
-            case LayerTypeRootLayer:
                 layerClass = [CALayer class];
                 break;
             case LayerTypeWebLayer:
@@ -569,15 +568,15 @@ void PlatformCALayer::setAcceleratesDrawing(bool acceleratesDrawing)
 #endif
 }
 
-CFTypeRef PlatformCALayer::contents() const
+void* PlatformCALayer::contents() const
 {
     return [m_layer.get() contents];
 }
 
-void PlatformCALayer::setContents(CFTypeRef value)
+void PlatformCALayer::setContents(void* value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer.get() setContents:static_cast<id>(const_cast<void*>(value))];
+    [m_layer.get() setContents:static_cast<id>(value)];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
index c24181b..12c6f0d 100644 (file)
@@ -144,7 +144,7 @@ static void freeData(void *, const void *data, size_t /* size */)
 {
     [super display];
     if (m_layerOwner)
-        m_layerOwner->layerDidDisplay(self);
+        m_layerOwner->didDisplay(self);
 }
 
 @end
index 30bf55b..62d69fc 100644 (file)
@@ -32,7 +32,6 @@
 
 namespace WebCore {
     class GraphicsLayer;
-    class PlatformCALayerClient;
 }
 
 #if defined(BUILDING_ON_LEOPARD)
@@ -48,8 +47,8 @@ namespace WebCore {
 @end
 
 // Functions allows us to share implementation across WebTiledLayer and WebLayer
-void drawLayerContents(CGContextRef, CALayer *, WebCore::PlatformCALayerClient*);
-void setLayerNeedsDisplayInRect(CALayer *, WebCore::PlatformCALayerClient*, CGRect);
+void drawLayerContents(CGContextRef, CALayer *, WebCore::GraphicsLayer*);
+void setLayerNeedsDisplayInRect(CALayer *, WebCore::GraphicsLayer*, CGRect);
 
 #endif // USE(ACCELERATED_COMPOSITING)
 
index 06ea9be..4154c10 100644 (file)
@@ -40,7 +40,7 @@ using namespace WebCore;
 
 @implementation WebLayer
 
-void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCALayerClient* layerContents)
+void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::GraphicsLayer* layerContents)
 {
     if (!layerContents)
         return;
@@ -48,38 +48,50 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCA
     CGContextSaveGState(context);
 
     CGRect layerBounds = [layer bounds];
-    if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp) {
+    if (layerContents->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp) {
         CGContextScaleCTM(context, 1, -1);
         CGContextTranslateCTM(context, 0, -layerBounds.size.height);
     }
 
-    [NSGraphicsContext saveGraphicsState];
+    if (layerContents->client()) {
+        [NSGraphicsContext saveGraphicsState];
 
-    // Set up an NSGraphicsContext for the context, so that parts of AppKit that rely on
-    // the current NSGraphicsContext (e.g. NSCell drawing) get the right one.
-    NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:YES];
-    [NSGraphicsContext setCurrentContext:layerContext];
+        // Set up an NSGraphicsContext for the context, so that parts of AppKit that rely on
+        // the current NSGraphicsContext (e.g. NSCell drawing) get the right one.
+        NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:YES];
+        [NSGraphicsContext setCurrentContext:layerContext];
 
-    GraphicsContext graphicsContext(context);
+        GraphicsContext graphicsContext(context);
 
-    if (!layerContents->platformCALayerContentsOpaque()) {
-        // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
-        graphicsContext.setShouldSmoothFonts(false);
+        if (!layerContents->contentsOpaque()) {
+            // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
+            graphicsContext.setShouldSmoothFonts(false);
+        }
+        
+        // It's important to get the clip from the context, because it may be significantly
+        // smaller than the layer bounds (e.g. tiled layers)
+        CGRect clipBounds = CGContextGetClipBoundingBox(context);
+        IntRect clip(enclosingIntRect(clipBounds));
+        layerContents->paintGraphicsLayerContents(graphicsContext, clip);
+
+        [NSGraphicsContext restoreGraphicsState];
     }
-    
-    // It's important to get the clip from the context, because it may be significantly
-    // smaller than the layer bounds (e.g. tiled layers)
-    CGRect clipBounds = CGContextGetClipBoundingBox(context);
-    IntRect clip(enclosingIntRect(clipBounds));
-    layerContents->platformCALayerPaintContents(graphicsContext, clip);
+#ifndef NDEBUG
+    else {
+        ASSERT_NOT_REACHED();
 
-    [NSGraphicsContext restoreGraphicsState];
+        // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is a plain color,
+        // so CA never makes backing store for it (which is what -setNeedsDisplay will do above).
+        CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f);
+        CGContextFillRect(context, layerBounds);
+    }
+#endif
 
-    if (layerContents->platformCALayerShowRepaintCounter()) {
+    if (layerContents->showRepaintCounter()) {
         bool isTiledLayer = [layer isKindOfClass:[CATiledLayer class]];
 
         char text[16]; // that's a lot of repaints
-        snprintf(text, sizeof(text), "%d", layerContents->platformCALayerIncrementRepaintCount());
+        snprintf(text, sizeof(text), "%d", layerContents->incrementRepaintCount());
 
         CGContextSaveGState(context);
         if (isTiledLayer)
@@ -105,26 +117,26 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCA
     CGContextRestoreGState(context);
 }
 
-void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::PlatformCALayerClient* layerContents, CGRect rect)
+void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::GraphicsLayer* layerContents, CGRect rect)
 {
-    if (layerContents && layerContents->platformCALayerDrawsContent()) {
+    if (layerContents && layerContents->client() && layerContents->drawsContent()) {
         struct objc_super layerSuper = { layer, class_getSuperclass(object_getClass(layer)) };
 #if defined(BUILDING_ON_LEOPARD)
         rect = CGRectApplyAffineTransform(rect, [layer contentsTransform]);
 #else
-        if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
+        if (layerContents->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
             rect.origin.y = [layer bounds].size.height - rect.origin.y - rect.size.height;
 #endif
         objc_msgSendSuper(&layerSuper, @selector(setNeedsDisplayInRect:), rect);
 
 #ifndef NDEBUG
-        if (layerContents->platformCALayerShowRepaintCounter()) {
+        if (layerContents->showRepaintCounter()) {
             CGRect bounds = [layer bounds];
             CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 46, 25);
 #if defined(BUILDING_ON_LEOPARD)
             indicatorRect = CGRectApplyAffineTransform(indicatorRect, [layer contentsTransform]);
 #else
-            if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
+            if (layerContents->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
                 indicatorRect.origin.y = [layer bounds].size.height - indicatorRect.origin.y - indicatorRect.size.height;
 #endif
             objc_msgSendSuper(&layerSuper, @selector(setNeedsDisplayInRect:), indicatorRect);
@@ -143,7 +155,7 @@ void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::PlatformCALayerClient*
 - (void)setNeedsDisplay
 {
     PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
-    if (layer && layer->owner() && layer->owner()->platformCALayerDrawsContent())
+    if (layer && layer->owner() && layer->owner()->client() && layer->owner()->drawsContent())
         [super setNeedsDisplay];
 }
 
@@ -159,7 +171,7 @@ void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::PlatformCALayerClient*
     [super display];
     PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
     if (layer && layer->owner())
-        layer->owner()->platformCALayerLayerDidDisplay(self);
+        layer->owner()->didDisplay(self);
 }
 
 - (void)drawInContext:(CGContextRef)context
index e9fa5b7..bf35431 100644 (file)
@@ -60,7 +60,7 @@ using namespace WebCore;
 - (void)setNeedsDisplay
 {
     PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
-    if (layer && layer->owner() && layer->owner()->platformCALayerDrawsContent())
+    if (layer && layer->owner() && layer->owner()->client() && layer->owner()->drawsContent())
         [super setNeedsDisplay];
 }
 
@@ -76,7 +76,7 @@ using namespace WebCore;
     [super display];
     PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
     if (layer && layer->owner())
-        layer->owner()->platformCALayerLayerDidDisplay(self);
+        layer->owner()->didDisplay(self);
 }
 
 - (void)drawInContext:(CGContextRef)context
index 1649372..bac514d 100644 (file)
@@ -1101,12 +1101,12 @@ void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& co
 
 bool RenderLayerBacking::showDebugBorders() const
 {
-    return compositor() ? compositor()->compositorShowDebugBorders() : false;
+    return compositor() ? compositor()->showDebugBorders() : false;
 }
 
 bool RenderLayerBacking::showRepaintCounter() const
 {
-    return compositor() ? compositor()->compositorShowRepaintCounter() : false;
+    return compositor() ? compositor()->showRepaintCounter() : false;
 }
 
 bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes)
index ce2224f..fa25348 100644 (file)
@@ -1351,13 +1351,13 @@ void RenderLayerCompositor::ensureRootPlatformLayer()
         if (!m_clipLayer) {
             ASSERT(!m_scrollLayer);
             // Create a clipping layer if this is an iframe
-            m_clipLayer = GraphicsLayer::create(this);
+            m_clipLayer = GraphicsLayer::create(0);
 #ifndef NDEBUG
             m_clipLayer->setName("iframe Clipping");
 #endif
             m_clipLayer->setMasksToBounds(true);
             
-            m_scrollLayer = GraphicsLayer::create(this);
+            m_scrollLayer = GraphicsLayer::create(0);
 #ifndef NDEBUG
             m_scrollLayer->setName("iframe scrolling");
 #endif
index 1409c06..06c0bcd 100644 (file)
@@ -54,11 +54,11 @@ enum CompositingUpdateType {
 // 
 // There is one RenderLayerCompositor per RenderView.
 
-class RenderLayerCompositor : public GraphicsLayerClient {
+class RenderLayerCompositor {
 public:
     RenderLayerCompositor(RenderView*);
     ~RenderLayerCompositor();
-
+    
     // Return true if this RenderView is in "compositing mode" (i.e. has one or more
     // composited RenderLayers)
     bool inCompositingMode() const { return m_compositing; }
@@ -71,6 +71,9 @@ public:
 
     bool canRender3DTransforms() const;
 
+    bool showDebugBorders() const { return m_showDebugBorders; }
+    bool showRepaintCounter() const { return m_showRepaintCounter; }
+    
     // Copy the accelerated compositing related flags from Settings
     void cacheAcceleratedCompositingFlags();
 
@@ -169,22 +172,7 @@ public:
 
     String layerTreeAsText();
 
-    // These are named to avoid conflicts with the functions in GraphicsLayerClient
-    // These return the actual internal variables.
-    bool compositorShowDebugBorders() const { return m_showDebugBorders; }
-    bool compositorShowRepaintCounter() const { return m_showRepaintCounter; }
-
 private:
-    // GraphicsLayerClient Implementation
-    virtual void notifyAnimationStarted(const GraphicsLayer*, double) { }
-    virtual void notifySyncRequired(const GraphicsLayer*) { scheduleSync(); }
-    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) { }
-
-    // These calls return false always. They are saying that the layers associated with this client
-    // (the clipLayer and scrollLayer) should never show debugging info.
-    virtual bool showDebugBorders() const { return false; }
-    virtual bool showRepaintCounter() const { return false; }
-    
     // Whether the given RL needs a compositing layer.
     bool needsToBeComposited(const RenderLayer*) const;
     // Whether the layer has an intrinsic need for compositing layer.