[chromium] Change WebLayer from a concrete type to a pure virtual interface
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 01:28:52 +0000 (01:28 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 01:28:52 +0000 (01:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=94174

Reviewed by Adrienne Walker.

Source/Platform:

This changes WebLayer from a value type to a pure virtual interface and changes Web*Layers from subtypes to
standalone types that have a WebLayer. This better isolates the implementation from the interface and, since
it's not possible to re-wrap an existing layer, makes cleanup explicit instead of requiring the caller to
invoke special cleanup methods before shutdown.

* chromium/public/WebContentLayer.h:
(WebContentLayer):
* chromium/public/WebExternalTextureLayer.h:
(WebExternalTextureLayer):
* chromium/public/WebIOSurfaceLayer.h:
(WebIOSurfaceLayer):
* chromium/public/WebImageLayer.h:
(WebImageLayer):
* chromium/public/WebLayer.h:
(WebKit):
(WebLayer):
(WebKit::WebLayer::~WebLayer):
* chromium/public/WebScrollableLayer.h: Removed.
* chromium/public/WebScrollbarLayer.h:
(WebScrollbarLayer):
* chromium/public/WebSolidColorLayer.h:
(WebKit):
(WebSolidColorLayer):
(WebKit::WebSolidColorLayer::~WebSolidColorLayer):
* chromium/public/WebVideoLayer.h:
(WebVideoLayer):

Source/WebCore:

This updates WebCore code for the WebLayer interface changes. Classes that have ownership of specific layer
types (such as DrawingBufferChromium, Canvas2DLayerBridge and ScrollingCoordinatorChromium) hold ownership
of a specific type and a pointer to the WebLayer to GraphicsLayerChromium to be included in the final layer
tree. GraphicsLayerChromium holds a WebContentLayer and (optionally) a WebImageLayer and WebLayer (for
m_transformLayer) and assembles the final layer tree.

* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
(ScrollingCoordinatorPrivate):
(WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::scrollLayer):
(WebCore::scrollableLayerForGraphicsLayer):
(WebCore):
(WebCore::createScrollbarLayer):
(WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
(WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
(WebCore::ScrollingCoordinator::setScrollLayer):
(WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
(WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
(WebCore::ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers):
(WebCore::ScrollingCoordinator::setLayerIsFixedToContainerLayer):
* platform/graphics/chromium/Canvas2DLayerBridge.cpp:
(WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
(WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
(WebCore::Canvas2DLayerBridge::prepareForDraw):
(WebCore::Canvas2DLayerBridge::layer):
(WebCore::Canvas2DLayerBridge::contextAcquired):
* platform/graphics/chromium/Canvas2DLayerBridge.h:
(Canvas2DLayerBridge):
* platform/graphics/chromium/DrawingBufferChromium.cpp:
(WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
(WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
(WebCore::DrawingBufferPrivate::layer):
(DrawingBufferPrivate):
* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::GraphicsLayerChromium):
(WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
(WebCore::GraphicsLayerChromium::willBeDestroyed):
(WebCore::GraphicsLayerChromium::updateNames):
(WebCore::GraphicsLayerChromium::removeFromParent):
(WebCore::GraphicsLayerChromium::setSize):
(WebCore::GraphicsLayerChromium::clearBackgroundColor):
(WebCore::GraphicsLayerChromium::setContentsOpaque):
(WebCore::GraphicsLayerChromium::setFilters):
(WebCore::GraphicsLayerChromium::setBackgroundFilters):
(WebCore::GraphicsLayerChromium::setMaskLayer):
(WebCore::GraphicsLayerChromium::setBackfaceVisibility):
(WebCore::GraphicsLayerChromium::setOpacity):
(WebCore::GraphicsLayerChromium::setReplicatedByLayer):
(WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
(WebCore::GraphicsLayerChromium::setNeedsDisplay):
(WebCore::GraphicsLayerChromium::setNeedsDisplayInRect):
(WebCore::GraphicsLayerChromium::setContentsToImage):
(WebCore::GraphicsLayerChromium::setContentsToCanvas):
(WebCore):
(WebCore::GraphicsLayerChromium::setContentsToMedia):
(WebCore::GraphicsLayerChromium::setContentsTo):
(WebCore::GraphicsLayerChromium::addAnimation):
(WebCore::GraphicsLayerChromium::pauseAnimation):
(WebCore::GraphicsLayerChromium::removeAnimation):
(WebCore::GraphicsLayerChromium::suspendAnimations):
(WebCore::GraphicsLayerChromium::resumeAnimations):
(WebCore::GraphicsLayerChromium::platformLayer):
(WebCore::GraphicsLayerChromium::setDebugBackgroundColor):
(WebCore::GraphicsLayerChromium::setDebugBorder):
(WebCore::GraphicsLayerChromium::updateChildList):
(WebCore::GraphicsLayerChromium::updateLayerPosition):
(WebCore::GraphicsLayerChromium::updateLayerSize):
(WebCore::GraphicsLayerChromium::updateAnchorPoint):
(WebCore::GraphicsLayerChromium::updateTransform):
(WebCore::GraphicsLayerChromium::updateChildrenTransform):
(WebCore::GraphicsLayerChromium::updateMasksToBounds):
(WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
(WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
(WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
(WebCore::GraphicsLayerChromium::updateContentsRect):
(WebCore::GraphicsLayerChromium::updateContentsScale):
(WebCore::GraphicsLayerChromium::setupContentsLayer):
* platform/graphics/chromium/GraphicsLayerChromium.h:
(GraphicsLayerChromium):
(WebCore::GraphicsLayerChromium::hasContentsLayer):
(WebCore::GraphicsLayerChromium::contentLayer):
(WebCore::GraphicsLayerChromium::contentsLayer):
* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::rootLayer):
* platform/graphics/chromium/LayerChromium.h:

Source/WebKit/chromium:

This updates the implementation of the Web*Layer family to the new design and updates callers in WebViewImpl /
NonCompositedContentHost / LinkHighlight.

* WebKit.gypi:
* src/LinkHighlight.cpp:
(WebKit::LinkHighlight::LinkHighlight):
(WebKit::LinkHighlight::contentLayer):
(WebKit::LinkHighlight::clipLayer):
(WebKit::LinkHighlight::releaseResources):
(WebKit::LinkHighlight::computeHighlightLayerPathAndPosition):
(WebKit::LinkHighlight::startHighlightAnimation):
(WebKit::LinkHighlight::updateGeometry):
* src/LinkHighlight.h:
(LinkHighlight):
* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::NonCompositedContentHost):
(WebKit::NonCompositedContentHost::setScrollLayer):
(WebKit::NonCompositedContentHost::setViewport):
(WebKit::NonCompositedContentHost::scrollLayer):
* src/NonCompositedContentHost.h:
* src/WebContentLayer.cpp: Removed.
* src/WebContentLayerImpl.cpp:
(WebKit::WebContentLayer::create):
(WebKit::WebContentLayerImpl::WebContentLayerImpl):
(WebKit::WebContentLayerImpl::~WebContentLayerImpl):
(WebKit::WebContentLayerImpl::layer):
(WebKit):
(WebKit::WebContentLayerImpl::setDoubleSided):
(WebKit::WebContentLayerImpl::setContentsScale):
(WebKit::WebContentLayerImpl::setUseLCDText):
(WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles):
(WebKit::WebContentLayerImpl::paintContents):
* src/WebContentLayerImpl.h:
(WebContentLayerImpl):
* src/WebExternalTextureLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp.
(WebKit):
(WebKit::WebExternalTextureLayer::create):
(WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayerImpl::layer):
(WebKit::WebExternalTextureLayerImpl::setTextureId):
(WebKit::WebExternalTextureLayerImpl::setFlipped):
(WebKit::WebExternalTextureLayerImpl::setUVRect):
(WebKit::WebExternalTextureLayerImpl::setOpaque):
(WebKit::WebExternalTextureLayerImpl::setPremultipliedAlpha):
(WebKit::WebExternalTextureLayerImpl::willModifyTexture):
(WebKit::WebExternalTextureLayerImpl::setRateLimitContext):
(WebTextureUpdaterImpl):
(WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
(WebKit::WebExternalTextureLayerImpl::prepareTexture):
(WebKit::WebExternalTextureLayerImpl::context):
* src/WebExternalTextureLayerImpl.h: Copied from Source/Platform/chromium/public/WebVideoLayer.h.
(WebKit):
(WebExternalTextureLayerImpl):
* src/WebIOSurfaceLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp.
(WebKit):
(WebKit::WebIOSurfaceLayer::create):
(WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl):
(WebKit::WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl):
(WebKit::WebIOSurfaceLayerImpl::setIOSurfaceProperties):
(WebKit::WebIOSurfaceLayerImpl::layer):
* src/WebIOSurfaceLayerImpl.h: Copied from Source/Platform/chromium/public/WebImageLayer.h.
(WebCore):
(WebKit):
(WebIOSurfaceLayerImpl):
* src/WebImageLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebSolidColorLayer.cpp.
(WebKit):
(WebKit::WebImageLayer::create):
(WebKit::WebImageLayerImpl::WebImageLayerImpl):
(WebKit::WebImageLayerImpl::~WebImageLayerImpl):
(WebKit::WebImageLayerImpl::layer):
(WebKit::WebImageLayerImpl::setBitmap):
* src/WebImageLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebImageLayer.cpp.
(WebCore):
(WebKit):
(WebImageLayerImpl):
* src/WebLayer.cpp: Removed.
* src/WebLayerImpl.cpp:
(WebKit::WebLayer::create):
(WebKit::WebLayerImpl::WebLayerImpl):
(WebKit::WebLayerImpl::~WebLayerImpl):
(WebKit):
(WebKit::WebLayerImpl::id):
(WebKit::WebLayerImpl::invalidateRect):
(WebKit::WebLayerImpl::invalidate):
(WebKit::WebLayerImpl::addChild):
(WebKit::WebLayerImpl::insertChild):
(WebKit::WebLayerImpl::replaceChild):
(WebKit::WebLayerImpl::setChildren):
(WebKit::WebLayerImpl::removeFromParent):
(WebKit::WebLayerImpl::removeAllChildren):
(WebKit::WebLayerImpl::setAnchorPoint):
(WebKit::WebLayerImpl::anchorPoint):
(WebKit::WebLayerImpl::setAnchorPointZ):
(WebKit::WebLayerImpl::anchorPointZ):
(WebKit::WebLayerImpl::setBounds):
(WebKit::WebLayerImpl::bounds):
(WebKit::WebLayerImpl::setMasksToBounds):
(WebKit::WebLayerImpl::masksToBounds):
(WebKit::WebLayerImpl::setMaskLayer):
(WebKit::WebLayerImpl::setReplicaLayer):
(WebKit::WebLayerImpl::setOpacity):
(WebKit::WebLayerImpl::opacity):
(WebKit::WebLayerImpl::setOpaque):
(WebKit::WebLayerImpl::opaque):
(WebKit::WebLayerImpl::setPosition):
(WebKit::WebLayerImpl::position):
(WebKit::WebLayerImpl::setSublayerTransform):
(WebKit::WebLayerImpl::sublayerTransform):
(WebKit::WebLayerImpl::setTransform):
(WebKit::WebLayerImpl::transform):
(WebKit::WebLayerImpl::setDrawsContent):
(WebKit::WebLayerImpl::drawsContent):
(WebKit::WebLayerImpl::setPreserves3D):
(WebKit::WebLayerImpl::setUseParentBackfaceVisibility):
(WebKit::WebLayerImpl::setBackgroundColor):
(WebKit::WebLayerImpl::setFilters):
(WebKit::WebLayerImpl::setBackgroundFilters):
(WebKit::WebLayerImpl::setDebugBorderColor):
(WebKit::WebLayerImpl::setDebugBorderWidth):
(WebKit::WebLayerImpl::setDebugName):
(WebKit::WebLayerImpl::setAnimationDelegate):
(WebKit::WebLayerImpl::addAnimation):
(WebKit::WebLayerImpl::removeAnimation):
(WebKit::WebLayerImpl::pauseAnimation):
(WebKit::WebLayerImpl::suspendAnimations):
(WebKit::WebLayerImpl::resumeAnimations):
(WebKit::WebLayerImpl::hasActiveAnimation):
(WebKit::WebLayerImpl::transferAnimationsTo):
(WebKit::WebLayerImpl::setForceRenderSurface):
(WebKit::WebLayerImpl::setScrollPosition):
(WebKit::WebLayerImpl::setScrollable):
(WebKit::WebLayerImpl::setHaveWheelEventHandlers):
(WebKit::WebLayerImpl::setShouldScrollOnMainThread):
(WebKit::WebLayerImpl::setNonFastScrollableRegion):
(WebKit::WebLayerImpl::setIsContainerForFixedPositionLayers):
(WebKit::WebLayerImpl::setFixedToContainerLayer):
(WebKit::WebLayerImpl::layer):
* src/WebLayerImpl.h:
(WebCore):
(WebLayerImpl):
* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::setRootLayer):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::create):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::readyStateChanged):
(WebKit::WebMediaPlayerClientImpl::repaint):
(WebKit::WebMediaPlayerClientImpl::setOpaque):
(WebKit::WebMediaPlayerClientImpl::platformLayer):
(WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
* src/WebMediaPlayerClientImpl.h:
(WebMediaPlayerClientImpl):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::setBackingTextureId):
(WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
(WebKit::WebPluginContainerImpl::commitBackingTexture):
(WebKit::WebPluginContainerImpl::setOpaque):
(WebKit::WebPluginContainerImpl::platformLayer):
* src/WebPluginContainerImpl.h:
(WebPluginContainerImpl):
* src/WebScrollableLayer.cpp: Removed.
* src/WebScrollbarLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayer.cpp.
(WebKit):
(WebKit::WebScrollbarLayer::create):
(WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl):
(WebKit::WebScrollbarLayerImpl::~WebScrollbarLayerImpl):
(WebKit::WebScrollbarLayerImpl::layer):
(WebKit::WebScrollbarLayerImpl::setScrollLayer):
* src/WebScrollbarLayerImpl.h: Copied from Source/WebKit/chromium/src/WebSolidColorLayerImpl.h.
(WebCore):
(WebKit):
(WebScrollbarLayerImpl):
* src/WebSolidColorLayerImpl.cpp:
(WebKit::WebSolidColorLayer::create):
(WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
(WebKit::WebSolidColorLayerImpl::layer):
(WebKit):
(WebKit::WebSolidColorLayerImpl::setBackgroundColor):
* src/WebSolidColorLayerImpl.h:
(WebCore):
(WebKit):
(WebSolidColorLayerImpl):
* src/WebVideoLayerImpl.cpp: Copied from Source/WebKit/chromium/src/WebVideoLayer.cpp.
(WebKit):
(WebKit::WebVideoLayer::create):
(WebKit::WebVideoLayerImpl::WebVideoLayerImpl):
(WebKit::WebVideoLayerImpl::~WebVideoLayerImpl):
(WebKit::WebVideoLayerImpl::layer):
(WebKit::WebVideoLayerImpl::active):
* src/WebVideoLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebVideoLayer.cpp.
(WebCore):
(WebKit):
(WebVideoLayerImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::setRootGraphicsLayer):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit):
* src/WebViewImpl.h:
* tests/ImageLayerChromiumTest.cpp:
(WebCore::TEST):
* tests/WebLayerTest.cpp:
* tests/WebLayerTreeViewTest.cpp:

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

54 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebContentLayer.h
Source/Platform/chromium/public/WebExternalTextureLayer.h
Source/Platform/chromium/public/WebIOSurfaceLayer.h
Source/Platform/chromium/public/WebImageLayer.h
Source/Platform/chromium/public/WebLayer.h
Source/Platform/chromium/public/WebScrollableLayer.h [deleted file]
Source/Platform/chromium/public/WebScrollbarLayer.h
Source/Platform/chromium/public/WebSolidColorLayer.h
Source/Platform/chromium/public/WebVideoLayer.h
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h
Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerChromium.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/src/LinkHighlight.cpp
Source/WebKit/chromium/src/LinkHighlight.h
Source/WebKit/chromium/src/NonCompositedContentHost.cpp
Source/WebKit/chromium/src/NonCompositedContentHost.h
Source/WebKit/chromium/src/WebContentLayerImpl.cpp
Source/WebKit/chromium/src/WebContentLayerImpl.h
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp with 50% similarity]
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h [moved from Source/WebKit/chromium/src/WebContentLayer.cpp with 53% similarity]
Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp with 70% similarity]
Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h [new file with mode: 0644]
Source/WebKit/chromium/src/WebImageLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebSolidColorLayer.cpp with 70% similarity]
Source/WebKit/chromium/src/WebImageLayerImpl.h [moved from Source/WebKit/chromium/src/WebImageLayer.cpp with 73% similarity]
Source/WebKit/chromium/src/WebLayer.cpp [deleted file]
Source/WebKit/chromium/src/WebLayerImpl.cpp
Source/WebKit/chromium/src/WebLayerImpl.h
Source/WebKit/chromium/src/WebLayerTreeView.cpp
Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.h
Source/WebKit/chromium/src/WebScrollableLayer.cpp [deleted file]
Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebScrollbarLayer.cpp with 61% similarity]
Source/WebKit/chromium/src/WebScrollbarLayerImpl.h [new file with mode: 0644]
Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp
Source/WebKit/chromium/src/WebSolidColorLayerImpl.h
Source/WebKit/chromium/src/WebVideoLayerImpl.cpp [new file with mode: 0644]
Source/WebKit/chromium/src/WebVideoLayerImpl.h [moved from Source/WebKit/chromium/src/WebVideoLayer.cpp with 74% similarity]
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h
Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp
Source/WebKit/chromium/tests/WebLayerTest.cpp
Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp

index fa41529..12aa87c 100644 (file)
@@ -1,3 +1,37 @@
+2012-08-22  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Change WebLayer from a concrete type to a pure virtual interface
+        https://bugs.webkit.org/show_bug.cgi?id=94174
+
+        Reviewed by Adrienne Walker.
+
+        This changes WebLayer from a value type to a pure virtual interface and changes Web*Layers from subtypes to
+        standalone types that have a WebLayer. This better isolates the implementation from the interface and, since
+        it's not possible to re-wrap an existing layer, makes cleanup explicit instead of requiring the caller to
+        invoke special cleanup methods before shutdown.
+
+        * chromium/public/WebContentLayer.h:
+        (WebContentLayer):
+        * chromium/public/WebExternalTextureLayer.h:
+        (WebExternalTextureLayer):
+        * chromium/public/WebIOSurfaceLayer.h:
+        (WebIOSurfaceLayer):
+        * chromium/public/WebImageLayer.h:
+        (WebImageLayer):
+        * chromium/public/WebLayer.h:
+        (WebKit):
+        (WebLayer):
+        (WebKit::WebLayer::~WebLayer):
+        * chromium/public/WebScrollableLayer.h: Removed.
+        * chromium/public/WebScrollbarLayer.h:
+        (WebScrollbarLayer):
+        * chromium/public/WebSolidColorLayer.h:
+        (WebKit):
+        (WebSolidColorLayer):
+        (WebKit::WebSolidColorLayer::~WebSolidColorLayer):
+        * chromium/public/WebVideoLayer.h:
+        (WebVideoLayer):
+
 2012-08-21  Benjamin Poulain  <bpoulain@apple.com>
 
         Store CString data in the CStringBuffer to avoid the double indirection
 2012-08-21  Benjamin Poulain  <bpoulain@apple.com>
 
         Store CString data in the CStringBuffer to avoid the double indirection
index 7336bfa..312107f 100644 (file)
 #define WebContentLayer_h
 
 #include "WebCommon.h"
 #define WebContentLayer_h
 
 #include "WebCommon.h"
-#include "WebScrollableLayer.h"
-
-namespace WebCore {
-class ContentLayerChromium;
-}
 
 namespace WebKit {
 class WebContentLayerClient;
 
 namespace WebKit {
 class WebContentLayerClient;
-class WebContentLayerImpl;
 
 
-class WebContentLayer : public WebScrollableLayer {
+class WebContentLayer {
 public:
 public:
-    WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*);
+    // The client must outlive the WebContentLayer.
+    WEBKIT_EXPORT static WebContentLayer* create(WebContentLayerClient*);
 
 
-    WebContentLayer() { }
-    WebContentLayer(const WebContentLayer& layer) : WebScrollableLayer(layer) { }
     virtual ~WebContentLayer() { }
     virtual ~WebContentLayer() { }
-    WebContentLayer& operator=(const WebContentLayer& layer)
-    {
-        WebLayer::assign(layer);
-        return *this;
-    }
 
 
-    // Called when the WebContentLayerClient is going away and should not be used.
-    WEBKIT_EXPORT void clearClient();
+    // The WebContentLayer has ownership of this wrapper.
+    virtual WebLayer* layer() = 0;
 
     // Set to true if the backside of this layer's contents should be visible when composited.
     // Defaults to false.
 
     // Set to true if the backside of this layer's contents should be visible when composited.
     // Defaults to false.
-    WEBKIT_EXPORT void setDoubleSided(bool);
+    virtual void setDoubleSided(bool) = 0;
 
     // Set to apply a scale factor used when painting and drawing this layer's content. Defaults to 1.0.
 
     // Set to apply a scale factor used when painting and drawing this layer's content. Defaults to 1.0.
-    WEBKIT_EXPORT void setContentsScale(float);
+    virtual void setContentsScale(float) = 0;
 
     // Set to render text in this layer with LCD antialiasing. Only set if you know that this layer will be
     // drawn in a way where this makes sense - i.e. opaque background, not rotated or scaled, etc.
     // Defaults to false;
 
     // Set to render text in this layer with LCD antialiasing. Only set if you know that this layer will be
     // drawn in a way where this makes sense - i.e. opaque background, not rotated or scaled, etc.
     // Defaults to false;
-    WEBKIT_EXPORT void setUseLCDText(bool);
+    virtual void setUseLCDText(bool) = 0;
 
     // Set to draw a system-defined checkerboard if the compositor would otherwise draw a tile in this layer
     // and the actual contents are unavailable. If false, the compositor will draw the layer's background color
     // for these tiles.
     // Defaults to false.
 
     // Set to draw a system-defined checkerboard if the compositor would otherwise draw a tile in this layer
     // and the actual contents are unavailable. If false, the compositor will draw the layer's background color
     // for these tiles.
     // Defaults to false.
-    WEBKIT_EXPORT void setDrawCheckerboardForMissingTiles(bool);
-
-#if WEBKIT_IMPLEMENTATION
-    WebContentLayer(const WTF::PassRefPtr<WebCore::ContentLayerChromium>&);
-    WebContentLayer& operator=(const WTF::PassRefPtr<WebCore::ContentLayerChromium>&);
-    operator WTF::PassRefPtr<WebCore::ContentLayerChromium>() const;
-#endif
+    virtual void setDrawCheckerboardForMissingTiles(bool) = 0;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index b19c05f..92d2c4f 100644 (file)
 #include "WebFloatRect.h"
 #include "WebLayer.h"
 
 #include "WebFloatRect.h"
 #include "WebLayer.h"
 
-namespace WebCore {
-class TextureLayerChromium;
-}
-
 namespace WebKit {
 
 class WebExternalTextureLayerClient;
 namespace WebKit {
 
 class WebExternalTextureLayerClient;
@@ -44,49 +40,43 @@ class WebExternalTextureLayerClient;
 // When in single-thread mode, this means during WebLayerTreeView::composite().
 // When using the threaded compositor, this can mean at an arbitrary time until
 // the WebLayerTreeView is destroyed.
 // When in single-thread mode, this means during WebLayerTreeView::composite().
 // When using the threaded compositor, this can mean at an arbitrary time until
 // the WebLayerTreeView is destroyed.
-class WebExternalTextureLayer : public WebLayer {
+class WebExternalTextureLayer {
 public:
     // The owner of this layer may optionally provide a client. This client will
     // be called whenever the compositor wishes to produce a new frame and can
     // provide a new front buffer texture ID. This is useful if the client wants to
     // implement a double-buffering scheme that is synchronized with the compositor, for instance.
 public:
     // The owner of this layer may optionally provide a client. This client will
     // be called whenever the compositor wishes to produce a new frame and can
     // provide a new front buffer texture ID. This is useful if the client wants to
     // implement a double-buffering scheme that is synchronized with the compositor, for instance.
-    WEBKIT_EXPORT static WebExternalTextureLayer create(WebExternalTextureLayerClient* = 0);
-
-    // Indicates that the client for this layer is going away and shouldn't be used.
-    WEBKIT_EXPORT void clearClient();
+    // The client must outlive the WebExternalTextureLayer.
+    WEBKIT_EXPORT static WebExternalTextureLayer* create(WebExternalTextureLayerClient* = 0);
 
 
-    WebExternalTextureLayer() { }
     virtual ~WebExternalTextureLayer() { }
 
     virtual ~WebExternalTextureLayer() { }
 
+    virtual WebLayer* layer() = 0;
+
     // Sets the texture id that represents the layer, in the namespace of the
     // compositor context.
     // Sets the texture id that represents the layer, in the namespace of the
     // compositor context.
-    WEBKIT_EXPORT void setTextureId(unsigned);
+    virtual void setTextureId(unsigned) = 0;
 
     // Sets whether or not the texture should be flipped in the Y direction when
     // rendered.
 
     // Sets whether or not the texture should be flipped in the Y direction when
     // rendered.
-    WEBKIT_EXPORT void setFlipped(bool);
+    virtual void setFlipped(bool) = 0;
 
     // Sets the rect in UV space of the texture that is mapped to the layer
     // bounds.
 
     // Sets the rect in UV space of the texture that is mapped to the layer
     // bounds.
-    WEBKIT_EXPORT void setUVRect(const WebFloatRect&);
+    virtual void setUVRect(const WebFloatRect&) = 0;
 
     // Sets whether every pixel in this layer is opaque. Defaults to false.
 
     // Sets whether every pixel in this layer is opaque. Defaults to false.
-    WEBKIT_EXPORT void setOpaque(bool);
+    virtual void setOpaque(bool) = 0;
 
     // Sets whether this layer's texture has premultiplied alpha or not. Defaults to true.
 
     // Sets whether this layer's texture has premultiplied alpha or not. Defaults to true.
-    WEBKIT_EXPORT void setPremultipliedAlpha(bool);
+    virtual void setPremultipliedAlpha(bool) = 0;
 
     // Indicates that the most recently provided texture ID is about to be modified externally.
 
     // Indicates that the most recently provided texture ID is about to be modified externally.
-    WEBKIT_EXPORT void willModifyTexture();
+    virtual void willModifyTexture() = 0;
 
     // Sets whether this context should be rate limited by the compositor. Rate limiting works by blocking
     // invalidate() and invalidateRect() calls if the compositor is too many frames behind.
 
     // Sets whether this context should be rate limited by the compositor. Rate limiting works by blocking
     // invalidate() and invalidateRect() calls if the compositor is too many frames behind.
-    WEBKIT_EXPORT void setRateLimitContext(bool);
-
-private:
-#if WEBKIT_IMPLEMENTATION
-    explicit WebExternalTextureLayer(PassRefPtr<WebCore::TextureLayerChromium>);
-#endif
+    virtual void setRateLimitContext(bool) = 0;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index 37a4c67..bcf1411 100644 (file)
 #include "WebLayer.h"
 #include "WebSize.h"
 
 #include "WebLayer.h"
 #include "WebSize.h"
 
-namespace WebCore {
-class IOSurfaceLayerChromium;
-}
-
 namespace WebKit {
 
 // This class represents a layer that renders an externally managed IOSurface.
 namespace WebKit {
 
 // This class represents a layer that renders an externally managed IOSurface.
-class WebIOSurfaceLayer : public WebLayer {
+class WebIOSurfaceLayer {
 public:
 public:
-    WEBKIT_EXPORT static WebIOSurfaceLayer create();
+    WEBKIT_EXPORT static WebIOSurfaceLayer* create();
 
 
-    WebIOSurfaceLayer() { }
     virtual ~WebIOSurfaceLayer() { }
 
     virtual ~WebIOSurfaceLayer() { }
 
-    // Sets the IO surface id that represents this layer's contents.
-    WEBKIT_EXPORT void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize);
+    virtual WebLayer* layer() = 0;
 
 
-private:
-#if WEBKIT_IMPLEMENTATION
-    explicit WebIOSurfaceLayer(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
-#endif
+    // Sets the IO surface id that represents this layer's contents.
+    virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) = 0;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index a916835..c7737f3 100644 (file)
 #include "WebCommon.h"
 #include "WebLayer.h"
 
 #include "WebCommon.h"
 #include "WebLayer.h"
 
-namespace WebCore {
-class ImageLayerChromium;
-}
-
 namespace WebKit {
 
 namespace WebKit {
 
-class WebImageLayer : public WebLayer {
+class WebImageLayer {
 public:
 public:
-    WEBKIT_EXPORT static WebImageLayer create();
+    WEBKIT_EXPORT static WebImageLayer* create();
 
 
-    WebImageLayer() { }
     virtual ~WebImageLayer() { }
 
     virtual ~WebImageLayer() { }
 
-    WEBKIT_EXPORT void setBitmap(SkBitmap);
-
-#if WEBKIT_IMPLEMENTATION
-    explicit WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium>);
-#endif
+    virtual WebLayer* layer() = 0;
+    virtual void setBitmap(SkBitmap) = 0;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index 6431f84..60ed694 100644 (file)
 #include "WebAnimation.h"
 #include "WebColor.h"
 #include "WebCommon.h"
 #include "WebAnimation.h"
 #include "WebColor.h"
 #include "WebCommon.h"
+#include "WebPoint.h"
 #include "WebPrivatePtr.h"
 #include "WebPrivatePtr.h"
+#include "WebRect.h"
 #include "WebString.h"
 #include "WebVector.h"
 
 class SkMatrix44;
 #include "WebString.h"
 #include "WebVector.h"
 
 class SkMatrix44;
-namespace WebCore { class LayerChromium; }
 
 namespace WebKit {
 class WebAnimationDelegate;
 
 namespace WebKit {
 class WebAnimationDelegate;
@@ -44,73 +45,69 @@ struct WebFloatPoint;
 struct WebFloatRect;
 struct WebSize;
 
 struct WebFloatRect;
 struct WebSize;
 
+class WebLayerImpl;
+
 class WebLayer {
 public:
 class WebLayer {
 public:
-    WEBKIT_EXPORT static WebLayer create();
-
-    WebLayer() { }
-    WebLayer(const WebLayer& layer) { assign(layer); }
-    virtual ~WebLayer() { reset(); }
-    WebLayer& operator=(const WebLayer& layer)
-    {
-        assign(layer);
-        return *this;
-    }
-    bool isNull() const { return m_private.isNull(); }
-    WEBKIT_EXPORT void reset();
-    WEBKIT_EXPORT void assign(const WebLayer&);
-    WEBKIT_EXPORT bool equals(const WebLayer&) const;
+#define WEBLAYER_IS_PURE_VIRTUAL
+    WEBKIT_EXPORT static WebLayer* create();
+
+    virtual ~WebLayer() { }
+
+    // Returns a positive ID that will be unique across all WebLayers allocated in this process.
+    virtual int id() const = 0;
 
     // Sets a region of the layer as invalid, i.e. needs to update its content.
 
     // Sets a region of the layer as invalid, i.e. needs to update its content.
-    WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
+    virtual void invalidateRect(const WebFloatRect&) = 0;
 
     // Sets the entire layer as invalid, i.e. needs to update its content.
 
     // Sets the entire layer as invalid, i.e. needs to update its content.
-    WEBKIT_EXPORT void invalidate();
+    virtual void invalidate() = 0;
 
 
-    WEBKIT_EXPORT void addChild(const WebLayer&);
-    WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index);
-    WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer);
-    WEBKIT_EXPORT void setChildren(const WebVector<WebLayer>&);
-    WEBKIT_EXPORT void removeFromParent();
-    WEBKIT_EXPORT void removeAllChildren();
+    // These functions do not take ownership of the WebLayer* parameter.
+    virtual void addChild(WebLayer*) = 0;
+    virtual void insertChild(WebLayer*, size_t index) = 0;
+    virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) = 0;
+    virtual void setChildren(const WebVector<WebLayer*>&) = 0;
+    virtual void removeFromParent() = 0;
+    virtual void removeAllChildren() = 0;
 
 
-    WEBKIT_EXPORT void setAnchorPoint(const WebFloatPoint&);
-    WEBKIT_EXPORT WebFloatPoint anchorPoint() const;
+    virtual void setAnchorPoint(const WebFloatPoint&) = 0;
+    virtual WebFloatPoint anchorPoint() const = 0;
 
 
-    WEBKIT_EXPORT void setAnchorPointZ(float);
-    WEBKIT_EXPORT float anchorPointZ() const;
+    virtual void setAnchorPointZ(float) = 0;
+    virtual float anchorPointZ() const = 0;
 
 
-    WEBKIT_EXPORT void setBounds(const WebSize&);
-    WEBKIT_EXPORT WebSize bounds() const;
+    virtual void setBounds(const WebSize&) = 0;
+    virtual WebSize bounds() const = 0;
 
 
-    WEBKIT_EXPORT void setMasksToBounds(bool);
-    WEBKIT_EXPORT bool masksToBounds() const;
+    virtual void setMasksToBounds(bool) = 0;
+    virtual bool masksToBounds() const = 0;
 
 
-    WEBKIT_EXPORT void setMaskLayer(const WebLayer&);
-    WEBKIT_EXPORT void setReplicaLayer(const WebLayer&);
+    virtual void setMaskLayer(WebLayer*) = 0;
+    virtual void setReplicaLayer(WebLayer*) = 0;
 
 
-    WEBKIT_EXPORT void setOpacity(float);
-    WEBKIT_EXPORT float opacity() const;
+    virtual void setOpacity(float) = 0;
+    virtual float opacity() const = 0;
 
 
-    WEBKIT_EXPORT void setOpaque(bool);
-    WEBKIT_EXPORT bool opaque() const;
+    virtual void setOpaque(bool) = 0;
+    virtual bool opaque() const = 0;
 
 
-    WEBKIT_EXPORT void setPosition(const WebFloatPoint&);
-    WEBKIT_EXPORT WebFloatPoint position() const;
+    virtual void setPosition(const WebFloatPoint&) = 0;
+    virtual WebFloatPoint position() const = 0;
 
 
-    WEBKIT_EXPORT void setSublayerTransform(const SkMatrix44&);
-    WEBKIT_EXPORT void setSublayerTransform(const WebTransformationMatrix&);
-    WEBKIT_EXPORT SkMatrix44 sublayerTransform() const;
+    virtual void setSublayerTransform(const SkMatrix44&) = 0;
+    virtual void setSublayerTransform(const WebTransformationMatrix&) = 0;
+    virtual SkMatrix44 sublayerTransform() const = 0;
 
 
-    WEBKIT_EXPORT void setTransform(const SkMatrix44&);
-    WEBKIT_EXPORT void setTransform(const WebTransformationMatrix&);
-    WEBKIT_EXPORT SkMatrix44 transform() const;
+    virtual void setTransform(const SkMatrix44&) = 0;
+    virtual void setTransform(const WebTransformationMatrix&) = 0;
+    virtual SkMatrix44 transform() const = 0;
 
     // Sets whether the layer draws its content when compositing.
 
     // Sets whether the layer draws its content when compositing.
-    WEBKIT_EXPORT void setDrawsContent(bool);
-    WEBKIT_EXPORT bool drawsContent() const;
+    virtual void setDrawsContent(bool) = 0;
+    virtual bool drawsContent() const = 0;
 
 
-    WEBKIT_EXPORT void setPreserves3D(bool);
+    virtual void setPreserves3D(bool) = 0;
 
     // Mark that this layer should use its parent's transform and double-sided
     // properties in determining this layer's backface visibility instead of
 
     // Mark that this layer should use its parent's transform and double-sided
     // properties in determining this layer's backface visibility instead of
@@ -119,105 +116,68 @@ public:
     // Note: This API is to work around issues with visibility the handling of
     // WebKit layers that have a contents layer (canvas, plugin, WebGL, video,
     // etc).
     // Note: This API is to work around issues with visibility the handling of
     // WebKit layers that have a contents layer (canvas, plugin, WebGL, video,
     // etc).
-    WEBKIT_EXPORT void setUseParentBackfaceVisibility(bool);
+    virtual void setUseParentBackfaceVisibility(bool) = 0;
 
 
-    WEBKIT_EXPORT void setBackgroundColor(WebColor);
+    virtual void setBackgroundColor(WebColor) = 0;
 
     // Clear the filters in use by passing in a newly instantiated
     // WebFilterOperations object.
 
     // Clear the filters in use by passing in a newly instantiated
     // WebFilterOperations object.
-    WEBKIT_EXPORT void setFilters(const WebFilterOperations&);
+    virtual void setFilters(const WebFilterOperations&) = 0;
 
     // Apply filters to pixels that show through the background of this layer.
     // Note: These filters are only possible on layers that are drawn directly
     // to a root render surface with an opaque background. This means if an
     // ancestor of the background-filtered layer sets certain properties
     // (opacity, transforms), it may conflict and hide the background filters.
 
     // Apply filters to pixels that show through the background of this layer.
     // Note: These filters are only possible on layers that are drawn directly
     // to a root render surface with an opaque background. This means if an
     // ancestor of the background-filtered layer sets certain properties
     // (opacity, transforms), it may conflict and hide the background filters.
-    WEBKIT_EXPORT void setBackgroundFilters(const WebFilterOperations&);
+    virtual void setBackgroundFilters(const WebFilterOperations&) = 0;
 
 
-    WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
-    WEBKIT_EXPORT void setDebugBorderWidth(float);
-    WEBKIT_EXPORT void setDebugName(WebString);
+    virtual void setDebugBorderColor(const WebColor&) = 0;
+    virtual void setDebugBorderWidth(float) = 0;
+    virtual void setDebugName(WebString) = 0;
 
     // An animation delegate is notified when animations are started and
     // stopped. The WebLayer does not take ownership of the delegate, and it is
     // the responsibility of the client to reset the layer's delegate before
     // deleting the delegate.
 
     // An animation delegate is notified when animations are started and
     // stopped. The WebLayer does not take ownership of the delegate, and it is
     // the responsibility of the client to reset the layer's delegate before
     // deleting the delegate.
-    WEBKIT_EXPORT void setAnimationDelegate(WebAnimationDelegate*);
+    virtual void setAnimationDelegate(WebAnimationDelegate*) = 0;
 
     // Returns false if the animation cannot be added.
 
     // Returns false if the animation cannot be added.
-    WEBKIT_EXPORT bool addAnimation(WebAnimation*);
+    virtual bool addAnimation(WebAnimation*) = 0;
 
     // Removes all animations with the given id.
 
     // Removes all animations with the given id.
-    WEBKIT_EXPORT void removeAnimation(int animationId);
+    virtual void removeAnimation(int animationId) = 0;
 
     // Removes all animations with the given id targeting the given property.
 
     // Removes all animations with the given id targeting the given property.
-    WEBKIT_EXPORT void removeAnimation(int animationId, WebAnimation::TargetProperty);
+    virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) = 0;
 
     // Pauses all animations with the given id.
 
     // Pauses all animations with the given id.
-    WEBKIT_EXPORT void pauseAnimation(int animationId, double timeOffset);
+    virtual void pauseAnimation(int animationId, double timeOffset) = 0;
 
     // The following functions suspend and resume all animations. The given time
     // is assumed to use the same time base as monotonicallyIncreasingTime().
 
     // The following functions suspend and resume all animations. The given time
     // is assumed to use the same time base as monotonicallyIncreasingTime().
-    WEBKIT_EXPORT void suspendAnimations(double monotonicTime);
-    WEBKIT_EXPORT void resumeAnimations(double monotonicTime);
+    virtual void suspendAnimations(double monotonicTime) = 0;
+    virtual void resumeAnimations(double monotonicTime) = 0;
 
     // Returns true if this layer has any active animations - useful for tests.
 
     // Returns true if this layer has any active animations - useful for tests.
-    WEBKIT_EXPORT bool hasActiveAnimation();
+    virtual bool hasActiveAnimation() = 0;
 
     // Transfers all animations running on the current layer.
 
     // Transfers all animations running on the current layer.
-    WEBKIT_EXPORT void transferAnimationsTo(WebLayer*);
+    virtual void transferAnimationsTo(WebLayer*) = 0;
+
+    // Scrolling
+    virtual void setScrollPosition(WebPoint) = 0;
+    virtual void setScrollable(bool) = 0;
+    virtual void setHaveWheelEventHandlers(bool) = 0;
+    virtual void setShouldScrollOnMainThread(bool) = 0;
+    virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) = 0;
+    virtual void setIsContainerForFixedPositionLayers(bool) = 0;
+    virtual void setFixedToContainerLayer(bool) = 0;
 
     // Forces this layer to use a render surface. There is no benefit in doing
     // so, but this is to facilitate benchmarks and tests.
 
     // Forces this layer to use a render surface. There is no benefit in doing
     // so, but this is to facilitate benchmarks and tests.
-    WEBKIT_EXPORT void setForceRenderSurface(bool);
-
-    // Drops this layer's render surface, if it has one. Used to break cycles in some
-    // cases - if you aren't sure, you don't need to call this.
-    WEBKIT_EXPORT void clearRenderSurface();
-
-    template<typename T> T to()
-    {
-        T res;
-        res.WebLayer::assign(*this);
-        return res;
-    }
-
-    template<typename T> const T toConst() const
-    {
-        T res;
-        res.WebLayer::assign(*this);
-        return res;
-    }
-
-#if WEBKIT_IMPLEMENTATION
-    WebLayer(const WTF::PassRefPtr<WebCore::LayerChromium>&);
-    WebLayer& operator=(const WTF::PassRefPtr<WebCore::LayerChromium>&);
-    operator WTF::PassRefPtr<WebCore::LayerChromium>() const;
-    template<typename T> T* unwrap() const
-    {
-        return static_cast<T*>(m_private.get());
-    }
-
-    template<typename T> const T* constUnwrap() const
-    {
-        return static_cast<const T*>(m_private.get());
-    }
-#endif
-
-protected:
-    WebPrivatePtr<WebCore::LayerChromium> m_private;
+    virtual void setForceRenderSurface(bool) = 0;
 };
 
 };
 
-inline bool operator==(const WebLayer& a, const WebLayer& b)
-{
-    return a.equals(b);
-}
-
-inline bool operator!=(const WebLayer& a, const WebLayer& b)
-{
-    return !(a == b);
-}
-
 } // namespace WebKit
 
 #endif // WebLayer_h
 } // namespace WebKit
 
 #endif // WebLayer_h
diff --git a/Source/Platform/chromium/public/WebScrollableLayer.h b/Source/Platform/chromium/public/WebScrollableLayer.h
deleted file mode 100644 (file)
index ea02f8c..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2012 Google 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 AND ITS 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 APPLE OR ITS 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 WebScrollableLayer_h
-#define WebScrollableLayer_h
-
-#include "WebCommon.h"
-#include "WebLayer.h"
-#include "WebPoint.h"
-#include "WebRect.h"
-#include "WebVector.h"
-
-namespace WebKit {
-
-class WebScrollableLayer : public WebLayer {
-public:
-    WebScrollableLayer() { }
-    WebScrollableLayer(const WebScrollableLayer& layer) : WebLayer(layer) { }
-    virtual ~WebScrollableLayer() { }
-    WebScrollableLayer& operator=(const WebScrollableLayer& layer)
-    {
-        WebLayer::assign(layer);
-        return *this;
-    }
-
-    WEBKIT_EXPORT void setScrollPosition(WebPoint);
-    WEBKIT_EXPORT void setScrollable(bool);
-    WEBKIT_EXPORT void setHaveWheelEventHandlers(bool);
-    WEBKIT_EXPORT void setShouldScrollOnMainThread(bool);
-    WEBKIT_EXPORT void setNonFastScrollableRegion(const WebVector<WebRect>&);
-    WEBKIT_EXPORT void setIsContainerForFixedPositionLayers(bool);
-    WEBKIT_EXPORT void setFixedToContainerLayer(bool);
-
-
-#if WEBKIT_IMPLEMENTATION
-    WebScrollableLayer(const WTF::PassRefPtr<WebCore::LayerChromium>& layer) : WebLayer(layer) { }
-#endif
-};
-
-} // namespace WebKit
-
-#endif // WebScrollableLayer_h
index 1bfe7d6..451a0b9 100644 (file)
 
 namespace WebCore {
 class Scrollbar;
 
 namespace WebCore {
 class Scrollbar;
-class ScrollbarLayerChromium;
 }
 
 namespace WebKit {
 
 }
 
 namespace WebKit {
 
-class WebScrollbarLayer : public WebLayer {
+class WebScrollbarLayer {
 public:
 public:
-    WebScrollbarLayer() { }
-    WebScrollbarLayer(const WebScrollbarLayer& layer) : WebLayer(layer) { }
     virtual ~WebScrollbarLayer() { }
     virtual ~WebScrollbarLayer() { }
-    WebScrollbarLayer& operator=(const WebScrollbarLayer& layer)
-    {
-        WebLayer::assign(layer);
-        return *this;
-    }
 
 
-    WEBKIT_EXPORT void setScrollLayer(const WebLayer);
+    virtual WebLayer* layer() = 0;
+
+    virtual void setScrollLayer(WebLayer*) = 0;
 
 #if WEBKIT_IMPLEMENTATION
 
 #if WEBKIT_IMPLEMENTATION
-    static WebScrollbarLayer create(WebCore::Scrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>);
-    explicit WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
-    WebScrollbarLayer& operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
-    operator WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>() const;
+    WEBKIT_EXPORT static WebScrollbarLayer* create(WebCore::Scrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>);
 #endif
 };
 
 #endif
 };
 
index ad9123d..02e46f0 100644 (file)
 #ifndef WebSolidColorLayer_h
 #define WebSolidColorLayer_h
 
 #ifndef WebSolidColorLayer_h
 #define WebSolidColorLayer_h
 
+#include "WebColor.h"
 #include "WebCommon.h"
 #include "WebCommon.h"
-#include "WebFloatRect.h"
-#include "WebLayer.h"
 
 namespace WebKit {
 
 namespace WebKit {
-class WebSolidColorLayerImpl;
+class WebLayer;
 
 
-class WebSolidColorLayer : public WebLayer {
+class WebSolidColorLayer {
 public:
 public:
-    WEBKIT_EXPORT static WebSolidColorLayer create();
-    WEBKIT_EXPORT void setBackgroundColor(const WebColor&);
+    WEBKIT_EXPORT static WebSolidColorLayer* create();
 
 
-#if WEBKIT_IMPLEMENTATION
-    WebSolidColorLayer(const WTF::PassRefPtr<WebSolidColorLayerImpl>&);
-#endif
+    virtual ~WebSolidColorLayer() { }
+
+    virtual WebLayer* layer() = 0;
+    virtual void setBackgroundColor(WebColor) = 0;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index 54da345..1acfff5 100644 (file)
 #include "WebCommon.h"
 #include "WebLayer.h"
 
 #include "WebCommon.h"
 #include "WebLayer.h"
 
-namespace WebCore {
-class VideoLayerChromium;
-}
-
 namespace WebKit {
 
 class WebVideoFrameProvider;
 
 namespace WebKit {
 
 class WebVideoFrameProvider;
 
-class WebVideoLayer : public WebLayer {
+class WebVideoLayer {
 public:
 public:
-    WEBKIT_EXPORT static WebVideoLayer create(WebVideoFrameProvider*);
+    WEBKIT_EXPORT static WebVideoLayer* create(WebVideoFrameProvider*);
 
 
-    WebVideoLayer() { }
     virtual ~WebVideoLayer() { }
 
     virtual ~WebVideoLayer() { }
 
-    // Returns true if this layer is actively rendering (e.g. currently attached to a WebLayerTreeView).
-    WEBKIT_EXPORT bool active() const;
+    virtual WebLayer* layer() = 0;
 
 
-#if WEBKIT_IMPLEMENTATION
-    explicit WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium>);
-#endif
+    // Returns true if this layer is actively rendering (e.g. currently attached to a WebLayerTreeView).
+    virtual bool active() const = 0;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index d4ec24c..7e1b942 100644 (file)
@@ -1,3 +1,100 @@
+2012-08-22  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Change WebLayer from a concrete type to a pure virtual interface
+        https://bugs.webkit.org/show_bug.cgi?id=94174
+
+        Reviewed by Adrienne Walker.
+
+        This updates WebCore code for the WebLayer interface changes. Classes that have ownership of specific layer
+        types (such as DrawingBufferChromium, Canvas2DLayerBridge and ScrollingCoordinatorChromium) hold ownership
+        of a specific type and a pointer to the WebLayer to GraphicsLayerChromium to be included in the final layer
+        tree. GraphicsLayerChromium holds a WebContentLayer and (optionally) a WebImageLayer and WebLayer (for
+        m_transformLayer) and assembles the final layer tree.
+
+        * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+        (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
+        (ScrollingCoordinatorPrivate):
+        (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+        (WebCore::scrollableLayerForGraphicsLayer):
+        (WebCore):
+        (WebCore::createScrollbarLayer):
+        (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
+        (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
+        (WebCore::ScrollingCoordinator::setScrollLayer):
+        (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
+        (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
+        (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
+        (WebCore::ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers):
+        (WebCore::ScrollingCoordinator::setLayerIsFixedToContainerLayer):
+        * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+        (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
+        (WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
+        (WebCore::Canvas2DLayerBridge::prepareForDraw):
+        (WebCore::Canvas2DLayerBridge::layer):
+        (WebCore::Canvas2DLayerBridge::contextAcquired):
+        * platform/graphics/chromium/Canvas2DLayerBridge.h:
+        (Canvas2DLayerBridge):
+        * platform/graphics/chromium/DrawingBufferChromium.cpp:
+        (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+        (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+        (WebCore::DrawingBufferPrivate::layer):
+        (DrawingBufferPrivate):
+        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+        (WebCore::GraphicsLayerChromium::GraphicsLayerChromium):
+        (WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
+        (WebCore::GraphicsLayerChromium::willBeDestroyed):
+        (WebCore::GraphicsLayerChromium::updateNames):
+        (WebCore::GraphicsLayerChromium::removeFromParent):
+        (WebCore::GraphicsLayerChromium::setSize):
+        (WebCore::GraphicsLayerChromium::clearBackgroundColor):
+        (WebCore::GraphicsLayerChromium::setContentsOpaque):
+        (WebCore::GraphicsLayerChromium::setFilters):
+        (WebCore::GraphicsLayerChromium::setBackgroundFilters):
+        (WebCore::GraphicsLayerChromium::setMaskLayer):
+        (WebCore::GraphicsLayerChromium::setBackfaceVisibility):
+        (WebCore::GraphicsLayerChromium::setOpacity):
+        (WebCore::GraphicsLayerChromium::setReplicatedByLayer):
+        (WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
+        (WebCore::GraphicsLayerChromium::setNeedsDisplay):
+        (WebCore::GraphicsLayerChromium::setNeedsDisplayInRect):
+        (WebCore::GraphicsLayerChromium::setContentsToImage):
+        (WebCore::GraphicsLayerChromium::setContentsToCanvas):
+        (WebCore):
+        (WebCore::GraphicsLayerChromium::setContentsToMedia):
+        (WebCore::GraphicsLayerChromium::setContentsTo):
+        (WebCore::GraphicsLayerChromium::addAnimation):
+        (WebCore::GraphicsLayerChromium::pauseAnimation):
+        (WebCore::GraphicsLayerChromium::removeAnimation):
+        (WebCore::GraphicsLayerChromium::suspendAnimations):
+        (WebCore::GraphicsLayerChromium::resumeAnimations):
+        (WebCore::GraphicsLayerChromium::platformLayer):
+        (WebCore::GraphicsLayerChromium::setDebugBackgroundColor):
+        (WebCore::GraphicsLayerChromium::setDebugBorder):
+        (WebCore::GraphicsLayerChromium::updateChildList):
+        (WebCore::GraphicsLayerChromium::updateLayerPosition):
+        (WebCore::GraphicsLayerChromium::updateLayerSize):
+        (WebCore::GraphicsLayerChromium::updateAnchorPoint):
+        (WebCore::GraphicsLayerChromium::updateTransform):
+        (WebCore::GraphicsLayerChromium::updateChildrenTransform):
+        (WebCore::GraphicsLayerChromium::updateMasksToBounds):
+        (WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
+        (WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
+        (WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
+        (WebCore::GraphicsLayerChromium::updateContentsRect):
+        (WebCore::GraphicsLayerChromium::updateContentsScale):
+        (WebCore::GraphicsLayerChromium::setupContentsLayer):
+        * platform/graphics/chromium/GraphicsLayerChromium.h:
+        (GraphicsLayerChromium):
+        (WebCore::GraphicsLayerChromium::hasContentsLayer):
+        (WebCore::GraphicsLayerChromium::contentLayer):
+        (WebCore::GraphicsLayerChromium::contentsLayer):
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::rootLayer):
+        * platform/graphics/chromium/LayerChromium.h:
+
 2012-08-22  Kentaro Hara  <haraken@chromium.org>
 
         [V8] Move runScript() from V8Proxy to ScriptRunner
 2012-08-22  Kentaro Hara  <haraken@chromium.org>
 
         [V8] Move runScript() from V8Proxy to ScriptRunner
index 1db7594..e256bde 100644 (file)
 
 #include "Frame.h"
 #include "FrameView.h"
 
 #include "Frame.h"
 #include "FrameView.h"
+#include "Page.h"
 #include "Region.h"
 #include "RenderLayerCompositor.h"
 #include "RenderView.h"
 #include "ScrollbarThemeComposite.h"
 #include "WebScrollbarThemeGeometryNative.h"
 #include "Region.h"
 #include "RenderLayerCompositor.h"
 #include "RenderView.h"
 #include "ScrollbarThemeComposite.h"
 #include "WebScrollbarThemeGeometryNative.h"
-#include <public/WebScrollableLayer.h>
 #include <public/WebScrollbar.h>
 #include <public/WebScrollbarLayer.h>
 #include <public/WebScrollbarThemeGeometry.h>
 #include <public/WebScrollbar.h>
 #include <public/WebScrollbarLayer.h>
 #include <public/WebScrollbarThemeGeometry.h>
@@ -42,7 +42,6 @@
 
 using WebKit::WebLayer;
 using WebKit::WebRect;
 
 using WebKit::WebLayer;
 using WebKit::WebRect;
-using WebKit::WebScrollableLayer;
 using WebKit::WebScrollbarLayer;
 using WebKit::WebVector;
 
 using WebKit::WebScrollbarLayer;
 using WebKit::WebVector;
 
@@ -51,36 +50,39 @@ namespace WebCore {
 class ScrollingCoordinatorPrivate {
 WTF_MAKE_NONCOPYABLE(ScrollingCoordinatorPrivate);
 public:
 class ScrollingCoordinatorPrivate {
 WTF_MAKE_NONCOPYABLE(ScrollingCoordinatorPrivate);
 public:
-    ScrollingCoordinatorPrivate() { }
+    ScrollingCoordinatorPrivate()
+        : m_scrollLayer(0)
+    {
+    }
+
     ~ScrollingCoordinatorPrivate() { }
 
     ~ScrollingCoordinatorPrivate() { }
 
-    void setScrollLayer(WebScrollableLayer layer)
+    void setScrollLayer(WebLayer* layer)
     {
         m_scrollLayer = layer;
 
     {
         m_scrollLayer = layer;
 
-        if (!m_horizontalScrollbarLayer.isNull())
-            m_horizontalScrollbarLayer.setScrollLayer(layer);
-        if (!m_verticalScrollbarLayer.isNull())
-            m_verticalScrollbarLayer.setScrollLayer(layer);
+        if (m_horizontalScrollbarLayer)
+            m_horizontalScrollbarLayer->setScrollLayer(layer);
+        if (m_verticalScrollbarLayer)
+            m_verticalScrollbarLayer->setScrollLayer(layer);
     }
 
     }
 
-    void setHorizontalScrollbarLayer(WebScrollbarLayer layer)
+    void setHorizontalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
     {
         m_horizontalScrollbarLayer = layer;
     }
 
     {
         m_horizontalScrollbarLayer = layer;
     }
 
-    void setVerticalScrollbarLayer(WebScrollbarLayer layer)
+    void setVerticalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
     {
         m_verticalScrollbarLayer = layer;
     }
 
     {
         m_verticalScrollbarLayer = layer;
     }
 
-    bool hasScrollLayer() const { return !m_scrollLayer.isNull(); }
-    WebScrollableLayer scrollLayer() const { return m_scrollLayer; }
+    WebLayer* scrollLayer() const { return m_scrollLayer; }
 
 private:
 
 private:
-    WebScrollableLayer m_scrollLayer;
-    WebScrollbarLayer m_horizontalScrollbarLayer;
-    WebScrollbarLayer m_verticalScrollbarLayer;
+    WebLayer* m_scrollLayer;
+    OwnPtr<WebScrollbarLayer> m_horizontalScrollbarLayer;
+    OwnPtr<WebScrollbarLayer> m_verticalScrollbarLayer;
 };
 
 PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
 };
 
 PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
@@ -112,15 +114,20 @@ static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView)
 #endif
 }
 
 #endif
 }
 
-static WebScrollbarLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollableLayer scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
+static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer)
+{
+    return layer->platformLayer();
+}
+
+static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar, WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
 {
     ASSERT(scrollbar);
     ASSERT(scrollbarGraphicsLayer);
 
 {
     ASSERT(scrollbar);
     ASSERT(scrollbarGraphicsLayer);
 
-    if (scrollLayer.isNull()) {
+    if (!scrollLayer) {
         // FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves.
         // FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves.
-        scrollLayer = scrollLayerForFrameView(frameView)->platformLayer()->to<WebScrollableLayer>();
-        ASSERT(!scrollLayer.isNull());
+        scrollLayer = scrollableLayerForGraphicsLayer(scrollLayerForFrameView(frameView));
+        ASSERT(scrollLayer);
     }
 
     // Root layer non-overlay scrollbars should be marked opaque to disable
     }
 
     // Root layer non-overlay scrollbars should be marked opaque to disable
@@ -138,7 +145,7 @@ static WebScrollbarLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollabl
     if (!platformSupported || scrollbar->isCustomScrollbar()) {
         scrollbarGraphicsLayer->setContentsToMedia(0);
         scrollbarGraphicsLayer->setDrawsContent(true);
     if (!platformSupported || scrollbar->isCustomScrollbar()) {
         scrollbarGraphicsLayer->setContentsToMedia(0);
         scrollbarGraphicsLayer->setDrawsContent(true);
-        return WebScrollbarLayer();
+        return nullptr;
     }
 
     // All Chromium scrollbar themes derive from ScrollbarThemeComposite.
     }
 
     // All Chromium scrollbar themes derive from ScrollbarThemeComposite.
@@ -146,14 +153,14 @@ static WebScrollbarLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollabl
     WebKit::WebScrollbarThemePainter painter(themeComposite, scrollbar);
     OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarThemeGeometryNative::create(themeComposite));
 
     WebKit::WebScrollbarThemePainter painter(themeComposite, scrollbar);
     OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarThemeGeometryNative::create(themeComposite));
 
-    WebScrollbarLayer scrollbarLayer = WebScrollbarLayer::create(scrollbar, painter, geometry.release());
-    scrollbarLayer.setScrollLayer(scrollLayer);
+    OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebScrollbarLayer::create(scrollbar, painter, geometry.release()));
+    scrollbarLayer->setScrollLayer(scrollLayer);
 
 
-    scrollbarGraphicsLayer->setContentsToMedia(&scrollbarLayer);
+    scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer->layer());
     scrollbarGraphicsLayer->setDrawsContent(false);
     scrollbarGraphicsLayer->setDrawsContent(false);
-    scrollbarLayer.setOpaque(scrollbarGraphicsLayer->contentsOpaque());
+    scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaque());
 
 
-    return scrollbarLayer;
+    return scrollbarLayer.release();
 }
 
 void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)
 }
 
 void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)
@@ -161,6 +168,7 @@ void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView*
     if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
         return;
 
     if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
         return;
 
+    setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
     m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView));
 }
 
     m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView));
 }
 
@@ -169,25 +177,25 @@ void ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange(FrameView* f
     if (!verticalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
         return;
 
     if (!verticalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
         return;
 
+    setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
     m_private->setVerticalScrollbarLayer(createScrollbarLayer(frameView->verticalScrollbar(), m_private->scrollLayer(), verticalScrollbarLayer, frameView));
 }
 
 void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer)
 {
     m_private->setVerticalScrollbarLayer(createScrollbarLayer(frameView->verticalScrollbar(), m_private->scrollLayer(), verticalScrollbarLayer, frameView));
 }
 
 void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer)
 {
-    WebScrollableLayer layer;
-    if (scrollLayer)
-        layer = scrollLayer->platformLayer()->to<WebScrollableLayer>();
-    m_private->setScrollLayer(layer);
+    m_private->setScrollLayer(scrollLayer ? scrollableLayerForGraphicsLayer(scrollLayer) : 0);
 }
 
 void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region)
 {
 }
 
 void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region)
 {
-    if (m_private->hasScrollLayer()) {
+    // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
+    setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
+    if (m_private->scrollLayer()) {
         Vector<IntRect> rects = region.rects();
         WebVector<WebRect> webRects(rects.size());
         for (size_t i = 0; i < rects.size(); ++i)
             webRects[i] = rects[i];
         Vector<IntRect> rects = region.rects();
         WebVector<WebRect> webRects(rects.size());
         for (size_t i = 0; i < rects.size(); ++i)
             webRects[i] = rects[i];
-        m_private->scrollLayer().setNonFastScrollableRegion(webRects);
+        m_private->scrollLayer()->setNonFastScrollableRegion(webRects);
     }
 }
 
     }
 }
 
@@ -198,14 +206,18 @@ void ScrollingCoordinator::setScrollParameters(const ScrollParameters&)
 
 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
 {
 
 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
 {
-    if (m_private->hasScrollLayer())
-        m_private->scrollLayer().setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
+    // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
+    setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
+    if (m_private->scrollLayer())
+        m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
 }
 
 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
 {
 }
 
 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
 {
-    if (m_private->hasScrollLayer())
-        m_private->scrollLayer().setShouldScrollOnMainThread(should);
+    // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
+    setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
+    if (m_private->scrollLayer())
+        m_private->scrollLayer()->setShouldScrollOnMainThread(should);
 }
 
 bool ScrollingCoordinator::supportsFixedPositionLayers() const
 }
 
 bool ScrollingCoordinator::supportsFixedPositionLayers() const
@@ -215,14 +227,14 @@ bool ScrollingCoordinator::supportsFixedPositionLayers() const
 
 void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer* layer, bool enable)
 {
 
 void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer* layer, bool enable)
 {
-    if (WebLayer* platformLayer = layer->platformLayer())
-        platformLayer->to<WebScrollableLayer>().setIsContainerForFixedPositionLayers(enable);
+    if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
+        scrollableLayer->setIsContainerForFixedPositionLayers(enable);
 }
 
 void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable)
 {
 }
 
 void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable)
 {
-    if (WebLayer* platformLayer = layer->platformLayer())
-        platformLayer->to<WebScrollableLayer>().setFixedToContainerLayer(enable);
+    if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
+        scrollableLayer->setFixedToContainerLayer(enable);
 }
 
 }
 }
 
 }
index db517ca..1065431 100644 (file)
@@ -69,22 +69,21 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context,
             grContext->resetContext();
     }
 
             grContext->resetContext();
     }
 
-    m_layer = WebExternalTextureLayer::create(this);
-    m_layer.setTextureId(textureId);
-    m_layer.setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
+    m_layer = adoptPtr(WebExternalTextureLayer::create(this));
+    m_layer->setTextureId(textureId);
+    m_layer->setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
 }
 
 Canvas2DLayerBridge::~Canvas2DLayerBridge()
 {
     if (SkDeferredCanvas* deferred = deferredCanvas())
         deferred->setNotificationClient(0);
 }
 
 Canvas2DLayerBridge::~Canvas2DLayerBridge()
 {
     if (SkDeferredCanvas* deferred = deferredCanvas())
         deferred->setNotificationClient(0);
-    m_layer.setTextureId(0);
+    m_layer->setTextureId(0);
     if (m_useDoubleBuffering) {
         m_context->makeContextCurrent();
         GLC(m_context.get(), m_context->deleteTexture(m_frontBufferTexture));
         m_context->flush();
     }
     if (m_useDoubleBuffering) {
         m_context->makeContextCurrent();
         GLC(m_context.get(), m_context->deleteTexture(m_frontBufferTexture));
         m_context->flush();
     }
-    m_layer.clearClient();
 }
 
 SkDeferredCanvas* Canvas2DLayerBridge::deferredCanvas()
 }
 
 SkDeferredCanvas* Canvas2DLayerBridge::deferredCanvas()
@@ -98,7 +97,7 @@ void Canvas2DLayerBridge::prepareForDraw()
 {
     ASSERT(deferredCanvas());
     if (!m_useDoubleBuffering)
 {
     ASSERT(deferredCanvas());
     if (!m_useDoubleBuffering)
-        m_layer.willModifyTexture();
+        m_layer->willModifyTexture();
     m_context->makeContextCurrent();
 }
 
     m_context->makeContextCurrent();
 }
 
@@ -148,13 +147,13 @@ WebGraphicsContext3D* Canvas2DLayerBridge::context()
 
 WebKit::WebLayer* Canvas2DLayerBridge::layer()
 {
 
 WebKit::WebLayer* Canvas2DLayerBridge::layer()
 {
-    return &m_layer;
+    return m_layer->layer();
 }
 
 void Canvas2DLayerBridge::contextAcquired()
 {
     if (m_deferralMode == NonDeferred && !m_useDoubleBuffering)
 }
 
 void Canvas2DLayerBridge::contextAcquired()
 {
     if (m_deferralMode == NonDeferred && !m_useDoubleBuffering)
-        m_layer.willModifyTexture();
+        m_layer->willModifyTexture();
 }
 
 unsigned Canvas2DLayerBridge::backBufferTexture()
 }
 
 unsigned Canvas2DLayerBridge::backBufferTexture()
index 409d207..27b1ea6 100644 (file)
@@ -76,7 +76,7 @@ private:
     unsigned m_backBufferTexture;
     IntSize m_size;
     SkCanvas* m_canvas;
     unsigned m_backBufferTexture;
     IntSize m_size;
     SkCanvas* m_canvas;
-    WebKit::WebExternalTextureLayer m_layer;
+    OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
     RefPtr<GraphicsContext3D> m_context;
 };
 
     RefPtr<GraphicsContext3D> m_context;
 };
 
index 1d167a5..6102a3e 100644 (file)
@@ -156,16 +156,15 @@ class DrawingBufferPrivate : public WebKit::WebExternalTextureLayerClient {
 public:
     explicit DrawingBufferPrivate(DrawingBuffer* drawingBuffer)
         : m_drawingBuffer(drawingBuffer)
 public:
     explicit DrawingBufferPrivate(DrawingBuffer* drawingBuffer)
         : m_drawingBuffer(drawingBuffer)
-        , m_layer(WebKit::WebExternalTextureLayer::create(this))
+        , m_layer(adoptPtr(WebKit::WebExternalTextureLayer::create(this)))
     {
         GraphicsContext3D::Attributes attributes = m_drawingBuffer->graphicsContext3D()->getContextAttributes();
     {
         GraphicsContext3D::Attributes attributes = m_drawingBuffer->graphicsContext3D()->getContextAttributes();
-        m_layer.setOpaque(!attributes.alpha);
-        m_layer.setPremultipliedAlpha(attributes.premultipliedAlpha);
+        m_layer->setOpaque(!attributes.alpha);
+        m_layer->setPremultipliedAlpha(attributes.premultipliedAlpha);
     }
 
     virtual ~DrawingBufferPrivate()
     {
     }
 
     virtual ~DrawingBufferPrivate()
     {
-        m_layer.clearClient();
     }
 
     virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE
     }
 
     virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE
@@ -187,11 +186,11 @@ public:
         return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_drawingBuffer->graphicsContext3D());
     }
 
         return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_drawingBuffer->graphicsContext3D());
     }
 
-    WebKit::WebLayer* layer() { return &m_layer; }
+    WebKit::WebLayer* layer() { return m_layer->layer(); }
 
 private:
     DrawingBuffer* m_drawingBuffer;
 
 private:
     DrawingBuffer* m_drawingBuffer;
-    WebKit::WebExternalTextureLayer m_layer;
+    OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
 };
 
 #if USE(ACCELERATED_COMPOSITING)
 };
 
 #if USE(ACCELERATED_COMPOSITING)
index 7973a2f..7d5591b 100644 (file)
@@ -82,6 +82,8 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
 
 GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
     : GraphicsLayer(client)
 
 GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
     : GraphicsLayer(client)
+    , m_contentsLayer(0)
+    , m_contentsLayerId(0)
     , m_linkHighlight(0)
     , m_contentsLayerPurpose(NoContentsLayer)
     , m_contentsLayerHasBackgroundColor(false)
     , m_linkHighlight(0)
     , m_contentsLayerPurpose(NoContentsLayer)
     , m_contentsLayerHasBackgroundColor(false)
@@ -89,8 +91,8 @@ GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
     , m_pageScaleChanged(false)
 {
     m_opaqueRectTrackingContentLayerDelegate = adoptPtr(new OpaqueRectTrackingContentLayerDelegate(this));
     , m_pageScaleChanged(false)
 {
     m_opaqueRectTrackingContentLayerDelegate = adoptPtr(new OpaqueRectTrackingContentLayerDelegate(this));
-    m_layer = WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get());
-    m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
+    m_layer = adoptPtr(WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get()));
+    m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
     if (client)
         deviceOrPageScaleFactorChanged();
     updateDebugIndicators();
     if (client)
         deviceOrPageScaleFactorChanged();
     updateDebugIndicators();
@@ -98,28 +100,11 @@ GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
 
 GraphicsLayerChromium::~GraphicsLayerChromium()
 {
 
 GraphicsLayerChromium::~GraphicsLayerChromium()
 {
-    // Do cleanup while we can still safely call methods on the derived class.
     willBeDestroyed();
 }
 
 void GraphicsLayerChromium::willBeDestroyed()
 {
     willBeDestroyed();
 }
 
 void GraphicsLayerChromium::willBeDestroyed()
 {
-    if (!m_layer.isNull()) {
-        m_layer.clearClient();
-        m_layer.clearRenderSurface();
-        m_layer.setAnimationDelegate(0);
-    }
-
-    if (!m_contentsLayer.isNull()) {
-        m_contentsLayer.clearRenderSurface();
-        m_contentsLayer.setAnimationDelegate(0);
-    }
-
-    if (!m_transformLayer.isNull()) {
-        m_transformLayer.clearRenderSurface();
-        m_transformLayer.setAnimationDelegate(0);
-    }
-
     if (m_linkHighlight) {
         m_linkHighlight->clearCurrentGraphicsLayer();
         m_linkHighlight = 0;
     if (m_linkHighlight) {
         m_linkHighlight->clearCurrentGraphicsLayer();
         m_linkHighlight = 0;
@@ -138,17 +123,16 @@ void GraphicsLayerChromium::setName(const String& inName)
 
 void GraphicsLayerChromium::updateNames()
 {
 
 void GraphicsLayerChromium::updateNames()
 {
-    if (!m_layer.isNull()) {
-        String debugName = "Layer for " + m_nameBase;
-        m_layer.setDebugName(debugName);
-    }
-    if (!m_transformLayer.isNull()) {
+    String debugName = "Layer for " + m_nameBase;
+    m_layer->layer()->setDebugName(debugName);
+
+    if (m_transformLayer) {
         String debugName = "TransformLayer for " + m_nameBase;
         String debugName = "TransformLayer for " + m_nameBase;
-        m_transformLayer.setDebugName(debugName);
+        m_transformLayer->setDebugName(debugName);
     }
     }
-    if (!m_contentsLayer.isNull()) {
+    if (m_contentsLayer) {
         String debugName = "ContentsLayer for " + m_nameBase;
         String debugName = "ContentsLayer for " + m_nameBase;
-        m_contentsLayer.setDebugName(debugName);
+        m_contentsLayer->setDebugName(debugName);
     }
     if (m_linkHighlight) {
         String debugName = "LinkHighlight for " + m_nameBase;
     }
     if (m_linkHighlight) {
         String debugName = "LinkHighlight for " + m_nameBase;
@@ -205,7 +189,7 @@ bool GraphicsLayerChromium::replaceChild(GraphicsLayer* oldChild, GraphicsLayer*
 void GraphicsLayerChromium::removeFromParent()
 {
     GraphicsLayer::removeFromParent();
 void GraphicsLayerChromium::removeFromParent()
 {
     GraphicsLayer::removeFromParent();
-    primaryLayer().removeFromParent();
+    platformLayer()->removeFromParent();
 }
 
 void GraphicsLayerChromium::setPosition(const FloatPoint& point)
 }
 
 void GraphicsLayerChromium::setPosition(const FloatPoint& point)
@@ -235,8 +219,8 @@ void GraphicsLayerChromium::setSize(const FloatSize& size)
     GraphicsLayer::setSize(clampedSize);
     updateLayerSize();
 
     GraphicsLayer::setSize(clampedSize);
     updateLayerSize();
 
-    if (m_pageScaleChanged && !m_layer.isNull()) {
-        m_layer.invalidate();
+    if (m_pageScaleChanged) {
+        m_layer->layer()->invalidate();
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
@@ -306,13 +290,13 @@ void GraphicsLayerChromium::setBackgroundColor(const Color& color)
 void GraphicsLayerChromium::clearBackgroundColor()
 {
     GraphicsLayer::clearBackgroundColor();
 void GraphicsLayerChromium::clearBackgroundColor()
 {
     GraphicsLayer::clearBackgroundColor();
-    m_contentsLayer.setBackgroundColor(static_cast<RGBA32>(0));
+    m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
 }
 
 void GraphicsLayerChromium::setContentsOpaque(bool opaque)
 {
     GraphicsLayer::setContentsOpaque(opaque);
 }
 
 void GraphicsLayerChromium::setContentsOpaque(bool opaque)
 {
     GraphicsLayer::setContentsOpaque(opaque);
-    m_layer.setOpaque(m_contentsOpaque);
+    m_layer->layer()->setOpaque(m_contentsOpaque);
 }
 
 static bool copyWebCoreFilterOperationsToWebFilterOperations(const FilterOperations& filters, WebFilterOperations& webFilters)
 }
 
 static bool copyWebCoreFilterOperationsToWebFilterOperations(const FilterOperations& filters, WebFilterOperations& webFilters)
@@ -396,11 +380,11 @@ bool GraphicsLayerChromium::setFilters(const FilterOperations& filters)
     if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters)) {
         // Make sure the filters are removed from the platform layer, as they are
         // going to fallback to software mode.
     if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters)) {
         // Make sure the filters are removed from the platform layer, as they are
         // going to fallback to software mode.
-        m_layer.setFilters(WebFilterOperations());
+        m_layer->layer()->setFilters(WebFilterOperations());
         GraphicsLayer::setFilters(FilterOperations());
         return false;
     }
         GraphicsLayer::setFilters(FilterOperations());
         return false;
     }
-    m_layer.setFilters(webFilters);
+    m_layer->layer()->setFilters(webFilters);
     return GraphicsLayer::setFilters(filters);
 }
 
     return GraphicsLayer::setFilters(filters);
 }
 
@@ -409,7 +393,7 @@ void GraphicsLayerChromium::setBackgroundFilters(const FilterOperations& filters
     WebFilterOperations webFilters;
     if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
         return;
     WebFilterOperations webFilters;
     if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
         return;
-    m_layer.setBackgroundFilters(webFilters);
+    m_layer->layer()->setBackgroundFilters(webFilters);
 }
 
 void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
 }
 
 void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
@@ -419,23 +403,21 @@ void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
 
     GraphicsLayer::setMaskLayer(maskLayer);
 
 
     GraphicsLayer::setMaskLayer(maskLayer);
 
-    WebLayer maskWebLayer;
-    if (m_maskLayer)
-        maskWebLayer = *m_maskLayer->platformLayer();
-    m_layer.setMaskLayer(maskWebLayer);
+    WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0;
+    m_layer->layer()->setMaskLayer(maskWebLayer);
 }
 
 void GraphicsLayerChromium::setBackfaceVisibility(bool visible)
 {
     GraphicsLayer::setBackfaceVisibility(visible);
 }
 
 void GraphicsLayerChromium::setBackfaceVisibility(bool visible)
 {
     GraphicsLayer::setBackfaceVisibility(visible);
-    m_layer.setDoubleSided(m_backfaceVisibility);
+    m_layer->setDoubleSided(m_backfaceVisibility);
 }
 
 void GraphicsLayerChromium::setOpacity(float opacity)
 {
     float clampedOpacity = max(min(opacity, 1.0f), 0.0f);
     GraphicsLayer::setOpacity(clampedOpacity);
 }
 
 void GraphicsLayerChromium::setOpacity(float opacity)
 {
     float clampedOpacity = max(min(opacity, 1.0f), 0.0f);
     GraphicsLayer::setOpacity(clampedOpacity);
-    primaryLayer().setOpacity(opacity);
+    platformLayer()->setOpacity(opacity);
 }
 
 void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
 }
 
 void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
@@ -443,23 +425,21 @@ void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
     GraphicsLayerChromium* layerChromium = static_cast<GraphicsLayerChromium*>(layer);
     GraphicsLayer::setReplicatedByLayer(layer);
 
     GraphicsLayerChromium* layerChromium = static_cast<GraphicsLayerChromium*>(layer);
     GraphicsLayer::setReplicatedByLayer(layer);
 
-    WebLayer webReplicaLayer;
-    if (layerChromium)
-        webReplicaLayer = layerChromium->primaryLayer();
-    primaryLayer().setReplicaLayer(webReplicaLayer);
+    WebLayer* webReplicaLayer = layerChromium ? layerChromium->platformLayer() : 0;
+    platformLayer()->setReplicaLayer(webReplicaLayer);
 }
 
 
 void GraphicsLayerChromium::setContentsNeedsDisplay()
 {
 }
 
 
 void GraphicsLayerChromium::setContentsNeedsDisplay()
 {
-    if (!m_contentsLayer.isNull())
-        m_contentsLayer.invalidate();
+    if (m_contentsLayer)
+        m_contentsLayer->invalidate();
 }
 
 void GraphicsLayerChromium::setNeedsDisplay()
 {
     if (drawsContent()) {
 }
 
 void GraphicsLayerChromium::setNeedsDisplay()
 {
     if (drawsContent()) {
-        m_layer.invalidate();
+        m_layer->layer()->invalidate();
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
@@ -468,7 +448,7 @@ void GraphicsLayerChromium::setNeedsDisplay()
 void GraphicsLayerChromium::setNeedsDisplayInRect(const FloatRect& rect)
 {
     if (drawsContent()) {
 void GraphicsLayerChromium::setNeedsDisplayInRect(const FloatRect& rect)
 {
     if (drawsContent()) {
-        m_layer.invalidateRect(rect);
+        m_layer->layer()->invalidateRect(rect);
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
@@ -487,46 +467,56 @@ void GraphicsLayerChromium::setContentsToImage(Image* image)
 {
     bool childrenChanged = false;
     if (image) {
 {
     bool childrenChanged = false;
     if (image) {
-        if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForImage) {
-            WebKit::WebImageLayer imageLayer = WebKit::WebImageLayer::create();
-            setupContentsLayer(imageLayer);
+        if (m_contentsLayerPurpose != ContentsLayerForImage) {
+            m_imageLayer = adoptPtr(WebImageLayer::create());
+            setupContentsLayer(m_imageLayer->layer());
             m_contentsLayerPurpose = ContentsLayerForImage;
             childrenChanged = true;
         }
             m_contentsLayerPurpose = ContentsLayerForImage;
             childrenChanged = true;
         }
-        WebKit::WebImageLayer imageLayer = m_contentsLayer.to<WebKit::WebImageLayer>();
         NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame();
         NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame();
-        imageLayer.setBitmap(nativeImage->bitmap());
-        imageLayer.setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
+        m_imageLayer->setBitmap(nativeImage->bitmap());
+        m_imageLayer->layer()->setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
         updateContentsRect();
     } else {
         updateContentsRect();
     } else {
-        if (!m_contentsLayer.isNull()) {
+        if (m_imageLayer) {
             childrenChanged = true;
 
             childrenChanged = true;
 
-            // The old contents layer will be removed via updateChildList.
-            m_contentsLayer.reset();
+            m_imageLayer.clear();
         }
         }
+        // The old contents layer will be removed via updateChildList.
+        m_contentsLayer = 0;
     }
 
     if (childrenChanged)
         updateChildList();
 }
 
     }
 
     if (childrenChanged)
         updateChildList();
 }
 
-void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* platformLayer)
+void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* layer)
+{
+    setContentsTo(ContentsLayerForCanvas, layer);
+}
+
+void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
+{
+    setContentsTo(ContentsLayerForVideo, layer);
+}
+
+void GraphicsLayerChromium::setContentsTo(ContentsLayerPurpose purpose, WebKit::WebLayer* layer)
 {
     bool childrenChanged = false;
 {
     bool childrenChanged = false;
-    if (platformLayer) {
-        if (m_contentsLayer != *platformLayer) {
-            setupContentsLayer(*platformLayer);
-            m_contentsLayerPurpose = ContentsLayerForCanvas;
+    if (layer) {
+        if (m_contentsLayerId != layer->id()) {
+            setupContentsLayer(layer);
+            m_contentsLayerPurpose = purpose;
             childrenChanged = true;
         }
         updateContentsRect();
     } else {
             childrenChanged = true;
         }
         updateContentsRect();
     } else {
-        if (!m_contentsLayer.isNull()) {
+        if (m_contentsLayer) {
             childrenChanged = true;
 
             // The old contents layer will be removed via updateChildList.
             childrenChanged = true;
 
             // The old contents layer will be removed via updateChildList.
-            m_contentsLayer.reset();
+            m_contentsLayer = 0;
         }
     }
 
         }
     }
 
@@ -536,7 +526,7 @@ void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* platformLayer)
 
 bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const Animation* animation, const String& animationName, double timeOffset)
 {
 
 bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const Animation* animation, const String& animationName, double timeOffset)
 {
-    primaryLayer().setAnimationDelegate(this);
+    platformLayer()->setAnimationDelegate(this);
 
     int animationId = mapAnimationNameToId(animationName);
     int groupId = AnimationIdVendor::getNextGroupId();
 
     int animationId = mapAnimationNameToId(animationName);
     int groupId = AnimationIdVendor::getNextGroupId();
@@ -545,8 +535,8 @@ bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const
 
     if (toAdd) {
         // Remove any existing animations with the same animation id and target property.
 
     if (toAdd) {
         // Remove any existing animations with the same animation id and target property.
-        primaryLayer().removeAnimation(animationId, toAdd->targetProperty());
-        return primaryLayer().addAnimation(toAdd.get());
+        platformLayer()->removeAnimation(animationId, toAdd->targetProperty());
+        return platformLayer()->addAnimation(toAdd.get());
     }
 
     return false;
     }
 
     return false;
@@ -554,12 +544,12 @@ bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const
 
 void GraphicsLayerChromium::pauseAnimation(const String& animationName, double timeOffset)
 {
 
 void GraphicsLayerChromium::pauseAnimation(const String& animationName, double timeOffset)
 {
-    primaryLayer().pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
+    platformLayer()->pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
 }
 
 void GraphicsLayerChromium::removeAnimation(const String& animationName)
 {
 }
 
 void GraphicsLayerChromium::removeAnimation(const String& animationName)
 {
-    primaryLayer().removeAnimation(mapAnimationNameToId(animationName));
+    platformLayer()->removeAnimation(mapAnimationNameToId(animationName));
 }
 
 void GraphicsLayerChromium::suspendAnimations(double wallClockTime)
 }
 
 void GraphicsLayerChromium::suspendAnimations(double wallClockTime)
@@ -567,12 +557,12 @@ void GraphicsLayerChromium::suspendAnimations(double wallClockTime)
     // |wallClockTime| is in the wrong time base. Need to convert here.
     // FIXME: find a more reliable way to do this.
     double monotonicTime = wallClockTime + monotonicallyIncreasingTime() - currentTime();
     // |wallClockTime| is in the wrong time base. Need to convert here.
     // FIXME: find a more reliable way to do this.
     double monotonicTime = wallClockTime + monotonicallyIncreasingTime() - currentTime();
-    primaryLayer().suspendAnimations(monotonicTime);
+    platformLayer()->suspendAnimations(monotonicTime);
 }
 
 void GraphicsLayerChromium::resumeAnimations()
 {
 }
 
 void GraphicsLayerChromium::resumeAnimations()
 {
-    primaryLayer().resumeAnimations(monotonicallyIncreasingTime());
+    platformLayer()->resumeAnimations(monotonicallyIncreasingTime());
 }
 
 void GraphicsLayerChromium::setLinkHighlight(LinkHighlightClient* linkHighlight)
 }
 
 void GraphicsLayerChromium::setLinkHighlight(LinkHighlightClient* linkHighlight)
@@ -581,66 +571,38 @@ void GraphicsLayerChromium::setLinkHighlight(LinkHighlightClient* linkHighlight)
     updateChildList();
 }
 
     updateChildList();
 }
 
-void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
-{
-    bool childrenChanged = false;
-    if (layer) {
-        if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForVideo) {
-            setupContentsLayer(*layer);
-            m_contentsLayerPurpose = ContentsLayerForVideo;
-            childrenChanged = true;
-        }
-        updateContentsRect();
-    } else {
-        if (!m_contentsLayer.isNull()) {
-            childrenChanged = true;
-
-            // The old contents layer will be removed via updateChildList.
-            m_contentsLayer.reset();
-        }
-    }
-
-    if (childrenChanged)
-        updateChildList();
-}
-
-WebKit::WebLayer GraphicsLayerChromium::primaryLayer() const
-{
-    return m_transformLayer.isNull() ? m_layer : m_transformLayer;
-}
-
 PlatformLayer* GraphicsLayerChromium::platformLayer() const
 {
 PlatformLayer* GraphicsLayerChromium::platformLayer() const
 {
-    return const_cast<PlatformLayer*>(m_transformLayer.isNull() ? &m_layer : &m_transformLayer);
+    return m_transformLayer ? m_transformLayer.get() : m_layer->layer();
 }
 
 void GraphicsLayerChromium::setDebugBackgroundColor(const Color& color)
 {
     if (color.isValid())
 }
 
 void GraphicsLayerChromium::setDebugBackgroundColor(const Color& color)
 {
     if (color.isValid())
-        m_layer.setBackgroundColor(color.rgb());
+        m_layer->layer()->setBackgroundColor(color.rgb());
     else
     else
-        m_layer.setBackgroundColor(static_cast<RGBA32>(0));
+        m_layer->layer()->setBackgroundColor(static_cast<RGBA32>(0));
 }
 
 void GraphicsLayerChromium::setDebugBorder(const Color& color, float borderWidth)
 {
     if (color.isValid()) {
 }
 
 void GraphicsLayerChromium::setDebugBorder(const Color& color, float borderWidth)
 {
     if (color.isValid()) {
-        m_layer.setDebugBorderColor(color.rgb());
-        m_layer.setDebugBorderWidth(borderWidth);
+        m_layer->layer()->setDebugBorderColor(color.rgb());
+        m_layer->layer()->setDebugBorderWidth(borderWidth);
     } else {
     } else {
-        m_layer.setDebugBorderColor(static_cast<RGBA32>(0));
-        m_layer.setDebugBorderWidth(0);
+        m_layer->layer()->setDebugBorderColor(static_cast<RGBA32>(0));
+        m_layer->layer()->setDebugBorderWidth(0);
     }
 }
 
 void GraphicsLayerChromium::updateChildList()
 {
     }
 }
 
 void GraphicsLayerChromium::updateChildList()
 {
-    Vector<WebLayer> newChildren;
+    Vector<WebLayer*> newChildren;
 
 
-    if (!m_transformLayer.isNull()) {
+    if (m_transformLayer) {
         // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
         // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
-        newChildren.append(m_layer);
-    } else if (!m_contentsLayer.isNull()) {
+        newChildren.append(m_layer->layer());
+    } else if (m_contentsLayer) {
         // FIXME: add the contents layer in the correct order with negative z-order children.
         // This does not cause visible rendering issues because currently contents layers are only used
         // for replaced elements that don't have children.
         // FIXME: add the contents layer in the correct order with negative z-order children.
         // This does not cause visible rendering issues because currently contents layers are only used
         // for replaced elements that don't have children.
@@ -652,79 +614,79 @@ void GraphicsLayerChromium::updateChildList()
     for (size_t i = 0; i < numChildren; ++i) {
         GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);
 
     for (size_t i = 0; i < numChildren; ++i) {
         GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);
 
-        newChildren.append(curChild->primaryLayer());
+        newChildren.append(curChild->platformLayer());
     }
 
     if (m_linkHighlight)
     }
 
     if (m_linkHighlight)
-        newChildren.append(*m_linkHighlight->layer());
+        newChildren.append(m_linkHighlight->layer());
 
     for (size_t i = 0; i < newChildren.size(); ++i)
 
     for (size_t i = 0; i < newChildren.size(); ++i)
-        newChildren[i].removeFromParent();
+        newChildren[i]->removeFromParent();
 
 
-    WebVector<WebLayer> newWebChildren;
+    WebVector<WebLayer*> newWebChildren;
     newWebChildren.assign(newChildren.data(), newChildren.size());
 
     newWebChildren.assign(newChildren.data(), newChildren.size());
 
-    if (!m_transformLayer.isNull()) {
-        m_transformLayer.setChildren(newWebChildren);
+    if (m_transformLayer) {
+        m_transformLayer->setChildren(newWebChildren);
 
 
-        if (!m_contentsLayer.isNull()) {
+        if (m_contentsLayer) {
             // If we have a transform layer, then the contents layer is parented in the
             // primary layer (which is itself a child of the transform layer).
             // If we have a transform layer, then the contents layer is parented in the
             // primary layer (which is itself a child of the transform layer).
-            m_layer.removeAllChildren();
-            m_layer.addChild(m_contentsLayer);
+            m_layer->layer()->removeAllChildren();
+            m_layer->layer()->addChild(m_contentsLayer);
         }
     } else
         }
     } else
-        m_layer.setChildren(newWebChildren);
+        m_layer->layer()->setChildren(newWebChildren);
 }
 
 void GraphicsLayerChromium::updateLayerPosition()
 {
 }
 
 void GraphicsLayerChromium::updateLayerPosition()
 {
-    primaryLayer().setPosition(m_position);
+    platformLayer()->setPosition(m_position);
 }
 
 void GraphicsLayerChromium::updateLayerSize()
 {
     IntSize layerSize(m_size.width(), m_size.height());
 }
 
 void GraphicsLayerChromium::updateLayerSize()
 {
     IntSize layerSize(m_size.width(), m_size.height());
-    if (!m_transformLayer.isNull()) {
-        m_transformLayer.setBounds(layerSize);
-        m_layer.setPosition(FloatPoint());
+    if (m_transformLayer) {
+        m_transformLayer->setBounds(layerSize);
+        m_layer->layer()->setPosition(FloatPoint());
     }
 
     }
 
-    m_layer.setBounds(layerSize);
+    m_layer->layer()->setBounds(layerSize);
 
 
-    // Note that we don't resize m_contentsLayer. It's up the caller to do that.
+    // Note that we don't resize m_contentsLayer-> It's up the caller to do that.
 }
 
 void GraphicsLayerChromium::updateAnchorPoint()
 {
 }
 
 void GraphicsLayerChromium::updateAnchorPoint()
 {
-    primaryLayer().setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
-    primaryLayer().setAnchorPointZ(m_anchorPoint.z());
+    platformLayer()->setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
+    platformLayer()->setAnchorPointZ(m_anchorPoint.z());
 }
 
 void GraphicsLayerChromium::updateTransform()
 {
 }
 
 void GraphicsLayerChromium::updateTransform()
 {
-    primaryLayer().setTransform(WebTransformationMatrix(m_transform));
+    platformLayer()->setTransform(WebTransformationMatrix(m_transform));
 }
 
 void GraphicsLayerChromium::updateChildrenTransform()
 {
 }
 
 void GraphicsLayerChromium::updateChildrenTransform()
 {
-    primaryLayer().setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
+    platformLayer()->setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
 }
 
 void GraphicsLayerChromium::updateMasksToBounds()
 {
 }
 
 void GraphicsLayerChromium::updateMasksToBounds()
 {
-    m_layer.setMasksToBounds(m_masksToBounds);
+    m_layer->layer()->setMasksToBounds(m_masksToBounds);
     updateDebugIndicators();
 }
 
 void GraphicsLayerChromium::updateLayerPreserves3D()
 {
     updateDebugIndicators();
 }
 
 void GraphicsLayerChromium::updateLayerPreserves3D()
 {
-    if (m_preserves3D && m_transformLayer.isNull()) {
+    if (m_preserves3D && !m_transformLayer) {
         // Create the transform layer.
         // Create the transform layer.
-        m_transformLayer = WebLayer::create();
-        m_transformLayer.setPreserves3D(true);
-        m_transformLayer.setAnimationDelegate(this);
-        m_layer.transferAnimationsTo(&m_transformLayer);
+        m_transformLayer = adoptPtr(WebLayer::create());
+        m_transformLayer->setPreserves3D(true);
+        m_transformLayer->setAnimationDelegate(this);
+        m_layer->layer()->transferAnimationsTo(m_transformLayer.get());
 
         // Copy the position from this layer.
         updateLayerPosition();
 
         // Copy the position from this layer.
         updateLayerPosition();
@@ -733,34 +695,34 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
         updateTransform();
         updateChildrenTransform();
 
         updateTransform();
         updateChildrenTransform();
 
-        m_layer.setPosition(FloatPoint::zero());
+        m_layer->layer()->setPosition(FloatPoint::zero());
 
 
-        m_layer.setAnchorPoint(FloatPoint(0.5f, 0.5f));
-        m_layer.setTransform(SkMatrix44());
+        m_layer->layer()->setAnchorPoint(FloatPoint(0.5f, 0.5f));
+        m_layer->layer()->setTransform(SkMatrix44());
 
         // Set the old layer to opacity of 1. Further down we will set the opacity on the transform layer.
 
         // Set the old layer to opacity of 1. Further down we will set the opacity on the transform layer.
-        m_layer.setOpacity(1);
+        m_layer->layer()->setOpacity(1);
 
 
-        m_layer.setContentsScale(contentsScale());
+        m_layer->setContentsScale(contentsScale());
 
         // Move this layer to be a child of the transform layer.
         if (parent())
 
         // Move this layer to be a child of the transform layer.
         if (parent())
-            parent()->platformLayer()->replaceChild(m_layer, m_transformLayer);
-        m_transformLayer.addChild(m_layer);
+            parent()->platformLayer()->replaceChild(m_layer->layer(), m_transformLayer.get());
+        m_transformLayer->addChild(m_layer->layer());
 
         updateChildList();
 
         updateChildList();
-    } else if (!m_preserves3D && !m_transformLayer.isNull()) {
+    } else if (m_preserves3D && !m_transformLayer) {
         // Relace the transformLayer in the parent with this layer.
         // Relace the transformLayer in the parent with this layer.
-        m_layer.removeFromParent();
+        m_layer->layer()->removeFromParent();
         if (parent())
         if (parent())
-            parent()->platformLayer()->replaceChild(m_transformLayer, m_layer);
+            parent()->platformLayer()->replaceChild(m_transformLayer.get(), m_layer->layer());
 
 
-        m_layer.setAnimationDelegate(this);
-        m_transformLayer.transferAnimationsTo(&m_layer);
+        m_layer->layer()->setAnimationDelegate(this);
+        m_transformLayer->transferAnimationsTo(m_layer->layer());
 
         // Release the transform layer.
 
         // Release the transform layer.
-        m_transformLayer.setAnimationDelegate(0);
-        m_transformLayer.reset();
+        m_transformLayer->setAnimationDelegate(0);
+        m_transformLayer.clear();
 
         updateLayerPosition();
         updateLayerSize();
 
         updateLayerPosition();
         updateLayerSize();
@@ -771,25 +733,25 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
         updateChildList();
     }
 
         updateChildList();
     }
 
-    m_layer.setPreserves3D(m_preserves3D);
-    primaryLayer().setOpacity(m_opacity);
+    m_layer->layer()->setPreserves3D(m_preserves3D);
+    platformLayer()->setOpacity(m_opacity);
     updateNames();
 }
 
 void GraphicsLayerChromium::updateLayerIsDrawable()
 {
     // For the rest of the accelerated compositor code, there is no reason to make a
     updateNames();
 }
 
 void GraphicsLayerChromium::updateLayerIsDrawable()
 {
     // For the rest of the accelerated compositor code, there is no reason to make a
-    // distinction between drawsContent and contentsVisible. So, for m_layer, these two
+    // distinction between drawsContent and contentsVisible. So, for m_layer->layer(), these two
     // flags are combined here. m_contentsLayer shouldn't receive the drawsContent flag
     // so it is only given contentsVisible.
 
     // flags are combined here. m_contentsLayer shouldn't receive the drawsContent flag
     // so it is only given contentsVisible.
 
-    m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
+    m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
 
 
-    if (!m_contentsLayer.isNull())
-        m_contentsLayer.setDrawsContent(m_contentsVisible);
+    if (m_contentsLayer)
+        m_contentsLayer->setDrawsContent(m_contentsVisible);
 
     if (m_drawsContent) {
 
     if (m_drawsContent) {
-        m_layer.invalidate();
+        m_layer->layer()->invalidate();
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
         if (m_linkHighlight)
             m_linkHighlight->invalidate();
     }
@@ -799,14 +761,14 @@ void GraphicsLayerChromium::updateLayerIsDrawable()
 
 void GraphicsLayerChromium::updateLayerBackgroundColor()
 {
 
 void GraphicsLayerChromium::updateLayerBackgroundColor()
 {
-    if (m_contentsLayer.isNull())
+    if (!m_contentsLayer)
         return;
 
     // We never create the contents layer just for background color yet.
     if (m_backgroundColorSet)
         return;
 
     // We never create the contents layer just for background color yet.
     if (m_backgroundColorSet)
-        m_contentsLayer.setBackgroundColor(m_backgroundColor.rgb());
+        m_contentsLayer->setBackgroundColor(m_backgroundColor.rgb());
     else
     else
-        m_contentsLayer.setBackgroundColor(static_cast<RGBA32>(0));
+        m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
 }
 
 void GraphicsLayerChromium::updateContentsVideo()
 }
 
 void GraphicsLayerChromium::updateContentsVideo()
@@ -816,50 +778,42 @@ void GraphicsLayerChromium::updateContentsVideo()
 
 void GraphicsLayerChromium::updateContentsRect()
 {
 
 void GraphicsLayerChromium::updateContentsRect()
 {
-    if (m_contentsLayer.isNull())
+    if (!m_contentsLayer)
         return;
 
         return;
 
-    m_contentsLayer.setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
-    m_contentsLayer.setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
+    m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
+    m_contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
 }
 
 void GraphicsLayerChromium::updateContentsScale()
 {
     // If page scale is already applied then there's no need to apply it again.
 }
 
 void GraphicsLayerChromium::updateContentsScale()
 {
     // If page scale is already applied then there's no need to apply it again.
-    if (appliesPageScale() || m_layer.isNull())
+    if (appliesPageScale())
         return;
 
         return;
 
-    m_layer.setContentsScale(contentsScale());
+    m_layer->setContentsScale(contentsScale());
 }
 
 }
 
-void GraphicsLayerChromium::setupContentsLayer(WebLayer contentsLayer)
+void GraphicsLayerChromium::setupContentsLayer(WebLayer* contentsLayer)
 {
 {
-    if (contentsLayer == m_contentsLayer)
-        return;
-
-    if (!m_contentsLayer.isNull()) {
-        m_contentsLayer.setUseParentBackfaceVisibility(false);
-        m_contentsLayer.removeFromParent();
-        m_contentsLayer.reset();
-    }
-
     m_contentsLayer = contentsLayer;
     m_contentsLayer = contentsLayer;
+    m_contentsLayerId = m_contentsLayer->id();
 
 
-    if (!m_contentsLayer.isNull()) {
-        m_contentsLayer.setAnchorPoint(FloatPoint(0, 0));
-        m_contentsLayer.setUseParentBackfaceVisibility(true);
+    if (m_contentsLayer) {
+        m_contentsLayer->setAnchorPoint(FloatPoint(0, 0));
+        m_contentsLayer->setUseParentBackfaceVisibility(true);
 
         // It is necessary to call setDrawsContent as soon as we receive the new contentsLayer, for
         // the correctness of early exit conditions in setDrawsContent() and setContentsVisible().
 
         // It is necessary to call setDrawsContent as soon as we receive the new contentsLayer, for
         // the correctness of early exit conditions in setDrawsContent() and setContentsVisible().
-        m_contentsLayer.setDrawsContent(m_contentsVisible);
+        m_contentsLayer->setDrawsContent(m_contentsVisible);
 
         // Insert the content layer first. Video elements require this, because they have
         // shadow content that must display in front of the video.
 
         // Insert the content layer first. Video elements require this, because they have
         // shadow content that must display in front of the video.
-        m_layer.insertChild(m_contentsLayer, 0);
+        m_layer->layer()->insertChild(m_contentsLayer, 0);
 
         if (showDebugBorders()) {
 
         if (showDebugBorders()) {
-            m_contentsLayer.setDebugBorderColor(Color(0, 0, 128, 180).rgb());
-            m_contentsLayer.setDebugBorderWidth(1);
+            m_contentsLayer->setDebugBorderColor(Color(0, 0, 128, 180).rgb());
+            m_contentsLayer->setDebugBorderWidth(1);
         }
     }
     updateDebugIndicators();
         }
     }
     updateDebugIndicators();
index 2a9148c..4fc8d1c 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <public/WebAnimationDelegate.h>
 #include <public/WebContentLayer.h>
 
 #include <public/WebAnimationDelegate.h>
 #include <public/WebContentLayer.h>
+#include <public/WebImageLayer.h>
 #include <public/WebLayer.h>
 #include <wtf/HashMap.h>
 
 #include <public/WebLayer.h>
 #include <wtf/HashMap.h>
 
@@ -62,6 +63,8 @@ public:
     GraphicsLayerChromium(GraphicsLayerClient*);
     virtual ~GraphicsLayerChromium();
 
     GraphicsLayerChromium(GraphicsLayerClient*);
     virtual ~GraphicsLayerChromium();
 
+    virtual void willBeDestroyed() OVERRIDE;
+
     virtual void setName(const String&);
 
     virtual bool setChildren(const Vector<GraphicsLayer*>&);
     virtual void setName(const String&);
 
     virtual bool setChildren(const Vector<GraphicsLayer*>&);
@@ -110,7 +113,7 @@ public:
     virtual void setContentsToImage(Image*);
     virtual void setContentsToMedia(PlatformLayer*);
     virtual void setContentsToCanvas(PlatformLayer*);
     virtual void setContentsToImage(Image*);
     virtual void setContentsToMedia(PlatformLayer*);
     virtual void setContentsToCanvas(PlatformLayer*);
-    virtual bool hasContentsLayer() const { return !m_contentsLayer.isNull(); }
+    virtual bool hasContentsLayer() const { return m_contentsLayer; }
 
     virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String&, double timeOffset);
     virtual void pauseAnimation(const String& animationName, double timeOffset);
 
     virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String&, double timeOffset);
     virtual void pauseAnimation(const String& animationName, double timeOffset);
@@ -135,15 +138,13 @@ public:
     virtual void notifyAnimationStarted(double startTime) OVERRIDE;
     virtual void notifyAnimationFinished(double finishTime) OVERRIDE;
 
     virtual void notifyAnimationStarted(double startTime) OVERRIDE;
     virtual void notifyAnimationFinished(double finishTime) OVERRIDE;
 
+    WebKit::WebContentLayer* contentLayer() const { return m_layer.get(); }
+
     // Exposed for tests.
     // Exposed for tests.
-    WebKit::WebLayer contentsLayer() const { return m_contentsLayer; }
+    WebKit::WebLayer* contentsLayer() const { return m_contentsLayer; }
     float contentsScale() const;
 
 private:
     float contentsScale() const;
 
 private:
-    virtual void willBeDestroyed();
-
-    WebKit::WebLayer primaryLayer() const;
-
     void updateNames();
     void updateChildList();
     void updateLayerPosition();
     void updateNames();
     void updateChildList();
     void updateLayerPosition();
@@ -161,26 +162,34 @@ private:
     void updateContentsRect();
     void updateContentsScale();
 
     void updateContentsRect();
     void updateContentsScale();
 
-    void setupContentsLayer(WebKit::WebLayer);
+    enum ContentsLayerPurpose {
+        NoContentsLayer = 0,
+        ContentsLayerForImage,
+        ContentsLayerForVideo,
+        ContentsLayerForCanvas,
+    };
+
+    void setContentsTo(ContentsLayerPurpose, WebKit::WebLayer*);
+    void setupContentsLayer(WebKit::WebLayer*);
 
     int mapAnimationNameToId(const String& animationName);
 
     String m_nameBase;
 
 
     int mapAnimationNameToId(const String& animationName);
 
     String m_nameBase;
 
-    WebKit::WebContentLayer m_layer;
-    WebKit::WebLayer m_transformLayer;
-    WebKit::WebLayer m_contentsLayer;
+    OwnPtr<WebKit::WebContentLayer> m_layer;
+    OwnPtr<WebKit::WebLayer> m_transformLayer;
+    OwnPtr<WebKit::WebImageLayer> m_imageLayer;
+    WebKit::WebLayer* m_contentsLayer;
+    // We don't have ownership of m_contentsLayer, but we do want to know if a given layer is the
+    // same as our current layer in setContentsTo(). Since m_contentsLayer may be deleted at this point,
+    // we stash an ID away when we know m_contentsLayer is alive and use that for comparisons from that point
+    // on.
+    int m_contentsLayerId;
+
     LinkHighlightClient* m_linkHighlight;
 
     OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLayerDelegate;
 
     LinkHighlightClient* m_linkHighlight;
 
     OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLayerDelegate;
 
-    enum ContentsLayerPurpose {
-        NoContentsLayer = 0,
-        ContentsLayerForImage,
-        ContentsLayerForVideo,
-        ContentsLayerForCanvas,
-    };
-
     ContentsLayerPurpose m_contentsLayerPurpose;
     bool m_contentsLayerHasBackgroundColor : 1;
     bool m_inSetChildren;
     ContentsLayerPurpose m_contentsLayerPurpose;
     bool m_contentsLayerHasBackgroundColor : 1;
     bool m_inSetChildren;
index 30c81b6..4e7fa74 100644 (file)
@@ -234,10 +234,11 @@ void LayerChromium::setBounds(const IntSize& size)
         setNeedsCommit();
 }
 
         setNeedsCommit();
 }
 
-const LayerChromium* LayerChromium::rootLayer() const
+LayerChromium* LayerChromium::rootLayer()
 {
 {
-    const LayerChromium* layer = this;
-    for (LayerChromium* parent = layer->parent(); parent; layer = parent, parent = parent->parent()) { }
+    LayerChromium* layer = this;
+    while (layer->parent())
+        layer = layer->parent();
     return layer;
 }
 
     return layer;
 }
 
index ec14a51..2e541ee 100644 (file)
@@ -95,7 +95,7 @@ public:
     // The root layer is a special case -- it operates in physical pixels.
     virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; }
 
     // The root layer is a special case -- it operates in physical pixels.
     virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; }
 
-    const LayerChromium* rootLayer() const;
+    LayerChromium* rootLayer();
     LayerChromium* parent() const;
     void addChild(PassRefPtr<LayerChromium>);
     void insertChild(PassRefPtr<LayerChromium>, size_t index);
     LayerChromium* parent() const;
     void addChild(PassRefPtr<LayerChromium>);
     void insertChild(PassRefPtr<LayerChromium>, size_t index);
index 4ebad89..253cce6 100644 (file)
@@ -1,3 +1,215 @@
+2012-08-22  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Change WebLayer from a concrete type to a pure virtual interface
+        https://bugs.webkit.org/show_bug.cgi?id=94174
+
+        Reviewed by Adrienne Walker.
+
+        This updates the implementation of the Web*Layer family to the new design and updates callers in WebViewImpl /
+        NonCompositedContentHost / LinkHighlight.
+
+        * WebKit.gypi:
+        * src/LinkHighlight.cpp:
+        (WebKit::LinkHighlight::LinkHighlight):
+        (WebKit::LinkHighlight::contentLayer):
+        (WebKit::LinkHighlight::clipLayer):
+        (WebKit::LinkHighlight::releaseResources):
+        (WebKit::LinkHighlight::computeHighlightLayerPathAndPosition):
+        (WebKit::LinkHighlight::startHighlightAnimation):
+        (WebKit::LinkHighlight::updateGeometry):
+        * src/LinkHighlight.h:
+        (LinkHighlight):
+        * src/NonCompositedContentHost.cpp:
+        (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+        (WebKit::NonCompositedContentHost::setScrollLayer):
+        (WebKit::NonCompositedContentHost::setViewport):
+        (WebKit::NonCompositedContentHost::scrollLayer):
+        * src/NonCompositedContentHost.h:
+        * src/WebContentLayer.cpp: Removed.
+        * src/WebContentLayerImpl.cpp:
+        (WebKit::WebContentLayer::create):
+        (WebKit::WebContentLayerImpl::WebContentLayerImpl):
+        (WebKit::WebContentLayerImpl::~WebContentLayerImpl):
+        (WebKit::WebContentLayerImpl::layer):
+        (WebKit):
+        (WebKit::WebContentLayerImpl::setDoubleSided):
+        (WebKit::WebContentLayerImpl::setContentsScale):
+        (WebKit::WebContentLayerImpl::setUseLCDText):
+        (WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles):
+        (WebKit::WebContentLayerImpl::paintContents):
+        * src/WebContentLayerImpl.h:
+        (WebContentLayerImpl):
+        * src/WebExternalTextureLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp.
+        (WebKit):
+        (WebKit::WebExternalTextureLayer::create):
+        (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+        (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl):
+        (WebKit::WebExternalTextureLayerImpl::layer):
+        (WebKit::WebExternalTextureLayerImpl::setTextureId):
+        (WebKit::WebExternalTextureLayerImpl::setFlipped):
+        (WebKit::WebExternalTextureLayerImpl::setUVRect):
+        (WebKit::WebExternalTextureLayerImpl::setOpaque):
+        (WebKit::WebExternalTextureLayerImpl::setPremultipliedAlpha):
+        (WebKit::WebExternalTextureLayerImpl::willModifyTexture):
+        (WebKit::WebExternalTextureLayerImpl::setRateLimitContext):
+        (WebTextureUpdaterImpl):
+        (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+        (WebKit::WebExternalTextureLayerImpl::prepareTexture):
+        (WebKit::WebExternalTextureLayerImpl::context):
+        * src/WebExternalTextureLayerImpl.h: Copied from Source/Platform/chromium/public/WebVideoLayer.h.
+        (WebKit):
+        (WebExternalTextureLayerImpl):
+        * src/WebIOSurfaceLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp.
+        (WebKit):
+        (WebKit::WebIOSurfaceLayer::create):
+        (WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl):
+        (WebKit::WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl):
+        (WebKit::WebIOSurfaceLayerImpl::setIOSurfaceProperties):
+        (WebKit::WebIOSurfaceLayerImpl::layer):
+        * src/WebIOSurfaceLayerImpl.h: Copied from Source/Platform/chromium/public/WebImageLayer.h.
+        (WebCore):
+        (WebKit):
+        (WebIOSurfaceLayerImpl):
+        * src/WebImageLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebSolidColorLayer.cpp.
+        (WebKit):
+        (WebKit::WebImageLayer::create):
+        (WebKit::WebImageLayerImpl::WebImageLayerImpl):
+        (WebKit::WebImageLayerImpl::~WebImageLayerImpl):
+        (WebKit::WebImageLayerImpl::layer):
+        (WebKit::WebImageLayerImpl::setBitmap):
+        * src/WebImageLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebImageLayer.cpp.
+        (WebCore):
+        (WebKit):
+        (WebImageLayerImpl):
+        * src/WebLayer.cpp: Removed.
+        * src/WebLayerImpl.cpp:
+        (WebKit::WebLayer::create):
+        (WebKit::WebLayerImpl::WebLayerImpl):
+        (WebKit::WebLayerImpl::~WebLayerImpl):
+        (WebKit):
+        (WebKit::WebLayerImpl::id):
+        (WebKit::WebLayerImpl::invalidateRect):
+        (WebKit::WebLayerImpl::invalidate):
+        (WebKit::WebLayerImpl::addChild):
+        (WebKit::WebLayerImpl::insertChild):
+        (WebKit::WebLayerImpl::replaceChild):
+        (WebKit::WebLayerImpl::setChildren):
+        (WebKit::WebLayerImpl::removeFromParent):
+        (WebKit::WebLayerImpl::removeAllChildren):
+        (WebKit::WebLayerImpl::setAnchorPoint):
+        (WebKit::WebLayerImpl::anchorPoint):
+        (WebKit::WebLayerImpl::setAnchorPointZ):
+        (WebKit::WebLayerImpl::anchorPointZ):
+        (WebKit::WebLayerImpl::setBounds):
+        (WebKit::WebLayerImpl::bounds):
+        (WebKit::WebLayerImpl::setMasksToBounds):
+        (WebKit::WebLayerImpl::masksToBounds):
+        (WebKit::WebLayerImpl::setMaskLayer):
+        (WebKit::WebLayerImpl::setReplicaLayer):
+        (WebKit::WebLayerImpl::setOpacity):
+        (WebKit::WebLayerImpl::opacity):
+        (WebKit::WebLayerImpl::setOpaque):
+        (WebKit::WebLayerImpl::opaque):
+        (WebKit::WebLayerImpl::setPosition):
+        (WebKit::WebLayerImpl::position):
+        (WebKit::WebLayerImpl::setSublayerTransform):
+        (WebKit::WebLayerImpl::sublayerTransform):
+        (WebKit::WebLayerImpl::setTransform):
+        (WebKit::WebLayerImpl::transform):
+        (WebKit::WebLayerImpl::setDrawsContent):
+        (WebKit::WebLayerImpl::drawsContent):
+        (WebKit::WebLayerImpl::setPreserves3D):
+        (WebKit::WebLayerImpl::setUseParentBackfaceVisibility):
+        (WebKit::WebLayerImpl::setBackgroundColor):
+        (WebKit::WebLayerImpl::setFilters):
+        (WebKit::WebLayerImpl::setBackgroundFilters):
+        (WebKit::WebLayerImpl::setDebugBorderColor):
+        (WebKit::WebLayerImpl::setDebugBorderWidth):
+        (WebKit::WebLayerImpl::setDebugName):
+        (WebKit::WebLayerImpl::setAnimationDelegate):
+        (WebKit::WebLayerImpl::addAnimation):
+        (WebKit::WebLayerImpl::removeAnimation):
+        (WebKit::WebLayerImpl::pauseAnimation):
+        (WebKit::WebLayerImpl::suspendAnimations):
+        (WebKit::WebLayerImpl::resumeAnimations):
+        (WebKit::WebLayerImpl::hasActiveAnimation):
+        (WebKit::WebLayerImpl::transferAnimationsTo):
+        (WebKit::WebLayerImpl::setForceRenderSurface):
+        (WebKit::WebLayerImpl::setScrollPosition):
+        (WebKit::WebLayerImpl::setScrollable):
+        (WebKit::WebLayerImpl::setHaveWheelEventHandlers):
+        (WebKit::WebLayerImpl::setShouldScrollOnMainThread):
+        (WebKit::WebLayerImpl::setNonFastScrollableRegion):
+        (WebKit::WebLayerImpl::setIsContainerForFixedPositionLayers):
+        (WebKit::WebLayerImpl::setFixedToContainerLayer):
+        (WebKit::WebLayerImpl::layer):
+        * src/WebLayerImpl.h:
+        (WebCore):
+        (WebLayerImpl):
+        * src/WebLayerTreeView.cpp:
+        (WebKit::WebLayerTreeView::setRootLayer):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::create):
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+        (WebKit::WebMediaPlayerClientImpl::repaint):
+        (WebKit::WebMediaPlayerClientImpl::setOpaque):
+        (WebKit::WebMediaPlayerClientImpl::platformLayer):
+        (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+        * src/WebMediaPlayerClientImpl.h:
+        (WebMediaPlayerClientImpl):
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::setBackingTextureId):
+        (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+        (WebKit::WebPluginContainerImpl::commitBackingTexture):
+        (WebKit::WebPluginContainerImpl::setOpaque):
+        (WebKit::WebPluginContainerImpl::platformLayer):
+        * src/WebPluginContainerImpl.h:
+        (WebPluginContainerImpl):
+        * src/WebScrollableLayer.cpp: Removed.
+        * src/WebScrollbarLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayer.cpp.
+        (WebKit):
+        (WebKit::WebScrollbarLayer::create):
+        (WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl):
+        (WebKit::WebScrollbarLayerImpl::~WebScrollbarLayerImpl):
+        (WebKit::WebScrollbarLayerImpl::layer):
+        (WebKit::WebScrollbarLayerImpl::setScrollLayer):
+        * src/WebScrollbarLayerImpl.h: Copied from Source/WebKit/chromium/src/WebSolidColorLayerImpl.h.
+        (WebCore):
+        (WebKit):
+        (WebScrollbarLayerImpl):
+        * src/WebSolidColorLayerImpl.cpp:
+        (WebKit::WebSolidColorLayer::create):
+        (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
+        (WebKit::WebSolidColorLayerImpl::layer):
+        (WebKit):
+        (WebKit::WebSolidColorLayerImpl::setBackgroundColor):
+        * src/WebSolidColorLayerImpl.h:
+        (WebCore):
+        (WebKit):
+        (WebSolidColorLayerImpl):
+        * src/WebVideoLayerImpl.cpp: Copied from Source/WebKit/chromium/src/WebVideoLayer.cpp.
+        (WebKit):
+        (WebKit::WebVideoLayer::create):
+        (WebKit::WebVideoLayerImpl::WebVideoLayerImpl):
+        (WebKit::WebVideoLayerImpl::~WebVideoLayerImpl):
+        (WebKit::WebVideoLayerImpl::layer):
+        (WebKit::WebVideoLayerImpl::active):
+        * src/WebVideoLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebVideoLayer.cpp.
+        (WebCore):
+        (WebKit):
+        (WebVideoLayerImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+        (WebKit::WebViewImpl::setRootGraphicsLayer):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        (WebKit):
+        * src/WebViewImpl.h:
+        * tests/ImageLayerChromiumTest.cpp:
+        (WebCore::TEST):
+        * tests/WebLayerTest.cpp:
+        * tests/WebLayerTreeViewTest.cpp:
+
 2012-08-22  Alejandro Piñeiro  <apinheiro@igalia.com>
 
         Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
 2012-08-22  Alejandro Piñeiro  <apinheiro@igalia.com>
 
         Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON
index 7fb0c0f..fc86f83 100644 (file)
             'src/WebAnimationImpl.h',
             'src/WebCompositorInputHandlerImpl.cpp',
             'src/WebCompositorInputHandlerImpl.h',
             'src/WebAnimationImpl.h',
             'src/WebCompositorInputHandlerImpl.cpp',
             'src/WebCompositorInputHandlerImpl.h',
-            'src/WebContentLayer.cpp',
             'src/WebContentLayerImpl.cpp',
             'src/WebContentLayerImpl.h',
             'src/WebContentLayerImpl.cpp',
             'src/WebContentLayerImpl.h',
-            'src/WebExternalTextureLayer.cpp',
+            'src/WebExternalTextureLayerImpl.cpp',
+            'src/WebExternalTextureLayerImpl.h',
             'src/WebFloatAnimationCurve.cpp',
             'src/WebFloatAnimationCurve.cpp',
-            'src/WebIOSurfaceLayer.cpp',
-            'src/WebImageLayer.cpp',
-            'src/WebLayer.cpp',
+            'src/WebIOSurfaceLayerImpl.cpp',
+            'src/WebIOSurfaceLayerImpl.h',
+            'src/WebImageLayerImpl.cpp',
+            'src/WebImageLayerImpl.h',
             'src/WebLayerImpl.cpp',
             'src/WebLayerImpl.h',
             'src/WebLayerTreeView.cpp',
             'src/WebLayerTreeViewImpl.cpp',
             'src/WebLayerTreeViewImpl.h',
             'src/WebLayerImpl.cpp',
             'src/WebLayerImpl.h',
             'src/WebLayerTreeView.cpp',
             'src/WebLayerTreeViewImpl.cpp',
             'src/WebLayerTreeViewImpl.h',
-            'src/WebScrollableLayer.cpp',
-            'src/WebScrollbarLayer.cpp',
-            'src/WebSolidColorLayer.cpp',
+            'src/WebScrollbarLayerImpl.cpp',
+            'src/WebScrollbarLayerImpl.h',
             'src/WebSolidColorLayerImpl.cpp',
             'src/WebSolidColorLayerImpl.h',
             'src/WebTransformAnimationCurve.cpp',
             'src/WebSolidColorLayerImpl.cpp',
             'src/WebSolidColorLayerImpl.h',
             'src/WebTransformAnimationCurve.cpp',
-            'src/WebVideoLayer.cpp',
+            'src/WebVideoLayerImpl.cpp',
+            'src/WebVideoLayerImpl.h',
         ],
 
         'conditions': [
         ],
 
         'conditions': [
index a63174e..fa34d1d 100644 (file)
@@ -59,8 +59,8 @@ PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningW
 }
 
 LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl)
 }
 
 LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl)
-    : m_contentLayer(WebContentLayer::create(this))
-    , m_clipLayer(WebLayer::create())
+    : m_contentLayer(adoptPtr(WebContentLayer::create(this)))
+    , m_clipLayer(adoptPtr(WebLayer::create()))
     , m_node(node)
     , m_owningWebViewImpl(owningWebViewImpl)
     , m_currentGraphicsLayer(0)
     , m_node(node)
     , m_owningWebViewImpl(owningWebViewImpl)
     , m_currentGraphicsLayer(0)
@@ -69,14 +69,14 @@ LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl)
     ASSERT(m_node);
     ASSERT(owningWebViewImpl);
 
     ASSERT(m_node);
     ASSERT(owningWebViewImpl);
 
-    m_clipLayer.setAnchorPoint(WebFloatPoint());
-    m_clipLayer.addChild(m_contentLayer);
-    m_contentLayer.setDrawsContent(false);
+    m_clipLayer->setAnchorPoint(WebFloatPoint());
+    m_clipLayer->addChild(m_contentLayer->layer());
+    m_contentLayer->layer()->setDrawsContent(false);
 
     // We don't want to show the highlight until startAnimation is called, even though the highlight
     // layer may be added to the tree immediately.
 
     // We don't want to show the highlight until startAnimation is called, even though the highlight
     // layer may be added to the tree immediately.
-    m_contentLayer.setOpacity(0);
-    m_contentLayer.setAnimationDelegate(this);
+    m_contentLayer->layer()->setOpacity(0);
+    m_contentLayer->layer()->setAnimationDelegate(this);
 }
 
 LinkHighlight::~LinkHighlight()
 }
 
 LinkHighlight::~LinkHighlight()
@@ -87,19 +87,17 @@ LinkHighlight::~LinkHighlight()
 
 WebContentLayer* LinkHighlight::contentLayer()
 {
 
 WebContentLayer* LinkHighlight::contentLayer()
 {
-    return &m_contentLayer;
+    return m_contentLayer.get();
 }
 
 WebLayer* LinkHighlight::clipLayer()
 {
 }
 
 WebLayer* LinkHighlight::clipLayer()
 {
-    return &m_clipLayer;
+    return m_clipLayer.get();
 }
 
 void LinkHighlight::releaseResources()
 {
     m_node.clear();
 }
 
 void LinkHighlight::releaseResources()
 {
     m_node.clear();
-    m_contentLayer.clearClient();
-    m_contentLayer.setAnimationDelegate(0);
 }
 
 RenderLayer* LinkHighlight::computeEnclosingCompositingLayer()
 }
 
 RenderLayer* LinkHighlight::computeEnclosingCompositingLayer()
@@ -175,8 +173,8 @@ bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositin
     IntPoint targetCompositorAbsolute = compositingLayer->renderer()->frame()->view()->windowToContents(targetWindow);
     FloatPoint targetCompositorLocal = compositingLayer->renderer()->absoluteToLocal(targetCompositorAbsolute, false, true);
 
     IntPoint targetCompositorAbsolute = compositingLayer->renderer()->frame()->view()->windowToContents(targetWindow);
     FloatPoint targetCompositorLocal = compositingLayer->renderer()->absoluteToLocal(targetCompositorAbsolute, false, true);
 
-    m_contentLayer.setBounds(WebSize(enclosingIntRect(nodeBounds).size()));
-    m_contentLayer.setPosition(WebFloatPoint(targetCompositorLocal));
+    m_contentLayer->layer()->setBounds(WebSize(enclosingIntRect(nodeBounds).size()));
+    m_contentLayer->layer()->setPosition(WebFloatPoint(targetCompositorLocal));
 
     return pathHasChanged;
 }
 
     return pathHasChanged;
 }
@@ -200,7 +198,7 @@ void LinkHighlight::startHighlightAnimation()
     // FIXME: Should duration be configurable?
     const float duration = 2;
 
     // FIXME: Should duration be configurable?
     const float duration = 2;
 
-    m_contentLayer.setOpacity(startOpacity);
+    m_contentLayer->layer()->setOpacity(startOpacity);
 
     WebFloatAnimationCurve curve;
     curve.add(WebFloatKeyframe(0, startOpacity));
 
     WebFloatAnimationCurve curve;
     curve.add(WebFloatKeyframe(0, startOpacity));
@@ -209,8 +207,8 @@ void LinkHighlight::startHighlightAnimation()
     curve.add(WebFloatKeyframe(duration, WebKit::layoutTestMode() ? startOpacity : 0));
 
     m_animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity));
     curve.add(WebFloatKeyframe(duration, WebKit::layoutTestMode() ? startOpacity : 0));
 
     m_animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity));
-    m_contentLayer.setDrawsContent(true);
-    m_contentLayer.addAnimation(m_animation.get());
+    m_contentLayer->layer()->setDrawsContent(true);
+    m_contentLayer->layer()->addAnimation(m_animation.get());
 
     invalidate();
     m_owningWebViewImpl->scheduleAnimation();
 
     invalidate();
     m_owningWebViewImpl->scheduleAnimation();
@@ -249,7 +247,7 @@ void LinkHighlight::updateGeometry()
     if (compositingLayer && computeHighlightLayerPathAndPosition(compositingLayer)) {
         // We only need to invalidate the layer if the highlight size has changed, otherwise
         // we can just re-position the layer without needing to repaint.
     if (compositingLayer && computeHighlightLayerPathAndPosition(compositingLayer)) {
         // We only need to invalidate the layer if the highlight size has changed, otherwise
         // we can just re-position the layer without needing to repaint.
-        m_contentLayer.invalidate();
+        m_contentLayer->layer()->invalidate();
     }
 }
 
     }
 }
 
index 8762f23..4eb6f59 100644 (file)
@@ -80,8 +80,8 @@ private:
     // size since the last call to this function.
     bool computeHighlightLayerPathAndPosition(WebCore::RenderLayer*);
 
     // size since the last call to this function.
     bool computeHighlightLayerPathAndPosition(WebCore::RenderLayer*);
 
-    WebContentLayer m_contentLayer;
-    WebLayer m_clipLayer;
+    OwnPtr<WebContentLayer> m_contentLayer;
+    OwnPtr<WebLayer> m_clipLayer;
     WebCore::Path m_path;
 
     RefPtr<WebCore::Node> m_node;
     WebCore::Path m_path;
 
     RefPtr<WebCore::Node> m_node;
index 65dac62..4df4204 100644 (file)
@@ -30,6 +30,7 @@
 #include "FloatPoint.h"
 #include "FloatRect.h"
 #include "GraphicsLayer.h"
 #include "FloatPoint.h"
 #include "FloatRect.h"
 #include "GraphicsLayer.h"
+#include "GraphicsLayerChromium.h"
 #include "PlatformContextSkia.h"
 #include "WebViewImpl.h"
 #include <public/WebContentLayer.h>
 #include "PlatformContextSkia.h"
 #include "WebViewImpl.h"
 #include <public/WebContentLayer.h>
@@ -48,11 +49,11 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView)
     m_graphicsLayer->setName("non-composited content");
 #endif
     m_graphicsLayer->setDrawsContent(true);
     m_graphicsLayer->setName("non-composited content");
 #endif
     m_graphicsLayer->setDrawsContent(true);
-    WebContentLayer layer = m_graphicsLayer->platformLayer()->to<WebContentLayer>();
-    layer.setUseLCDText(true);
-    layer.setOpaque(true);
+    WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer();
+    layer->setUseLCDText(true);
+    layer->layer()->setOpaque(true);
 #if !OS(ANDROID)
 #if !OS(ANDROID)
-    layer.setDrawCheckerboardForMissingTiles(true);
+    layer->setDrawCheckerboardForMissingTiles(true);
 #endif
 }
 
 #endif
 }
 
@@ -80,7 +81,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
         return;
     }
 
         return;
     }
 
-    if (*layer->platformLayer() == scrollLayer())
+    if (layer->platformLayer() == scrollLayer())
         return;
 
     layer->addChildAtIndex(m_graphicsLayer.get(), 0);
         return;
 
     layer->addChildAtIndex(m_graphicsLayer.get(), 0);
@@ -95,12 +96,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
     bool visibleRectChanged = m_viewportSize != viewportSize;
 
     m_viewportSize = viewportSize;
     bool visibleRectChanged = m_viewportSize != viewportSize;
 
     m_viewportSize = viewportSize;
-    WebScrollableLayer layer = scrollLayer();
-    layer.setScrollPosition(scrollPosition + scrollOrigin);
-    layer.setPosition(WebFloatPoint(-scrollPosition));
+    WebLayer* layer = scrollLayer();
+    layer->setScrollPosition(scrollPosition + scrollOrigin);
+    layer->setPosition(WebFloatPoint(-scrollPosition));
     // Due to the possibility of pinch zoom, the noncomposited layer is always
     // assumed to be scrollable.
     // Due to the possibility of pinch zoom, the noncomposited layer is always
     // assumed to be scrollable.
-    layer.setScrollable(true);
+    layer->setScrollable(true);
     m_deviceScaleFactor = deviceScale;
     m_graphicsLayer->deviceOrPageScaleFactorChanged();
     m_graphicsLayer->setSize(contentsSize);
     m_deviceScaleFactor = deviceScale;
     m_graphicsLayer->deviceOrPageScaleFactorChanged();
     m_graphicsLayer->setSize(contentsSize);
@@ -127,11 +128,11 @@ bool NonCompositedContentHost::haveScrollLayer()
     return m_graphicsLayer->parent();
 }
 
     return m_graphicsLayer->parent();
 }
 
-WebScrollableLayer NonCompositedContentHost::scrollLayer()
+WebLayer* NonCompositedContentHost::scrollLayer()
 {
     if (!m_graphicsLayer->parent())
 {
     if (!m_graphicsLayer->parent())
-        return WebScrollableLayer();
-    return m_graphicsLayer->parent()->platformLayer()->to<WebScrollableLayer>();
+        return 0;
+    return m_graphicsLayer->parent()->platformLayer();
 }
 
 void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)
 }
 
 void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)
index e60e9ef..08b5f6a 100644 (file)
@@ -29,7 +29,7 @@
 #include "GraphicsLayerClient.h"
 #include "IntSize.h"
 
 #include "GraphicsLayerClient.h"
 #include "IntSize.h"
 
-#include <public/WebScrollableLayer.h>
+#include <public/WebLayer.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
@@ -80,7 +80,7 @@ private:
     virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; }
 
     bool haveScrollLayer();
     virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; }
 
     bool haveScrollLayer();
-    WebScrollableLayer scrollLayer();
+    WebLayer* scrollLayer();
 
     OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
     WebViewImpl* m_webView;
 
     OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
     WebViewImpl* m_webView;
index 69da1ea..fa21e89 100644 (file)
 #include "config.h"
 #include "WebContentLayerImpl.h"
 
 #include "config.h"
 #include "WebContentLayerImpl.h"
 
+#include "SkMatrix44.h"
 #include <public/WebContentLayerClient.h>
 #include <public/WebContentLayerClient.h>
+#include <public/WebFloatPoint.h>
 #include <public/WebFloatRect.h>
 #include <public/WebRect.h>
 #include <public/WebFloatRect.h>
 #include <public/WebRect.h>
+#include <public/WebSize.h>
 
 using namespace WebCore;
 
 namespace WebKit {
 
 
 using namespace WebCore;
 
 namespace WebKit {
 
-PassRefPtr<WebContentLayerImpl> WebContentLayerImpl::create(WebContentLayerClient* contentClient)
+WebContentLayer* WebContentLayer::create(WebContentLayerClient* client)
 {
 {
-    return adoptRef(new WebContentLayerImpl(contentClient));
+    return new WebContentLayerImpl(client);
 }
 
 }
 
-WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient)
-    : ContentLayerChromium(this)
-    , m_contentClient(contentClient)
+WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client)
+    : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this))))
+    , m_client(client)
 {
 {
-    setIsDrawable(true);
+    m_webLayerImpl->layer()->setIsDrawable(true);
 }
 
 WebContentLayerImpl::~WebContentLayerImpl()
 {
 }
 
 WebContentLayerImpl::~WebContentLayerImpl()
 {
-    clearDelegate();
+    static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate();
 }
 
 }
 
+WebLayer* WebContentLayerImpl::layer()
+{
+    return m_webLayerImpl.get();
+}
+
+void WebContentLayerImpl::setDoubleSided(bool doubleSided)
+{
+    m_webLayerImpl->layer()->setDoubleSided(doubleSided);
+}
+
+void WebContentLayerImpl::setContentsScale(float scale)
+{
+    m_webLayerImpl->layer()->setContentsScale(scale);
+}
+
+void WebContentLayerImpl::setUseLCDText(bool enable)
+{
+    m_webLayerImpl->layer()->setUseLCDText(enable);
+}
+
+void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable)
+{
+    m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable);
+}
+
+
 void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque)
 {
 void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque)
 {
-    if (!m_contentClient)
+    if (!m_client)
         return;
     WebFloatRect webOpaque;
         return;
     WebFloatRect webOpaque;
-    m_contentClient->paintContents(canvas, WebRect(clip), webOpaque);
+    m_client->paintContents(canvas, WebRect(clip), webOpaque);
     opaque = webOpaque;
 }
 
     opaque = webOpaque;
 }
 
index 97729ea..511f8e0 100644 (file)
 #define WebContentLayerImpl_h
 
 #include "ContentLayerChromium.h"
 #define WebContentLayerImpl_h
 
 #include "ContentLayerChromium.h"
+#include "WebLayerImpl.h"
+#include <public/WebContentLayer.h>
 #include <wtf/PassRefPtr.h>
 
 namespace WebKit {
 class WebContentLayerClient;
 
 #include <wtf/PassRefPtr.h>
 
 namespace WebKit {
 class WebContentLayerClient;
 
-class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate {
+class WebContentLayerImpl : public WebContentLayer,
+                            public WebCore::ContentLayerDelegate {
 public:
 public:
-    static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient);
+    explicit WebContentLayerImpl(WebContentLayerClient*);
+
+    // WebContentLayer implementation.
+    virtual WebLayer* layer() OVERRIDE;
+    virtual void setDoubleSided(bool)  OVERRIDE;
+    virtual void setContentsScale(float)  OVERRIDE;
+    virtual void setUseLCDText(bool)  OVERRIDE;
+    virtual void setDrawCheckerboardForMissingTiles(bool)  OVERRIDE;
 
 protected:
 
 protected:
-    explicit WebContentLayerImpl(WebContentLayerClient* contentClient);
     virtual ~WebContentLayerImpl();
 
     // ContentLayerDelegate implementation.
     virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE;
 
     virtual ~WebContentLayerImpl();
 
     // ContentLayerDelegate implementation.
     virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE;
 
-    WebContentLayerClient* m_contentClient;
+    OwnPtr<WebLayerImpl> m_webLayerImpl;
+    WebContentLayerClient* m_client;
     bool m_drawsContent;
 };
 
     bool m_drawsContent;
 };
 
  */
 
 #include "config.h"
  */
 
 #include "config.h"
-#include <public/WebExternalTextureLayer.h>
+#include "WebExternalTextureLayerImpl.h"
 
 #include "CCTextureUpdateQueue.h"
 #include "TextureLayerChromium.h"
 
 #include "CCTextureUpdateQueue.h"
 #include "TextureLayerChromium.h"
+#include "WebLayerImpl.h"
 #include <public/WebExternalTextureLayerClient.h>
 #include <public/WebFloatRect.h>
 #include <public/WebSize.h>
 #include <public/WebExternalTextureLayerClient.h>
 #include <public/WebFloatRect.h>
 #include <public/WebSize.h>
@@ -36,96 +37,96 @@ using namespace WebCore;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-class WebTextureUpdaterImpl : public WebTextureUpdater {
-public:
-    explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue)
-        : m_queue(queue)
-    {
-    }
-
-    virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
-    {
-        TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size };
-        m_queue.appendCopy(copy);
-    }
-
-private:
-    CCTextureUpdateQueue& m_queue;
-};
-
-class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium {
-public:
-    explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
-        : TextureLayerChromium(client ? this : 0)
-        , m_client(client)
-    {
-    }
-
-    virtual unsigned prepareTexture(CCTextureUpdateQueue& queue) OVERRIDE
-    {
-        WebTextureUpdaterImpl updaterImpl(queue);
-        return m_client->prepareTexture(updaterImpl);
-    }
+WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
+{
+    return new WebExternalTextureLayerImpl(client);
+}
 
 
-    virtual WebKit::WebGraphicsContext3D* context() OVERRIDE
-    {
-        return m_client->context();
-    }
+WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
+    : m_client(client)
+{
+    RefPtr<TextureLayerChromium> layer;
+    if (m_client)
+        layer = TextureLayerChromium::create(this);
+    else
+        layer = TextureLayerChromium::create(0);
+    layer->setIsDrawable(true);
+    m_layer = adoptPtr(new WebLayerImpl(layer.release()));
+}
 
 
-private:
-    WebExternalTextureLayerClient* m_client;
-};
+WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
+{
+    static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient();
+}
 
 
-WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
+WebLayer* WebExternalTextureLayerImpl::layer()
 {
 {
-    RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client));
-    layer->setIsDrawable(true);
-    return WebExternalTextureLayer(layer.release());
+    return m_layer.get();
 }
 
 }
 
-void WebExternalTextureLayer::clearClient()
+void WebExternalTextureLayerImpl::setTextureId(unsigned id)
 {
 {
-    unwrap<TextureLayerChromium>()->clearClient();
+    static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id);
 }
 
 }
 
-void WebExternalTextureLayer::setTextureId(unsigned id)
+void WebExternalTextureLayerImpl::setFlipped(bool flipped)
 {
 {
-    unwrap<TextureLayerChromium>()->setTextureId(id);
+    static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped);
 }
 
 }
 
-void WebExternalTextureLayer::setFlipped(bool flipped)
+void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect)
 {
 {
-    unwrap<TextureLayerChromium>()->setFlipped(flipped);
+    static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect);
 }
 
 }
 
-void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
+void WebExternalTextureLayerImpl::setOpaque(bool opaque)
 {
 {
-    unwrap<TextureLayerChromium>()->setUVRect(rect);
+    static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque);
 }
 
 }
 
-void WebExternalTextureLayer::setOpaque(bool opaque)
+void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha)
 {
 {
-    unwrap<TextureLayerChromium>()->setOpaque(opaque);
+    static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha);
 }
 
 }
 
-void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha)
+void WebExternalTextureLayerImpl::willModifyTexture()
 {
 {
-    unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha);
+    static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture();
 }
 
 }
 
-void WebExternalTextureLayer::willModifyTexture()
+void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit)
 {
 {
-    unwrap<TextureLayerChromium>()->willModifyTexture();
+    static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(rateLimit);
 }
 
 }
 
-void WebExternalTextureLayer::setRateLimitContext(bool rateLimit)
+class WebTextureUpdaterImpl : public WebTextureUpdater {
+public:
+    explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue)
+        : m_queue(queue)
+    {
+    }
+
+    virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
+    {
+        TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size };
+        m_queue.appendCopy(copy);
+    }
+
+private:
+    CCTextureUpdateQueue& m_queue;
+};
+
+unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue)
 {
 {
-    unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit);
+    ASSERT(m_client);
+    WebTextureUpdaterImpl updaterImpl(queue);
+    return m_client->prepareTexture(updaterImpl);
 }
 
 }
 
-WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
-    : WebLayer(layer)
+WebGraphicsContext3D* WebExternalTextureLayerImpl::context()
 {
 {
+    ASSERT(m_client);
+    return m_client->context();
 }
 
 } // namespace WebKit
 }
 
 } // namespace WebKit
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include <public/WebContentLayer.h>
+#ifndef WebExternalTextureLayerImpl_h
+#define WebExternalTextureLayerImpl_h
 
 
-#include "ContentLayerChromium.h"
-#include "WebContentLayerImpl.h"
-
-using namespace WebCore;
+#include "TextureLayerChromium.h"
+#include <public/WebExternalTextureLayer.h>
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient)
-{
-    return WebContentLayer(WebContentLayerImpl::create(contentClient));
-}
+class WebLayerImpl;
 
 
-void WebContentLayer::clearClient()
-{
-    unwrap<ContentLayerChromium>()->clearDelegate();
-}
+class WebExternalTextureLayerImpl : public WebExternalTextureLayer,
+                                    public WebCore::TextureLayerChromiumClient {
+public:
+    explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient*);
+    virtual ~WebExternalTextureLayerImpl();
 
 
-void WebContentLayer::setDoubleSided(bool doubleSided)
-{
-    m_private->setDoubleSided(doubleSided);
-}
+    // WebExternalTextureLayer implementation.
+    virtual WebLayer* layer() OVERRIDE;
+    virtual void setTextureId(unsigned) OVERRIDE;
+    virtual void setFlipped(bool) OVERRIDE;
+    virtual void setUVRect(const WebFloatRect&) OVERRIDE;
+    virtual void setOpaque(bool) OVERRIDE;
+    virtual void setPremultipliedAlpha(bool) OVERRIDE;
+    virtual void willModifyTexture() OVERRIDE;
+    virtual void setRateLimitContext(bool) OVERRIDE;
 
 
-void WebContentLayer::setContentsScale(float scale)
-{
-    m_private->setContentsScale(scale);
-}
+    // TextureLayerChromiumClient implementation.
+    virtual unsigned prepareTexture(WebCore::CCTextureUpdateQueue&) OVERRIDE;
+    virtual WebGraphicsContext3D* context() OVERRIDE;
 
 
-void WebContentLayer::setUseLCDText(bool enable)
-{
-    m_private->setUseLCDText(enable);
-}
+private:
+    WebExternalTextureLayerClient* m_client;
+    OwnPtr<WebLayerImpl> m_layer;
+};
 
 
-void WebContentLayer::setDrawCheckerboardForMissingTiles(bool enable)
-{
-    m_private->setDrawCheckerboardForMissingTiles(enable);
 }
 
 }
 
-WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node)
-    : WebScrollableLayer(node)
-{
-}
-
-WebContentLayer& WebContentLayer::operator=(const PassRefPtr<ContentLayerChromium>& node)
-{
-    m_private = node;
-    return *this;
-}
-
-WebContentLayer::operator PassRefPtr<ContentLayerChromium>() const
-{
-    return static_cast<ContentLayerChromium*>(m_private.get());
-}
+#endif // WebExternalTextureLayerImpl_h
 
 
-} // namespace WebKit
  */
 
 #include "config.h"
  */
 
 #include "config.h"
-#include <public/WebIOSurfaceLayer.h>
+#include "WebIOSurfaceLayerImpl.h"
 
 #include "IOSurfaceLayerChromium.h"
 
 #include "IOSurfaceLayerChromium.h"
-#include <public/WebSize.h>
+#include "WebLayerImpl.h"
 
 
-using namespace WebCore;
+using WebCore::IOSurfaceLayerChromium;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-WebIOSurfaceLayer WebIOSurfaceLayer::create()
+WebIOSurfaceLayer* WebIOSurfaceLayer::create()
 {
     RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create();
     layer->setIsDrawable(true);
 {
     RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create();
     layer->setIsDrawable(true);
-    return WebIOSurfaceLayer(layer.release());
+    return new WebIOSurfaceLayerImpl(layer.release());
 }
 
 }
 
-void WebIOSurfaceLayer::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
+WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer)
+    : m_layer(adoptPtr(new WebLayerImpl(layer)))
 {
 {
-    unwrap<IOSurfaceLayerChromium>()->setIOSurfaceProperties(ioSurfaceId, size);
 }
 
 }
 
-WebIOSurfaceLayer::WebIOSurfaceLayer(PassRefPtr<IOSurfaceLayerChromium> layer)
-    : WebLayer(layer)
+WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl()
 {
 }
 
 {
 }
 
+void WebIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
+{
+    static_cast<IOSurfaceLayerChromium*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, size);
+}
+
+WebLayer* WebIOSurfaceLayerImpl::layer()
+{
+    return m_layer.get();
+}
+
 } // namespace WebKit
 } // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h
new file mode 100644 (file)
index 0000000..3dbb027
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google 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 AND ITS 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 APPLE OR ITS 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 WebIOSurfaceLayerImpl_h
+#define WebIOSurfaceLayerImpl_h
+
+#include <public/WebIOSurfaceLayer.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+class IOSurfaceLayerChromium;
+}
+
+namespace WebKit {
+
+class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer {
+public:
+    explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
+    virtual ~WebIOSurfaceLayerImpl();
+
+    // WebIOSurfaceLayer implementation.
+    virtual WebLayer* layer() OVERRIDE;
+    virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) OVERRIDE;
+
+private:
+    OwnPtr<WebLayerImpl> m_layer;
+};
+
+}
+
+#endif // WebIOSurfaceLayerImpl_h
+
  */
 
 #include "config.h"
  */
 
 #include "config.h"
-#include <public/WebSolidColorLayer.h>
+#include "WebImageLayerImpl.h"
 
 
-#include "WebSolidColorLayerImpl.h"
-#include <public/WebFloatRect.h>
+#include "ImageLayerChromium.h"
+#include "WebLayerImpl.h"
+
+using WebCore::ImageLayerChromium;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-WebSolidColorLayer WebSolidColorLayer::create()
+WebImageLayer* WebImageLayer::create()
+{
+    return new WebImageLayerImpl(WebCore::ImageLayerChromium::create());
+}
+
+WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer)
+    : m_layer(adoptPtr(new WebLayerImpl(layer)))
+{
+}
+
+WebImageLayerImpl::~WebImageLayerImpl()
 {
 {
-    return WebSolidColorLayer(WebSolidColorLayerImpl::create());
 }
 
 }
 
-WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node)
-    : WebLayer(node)
+WebLayer* WebImageLayerImpl::layer()
 {
 {
+    return m_layer.get();
 }
 
 }
 
-void WebSolidColorLayer::setBackgroundColor(const WebColor& color)
+void WebImageLayerImpl::setBitmap(SkBitmap bitmap)
 {
 {
-    m_private->setBackgroundColor(color);
+    static_cast<ImageLayerChromium*>(m_layer->layer())->setBitmap(bitmap);
 }
 
 } // namespace WebKit
 }
 
 } // namespace WebKit
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
+#ifndef WebImageLayerImpl_h
+#define WebImageLayerImpl_h
+
 #include <public/WebImageLayer.h>
 #include <public/WebImageLayer.h>
+#include <wtf/OwnPtr.h>
 
 
-#include "ImageLayerChromium.h"
+namespace WebCore {
+class ImageLayerChromium;
+}
 
 namespace WebKit {
 
 namespace WebKit {
+class WebLayerImpl;
 
 
-WebImageLayer WebImageLayer::create()
-{
-    return WebImageLayer(WebCore::ImageLayerChromium::create());
-}
+class WebImageLayerImpl : public WebImageLayer {
+public:
+    explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>);
+    virtual ~WebImageLayerImpl();
 
 
-WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer)
-    : WebLayer(layer)
-{
-}
+    // WebImageLayer implementation.
+    WebLayer* layer() OVERRIDE;
+    virtual void setBitmap(SkBitmap) OVERRIDE;
+
+private:
+    OwnPtr<WebLayerImpl> m_layer;
+};
 
 
-void WebImageLayer::setBitmap(SkBitmap bitmap)
-{
-    unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap);
 }
 
 }
 
-} // namespace WebKit
+#endif // WebImageLayerImpl_h
diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp
deleted file mode 100644 (file)
index 37897e6..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright (C) 2011 Google 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 AND ITS 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 APPLE OR ITS 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 <public/WebLayer.h>
-
-#include "LayerChromium.h"
-#include "SkMatrix44.h"
-#include "WebAnimationImpl.h"
-#include "WebLayerImpl.h"
-#include <public/WebFilterOperations.h>
-#include <public/WebFloatPoint.h>
-#include <public/WebFloatRect.h>
-#include <public/WebSize.h>
-#include <public/WebTransformationMatrix.h>
-
-using namespace WebCore;
-using WebKit::WebTransformationMatrix;
-
-namespace {
-
-WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix)
-{
-    double data[16];
-    matrix.asColMajord(data);
-    return WebTransformationMatrix(data[0], data[1], data[2], data[3],
-                                   data[4], data[5], data[6], data[7],
-                                   data[8], data[9], data[10], data[11],
-                                   data[12], data[13], data[14], data[15]);
-}
-
-SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix)
-{
-    SkMatrix44 skMatrix;
-    skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11()));
-    skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12()));
-    skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13()));
-    skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14()));
-    skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21()));
-    skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22()));
-    skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23()));
-    skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24()));
-    skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31()));
-    skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32()));
-    skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33()));
-    skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34()));
-    skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41()));
-    skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42()));
-    skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43()));
-    skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44()));
-    return skMatrix;
-}
-
-} // anonymous namespace
-
-namespace WebKit {
-
-WebLayer WebLayer::create()
-{
-    return WebLayer(WebLayerImpl::create());
-}
-
-void WebLayer::reset()
-{
-    m_private.reset();
-}
-
-void WebLayer::assign(const WebLayer& other)
-{
-    m_private = other.m_private;
-}
-
-bool WebLayer::equals(const WebLayer& n) const
-{
-    return (m_private.get() == n.m_private.get());
-}
-
-void WebLayer::invalidateRect(const WebFloatRect& dirtyRect)
-{
-    m_private->setNeedsDisplayRect(dirtyRect);
-}
-
-void WebLayer::invalidate()
-{
-    m_private->setNeedsDisplay();
-}
-
-void WebLayer::addChild(const WebLayer& child)
-{
-    m_private->addChild(child);
-}
-
-void WebLayer::insertChild(const WebLayer& child, size_t index)
-{
-    m_private->insertChild(child, index);
-}
-
-void WebLayer::replaceChild(const WebLayer& reference, const WebLayer& newLayer)
-{
-    WebLayer ref = reference;
-    m_private->replaceChild(ref.unwrap<LayerChromium>(), newLayer);
-}
-
-void WebLayer::setChildren(const WebVector<WebLayer>& webChildren)
-{
-    Vector<RefPtr<LayerChromium> > children(webChildren.size());
-    for (size_t i = 0; i < webChildren.size(); ++i)
-        children[i] = webChildren[i].unwrap<LayerChromium>();
-    m_private->setChildren(children);
-}
-
-void WebLayer::removeFromParent()
-{
-    m_private->removeFromParent();
-}
-
-void WebLayer::removeAllChildren()
-{
-    m_private->removeAllChildren();
-}
-
-void WebLayer::setAnchorPoint(const WebFloatPoint& anchorPoint)
-{
-    m_private->setAnchorPoint(anchorPoint);
-}
-
-WebFloatPoint WebLayer::anchorPoint() const
-{
-    return WebFloatPoint(m_private->anchorPoint());
-}
-
-void WebLayer::setAnchorPointZ(float anchorPointZ)
-{
-    m_private->setAnchorPointZ(anchorPointZ);
-}
-
-float WebLayer::anchorPointZ() const
-{
-    return m_private->anchorPointZ();
-}
-
-void WebLayer::setBounds(const WebSize& size)
-{
-    m_private->setBounds(size);
-}
-
-WebSize WebLayer::bounds() const
-{
-    return WebSize(m_private->bounds());
-}
-
-void WebLayer::setMasksToBounds(bool masksToBounds)
-{
-    m_private->setMasksToBounds(masksToBounds);
-}
-
-bool WebLayer::masksToBounds() const
-{
-    return m_private->masksToBounds();
-}
-
-void WebLayer::setMaskLayer(const WebLayer& maskLayer)
-{
-    WebLayer ref = maskLayer;
-    m_private->setMaskLayer(ref.unwrap<LayerChromium>());
-}
-
-void WebLayer::setReplicaLayer(const WebLayer& replicaLayer)
-{
-    WebLayer ref = replicaLayer;
-    m_private->setReplicaLayer(ref.unwrap<LayerChromium>());
-}
-
-void WebLayer::setOpacity(float opacity)
-{
-    m_private->setOpacity(opacity);
-}
-
-float WebLayer::opacity() const
-{
-    return m_private->opacity();
-}
-
-void WebLayer::setOpaque(bool opaque)
-{
-    m_private->setOpaque(opaque);
-}
-
-bool WebLayer::opaque() const
-{
-    return m_private->opaque();
-}
-
-void WebLayer::setPosition(const WebFloatPoint& position)
-{
-    m_private->setPosition(position);
-}
-
-WebFloatPoint WebLayer::position() const
-{
-    return WebFloatPoint(m_private->position());
-}
-
-void WebLayer::setSublayerTransform(const SkMatrix44& matrix)
-{
-    m_private->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix));
-}
-
-void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix)
-{
-    m_private->setSublayerTransform(matrix);
-}
-
-SkMatrix44 WebLayer::sublayerTransform() const
-{
-    return skMatrix44FromTransformationMatrix(m_private->sublayerTransform());
-}
-
-void WebLayer::setTransform(const SkMatrix44& matrix)
-{
-    m_private->setTransform(transformationMatrixFromSkMatrix44(matrix));
-}
-
-void WebLayer::setTransform(const WebTransformationMatrix& matrix)
-{
-    m_private->setTransform(matrix);
-}
-
-SkMatrix44 WebLayer::transform() const
-{
-    return skMatrix44FromTransformationMatrix(m_private->transform());
-}
-
-void WebLayer::setDrawsContent(bool drawsContent)
-{
-    m_private->setIsDrawable(drawsContent);
-}
-
-bool WebLayer::drawsContent() const
-{
-    return m_private->drawsContent();
-}
-
-void WebLayer::setPreserves3D(bool preserve3D)
-{
-    m_private->setPreserves3D(preserve3D);
-}
-
-void WebLayer::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility)
-{
-    m_private->setUseParentBackfaceVisibility(useParentBackfaceVisibility);
-}
-
-void WebLayer::setBackgroundColor(WebColor color)
-{
-    m_private->setBackgroundColor(color);
-}
-
-void WebLayer::setFilters(const WebFilterOperations& filters)
-{
-    m_private->setFilters(filters);
-}
-
-void WebLayer::setBackgroundFilters(const WebFilterOperations& filters)
-{
-    m_private->setBackgroundFilters(filters);
-}
-
-void WebLayer::setDebugBorderColor(const WebColor& color)
-{
-    m_private->setDebugBorderColor(color);
-}
-
-void WebLayer::setDebugBorderWidth(float width)
-{
-    m_private->setDebugBorderWidth(width);
-}
-
-void WebLayer::setDebugName(WebString name)
-{
-    m_private->setDebugName(name);
-}
-
-void WebLayer::setAnimationDelegate(WebAnimationDelegate* delegate)
-{
-    m_private->setLayerAnimationDelegate(delegate);
-}
-
-bool WebLayer::addAnimation(WebAnimation* animation)
-{
-    return m_private->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation());
-}
-
-void WebLayer::removeAnimation(int animationId)
-{
-    m_private->removeAnimation(animationId);
-}
-
-void WebLayer::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty)
-{
-    m_private->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty));
-}
-
-void WebLayer::pauseAnimation(int animationId, double timeOffset)
-{
-    m_private->pauseAnimation(animationId, timeOffset);
-}
-
-void WebLayer::suspendAnimations(double monotonicTime)
-{
-    m_private->suspendAnimations(monotonicTime);
-}
-
-void WebLayer::resumeAnimations(double monotonicTime)
-{
-    m_private->resumeAnimations(monotonicTime);
-}
-
-bool WebLayer::hasActiveAnimation()
-{
-    return m_private->hasActiveAnimation();
-}
-
-void WebLayer::transferAnimationsTo(WebLayer* other)
-{
-    ASSERT(other);
-    if (other)
-        other->m_private->setLayerAnimationController(m_private->releaseLayerAnimationController());
-}
-
-void WebLayer::setForceRenderSurface(bool forceRenderSurface)
-{
-    m_private->setForceRenderSurface(forceRenderSurface);
-}
-
-void WebLayer::clearRenderSurface()
-{
-    m_private->clearRenderSurface();
-}
-
-WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node)
-    : m_private(node)
-{
-}
-
-WebLayer& WebLayer::operator=(const PassRefPtr<LayerChromium>& node)
-{
-    m_private = node;
-    return *this;
-}
-
-WebLayer::operator PassRefPtr<LayerChromium>() const
-{
-    return m_private.get();
-}
-
-} // namespace WebKit
index 16e1206..40ced48 100644 (file)
 #include "config.h"
 #include "WebLayerImpl.h"
 
 #include "config.h"
 #include "WebLayerImpl.h"
 
-using namespace WebCore;
+#include "CCActiveAnimation.h"
+#include "LayerChromium.h"
+#include "SkMatrix44.h"
+#include "WebAnimationImpl.h"
+#include <public/WebFloatPoint.h>
+#include <public/WebFloatRect.h>
+#include <public/WebSize.h>
+#include <public/WebTransformationMatrix.h>
+
+using WebCore::CCActiveAnimation;
+using WebCore::LayerChromium;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-PassRefPtr<WebLayerImpl> WebLayerImpl::create()
+namespace {
+
+WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix)
+{
+    double data[16];
+    matrix.asColMajord(data);
+    return WebTransformationMatrix(data[0], data[1], data[2], data[3],
+                                   data[4], data[5], data[6], data[7],
+                                   data[8], data[9], data[10], data[11],
+                                   data[12], data[13], data[14], data[15]);
+}
+
+SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix)
+{
+    SkMatrix44 skMatrix;
+    skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11()));
+    skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12()));
+    skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13()));
+    skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14()));
+    skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21()));
+    skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22()));
+    skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23()));
+    skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24()));
+    skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31()));
+    skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32()));
+    skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33()));
+    skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34()));
+    skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41()));
+    skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42()));
+    skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43()));
+    skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44()));
+    return skMatrix;
+}
+
+} // anonymous namespace
+
+
+WebLayer* WebLayer::create()
 {
 {
-    return adoptRef(new WebLayerImpl());
+    return new WebLayerImpl(LayerChromium::create());
 }
 
 }
 
-WebLayerImpl::WebLayerImpl()
-    : LayerChromium()
+WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer)
+    : m_layer(layer)
 {
 {
-    // Make sure that this layer does not draw content. This way we don't have to override
-    // the base class implementation of drawsContent().
-    ASSERT(!drawsContent());
 }
 
 WebLayerImpl::~WebLayerImpl()
 {
 }
 
 WebLayerImpl::~WebLayerImpl()
 {
+    m_layer->clearRenderSurface();
+    m_layer->setLayerAnimationDelegate(0);
+}
+
+int WebLayerImpl::id() const
+{
+    return m_layer->id();
+}
+
+void WebLayerImpl::invalidateRect(const WebFloatRect& rect)
+{
+    m_layer->setNeedsDisplayRect(rect);
+}
+
+void WebLayerImpl::invalidate()
+{
+    m_layer->setNeedsDisplay();
+}
+
+void WebLayerImpl::addChild(WebLayer* child)
+{
+    m_layer->addChild(static_cast<WebLayerImpl*>(child)->layer());
+}
+
+void WebLayerImpl::insertChild(WebLayer* child, size_t index)
+{
+    m_layer->insertChild(static_cast<WebLayerImpl*>(child)->layer(), index);
+}
+
+void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* newLayer)
+{
+    m_layer->replaceChild(static_cast<WebLayerImpl*>(reference)->layer(), static_cast<WebLayerImpl*>(newLayer)->layer());
+}
+
+void WebLayerImpl::setChildren(const WebVector<WebLayer*>& webChildren)
+{
+    Vector<RefPtr<LayerChromium> > children(webChildren.size());
+    for (size_t i = 0; i < webChildren.size(); ++i)
+        children[i] = static_cast<WebLayerImpl*>(webChildren[i])->layer();
+    m_layer->setChildren(children);
+}
+
+void WebLayerImpl::removeFromParent()
+{
+    m_layer->removeFromParent();
+}
+
+void WebLayerImpl::removeAllChildren()
+{
+    m_layer->removeAllChildren();
+}
+
+void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchorPoint)
+{
+    m_layer->setAnchorPoint(anchorPoint);
+}
+
+WebFloatPoint WebLayerImpl::anchorPoint() const
+{
+    return WebFloatPoint(m_layer->anchorPoint());
+}
+
+void WebLayerImpl::setAnchorPointZ(float anchorPointZ)
+{
+    m_layer->setAnchorPointZ(anchorPointZ);
+}
+
+float WebLayerImpl::anchorPointZ() const
+{
+    return m_layer->anchorPointZ();
+}
+
+void WebLayerImpl::setBounds(const WebSize& size)
+{
+    m_layer->setBounds(size);
+}
+
+WebSize WebLayerImpl::bounds() const
+{
+    return WebSize(m_layer->bounds());
+}
+
+void WebLayerImpl::setMasksToBounds(bool masksToBounds)
+{
+    m_layer->setMasksToBounds(masksToBounds);
+}
+
+bool WebLayerImpl::masksToBounds() const
+{
+    return m_layer->masksToBounds();
+}
+
+void WebLayerImpl::setMaskLayer(WebLayer* maskLayer)
+{
+    m_layer->setMaskLayer(maskLayer ? static_cast<WebLayerImpl*>(maskLayer)->layer() : 0);
+}
+
+void WebLayerImpl::setReplicaLayer(WebLayer* replicaLayer)
+{
+    m_layer->setReplicaLayer(replicaLayer ? static_cast<WebLayerImpl*>(replicaLayer)->layer() : 0);
+}
+
+void WebLayerImpl::setOpacity(float opacity)
+{
+    m_layer->setOpacity(opacity);
+}
+
+float WebLayerImpl::opacity() const
+{
+    return m_layer->opacity();
+}
+
+void WebLayerImpl::setOpaque(bool opaque)
+{
+    m_layer->setOpaque(opaque);
+}
+
+bool WebLayerImpl::opaque() const
+{
+    return m_layer->opaque();
+}
+
+void WebLayerImpl::setPosition(const WebFloatPoint& position)
+{
+    m_layer->setPosition(position);
+}
+
+WebFloatPoint WebLayerImpl::position() const
+{
+    return WebFloatPoint(m_layer->position());
+}
+
+void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix)
+{
+    m_layer->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix));
+}
+
+void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix)
+{
+    m_layer->setSublayerTransform(matrix);
+}
+
+SkMatrix44 WebLayerImpl::sublayerTransform() const
+{
+    return skMatrix44FromTransformationMatrix(m_layer->sublayerTransform());
+}
+
+void WebLayerImpl::setTransform(const SkMatrix44& matrix)
+{
+    m_layer->setTransform(transformationMatrixFromSkMatrix44(matrix));
+}
+
+void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix)
+{
+    m_layer->setTransform(matrix);
+}
+
+SkMatrix44 WebLayerImpl::transform() const
+{
+    return skMatrix44FromTransformationMatrix(m_layer->transform());
+}
+
+void WebLayerImpl::setDrawsContent(bool drawsContent)
+{
+    m_layer->setIsDrawable(drawsContent);
+}
+
+bool WebLayerImpl::drawsContent() const
+{
+    return m_layer->drawsContent();
+}
+
+void WebLayerImpl::setPreserves3D(bool preserve3D)
+{
+    m_layer->setPreserves3D(preserve3D);
+}
+
+void WebLayerImpl::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility)
+{
+    m_layer->setUseParentBackfaceVisibility(useParentBackfaceVisibility);
+}
+
+void WebLayerImpl::setBackgroundColor(WebColor color)
+{
+    m_layer->setBackgroundColor(color);
+}
+
+void WebLayerImpl::setFilters(const WebFilterOperations& filters)
+{
+    m_layer->setFilters(filters);
+}
+
+void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters)
+{
+    m_layer->setBackgroundFilters(filters);
+}
+
+void WebLayerImpl::setDebugBorderColor(const WebColor& color)
+{
+    m_layer->setDebugBorderColor(color);
+}
+
+void WebLayerImpl::setDebugBorderWidth(float width)
+{
+    m_layer->setDebugBorderWidth(width);
+}
+
+void WebLayerImpl::setDebugName(WebString name)
+{
+    m_layer->setDebugName(name);
+}
+
+void WebLayerImpl::setAnimationDelegate(WebAnimationDelegate* delegate)
+{
+    m_layer->setLayerAnimationDelegate(delegate);
+}
+
+bool WebLayerImpl::addAnimation(WebAnimation* animation)
+{
+    return m_layer->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation());
+}
+
+void WebLayerImpl::removeAnimation(int animationId)
+{
+    m_layer->removeAnimation(animationId);
+}
+
+void WebLayerImpl::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty)
+{
+    m_layer->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty));
+}
+
+void WebLayerImpl::pauseAnimation(int animationId, double timeOffset)
+{
+    m_layer->pauseAnimation(animationId, timeOffset);
+}
+
+void WebLayerImpl::suspendAnimations(double monotonicTime)
+{
+    m_layer->suspendAnimations(monotonicTime);
+}
+
+void WebLayerImpl::resumeAnimations(double monotonicTime)
+{
+    m_layer->resumeAnimations(monotonicTime);
+}
+
+bool WebLayerImpl::hasActiveAnimation()
+{
+    return m_layer->hasActiveAnimation();
+}
+
+void WebLayerImpl::transferAnimationsTo(WebLayer* other)
+{
+    ASSERT(other);
+    static_cast<WebLayerImpl*>(other)->m_layer->setLayerAnimationController(m_layer->releaseLayerAnimationController());
+}
+
+void WebLayerImpl::setForceRenderSurface(bool forceRenderSurface)
+{
+    m_layer->setForceRenderSurface(forceRenderSurface);
+}
+
+void WebLayerImpl::setScrollPosition(WebPoint position)
+{
+    m_layer->setScrollPosition(position);
+}
+
+void WebLayerImpl::setScrollable(bool scrollable)
+{
+    m_layer->setScrollable(scrollable);
+}
+
+void WebLayerImpl::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
+{
+    m_layer->setHaveWheelEventHandlers(haveWheelEventHandlers);
+}
+
+void WebLayerImpl::setShouldScrollOnMainThread(bool shouldScrollOnMainThread)
+{
+    m_layer->setShouldScrollOnMainThread(shouldScrollOnMainThread);
+}
+
+void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects)
+{
+    WebCore::Region region;
+    for (size_t i = 0; i < rects.size(); ++i) {
+        WebCore::IntRect rect = rects[i];
+        region.unite(rect);
+    }
+    m_layer->setNonFastScrollableRegion(region);
+
+}
+
+void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable)
+{
+    m_layer->setIsContainerForFixedPositionLayers(enable);
+}
+
+void WebLayerImpl::setFixedToContainerLayer(bool enable)
+{
+    m_layer->setFixedToContainerLayer(enable);
+}
+
+LayerChromium* WebLayerImpl::layer() const
+{
+    return m_layer.get();
 }
 
 } // namespace WebKit
 }
 
 } // namespace WebKit
index 7e4e750..7e3b533 100644 (file)
 #ifndef WebLayerImpl_h
 #define WebLayerImpl_h
 
 #ifndef WebLayerImpl_h
 #define WebLayerImpl_h
 
-#include "LayerChromium.h"
-#include <wtf/PassRefPtr.h>
+#include <public/WebLayer.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+class LayerChromium;
+}
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-class WebLayerImpl : public WebCore::LayerChromium {
+class WebLayerImpl : public WebLayer {
 public:
 public:
-    static PassRefPtr<WebLayerImpl> create();
+    explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>);
+    virtual ~WebLayerImpl();
+
+    // WebLayer implementation.
+    virtual int id() const OVERRIDE;
+    virtual void invalidateRect(const WebFloatRect&) OVERRIDE;
+    virtual void invalidate() OVERRIDE;
+    virtual void addChild(WebLayer*) OVERRIDE;
+    virtual void insertChild(WebLayer*, size_t index) OVERRIDE;
+    virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) OVERRIDE;
+    virtual void setChildren(const WebVector<WebLayer*>&) OVERRIDE;
+    virtual void removeFromParent() OVERRIDE;
+    virtual void removeAllChildren() OVERRIDE;
+    virtual void setAnchorPoint(const WebFloatPoint&) OVERRIDE;
+    virtual WebFloatPoint anchorPoint() const OVERRIDE;
+    virtual void setAnchorPointZ(float) OVERRIDE;
+    virtual float anchorPointZ() const OVERRIDE;
+    virtual void setBounds(const WebSize&) OVERRIDE;
+    virtual WebSize bounds() const OVERRIDE;
+    virtual void setMasksToBounds(bool) OVERRIDE;
+    virtual bool masksToBounds() const OVERRIDE;
+    virtual void setMaskLayer(WebLayer*) OVERRIDE;
+    virtual void setReplicaLayer(WebLayer*) OVERRIDE;
+    virtual void setOpacity(float) OVERRIDE;
+    virtual float opacity() const OVERRIDE;
+    virtual void setOpaque(bool) OVERRIDE;
+    virtual bool opaque() const OVERRIDE;
+    virtual void setPosition(const WebFloatPoint&) OVERRIDE;
+    virtual WebFloatPoint position() const OVERRIDE;
+    virtual void setSublayerTransform(const SkMatrix44&) OVERRIDE;
+    virtual void setSublayerTransform(const WebTransformationMatrix&) OVERRIDE;
+    virtual SkMatrix44 sublayerTransform() const OVERRIDE;
+    virtual void setTransform(const SkMatrix44&) OVERRIDE;
+    virtual void setTransform(const WebTransformationMatrix&) OVERRIDE;
+    virtual SkMatrix44 transform() const OVERRIDE;
+    virtual void setDrawsContent(bool) OVERRIDE;
+    virtual bool drawsContent() const OVERRIDE;
+    virtual void setPreserves3D(bool) OVERRIDE;
+    virtual void setUseParentBackfaceVisibility(bool) OVERRIDE;
+    virtual void setBackgroundColor(WebColor) OVERRIDE;
+    virtual void setFilters(const WebFilterOperations&) OVERRIDE;
+    virtual void setBackgroundFilters(const WebFilterOperations&) OVERRIDE;
+    virtual void setDebugBorderColor(const WebColor&) OVERRIDE;
+    virtual void setDebugBorderWidth(float) OVERRIDE;
+    virtual void setDebugName(WebString) OVERRIDE;
+    virtual void setAnimationDelegate(WebAnimationDelegate*) OVERRIDE;
+    virtual bool addAnimation(WebAnimation*) OVERRIDE;
+    virtual void removeAnimation(int animationId) OVERRIDE;
+    virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) OVERRIDE;
+    virtual void pauseAnimation(int animationId, double timeOffset) OVERRIDE;
+    virtual void suspendAnimations(double monotonicTime) OVERRIDE;
+    virtual void resumeAnimations(double monotonicTime) OVERRIDE;
+    virtual bool hasActiveAnimation() OVERRIDE;
+    virtual void transferAnimationsTo(WebLayer*) OVERRIDE;
+    virtual void setForceRenderSurface(bool) OVERRIDE;
+    virtual void setScrollPosition(WebPoint) OVERRIDE;
+    virtual void setScrollable(bool) OVERRIDE;
+    virtual void setHaveWheelEventHandlers(bool) OVERRIDE;
+    virtual void setShouldScrollOnMainThread(bool) OVERRIDE;
+    virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) OVERRIDE;
+    virtual void setIsContainerForFixedPositionLayers(bool) OVERRIDE;
+    virtual void setFixedToContainerLayer(bool) OVERRIDE;
+
+    WebCore::LayerChromium* layer() const;
 
 protected:
 
 protected:
-    WebLayerImpl();
-    virtual ~WebLayerImpl();
+    RefPtr<WebCore::LayerChromium> m_layer;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index f397e53..7dfbcd1 100644 (file)
@@ -31,6 +31,7 @@
 #include "CCLayerTreeHost.h"
 #include "CCRenderingStats.h"
 #include "LayerChromium.h"
 #include "CCLayerTreeHost.h"
 #include "CCRenderingStats.h"
 #include "LayerChromium.h"
+#include "WebLayerImpl.h"
 #include "WebLayerTreeViewImpl.h"
 #include <public/WebLayer.h>
 #include <public/WebPoint.h>
 #include "WebLayerTreeViewImpl.h"
 #include <public/WebLayer.h>
 #include <public/WebPoint.h>
@@ -83,7 +84,7 @@ void WebLayerTreeView::setSurfaceReady()
 void WebLayerTreeView::setRootLayer(WebLayer *root)
 {
     if (root)
 void WebLayerTreeView::setRootLayer(WebLayer *root)
 {
     if (root)
-        m_private->layerTreeHost()->setRootLayer(*root);
+        m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer());
     else
         m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>());
 }
     else
         m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>());
 }
index 1f1933f..1fd8239 100644 (file)
@@ -29,6 +29,7 @@
 #include "CCLayerTreeHost.h"
 #include "CCThreadProxy.h"
 #include "LayerChromium.h"
 #include "CCLayerTreeHost.h"
 #include "CCThreadProxy.h"
 #include "LayerChromium.h"
+#include "WebLayerImpl.h"
 #include <public/WebGraphicsContext3D.h>
 #include <public/WebLayer.h>
 #include <public/WebLayerTreeView.h>
 #include <public/WebGraphicsContext3D.h>
 #include <public/WebLayer.h>
 #include <public/WebLayerTreeView.h>
@@ -142,7 +143,7 @@ PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewCl
     OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings));
     if (!impl->layerTreeHost())
         return nullptr;
     OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings));
     if (!impl->layerTreeHost())
         return nullptr;
-    impl->layerTreeHost()->setRootLayer(root);
+    impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer());
     return impl.release();
 }
 
     return impl.release();
 }
 
index 4a90a98..cb75623 100644 (file)
@@ -109,9 +109,9 @@ void WebMediaPlayerClientImpl::readyStateChanged()
     ASSERT(m_mediaPlayer);
     m_mediaPlayer->readyStateChanged();
 #if USE(ACCELERATED_COMPOSITING)
     ASSERT(m_mediaPlayer);
     m_mediaPlayer->readyStateChanged();
 #if USE(ACCELERATED_COMPOSITING)
-    if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) {
-        m_videoLayer = WebVideoLayer::create(this);
-        m_videoLayer.setOpaque(m_opaque);
+    if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) {
+        m_videoLayer = adoptPtr(WebVideoLayer::create(this));
+        m_videoLayer->layer()->setOpaque(m_opaque);
     }
 #endif
 }
     }
 #endif
 }
@@ -138,8 +138,8 @@ void WebMediaPlayerClientImpl::repaint()
 {
     ASSERT(m_mediaPlayer);
 #if USE(ACCELERATED_COMPOSITING)
 {
     ASSERT(m_mediaPlayer);
 #if USE(ACCELERATED_COMPOSITING)
-    if (!m_videoLayer.isNull() && supportsAcceleratedRendering())
-        m_videoLayer.invalidate();
+    if (m_videoLayer && supportsAcceleratedRendering())
+        m_videoLayer->layer()->invalidate();
 #endif
     m_mediaPlayer->repaint();
 }
 #endif
     m_mediaPlayer->repaint();
 }
@@ -166,8 +166,8 @@ void WebMediaPlayerClientImpl::setOpaque(bool opaque)
 {
 #if USE(ACCELERATED_COMPOSITING)
     m_opaque = opaque;
 {
 #if USE(ACCELERATED_COMPOSITING)
     m_opaque = opaque;
-    if (!m_videoLayer.isNull())
-        m_videoLayer.setOpaque(m_opaque);
+    if (m_videoLayer)
+        m_videoLayer->layer()->setOpaque(m_opaque);
 #endif
 }
 
 #endif
 }
 
@@ -343,7 +343,7 @@ void WebMediaPlayerClientImpl::cancelLoad()
 WebLayer* WebMediaPlayerClientImpl::platformLayer() const
 {
     ASSERT(m_supportsAcceleratedCompositing);
 WebLayer* WebMediaPlayerClientImpl::platformLayer() const
 {
     ASSERT(m_supportsAcceleratedCompositing);
-    return const_cast<WebVideoLayer*>(&m_videoLayer);
+    return m_videoLayer ? m_videoLayer->layer() : 0;
 }
 #endif
 
 }
 #endif
 
@@ -745,7 +745,7 @@ bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const
 
 bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
 {
 
 bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
 {
-    return !m_videoLayer.isNull() && m_videoLayer.active();
+    return m_videoLayer && m_videoLayer->active();
 }
 
 void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client)
 }
 
 void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client)
index 373015e..329fd9e 100644 (file)
@@ -205,7 +205,7 @@ private:
     WebCore::MediaPlayer::Preload m_preload;
     RefPtr<WebHelperPluginImpl> m_helperPlugin;
 #if USE(ACCELERATED_COMPOSITING)
     WebCore::MediaPlayer::Preload m_preload;
     RefPtr<WebHelperPluginImpl> m_helperPlugin;
 #if USE(ACCELERATED_COMPOSITING)
-    WebVideoLayer m_videoLayer;
+    OwnPtr<WebVideoLayer> m_videoLayer;
     bool m_supportsAcceleratedCompositing;
     bool m_opaque;
     WebVideoFrameProvider::Client* m_videoFrameProviderClient;
     bool m_supportsAcceleratedCompositing;
     bool m_opaque;
     WebVideoFrameProvider::Client* m_videoFrameProviderClient;
index a35a040..75a97e0 100644 (file)
@@ -366,11 +366,11 @@ void WebPluginContainerImpl::setBackingTextureId(unsigned textureId)
     if (m_textureId == textureId)
         return;
 
     if (m_textureId == textureId)
         return;
 
-    ASSERT(m_ioSurfaceLayer.isNull());
+    ASSERT(!m_ioSurfaceLayer);
 
 
-    if (m_textureLayer.isNull())
-        m_textureLayer = WebExternalTextureLayer::create();
-    m_textureLayer.setTextureId(textureId);
+    if (!m_textureLayer)
+        m_textureLayer = adoptPtr(WebExternalTextureLayer::create());
+    m_textureLayer->setTextureId(textureId);
 
     // If anyone of the IDs is zero we need to switch between hardware
     // and software compositing. This is done by triggering a style recalc
 
     // If anyone of the IDs is zero we need to switch between hardware
     // and software compositing. This is done by triggering a style recalc
@@ -390,11 +390,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
     if (ioSurfaceId == m_ioSurfaceId)
         return;
 
     if (ioSurfaceId == m_ioSurfaceId)
         return;
 
-    ASSERT(m_textureLayer.isNull());
+    ASSERT(!m_textureLayer);
 
 
-    if (m_ioSurfaceLayer.isNull())
-        m_ioSurfaceLayer = WebIOSurfaceLayer::create();
-    m_ioSurfaceLayer.setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
+    if (!m_ioSurfaceLayer)
+        m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create());
+    m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
 
     // If anyone of the IDs is zero we need to switch between hardware
     // and software compositing. This is done by triggering a style recalc
 
     // If anyone of the IDs is zero we need to switch between hardware
     // and software compositing. This is done by triggering a style recalc
@@ -409,11 +409,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
 void WebPluginContainerImpl::commitBackingTexture()
 {
 #if USE(ACCELERATED_COMPOSITING)
 void WebPluginContainerImpl::commitBackingTexture()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (!m_textureLayer.isNull())
-        m_textureLayer.invalidate();
+    if (m_textureLayer)
+        m_textureLayer->layer()->invalidate();
 
 
-    if (!m_ioSurfaceLayer.isNull())
-        m_ioSurfaceLayer.invalidate();
+    if (m_ioSurfaceLayer)
+        m_ioSurfaceLayer->layer()->invalidate();
 #endif
 }
 
 #endif
 }
 
@@ -480,11 +480,11 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel)
 void WebPluginContainerImpl::setOpaque(bool opaque)
 {
 #if USE(ACCELERATED_COMPOSITING)
 void WebPluginContainerImpl::setOpaque(bool opaque)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (!m_textureLayer.isNull())
-        m_textureLayer.setOpaque(opaque);
+    if (m_textureLayer)
+        m_textureLayer->layer()->setOpaque(opaque);
 
 
-    if (!m_ioSurfaceLayer.isNull())
-        m_ioSurfaceLayer.setOpaque(opaque);
+    if (m_ioSurfaceLayer)
+        m_ioSurfaceLayer->layer()->setOpaque(opaque);
 #endif
 }
 
 #endif
 }
 
@@ -575,9 +575,9 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
 WebLayer* WebPluginContainerImpl::platformLayer() const
 {
     if (m_textureId)
 WebLayer* WebPluginContainerImpl::platformLayer() const
 {
     if (m_textureId)
-        return const_cast<WebExternalTextureLayer*>(&m_textureLayer);
+        return m_textureLayer->layer();
     if (m_ioSurfaceId)
     if (m_ioSurfaceId)
-        return const_cast<WebIOSurfaceLayer*>(&m_ioSurfaceLayer);
+        return m_ioSurfaceLayer->layer();
     return 0;
 }
 #endif
     return 0;
 }
 #endif
index 074a0cc..998be6e 100644 (file)
@@ -186,10 +186,10 @@ private:
     // A composited plugin will either have no composited layer, a texture layer, or an IOSurface layer.
     // It will never have both a texture and IOSurface output.
     unsigned m_textureId;
     // A composited plugin will either have no composited layer, a texture layer, or an IOSurface layer.
     // It will never have both a texture and IOSurface output.
     unsigned m_textureId;
-    WebExternalTextureLayer m_textureLayer;
+    OwnPtr<WebExternalTextureLayer> m_textureLayer;
 
     unsigned m_ioSurfaceId;
 
     unsigned m_ioSurfaceId;
-    WebIOSurfaceLayer m_ioSurfaceLayer;
+    OwnPtr<WebIOSurfaceLayer> m_ioSurfaceLayer;
 #endif
 
     // The associated scrollbar group object, created lazily. Used for Pepper
 #endif
 
     // The associated scrollbar group object, created lazily. Used for Pepper
diff --git a/Source/WebKit/chromium/src/WebScrollableLayer.cpp b/Source/WebKit/chromium/src/WebScrollableLayer.cpp
deleted file mode 100644 (file)
index a20e81d..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 Google 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 AND ITS 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 APPLE OR ITS 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 <public/WebScrollableLayer.h>
-
-#include "LayerChromium.h"
-#include "Region.h"
-
-namespace WebKit {
-
-void WebScrollableLayer::setScrollPosition(WebPoint position)
-{
-    m_private->setScrollPosition(position);
-}
-
-void WebScrollableLayer::setScrollable(bool scrollable)
-{
-    m_private->setScrollable(scrollable);
-}
-
-void WebScrollableLayer::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
-{
-    m_private->setHaveWheelEventHandlers(haveWheelEventHandlers);
-}
-
-void WebScrollableLayer::setShouldScrollOnMainThread(bool shouldScrollOnMainThread)
-{
-    m_private->setShouldScrollOnMainThread(shouldScrollOnMainThread);
-}
-
-void WebScrollableLayer::setNonFastScrollableRegion(const WebVector<WebRect>& rects)
-{
-    WebCore::Region region;
-    for (size_t i = 0; i < rects.size(); ++i) {
-        WebCore::IntRect rect = rects[i];
-        region.unite(rect);
-    }
-    m_private->setNonFastScrollableRegion(region);
-
-}
-
-void WebScrollableLayer::setIsContainerForFixedPositionLayers(bool enable)
-{
-    m_private->setIsContainerForFixedPositionLayers(enable);
-}
-
-void WebScrollableLayer::setFixedToContainerLayer(bool enable)
-{
-    m_private->setFixedToContainerLayer(enable);
-}
-
-} // namespace WebKit
  */
 
 #include "config.h"
  */
 
 #include "config.h"
-#include <public/WebScrollbarLayer.h>
+#include "WebScrollbarLayerImpl.h"
 
 #include "ScrollbarLayerChromium.h"
 
 #include "ScrollbarLayerChromium.h"
+#include "WebLayerImpl.h"
 
 
-using namespace WebCore;
+using WebCore::Scrollbar;
+using WebCore::ScrollbarLayerChromium;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-void WebScrollbarLayer::setScrollLayer(const WebLayer layer)
+WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
 {
 {
-    int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id();
-    unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
+    return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
 }
 
 }
 
-WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
+
+WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer)
+    : m_layer(adoptPtr(new WebLayerImpl(layer)))
 {
 {
-    return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
 }
 
 }
 
-WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
-    : WebLayer(layer)
+WebScrollbarLayerImpl::~WebScrollbarLayerImpl()
 {
 }
 
 {
 }
 
-WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
+WebLayer* WebScrollbarLayerImpl::layer()
 {
 {
-    m_private = layer;
-    return *this;
+    return m_layer.get();
 }
 
 }
 
-WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const
+void WebScrollbarLayerImpl::setScrollLayer(WebLayer* layer)
 {
 {
-    return unwrap<ScrollbarLayerChromium>();
+    int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0;
+    static_cast<ScrollbarLayerChromium*>(m_layer->layer())->setScrollLayerId(id);
 }
 
 }
 
+
+
 } // namespace WebKit
 } // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h
new file mode 100644 (file)
index 0000000..720f79c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 Google 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 AND ITS 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 APPLE OR ITS 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 WebScrollbarLayerImpl_h
+#define WebScrollbarLayerImpl_h
+
+#include <public/WebScrollbarLayer.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+class ScrollbarLayerChromium;
+}
+
+namespace WebKit {
+class WebLayerImpl;
+
+class WebScrollbarLayerImpl : public WebScrollbarLayer {
+public:
+    explicit WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium>);
+    virtual ~WebScrollbarLayerImpl();
+
+    // WebScrollbarLayer implementation.
+    virtual WebLayer* layer() OVERRIDE;
+    virtual void setScrollLayer(WebLayer*) OVERRIDE;
+
+private:
+    OwnPtr<WebLayerImpl> m_layer;
+};
+
+}
+
+#endif // WebScrollbarLayerImpl_h
index 33b1a30..9440426 100644 (file)
 #include "config.h"
 #include "WebSolidColorLayerImpl.h"
 
 #include "config.h"
 #include "WebSolidColorLayerImpl.h"
 
-using namespace WebCore;
+#include "SolidColorLayerChromium.h"
+#include "WebLayerImpl.h"
+
+using WebCore::SolidColorLayerChromium;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create()
+WebSolidColorLayer* WebSolidColorLayer::create()
 {
 {
-    return adoptRef(new WebSolidColorLayerImpl());
+    return new WebSolidColorLayerImpl(SolidColorLayerChromium::create());
 }
 
 }
 
-WebSolidColorLayerImpl::WebSolidColorLayerImpl()
-    : SolidColorLayerChromium()
+WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer)
+    : m_layer(adoptPtr(new WebLayerImpl(layer)))
 {
 {
-    setIsDrawable(true);
+    m_layer->layer()->setIsDrawable(true);
 }
 
 WebSolidColorLayerImpl::~WebSolidColorLayerImpl()
 {
 }
 
 }
 
 WebSolidColorLayerImpl::~WebSolidColorLayerImpl()
 {
 }
 
+WebLayer* WebSolidColorLayerImpl::layer()
+{
+    return m_layer.get();
+}
+
+void WebSolidColorLayerImpl::setBackgroundColor(WebColor color)
+{
+    m_layer->setBackgroundColor(color);
+}
+
 } // namespace WebKit
 
 } // namespace WebKit
 
index d2673b4..7742ba4 100644 (file)
 #ifndef WebSolidColorLayerImpl_h
 #define WebSolidColorLayerImpl_h
 
 #ifndef WebSolidColorLayerImpl_h
 #define WebSolidColorLayerImpl_h
 
-#include "SolidColorLayerChromium.h"
+#include <public/WebSolidColorLayer.h>
+#include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 
 #include <wtf/PassRefPtr.h>
 
+namespace WebCore {
+class SolidColorLayerChromium;
+}
+
 namespace WebKit {
 namespace WebKit {
+class WebLayerImpl;
 
 
-class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium {
+class WebSolidColorLayerImpl : public WebSolidColorLayer {
 public:
 public:
-    static PassRefPtr<WebSolidColorLayerImpl> create();
-
-protected:
-    WebSolidColorLayerImpl();
+    explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>);
     virtual ~WebSolidColorLayerImpl();
     virtual ~WebSolidColorLayerImpl();
+
+    // WebSolidColorLayer implementation.
+    virtual WebLayer* layer() OVERRIDE;
+    virtual void setBackgroundColor(WebColor) OVERRIDE;
+
+private:
+    OwnPtr<WebLayerImpl> m_layer;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp b/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp
new file mode 100644 (file)
index 0000000..5bfed67
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Google 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 AND ITS 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 APPLE OR ITS 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 "WebVideoLayerImpl.h"
+
+#include "VideoLayerChromium.h"
+#include "WebLayerImpl.h"
+
+namespace WebKit {
+
+WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider)
+{
+    return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider));
+}
+
+WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer)
+    : m_layer(adoptPtr(new WebLayerImpl(layer)))
+{
+}
+
+WebVideoLayerImpl::~WebVideoLayerImpl()
+{
+}
+
+WebLayer* WebVideoLayerImpl::layer()
+{
+    return m_layer.get();
+}
+
+bool WebVideoLayerImpl::active() const
+{
+    return m_layer->layer()->layerTreeHost();
+}
+
+} // namespace WebKit
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "VideoLayerChromium.h"
+#ifndef WebVideoLayerImpl_h
+#define WebVideoLayerImpl_h
+
 #include <public/WebVideoLayer.h>
 
 #include <public/WebVideoLayer.h>
 
+namespace WebCore {
+class VideoLayerChromium;
+}
+
 namespace WebKit {
 namespace WebKit {
+class WebLayerImpl;
 
 
-WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider)
-{
-    return WebVideoLayer(WebCore::VideoLayerChromium::create(provider));
-}
+class WebVideoLayerImpl : public WebVideoLayer {
+public:
+    explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>);
+    virtual ~WebVideoLayerImpl();
 
 
-WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer)
-    : WebLayer(layer)
-{
-}
+    // WebVideoLayer implementation.
+    virtual WebLayer* layer() OVERRIDE;
+    virtual bool active() const OVERRIDE;
+
+private:
+    OwnPtr<WebLayerImpl> m_layer;
+};
 
 
-bool WebVideoLayer::active() const
-{
-    return m_private->layerTreeHost();
 }
 
 }
 
-} // namespace WebKit
+#endif // WebVideoLayerImpl_h
+
index e28af40..c6f9f7e 100644 (file)
@@ -409,6 +409,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
     , m_isCancelingFullScreen(false)
     , m_benchmarkSupport(this)
 #if USE(ACCELERATED_COMPOSITING)
     , m_isCancelingFullScreen(false)
     , m_benchmarkSupport(this)
 #if USE(ACCELERATED_COMPOSITING)
+    , m_rootLayer(0)
     , m_rootGraphicsLayer(0)
     , m_isAcceleratedCompositingActive(false)
     , m_compositorCreationFailed(false)
     , m_rootGraphicsLayer(0)
     , m_isAcceleratedCompositingActive(false)
     , m_compositorCreationFailed(false)
@@ -3640,6 +3641,7 @@ bool WebViewImpl::allowsAcceleratedCompositing()
 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
 {
     m_rootGraphicsLayer = layer;
 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
 {
     m_rootGraphicsLayer = layer;
+    m_rootLayer = layer ? layer->platformLayer() : 0;
 
     setIsAcceleratedCompositingActive(layer);
     if (m_nonCompositedContentHost) {
 
     setIsAcceleratedCompositingActive(layer);
     if (m_nonCompositedContentHost) {
@@ -3653,11 +3655,8 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
         m_nonCompositedContentHost->setScrollLayer(scrollLayer);
     }
 
         m_nonCompositedContentHost->setScrollLayer(scrollLayer);
     }
 
-    if (layer)
-        m_rootLayer = *layer->platformLayer();
-
     if (!m_layerTreeView.isNull())
     if (!m_layerTreeView.isNull())
-        m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0);
+        m_layerTreeView.setRootLayer(m_rootLayer);
 
     IntRect damagedRect(0, 0, m_size.width, m_size.height);
     if (!m_isAcceleratedCompositingActive)
 
     IntRect damagedRect(0, 0, m_size.width, m_size.height);
     if (!m_isAcceleratedCompositingActive)
@@ -3770,7 +3769,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
         m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
         m_nonCompositedContentHost->setOpaque(!isTransparent());
 
         m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
         m_nonCompositedContentHost->setOpaque(!isTransparent());
 
-        m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings);
+        m_layerTreeView.initialize(this, *m_rootLayer, layerTreeViewSettings);
         if (!m_layerTreeView.isNull()) {
             if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) {
                 ASSERT(page()->deviceScaleFactor());
         if (!m_layerTreeView.isNull()) {
             if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) {
                 ASSERT(page()->deviceScaleFactor());
index 5124e94..206cf45 100644 (file)
@@ -825,7 +825,7 @@ private:
     WebCore::IntRect m_rootLayerScrollDamage;
     OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
     WebLayerTreeView m_layerTreeView;
     WebCore::IntRect m_rootLayerScrollDamage;
     OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
     WebLayerTreeView m_layerTreeView;
-    WebLayer m_rootLayer;
+    WebLayer* m_rootLayer;
     WebCore::GraphicsLayer* m_rootGraphicsLayer;
     bool m_isAcceleratedCompositingActive;
     bool m_compositorCreationFailed;
     WebCore::GraphicsLayer* m_rootGraphicsLayer;
     bool m_isAcceleratedCompositingActive;
     bool m_compositorCreationFailed;
index a5ca551..4948f97 100644 (file)
@@ -122,13 +122,13 @@ TEST(ImageLayerChromiumTest, opaqueImages)
     RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false);
     ASSERT_TRUE(nonOpaqueImage.get());
 
     RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false);
     ASSERT_TRUE(nonOpaqueImage.get());
 
-    ASSERT_TRUE(graphicsLayer->contentsLayer().isNull());
+    ASSERT_FALSE(graphicsLayer->contentsLayer());
 
     graphicsLayer->setContentsToImage(opaqueImage.get());
 
     graphicsLayer->setContentsToImage(opaqueImage.get());
-    ASSERT_TRUE(graphicsLayer->contentsLayer().opaque());
+    ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque());
 
     graphicsLayer->setContentsToImage(nonOpaqueImage.get());
 
     graphicsLayer->setContentsToImage(nonOpaqueImage.get());
-    ASSERT_FALSE(graphicsLayer->contentsLayer().opaque());
+    ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque());
 }
 
 } // namespace
 }
 
 } // namespace
index 6672004..9b8e58c 100644 (file)
@@ -26,6 +26,7 @@
 #include <public/WebLayer.h>
 
 #include "CompositorFakeWebGraphicsContext3D.h"
 #include <public/WebLayer.h>
 
 #include "CompositorFakeWebGraphicsContext3D.h"
+#include "WebLayerImpl.h"
 #include <public/WebCompositor.h>
 #include <public/WebContentLayer.h>
 #include <public/WebContentLayerClient.h>
 #include <public/WebCompositor.h>
 #include <public/WebContentLayer.h>
 #include <public/WebContentLayerClient.h>
@@ -76,9 +77,9 @@ public:
     {
         // Initialize without threading support.
         WebKit::WebCompositor::initialize(0);
     {
         // Initialize without threading support.
         WebKit::WebCompositor::initialize(0);
-        m_rootLayer = WebLayer::create();
+        m_rootLayer = adoptPtr(WebLayer::create());
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-        EXPECT_TRUE(m_view.initialize(&m_client, m_rootLayer, WebLayerTreeView::Settings()));
+        EXPECT_TRUE(m_view.initialize(&m_client, *m_rootLayer, WebLayerTreeView::Settings()));
         Mock::VerifyAndClearExpectations(&m_client);
     }
 
         Mock::VerifyAndClearExpectations(&m_client);
     }
 
@@ -87,14 +88,14 @@ public:
         // We may get any number of scheduleComposite calls during shutdown.
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
         m_view.setRootLayer(0);
         // We may get any number of scheduleComposite calls during shutdown.
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
         m_view.setRootLayer(0);
-        m_rootLayer.reset();
+        m_rootLayer.clear();
         m_view.reset();
         WebKit::WebCompositor::shutdown();
     }
 
 protected:
     MockWebLayerTreeViewClient m_client;
         m_view.reset();
         WebKit::WebCompositor::shutdown();
     }
 
 protected:
     MockWebLayerTreeViewClient m_client;
-    WebLayer m_rootLayer;
+    OwnPtr<WebLayer> m_rootLayer;
     WebLayerTreeView m_view;
 };
 
     WebLayerTreeView m_view;
 };
 
@@ -104,73 +105,73 @@ TEST_F(WebLayerTest, Client)
 {
     // Base layer.
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
 {
     // Base layer.
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    WebLayer layer = WebLayer::create();
-    m_rootLayer.addChild(layer);
+    OwnPtr<WebLayer> layer = adoptPtr(WebLayer::create());
+    m_rootLayer->addChild(layer.get());
     Mock::VerifyAndClearExpectations(&m_client);
 
     WebFloatPoint point(3, 4);
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     Mock::VerifyAndClearExpectations(&m_client);
 
     WebFloatPoint point(3, 4);
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer.setAnchorPoint(point);
+    layer->setAnchorPoint(point);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(point, layer.anchorPoint());
+    EXPECT_EQ(point, layer->anchorPoint());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     float anchorZ = 5;
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     float anchorZ = 5;
-    layer.setAnchorPointZ(anchorZ);
+    layer->setAnchorPointZ(anchorZ);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(anchorZ, layer.anchorPointZ());
+    EXPECT_EQ(anchorZ, layer->anchorPointZ());
 
     WebSize size(7, 8);
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
 
     WebSize size(7, 8);
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer.setBounds(size);
+    layer->setBounds(size);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(size, layer.bounds());
+    EXPECT_EQ(size, layer->bounds());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer.setMasksToBounds(true);
+    layer->setMasksToBounds(true);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_TRUE(layer.masksToBounds());
+    EXPECT_TRUE(layer->masksToBounds());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    WebLayer otherLayer = WebLayer::create();
-    m_rootLayer.addChild(otherLayer);
+    OwnPtr<WebLayer> otherLayer = adoptPtr(WebLayer::create());
+    m_rootLayer->addChild(otherLayer.get());
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer.setMaskLayer(otherLayer);
+    layer->setMaskLayer(otherLayer.get());
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     float opacity = 0.123f;
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     float opacity = 0.123f;
-    layer.setOpacity(opacity);
+    layer->setOpacity(opacity);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(opacity, layer.opacity());
+    EXPECT_EQ(opacity, layer->opacity());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer.setOpaque(true);
+    layer->setOpaque(true);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_TRUE(layer.opaque());
+    EXPECT_TRUE(layer->opaque());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer.setPosition(point);
+    layer->setPosition(point);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(point, layer.position());
+    EXPECT_EQ(point, layer->position());
 
     // Texture layer.
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
 
     // Texture layer.
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create();
-    m_rootLayer.addChild(textureLayer);
+    OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create());
+    m_rootLayer->addChild(textureLayer->layer());
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    textureLayer.setTextureId(3);
+    textureLayer->setTextureId(3);
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    textureLayer.setFlipped(true);
+    textureLayer->setFlipped(true);
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     WebFloatRect uvRect(0.1f, 0.1f, 0.9f, 0.9f);
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     WebFloatRect uvRect(0.1f, 0.1f, 0.9f, 0.9f);
-    textureLayer.setUVRect(uvRect);
+    textureLayer->setUVRect(uvRect);
     Mock::VerifyAndClearExpectations(&m_client);
 
 
     Mock::VerifyAndClearExpectations(&m_client);
 
 
@@ -178,14 +179,14 @@ TEST_F(WebLayerTest, Client)
     MockWebContentLayerClient contentClient;
     EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber());
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
     MockWebContentLayerClient contentClient;
     EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber());
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    WebContentLayer contentLayer = WebContentLayer::create(&contentClient);
-    m_rootLayer.addChild(contentLayer);
+    OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&contentClient));
+    m_rootLayer->addChild(contentLayer->layer());
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    contentLayer.setDrawsContent(false);
+    contentLayer->layer()->setDrawsContent(false);
     Mock::VerifyAndClearExpectations(&m_client);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_FALSE(contentLayer.drawsContent());
+    EXPECT_FALSE(contentLayer->layer()->drawsContent());
 }
 
 }
 }
 
 }
index bec2c60..1c1602c 100644 (file)
@@ -60,8 +60,8 @@ public:
     virtual void SetUp()
     {
         initializeCompositor();
     virtual void SetUp()
     {
         initializeCompositor();
-        m_rootLayer = WebLayer::create();
-        EXPECT_TRUE(m_view.initialize(client(), m_rootLayer, WebLayerTreeView::Settings()));
+        m_rootLayer = adoptPtr(WebLayer::create());
+        EXPECT_TRUE(m_view.initialize(client(), *m_rootLayer, WebLayerTreeView::Settings()));
         m_view.setSurfaceReady();
     }
 
         m_view.setSurfaceReady();
     }
 
@@ -70,13 +70,13 @@ public:
         Mock::VerifyAndClearExpectations(client());
 
         m_view.setRootLayer(0);
         Mock::VerifyAndClearExpectations(client());
 
         m_view.setRootLayer(0);
-        m_rootLayer.reset();
+        m_rootLayer.clear();
         m_view.reset();
         WebKit::WebCompositor::shutdown();
     }
 
 protected:
         m_view.reset();
         WebKit::WebCompositor::shutdown();
     }
 
 protected:
-    WebLayer m_rootLayer;
+    OwnPtr<WebLayer> m_rootLayer;
     WebLayerTreeView m_view;
 };
 
     WebLayerTreeView m_view;
 };