Unreviewed, rolling out r126170.
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2012 17:52:00 +0000 (17:52 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2012 17:52:00 +0000 (17:52 +0000)
http://trac.webkit.org/changeset/126170
https://bugs.webkit.org/show_bug.cgi?id=94614

I spoke too soon

Source/Platform:

* chromium/public/WebContentLayer.h:
(WebCore):
(WebKit):
(WebContentLayer):
(WebKit::WebContentLayer::WebContentLayer):
(WebKit::WebContentLayer::operator=):
* chromium/public/WebExternalTextureLayer.h:
(WebCore):
(WebExternalTextureLayer):
(WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
(WebKit::WebExternalTextureLayer::~WebExternalTextureLayer):
* chromium/public/WebIOSurfaceLayer.h:
(WebCore):
(WebIOSurfaceLayer):
(WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
* chromium/public/WebImageLayer.h:
(WebCore):
(WebImageLayer):
(WebKit::WebImageLayer::WebImageLayer):
* chromium/public/WebLayer.h:
(WebKit):
(WebLayer):
(WebKit::WebLayer::WebLayer):
(WebKit::WebLayer::~WebLayer):
(WebKit::WebLayer::operator=):
(WebKit::WebLayer::isNull):
(WebKit::WebLayer::to):
(WebKit::WebLayer::toConst):
(WebKit::WebLayer::unwrap):
(WebKit::WebLayer::constUnwrap):
(WebKit::operator==):
(WebKit::operator!=):
* chromium/public/WebScrollableLayer.h: Copied from Source/Platform/chromium/public/WebScrollbarLayer.h.
(WebKit):
(WebScrollableLayer):
(WebKit::WebScrollableLayer::WebScrollableLayer):
(WebKit::WebScrollableLayer::~WebScrollableLayer):
(WebKit::WebScrollableLayer::operator=):
* chromium/public/WebScrollbarLayer.h:
(WebCore):
(WebKit::WebScrollbarLayer::WebScrollbarLayer):
(WebKit::WebScrollbarLayer::operator=):
(WebScrollbarLayer):
* chromium/public/WebSolidColorLayer.h:
(WebKit):
(WebSolidColorLayer):
* chromium/public/WebVideoLayer.h:
(WebCore):
(WebVideoLayer):
(WebKit::WebVideoLayer::WebVideoLayer):

Source/WebCore:

* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
(WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::hasScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::scrollLayer):
(ScrollingCoordinatorPrivate):
(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):
(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::GraphicsLayerChromium::addAnimation):
(WebCore::GraphicsLayerChromium::pauseAnimation):
(WebCore::GraphicsLayerChromium::removeAnimation):
(WebCore::GraphicsLayerChromium::suspendAnimations):
(WebCore::GraphicsLayerChromium::resumeAnimations):
(WebCore::GraphicsLayerChromium::addLinkHighlight):
(WebCore::GraphicsLayerChromium::didFinishLinkHighlight):
(WebCore::GraphicsLayerChromium::setContentsToMedia):
(WebCore::GraphicsLayerChromium::primaryLayer):
(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:
(WebCore::GraphicsLayerChromium::hasContentsLayer):
(GraphicsLayerChromium):
(WebCore::GraphicsLayerChromium::contentsLayer):
* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::rootLayer):
* platform/graphics/chromium/LayerChromium.h:

Source/WebKit/chromium:

* WebKit.gypi:
* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::NonCompositedContentHost):
(WebKit::NonCompositedContentHost::setScrollLayer):
(WebKit::NonCompositedContentHost::setViewport):
(WebKit::NonCompositedContentHost::scrollLayer):
* src/NonCompositedContentHost.h:
* src/WebContentLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp.
(WebKit):
(WebKit::WebContentLayer::create):
(WebKit::WebContentLayer::clearClient):
(WebKit::WebContentLayer::setDoubleSided):
(WebKit::WebContentLayer::setContentsScale):
(WebKit::WebContentLayer::setUseLCDText):
(WebKit::WebContentLayer::setDrawCheckerboardForMissingTiles):
(WebKit::WebContentLayer::WebContentLayer):
(WebKit::WebContentLayer::operator=):
(WebKit::WebContentLayer::operator PassRefPtr<ContentLayerChromium>):
* src/WebContentLayerImpl.cpp:
(WebKit::WebContentLayerImpl::create):
(WebKit::WebContentLayerImpl::WebContentLayerImpl):
(WebKit::WebContentLayerImpl::~WebContentLayerImpl):
(WebKit::WebContentLayerImpl::paintContents):
* src/WebContentLayerImpl.h:
(WebContentLayerImpl):
* src/WebExternalTextureLayer.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp.
(WebKit):
(WebTextureUpdaterImpl):
(WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
(WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayer::create):
(WebKit::WebExternalTextureLayer::clearClient):
(WebKit::WebExternalTextureLayer::setTextureId):
(WebKit::WebExternalTextureLayer::setFlipped):
(WebKit::WebExternalTextureLayer::setUVRect):
(WebKit::WebExternalTextureLayer::setOpaque):
(WebKit::WebExternalTextureLayer::setPremultipliedAlpha):
(WebKit::WebExternalTextureLayer::willModifyTexture):
(WebKit::WebExternalTextureLayer::setRateLimitContext):
(WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
* src/WebExternalTextureLayerImpl.h: Removed.
* src/WebIOSurfaceLayer.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp.
(WebKit):
(WebKit::WebIOSurfaceLayer::create):
(WebKit::WebIOSurfaceLayer::setIOSurfaceProperties):
(WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
* src/WebIOSurfaceLayerImpl.h: Removed.
* src/WebImageLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.h.
(WebKit):
(WebKit::WebImageLayer::create):
(WebKit::WebImageLayer::WebImageLayer):
(WebKit::WebImageLayer::setBitmap):
* src/WebLayer.cpp: Added.
(WebKit):
(WebKit::WebLayer::create):
(WebKit::WebLayer::reset):
(WebKit::WebLayer::assign):
(WebKit::WebLayer::equals):
(WebKit::WebLayer::invalidateRect):
(WebKit::WebLayer::invalidate):
(WebKit::WebLayer::addChild):
(WebKit::WebLayer::insertChild):
(WebKit::WebLayer::replaceChild):
(WebKit::WebLayer::setChildren):
(WebKit::WebLayer::removeFromParent):
(WebKit::WebLayer::removeAllChildren):
(WebKit::WebLayer::setAnchorPoint):
(WebKit::WebLayer::anchorPoint):
(WebKit::WebLayer::setAnchorPointZ):
(WebKit::WebLayer::anchorPointZ):
(WebKit::WebLayer::setBounds):
(WebKit::WebLayer::bounds):
(WebKit::WebLayer::setMasksToBounds):
(WebKit::WebLayer::masksToBounds):
(WebKit::WebLayer::setMaskLayer):
(WebKit::WebLayer::setReplicaLayer):
(WebKit::WebLayer::setOpacity):
(WebKit::WebLayer::opacity):
(WebKit::WebLayer::setOpaque):
(WebKit::WebLayer::opaque):
(WebKit::WebLayer::setPosition):
(WebKit::WebLayer::position):
(WebKit::WebLayer::setSublayerTransform):
(WebKit::WebLayer::sublayerTransform):
(WebKit::WebLayer::setTransform):
(WebKit::WebLayer::transform):
(WebKit::WebLayer::setDrawsContent):
(WebKit::WebLayer::drawsContent):
(WebKit::WebLayer::setPreserves3D):
(WebKit::WebLayer::setUseParentBackfaceVisibility):
(WebKit::WebLayer::setBackgroundColor):
(WebKit::WebLayer::setFilters):
(WebKit::WebLayer::setBackgroundFilters):
(WebKit::WebLayer::setDebugBorderColor):
(WebKit::WebLayer::setDebugBorderWidth):
(WebKit::WebLayer::setDebugName):
(WebKit::WebLayer::setAnimationDelegate):
(WebKit::WebLayer::addAnimation):
(WebKit::WebLayer::removeAnimation):
(WebKit::WebLayer::pauseAnimation):
(WebKit::WebLayer::suspendAnimations):
(WebKit::WebLayer::resumeAnimations):
(WebKit::WebLayer::hasActiveAnimation):
(WebKit::WebLayer::transferAnimationsTo):
(WebKit::WebLayer::setForceRenderSurface):
(WebKit::WebLayer::clearRenderSurface):
(WebKit::WebLayer::WebLayer):
(WebKit::WebLayer::operator=):
(WebKit::WebLayer::operator PassRefPtr<LayerChromium>):
* src/WebLayerImpl.cpp:
(WebKit::WebLayerImpl::create):
(WebKit::WebLayerImpl::WebLayerImpl):
(WebKit::WebLayerImpl::~WebLayerImpl):
* src/WebLayerImpl.h:
(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: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.cpp.
(WebKit):
(WebKit::WebScrollableLayer::setScrollPosition):
(WebKit::WebScrollableLayer::setScrollable):
(WebKit::WebScrollableLayer::setHaveWheelEventHandlers):
(WebKit::WebScrollableLayer::setShouldScrollOnMainThread):
(WebKit::WebScrollableLayer::setNonFastScrollableRegion):
(WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers):
(WebKit::WebScrollableLayer::setFixedToContainerLayer):
* src/WebScrollbarLayer.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp.
(WebKit):
(WebKit::WebScrollbarLayer::setScrollLayer):
(WebKit::WebScrollbarLayer::create):
(WebKit::WebScrollbarLayer::WebScrollbarLayer):
(WebKit::WebScrollbarLayer::operator=):
(WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>):
* src/WebScrollbarLayerImpl.h: Removed.
* src/WebSolidColorLayer.cpp: Copied from Source/Platform/chromium/public/WebSolidColorLayer.h.
(WebKit):
(WebKit::WebSolidColorLayer::create):
(WebKit::WebSolidColorLayer::WebSolidColorLayer):
(WebKit::WebSolidColorLayer::setBackgroundColor):
* src/WebSolidColorLayerImpl.cpp:
(WebKit::WebSolidColorLayerImpl::create):
(WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
* src/WebSolidColorLayerImpl.h:
(WebSolidColorLayerImpl):
* src/WebVideoLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.h.
(WebKit):
(WebKit::WebVideoLayer::create):
(WebKit::WebVideoLayer::WebVideoLayer):
(WebKit::WebVideoLayer::active):
* 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@126174 268f45cc-cd09-0410-ab3c-d52691b4dbfc

51 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 [moved from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h with 56% similarity]
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/NonCompositedContentHost.cpp
Source/WebKit/chromium/src/NonCompositedContentHost.h
Source/WebKit/chromium/src/WebContentLayer.cpp [moved from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp with 55% similarity]
Source/WebKit/chromium/src/WebContentLayerImpl.cpp
Source/WebKit/chromium/src/WebContentLayerImpl.h
Source/WebKit/chromium/src/WebExternalTextureLayer.cpp [moved from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp with 50% similarity]
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h [deleted file]
Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp [moved from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp with 70% similarity]
Source/WebKit/chromium/src/WebImageLayer.cpp [moved from Source/WebKit/chromium/src/WebImageLayerImpl.h with 73% similarity]
Source/WebKit/chromium/src/WebLayer.cpp [new file with mode: 0644]
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 [new file with mode: 0644]
Source/WebKit/chromium/src/WebScrollbarLayer.cpp [moved from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp with 61% similarity]
Source/WebKit/chromium/src/WebScrollbarLayerImpl.h [deleted file]
Source/WebKit/chromium/src/WebSolidColorLayer.cpp [moved from Source/WebKit/chromium/src/WebImageLayerImpl.cpp with 70% similarity]
Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp
Source/WebKit/chromium/src/WebSolidColorLayerImpl.h
Source/WebKit/chromium/src/WebVideoLayer.cpp [moved from Source/WebKit/chromium/src/WebVideoLayerImpl.h 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 7ef822a..8bca430 100644 (file)
@@ -1,5 +1,64 @@
 2012-08-21  James Robinson  <jamesr@chromium.org>
 
+        Unreviewed, rolling out r126170.
+        http://trac.webkit.org/changeset/126170
+        https://bugs.webkit.org/show_bug.cgi?id=94614
+
+        I spoke too soon
+
+        * chromium/public/WebContentLayer.h:
+        (WebCore):
+        (WebKit):
+        (WebContentLayer):
+        (WebKit::WebContentLayer::WebContentLayer):
+        (WebKit::WebContentLayer::operator=):
+        * chromium/public/WebExternalTextureLayer.h:
+        (WebCore):
+        (WebExternalTextureLayer):
+        (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+        (WebKit::WebExternalTextureLayer::~WebExternalTextureLayer):
+        * chromium/public/WebIOSurfaceLayer.h:
+        (WebCore):
+        (WebIOSurfaceLayer):
+        (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
+        * chromium/public/WebImageLayer.h:
+        (WebCore):
+        (WebImageLayer):
+        (WebKit::WebImageLayer::WebImageLayer):
+        * chromium/public/WebLayer.h:
+        (WebKit):
+        (WebLayer):
+        (WebKit::WebLayer::WebLayer):
+        (WebKit::WebLayer::~WebLayer):
+        (WebKit::WebLayer::operator=):
+        (WebKit::WebLayer::isNull):
+        (WebKit::WebLayer::to):
+        (WebKit::WebLayer::toConst):
+        (WebKit::WebLayer::unwrap):
+        (WebKit::WebLayer::constUnwrap):
+        (WebKit::operator==):
+        (WebKit::operator!=):
+        * chromium/public/WebScrollableLayer.h: Copied from Source/Platform/chromium/public/WebScrollbarLayer.h.
+        (WebKit):
+        (WebScrollableLayer):
+        (WebKit::WebScrollableLayer::WebScrollableLayer):
+        (WebKit::WebScrollableLayer::~WebScrollableLayer):
+        (WebKit::WebScrollableLayer::operator=):
+        * chromium/public/WebScrollbarLayer.h:
+        (WebCore):
+        (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+        (WebKit::WebScrollbarLayer::operator=):
+        (WebScrollbarLayer):
+        * chromium/public/WebSolidColorLayer.h:
+        (WebKit):
+        (WebSolidColorLayer):
+        * chromium/public/WebVideoLayer.h:
+        (WebCore):
+        (WebVideoLayer):
+        (WebKit::WebVideoLayer::WebVideoLayer):
+
+2012-08-21  James Robinson  <jamesr@chromium.org>
+
         Unreviewed, rolling out r126169.
         http://trac.webkit.org/changeset/126169
         https://bugs.webkit.org/show_bug.cgi?id=94614
index 312107f..7336bfa 100644 (file)
 #define WebContentLayer_h
 
 #include "WebCommon.h"
+#include "WebScrollableLayer.h"
+
+namespace WebCore {
+class ContentLayerChromium;
+}
 
 namespace WebKit {
 class WebContentLayerClient;
+class WebContentLayerImpl;
 
-class WebContentLayer {
+class WebContentLayer : public WebScrollableLayer {
 public:
-    // The client must outlive the WebContentLayer.
-    WEBKIT_EXPORT static WebContentLayer* create(WebContentLayerClient*);
+    WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*);
 
+    WebContentLayer() { }
+    WebContentLayer(const WebContentLayer& layer) : WebScrollableLayer(layer) { }
     virtual ~WebContentLayer() { }
+    WebContentLayer& operator=(const WebContentLayer& layer)
+    {
+        WebLayer::assign(layer);
+        return *this;
+    }
 
-    // The WebContentLayer has ownership of this wrapper.
-    virtual WebLayer* layer() = 0;
+    // Called when the WebContentLayerClient is going away and should not be used.
+    WEBKIT_EXPORT void clearClient();
 
     // Set to true if the backside of this layer's contents should be visible when composited.
     // Defaults to false.
-    virtual void setDoubleSided(bool) = 0;
+    WEBKIT_EXPORT void setDoubleSided(bool);
 
     // Set to apply a scale factor used when painting and drawing this layer's content. Defaults to 1.0.
-    virtual void setContentsScale(float) = 0;
+    WEBKIT_EXPORT void setContentsScale(float);
 
     // 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;
-    virtual void setUseLCDText(bool) = 0;
+    WEBKIT_EXPORT void setUseLCDText(bool);
 
     // 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.
-    virtual void setDrawCheckerboardForMissingTiles(bool) = 0;
+    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
 };
 
 } // namespace WebKit
index 92d2c4f..b19c05f 100644 (file)
 #include "WebFloatRect.h"
 #include "WebLayer.h"
 
+namespace WebCore {
+class TextureLayerChromium;
+}
+
 namespace WebKit {
 
 class WebExternalTextureLayerClient;
@@ -40,43 +44,49 @@ 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.
-class WebExternalTextureLayer {
+class WebExternalTextureLayer : public WebLayer {
 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.
-    // The client must outlive the WebExternalTextureLayer.
-    WEBKIT_EXPORT static WebExternalTextureLayer* create(WebExternalTextureLayerClient* = 0);
+    WEBKIT_EXPORT static WebExternalTextureLayer create(WebExternalTextureLayerClient* = 0);
 
-    virtual ~WebExternalTextureLayer() { }
+    // Indicates that the client for this layer is going away and shouldn't be used.
+    WEBKIT_EXPORT void clearClient();
 
-    virtual WebLayer* layer() = 0;
+    WebExternalTextureLayer() { }
+    virtual ~WebExternalTextureLayer() { }
 
     // Sets the texture id that represents the layer, in the namespace of the
     // compositor context.
-    virtual void setTextureId(unsigned) = 0;
+    WEBKIT_EXPORT void setTextureId(unsigned);
 
     // Sets whether or not the texture should be flipped in the Y direction when
     // rendered.
-    virtual void setFlipped(bool) = 0;
+    WEBKIT_EXPORT void setFlipped(bool);
 
     // Sets the rect in UV space of the texture that is mapped to the layer
     // bounds.
-    virtual void setUVRect(const WebFloatRect&) = 0;
+    WEBKIT_EXPORT void setUVRect(const WebFloatRect&);
 
     // Sets whether every pixel in this layer is opaque. Defaults to false.
-    virtual void setOpaque(bool) = 0;
+    WEBKIT_EXPORT void setOpaque(bool);
 
     // Sets whether this layer's texture has premultiplied alpha or not. Defaults to true.
-    virtual void setPremultipliedAlpha(bool) = 0;
+    WEBKIT_EXPORT void setPremultipliedAlpha(bool);
 
     // Indicates that the most recently provided texture ID is about to be modified externally.
-    virtual void willModifyTexture() = 0;
+    WEBKIT_EXPORT void willModifyTexture();
 
     // 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.
-    virtual void setRateLimitContext(bool) = 0;
+    WEBKIT_EXPORT void setRateLimitContext(bool);
+
+private:
+#if WEBKIT_IMPLEMENTATION
+    explicit WebExternalTextureLayer(PassRefPtr<WebCore::TextureLayerChromium>);
+#endif
 };
 
 } // namespace WebKit
index bcf1411..37a4c67 100644 (file)
 #include "WebLayer.h"
 #include "WebSize.h"
 
+namespace WebCore {
+class IOSurfaceLayerChromium;
+}
+
 namespace WebKit {
 
 // This class represents a layer that renders an externally managed IOSurface.
-class WebIOSurfaceLayer {
+class WebIOSurfaceLayer : public WebLayer {
 public:
-    WEBKIT_EXPORT static WebIOSurfaceLayer* create();
+    WEBKIT_EXPORT static WebIOSurfaceLayer create();
 
+    WebIOSurfaceLayer() { }
     virtual ~WebIOSurfaceLayer() { }
 
-    virtual WebLayer* layer() = 0;
-
     // Sets the IO surface id that represents this layer's contents.
-    virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) = 0;
+    WEBKIT_EXPORT void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize);
+
+private:
+#if WEBKIT_IMPLEMENTATION
+    explicit WebIOSurfaceLayer(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
+#endif
 };
 
 } // namespace WebKit
index c7737f3..a916835 100644 (file)
 #include "WebCommon.h"
 #include "WebLayer.h"
 
+namespace WebCore {
+class ImageLayerChromium;
+}
+
 namespace WebKit {
 
-class WebImageLayer {
+class WebImageLayer : public WebLayer {
 public:
-    WEBKIT_EXPORT static WebImageLayer* create();
+    WEBKIT_EXPORT static WebImageLayer create();
 
+    WebImageLayer() { }
     virtual ~WebImageLayer() { }
 
-    virtual WebLayer* layer() = 0;
-    virtual void setBitmap(SkBitmap) = 0;
+    WEBKIT_EXPORT void setBitmap(SkBitmap);
+
+#if WEBKIT_IMPLEMENTATION
+    explicit WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium>);
+#endif
 };
 
 } // namespace WebKit
index 60ed694..6431f84 100644 (file)
 #include "WebAnimation.h"
 #include "WebColor.h"
 #include "WebCommon.h"
-#include "WebPoint.h"
 #include "WebPrivatePtr.h"
-#include "WebRect.h"
 #include "WebString.h"
 #include "WebVector.h"
 
 class SkMatrix44;
+namespace WebCore { class LayerChromium; }
 
 namespace WebKit {
 class WebAnimationDelegate;
@@ -45,69 +44,73 @@ struct WebFloatPoint;
 struct WebFloatRect;
 struct WebSize;
 
-class WebLayerImpl;
-
 class WebLayer {
 public:
-#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;
+    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;
 
     // Sets a region of the layer as invalid, i.e. needs to update its content.
-    virtual void invalidateRect(const WebFloatRect&) = 0;
+    WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
 
     // Sets the entire layer as invalid, i.e. needs to update its content.
-    virtual void invalidate() = 0;
+    WEBKIT_EXPORT void invalidate();
 
-    // 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 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();
 
-    virtual void setAnchorPoint(const WebFloatPoint&) = 0;
-    virtual WebFloatPoint anchorPoint() const = 0;
+    WEBKIT_EXPORT void setAnchorPoint(const WebFloatPoint&);
+    WEBKIT_EXPORT WebFloatPoint anchorPoint() const;
 
-    virtual void setAnchorPointZ(float) = 0;
-    virtual float anchorPointZ() const = 0;
+    WEBKIT_EXPORT void setAnchorPointZ(float);
+    WEBKIT_EXPORT float anchorPointZ() const;
 
-    virtual void setBounds(const WebSize&) = 0;
-    virtual WebSize bounds() const = 0;
+    WEBKIT_EXPORT void setBounds(const WebSize&);
+    WEBKIT_EXPORT WebSize bounds() const;
 
-    virtual void setMasksToBounds(bool) = 0;
-    virtual bool masksToBounds() const = 0;
+    WEBKIT_EXPORT void setMasksToBounds(bool);
+    WEBKIT_EXPORT bool masksToBounds() const;
 
-    virtual void setMaskLayer(WebLayer*) = 0;
-    virtual void setReplicaLayer(WebLayer*) = 0;
+    WEBKIT_EXPORT void setMaskLayer(const WebLayer&);
+    WEBKIT_EXPORT void setReplicaLayer(const WebLayer&);
 
-    virtual void setOpacity(float) = 0;
-    virtual float opacity() const = 0;
+    WEBKIT_EXPORT void setOpacity(float);
+    WEBKIT_EXPORT float opacity() const;
 
-    virtual void setOpaque(bool) = 0;
-    virtual bool opaque() const = 0;
+    WEBKIT_EXPORT void setOpaque(bool);
+    WEBKIT_EXPORT bool opaque() const;
 
-    virtual void setPosition(const WebFloatPoint&) = 0;
-    virtual WebFloatPoint position() const = 0;
+    WEBKIT_EXPORT void setPosition(const WebFloatPoint&);
+    WEBKIT_EXPORT WebFloatPoint position() const;
 
-    virtual void setSublayerTransform(const SkMatrix44&) = 0;
-    virtual void setSublayerTransform(const WebTransformationMatrix&) = 0;
-    virtual SkMatrix44 sublayerTransform() const = 0;
+    WEBKIT_EXPORT void setSublayerTransform(const SkMatrix44&);
+    WEBKIT_EXPORT void setSublayerTransform(const WebTransformationMatrix&);
+    WEBKIT_EXPORT SkMatrix44 sublayerTransform() const;
 
-    virtual void setTransform(const SkMatrix44&) = 0;
-    virtual void setTransform(const WebTransformationMatrix&) = 0;
-    virtual SkMatrix44 transform() const = 0;
+    WEBKIT_EXPORT void setTransform(const SkMatrix44&);
+    WEBKIT_EXPORT void setTransform(const WebTransformationMatrix&);
+    WEBKIT_EXPORT SkMatrix44 transform() const;
 
     // Sets whether the layer draws its content when compositing.
-    virtual void setDrawsContent(bool) = 0;
-    virtual bool drawsContent() const = 0;
+    WEBKIT_EXPORT void setDrawsContent(bool);
+    WEBKIT_EXPORT bool drawsContent() const;
 
-    virtual void setPreserves3D(bool) = 0;
+    WEBKIT_EXPORT void setPreserves3D(bool);
 
     // Mark that this layer should use its parent's transform and double-sided
     // properties in determining this layer's backface visibility instead of
@@ -116,68 +119,105 @@ 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).
-    virtual void setUseParentBackfaceVisibility(bool) = 0;
+    WEBKIT_EXPORT void setUseParentBackfaceVisibility(bool);
 
-    virtual void setBackgroundColor(WebColor) = 0;
+    WEBKIT_EXPORT void setBackgroundColor(WebColor);
 
     // Clear the filters in use by passing in a newly instantiated
     // WebFilterOperations object.
-    virtual void setFilters(const WebFilterOperations&) = 0;
+    WEBKIT_EXPORT void setFilters(const WebFilterOperations&);
 
     // 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.
-    virtual void setBackgroundFilters(const WebFilterOperations&) = 0;
+    WEBKIT_EXPORT void setBackgroundFilters(const WebFilterOperations&);
 
-    virtual void setDebugBorderColor(const WebColor&) = 0;
-    virtual void setDebugBorderWidth(float) = 0;
-    virtual void setDebugName(WebString) = 0;
+    WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
+    WEBKIT_EXPORT void setDebugBorderWidth(float);
+    WEBKIT_EXPORT void setDebugName(WebString);
 
     // 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.
-    virtual void setAnimationDelegate(WebAnimationDelegate*) = 0;
+    WEBKIT_EXPORT void setAnimationDelegate(WebAnimationDelegate*);
 
     // Returns false if the animation cannot be added.
-    virtual bool addAnimation(WebAnimation*) = 0;
+    WEBKIT_EXPORT bool addAnimation(WebAnimation*);
 
     // Removes all animations with the given id.
-    virtual void removeAnimation(int animationId) = 0;
+    WEBKIT_EXPORT void removeAnimation(int animationId);
 
     // Removes all animations with the given id targeting the given property.
-    virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) = 0;
+    WEBKIT_EXPORT void removeAnimation(int animationId, WebAnimation::TargetProperty);
 
     // Pauses all animations with the given id.
-    virtual void pauseAnimation(int animationId, double timeOffset) = 0;
+    WEBKIT_EXPORT void pauseAnimation(int animationId, double timeOffset);
 
     // The following functions suspend and resume all animations. The given time
     // is assumed to use the same time base as monotonicallyIncreasingTime().
-    virtual void suspendAnimations(double monotonicTime) = 0;
-    virtual void resumeAnimations(double monotonicTime) = 0;
+    WEBKIT_EXPORT void suspendAnimations(double monotonicTime);
+    WEBKIT_EXPORT void resumeAnimations(double monotonicTime);
 
     // Returns true if this layer has any active animations - useful for tests.
-    virtual bool hasActiveAnimation() = 0;
+    WEBKIT_EXPORT bool hasActiveAnimation();
 
     // Transfers all animations running on the current layer.
-    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;
+    WEBKIT_EXPORT void transferAnimationsTo(WebLayer*);
 
     // Forces this layer to use a render surface. There is no benefit in doing
     // so, but this is to facilitate benchmarks and tests.
-    virtual void setForceRenderSurface(bool) = 0;
+    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;
 };
 
+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
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebIOSurfaceLayerImpl_h
-#define WebIOSurfaceLayerImpl_h
+#ifndef WebScrollableLayer_h
+#define WebScrollableLayer_h
 
-#include <public/WebIOSurfaceLayer.h>
-#include <wtf/OwnPtr.h>
-
-namespace WebCore {
-class IOSurfaceLayerChromium;
-}
+#include "WebCommon.h"
+#include "WebLayer.h"
+#include "WebPoint.h"
+#include "WebRect.h"
+#include "WebVector.h"
 
 namespace WebKit {
 
-class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer {
+class WebScrollableLayer : public WebLayer {
 public:
-    explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
-    virtual ~WebIOSurfaceLayerImpl();
+    WebScrollableLayer() { }
+    WebScrollableLayer(const WebScrollableLayer& layer) : WebLayer(layer) { }
+    virtual ~WebScrollableLayer() { }
+    WebScrollableLayer& operator=(const WebScrollableLayer& layer)
+    {
+        WebLayer::assign(layer);
+        return *this;
+    }
 
-    // WebIOSurfaceLayer implementation.
-    virtual WebLayer* layer() OVERRIDE;
-    virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) OVERRIDE;
+    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);
 
-private:
-    OwnPtr<WebLayerImpl> m_layer;
-};
 
-}
+#if WEBKIT_IMPLEMENTATION
+    WebScrollableLayer(const WTF::PassRefPtr<WebCore::LayerChromium>& layer) : WebLayer(layer) { }
+#endif
+};
 
-#endif // WebIOSurfaceLayerImpl_h
+} // namespace WebKit
 
+#endif // WebScrollableLayer_h
index 451a0b9..1bfe7d6 100644 (file)
 
 namespace WebCore {
 class Scrollbar;
+class ScrollbarLayerChromium;
 }
 
 namespace WebKit {
 
-class WebScrollbarLayer {
+class WebScrollbarLayer : public WebLayer {
 public:
+    WebScrollbarLayer() { }
+    WebScrollbarLayer(const WebScrollbarLayer& layer) : WebLayer(layer) { }
     virtual ~WebScrollbarLayer() { }
+    WebScrollbarLayer& operator=(const WebScrollbarLayer& layer)
+    {
+        WebLayer::assign(layer);
+        return *this;
+    }
 
-    virtual WebLayer* layer() = 0;
-
-    virtual void setScrollLayer(WebLayer*) = 0;
+    WEBKIT_EXPORT void setScrollLayer(const WebLayer);
 
 #if WEBKIT_IMPLEMENTATION
-    WEBKIT_EXPORT static WebScrollbarLayer* create(WebCore::Scrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>);
+    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;
 #endif
 };
 
index 02e46f0..ad9123d 100644 (file)
 #ifndef WebSolidColorLayer_h
 #define WebSolidColorLayer_h
 
-#include "WebColor.h"
 #include "WebCommon.h"
+#include "WebFloatRect.h"
+#include "WebLayer.h"
 
 namespace WebKit {
-class WebLayer;
+class WebSolidColorLayerImpl;
 
-class WebSolidColorLayer {
+class WebSolidColorLayer : public WebLayer {
 public:
-    WEBKIT_EXPORT static WebSolidColorLayer* create();
+    WEBKIT_EXPORT static WebSolidColorLayer create();
+    WEBKIT_EXPORT void setBackgroundColor(const WebColor&);
 
-    virtual ~WebSolidColorLayer() { }
-
-    virtual WebLayer* layer() = 0;
-    virtual void setBackgroundColor(WebColor) = 0;
+#if WEBKIT_IMPLEMENTATION
+    WebSolidColorLayer(const WTF::PassRefPtr<WebSolidColorLayerImpl>&);
+#endif
 };
 
 } // namespace WebKit
index 1acfff5..54da345 100644 (file)
 #include "WebCommon.h"
 #include "WebLayer.h"
 
+namespace WebCore {
+class VideoLayerChromium;
+}
+
 namespace WebKit {
 
 class WebVideoFrameProvider;
 
-class WebVideoLayer {
+class WebVideoLayer : public WebLayer {
 public:
-    WEBKIT_EXPORT static WebVideoLayer* create(WebVideoFrameProvider*);
+    WEBKIT_EXPORT static WebVideoLayer create(WebVideoFrameProvider*);
 
+    WebVideoLayer() { }
     virtual ~WebVideoLayer() { }
 
-    virtual WebLayer* layer() = 0;
-
     // Returns true if this layer is actively rendering (e.g. currently attached to a WebLayerTreeView).
-    virtual bool active() const = 0;
+    WEBKIT_EXPORT bool active() const;
+
+#if WEBKIT_IMPLEMENTATION
+    explicit WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium>);
+#endif
 };
 
 } // namespace WebKit
index 5071a2b..b6b5f2b 100644 (file)
@@ -1,3 +1,95 @@
+2012-08-21  James Robinson  <jamesr@chromium.org>
+
+        Unreviewed, rolling out r126170.
+        http://trac.webkit.org/changeset/126170
+        https://bugs.webkit.org/show_bug.cgi?id=94614
+
+        I spoke too soon
+
+        * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+        (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
+        (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+        (WebCore::ScrollingCoordinatorPrivate::hasScrollLayer):
+        (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+        (ScrollingCoordinatorPrivate):
+        (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):
+        (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::GraphicsLayerChromium::addAnimation):
+        (WebCore::GraphicsLayerChromium::pauseAnimation):
+        (WebCore::GraphicsLayerChromium::removeAnimation):
+        (WebCore::GraphicsLayerChromium::suspendAnimations):
+        (WebCore::GraphicsLayerChromium::resumeAnimations):
+        (WebCore::GraphicsLayerChromium::addLinkHighlight):
+        (WebCore::GraphicsLayerChromium::didFinishLinkHighlight):
+        (WebCore::GraphicsLayerChromium::setContentsToMedia):
+        (WebCore::GraphicsLayerChromium::primaryLayer):
+        (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:
+        (WebCore::GraphicsLayerChromium::hasContentsLayer):
+        (GraphicsLayerChromium):
+        (WebCore::GraphicsLayerChromium::contentsLayer):
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::rootLayer):
+        * platform/graphics/chromium/LayerChromium.h:
+
 2012-08-21  Adam Barth  <abarth@webkit.org>
 
         Update run-bindings-tests results after http://trac.webkit.org/changeset/126165
index e256bde..1db7594 100644 (file)
 
 #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 <public/WebScrollableLayer.h>
 #include <public/WebScrollbar.h>
 #include <public/WebScrollbarLayer.h>
 #include <public/WebScrollbarThemeGeometry.h>
@@ -42,6 +42,7 @@
 
 using WebKit::WebLayer;
 using WebKit::WebRect;
+using WebKit::WebScrollableLayer;
 using WebKit::WebScrollbarLayer;
 using WebKit::WebVector;
 
@@ -50,39 +51,36 @@ namespace WebCore {
 class ScrollingCoordinatorPrivate {
 WTF_MAKE_NONCOPYABLE(ScrollingCoordinatorPrivate);
 public:
-    ScrollingCoordinatorPrivate()
-        : m_scrollLayer(0)
-    {
-    }
-
+    ScrollingCoordinatorPrivate() { }
     ~ScrollingCoordinatorPrivate() { }
 
-    void setScrollLayer(WebLayer* layer)
+    void setScrollLayer(WebScrollableLayer layer)
     {
         m_scrollLayer = layer;
 
-        if (m_horizontalScrollbarLayer)
-            m_horizontalScrollbarLayer->setScrollLayer(layer);
-        if (m_verticalScrollbarLayer)
-            m_verticalScrollbarLayer->setScrollLayer(layer);
+        if (!m_horizontalScrollbarLayer.isNull())
+            m_horizontalScrollbarLayer.setScrollLayer(layer);
+        if (!m_verticalScrollbarLayer.isNull())
+            m_verticalScrollbarLayer.setScrollLayer(layer);
     }
 
-    void setHorizontalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
+    void setHorizontalScrollbarLayer(WebScrollbarLayer layer)
     {
         m_horizontalScrollbarLayer = layer;
     }
 
-    void setVerticalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
+    void setVerticalScrollbarLayer(WebScrollbarLayer layer)
     {
         m_verticalScrollbarLayer = layer;
     }
 
-    WebLayer* scrollLayer() const { return m_scrollLayer; }
+    bool hasScrollLayer() const { return !m_scrollLayer.isNull(); }
+    WebScrollableLayer scrollLayer() const { return m_scrollLayer; }
 
 private:
-    WebLayer* m_scrollLayer;
-    OwnPtr<WebScrollbarLayer> m_horizontalScrollbarLayer;
-    OwnPtr<WebScrollbarLayer> m_verticalScrollbarLayer;
+    WebScrollableLayer m_scrollLayer;
+    WebScrollbarLayer m_horizontalScrollbarLayer;
+    WebScrollbarLayer m_verticalScrollbarLayer;
 };
 
 PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
@@ -114,20 +112,15 @@ static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView)
 #endif
 }
 
-static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer)
-{
-    return layer->platformLayer();
-}
-
-static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar, WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
+static WebScrollbarLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollableLayer scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
 {
     ASSERT(scrollbar);
     ASSERT(scrollbarGraphicsLayer);
 
-    if (!scrollLayer) {
+    if (scrollLayer.isNull()) {
         // FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves.
-        scrollLayer = scrollableLayerForGraphicsLayer(scrollLayerForFrameView(frameView));
-        ASSERT(scrollLayer);
+        scrollLayer = scrollLayerForFrameView(frameView)->platformLayer()->to<WebScrollableLayer>();
+        ASSERT(!scrollLayer.isNull());
     }
 
     // Root layer non-overlay scrollbars should be marked opaque to disable
@@ -145,7 +138,7 @@ static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar,
     if (!platformSupported || scrollbar->isCustomScrollbar()) {
         scrollbarGraphicsLayer->setContentsToMedia(0);
         scrollbarGraphicsLayer->setDrawsContent(true);
-        return nullptr;
+        return WebScrollbarLayer();
     }
 
     // All Chromium scrollbar themes derive from ScrollbarThemeComposite.
@@ -153,14 +146,14 @@ static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar,
     WebKit::WebScrollbarThemePainter painter(themeComposite, scrollbar);
     OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarThemeGeometryNative::create(themeComposite));
 
-    OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebScrollbarLayer::create(scrollbar, painter, geometry.release()));
-    scrollbarLayer->setScrollLayer(scrollLayer);
+    WebScrollbarLayer scrollbarLayer = WebScrollbarLayer::create(scrollbar, painter, geometry.release());
+    scrollbarLayer.setScrollLayer(scrollLayer);
 
-    scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer->layer());
+    scrollbarGraphicsLayer->setContentsToMedia(&scrollbarLayer);
     scrollbarGraphicsLayer->setDrawsContent(false);
-    scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaque());
+    scrollbarLayer.setOpaque(scrollbarGraphicsLayer->contentsOpaque());
 
-    return scrollbarLayer.release();
+    return scrollbarLayer;
 }
 
 void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)
@@ -168,7 +161,6 @@ void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView*
     if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
         return;
 
-    setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
     m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView));
 }
 
@@ -177,25 +169,25 @@ void ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange(FrameView* f
     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->setScrollLayer(scrollLayer ? scrollableLayerForGraphicsLayer(scrollLayer) : 0);
+    WebScrollableLayer layer;
+    if (scrollLayer)
+        layer = scrollLayer->platformLayer()->to<WebScrollableLayer>();
+    m_private->setScrollLayer(layer);
 }
 
 void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region)
 {
-    // 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()) {
+    if (m_private->hasScrollLayer()) {
         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);
     }
 }
 
@@ -206,18 +198,14 @@ void ScrollingCoordinator::setScrollParameters(const ScrollParameters&)
 
 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
 {
-    // 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);
+    if (m_private->hasScrollLayer())
+        m_private->scrollLayer().setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
 }
 
 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool 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);
+    if (m_private->hasScrollLayer())
+        m_private->scrollLayer().setShouldScrollOnMainThread(should);
 }
 
 bool ScrollingCoordinator::supportsFixedPositionLayers() const
@@ -227,14 +215,14 @@ bool ScrollingCoordinator::supportsFixedPositionLayers() const
 
 void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer* layer, bool enable)
 {
-    if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
-        scrollableLayer->setIsContainerForFixedPositionLayers(enable);
+    if (WebLayer* platformLayer = layer->platformLayer())
+        platformLayer->to<WebScrollableLayer>().setIsContainerForFixedPositionLayers(enable);
 }
 
 void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable)
 {
-    if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
-        scrollableLayer->setFixedToContainerLayer(enable);
+    if (WebLayer* platformLayer = layer->platformLayer())
+        platformLayer->to<WebScrollableLayer>().setFixedToContainerLayer(enable);
 }
 
 }
index 1065431..db517ca 100644 (file)
@@ -69,21 +69,22 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context,
             grContext->resetContext();
     }
 
-    m_layer = adoptPtr(WebExternalTextureLayer::create(this));
-    m_layer->setTextureId(textureId);
-    m_layer->setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
+    m_layer = WebExternalTextureLayer::create(this);
+    m_layer.setTextureId(textureId);
+    m_layer.setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
 }
 
 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();
     }
+    m_layer.clearClient();
 }
 
 SkDeferredCanvas* Canvas2DLayerBridge::deferredCanvas()
@@ -97,7 +98,7 @@ void Canvas2DLayerBridge::prepareForDraw()
 {
     ASSERT(deferredCanvas());
     if (!m_useDoubleBuffering)
-        m_layer->willModifyTexture();
+        m_layer.willModifyTexture();
     m_context->makeContextCurrent();
 }
 
@@ -147,13 +148,13 @@ WebGraphicsContext3D* Canvas2DLayerBridge::context()
 
 WebKit::WebLayer* Canvas2DLayerBridge::layer()
 {
-    return m_layer->layer();
+    return &m_layer;
 }
 
 void Canvas2DLayerBridge::contextAcquired()
 {
     if (m_deferralMode == NonDeferred && !m_useDoubleBuffering)
-        m_layer->willModifyTexture();
+        m_layer.willModifyTexture();
 }
 
 unsigned Canvas2DLayerBridge::backBufferTexture()
index 27b1ea6..409d207 100644 (file)
@@ -76,7 +76,7 @@ private:
     unsigned m_backBufferTexture;
     IntSize m_size;
     SkCanvas* m_canvas;
-    OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
+    WebKit::WebExternalTextureLayer m_layer;
     RefPtr<GraphicsContext3D> m_context;
 };
 
index 6102a3e..1d167a5 100644 (file)
@@ -156,15 +156,16 @@ class DrawingBufferPrivate : public WebKit::WebExternalTextureLayerClient {
 public:
     explicit DrawingBufferPrivate(DrawingBuffer* drawingBuffer)
         : m_drawingBuffer(drawingBuffer)
-        , m_layer(adoptPtr(WebKit::WebExternalTextureLayer::create(this)))
+        , m_layer(WebKit::WebExternalTextureLayer::create(this))
     {
         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()
     {
+        m_layer.clearClient();
     }
 
     virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE
@@ -186,11 +187,11 @@ public:
         return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_drawingBuffer->graphicsContext3D());
     }
 
-    WebKit::WebLayer* layer() { return m_layer->layer(); }
+    WebKit::WebLayer* layer() { return &m_layer; }
 
 private:
     DrawingBuffer* m_drawingBuffer;
-    OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
+    WebKit::WebExternalTextureLayer m_layer;
 };
 
 #if USE(ACCELERATED_COMPOSITING)
index 27d51e9..fb0900b 100644 (file)
@@ -83,16 +83,14 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
 
 GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
     : GraphicsLayer(client)
-    , m_contentsLayer(0)
-    , m_contentsLayerId(0)
     , m_contentsLayerPurpose(NoContentsLayer)
     , m_contentsLayerHasBackgroundColor(false)
     , m_inSetChildren(false)
     , m_pageScaleChanged(false)
 {
     m_opaqueRectTrackingContentLayerDelegate = adoptPtr(new OpaqueRectTrackingContentLayerDelegate(this));
-    m_layer = adoptPtr(WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get()));
-    m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
+    m_layer = WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get());
+    m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
     if (client)
         deviceOrPageScaleFactorChanged();
     updateDebugIndicators();
@@ -100,9 +98,34 @@ GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
 
 GraphicsLayerChromium::~GraphicsLayerChromium()
 {
+    // Do cleanup while we can still safely call methods on the derived class.
     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.clear();
+
+    GraphicsLayer::willBeDestroyed();
+}
+
 void GraphicsLayerChromium::setName(const String& inName)
 {
     m_nameBase = inName;
@@ -113,16 +136,21 @@ void GraphicsLayerChromium::setName(const String& inName)
 
 void GraphicsLayerChromium::updateNames()
 {
-    String debugName = "Layer for " + m_nameBase;
-    m_layer->layer()->setDebugName(debugName);
-
-    if (m_transformLayer) {
+    if (!m_layer.isNull()) {
+        String debugName = "Layer for " + m_nameBase;
+        m_layer.setDebugName(debugName);
+    }
+    if (!m_transformLayer.isNull()) {
         String debugName = "TransformLayer for " + m_nameBase;
-        m_transformLayer->setDebugName(debugName);
+        m_transformLayer.setDebugName(debugName);
     }
-    if (m_contentsLayer) {
+    if (!m_contentsLayer.isNull()) {
         String debugName = "ContentsLayer for " + m_nameBase;
-        m_contentsLayer->setDebugName(debugName);
+        m_contentsLayer.setDebugName(debugName);
+    }
+    if (m_linkHighlight) {
+        String debugName = "LinkHighlight for " + m_nameBase;
+        m_linkHighlight->contentLayer()->setDebugName(debugName);
     }
 }
 
@@ -175,7 +203,7 @@ bool GraphicsLayerChromium::replaceChild(GraphicsLayer* oldChild, GraphicsLayer*
 void GraphicsLayerChromium::removeFromParent()
 {
     GraphicsLayer::removeFromParent();
-    platformLayer()->removeFromParent();
+    primaryLayer().removeFromParent();
 }
 
 void GraphicsLayerChromium::setPosition(const FloatPoint& point)
@@ -205,8 +233,8 @@ void GraphicsLayerChromium::setSize(const FloatSize& size)
     GraphicsLayer::setSize(clampedSize);
     updateLayerSize();
 
-    if (m_pageScaleChanged)
-        m_layer->layer()->invalidate();
+    if (m_pageScaleChanged && !m_layer.isNull())
+        m_layer.invalidate();
     m_pageScaleChanged = false;
 }
 
@@ -273,13 +301,13 @@ void GraphicsLayerChromium::setBackgroundColor(const Color& color)
 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);
-    m_layer->layer()->setOpaque(m_contentsOpaque);
+    m_layer.setOpaque(m_contentsOpaque);
 }
 
 static bool copyWebCoreFilterOperationsToWebFilterOperations(const FilterOperations& filters, WebFilterOperations& webFilters)
@@ -363,11 +391,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.
-        m_layer->layer()->setFilters(WebFilterOperations());
+        m_layer.setFilters(WebFilterOperations());
         GraphicsLayer::setFilters(FilterOperations());
         return false;
     }
-    m_layer->layer()->setFilters(webFilters);
+    m_layer.setFilters(webFilters);
     return GraphicsLayer::setFilters(filters);
 }
 
@@ -376,7 +404,7 @@ void GraphicsLayerChromium::setBackgroundFilters(const FilterOperations& filters
     WebFilterOperations webFilters;
     if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
         return;
-    m_layer->layer()->setBackgroundFilters(webFilters);
+    m_layer.setBackgroundFilters(webFilters);
 }
 
 void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
@@ -386,21 +414,23 @@ void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
 
     GraphicsLayer::setMaskLayer(maskLayer);
 
-    WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0;
-    m_layer->layer()->setMaskLayer(maskWebLayer);
+    WebLayer maskWebLayer;
+    if (m_maskLayer)
+        maskWebLayer = *m_maskLayer->platformLayer();
+    m_layer.setMaskLayer(maskWebLayer);
 }
 
 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);
-    platformLayer()->setOpacity(opacity);
+    primaryLayer().setOpacity(opacity);
 }
 
 void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
@@ -408,27 +438,29 @@ void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
     GraphicsLayerChromium* layerChromium = static_cast<GraphicsLayerChromium*>(layer);
     GraphicsLayer::setReplicatedByLayer(layer);
 
-    WebLayer* webReplicaLayer = layerChromium ? layerChromium->platformLayer() : 0;
-    platformLayer()->setReplicaLayer(webReplicaLayer);
+    WebLayer webReplicaLayer;
+    if (layerChromium)
+        webReplicaLayer = layerChromium->primaryLayer();
+    primaryLayer().setReplicaLayer(webReplicaLayer);
 }
 
 
 void GraphicsLayerChromium::setContentsNeedsDisplay()
 {
-    if (m_contentsLayer)
-        m_contentsLayer->invalidate();
+    if (!m_contentsLayer.isNull())
+        m_contentsLayer.invalidate();
 }
 
 void GraphicsLayerChromium::setNeedsDisplay()
 {
     if (drawsContent())
-        m_layer->layer()->invalidate();
+        m_layer.invalidate();
 }
 
 void GraphicsLayerChromium::setNeedsDisplayInRect(const FloatRect& rect)
 {
     if (drawsContent())
-        m_layer->layer()->invalidateRect(rect);
+        m_layer.invalidateRect(rect);
 }
 
 void GraphicsLayerChromium::setContentsRect(const IntRect& rect)
@@ -444,56 +476,46 @@ void GraphicsLayerChromium::setContentsToImage(Image* image)
 {
     bool childrenChanged = false;
     if (image) {
-        if (m_contentsLayerPurpose != ContentsLayerForImage) {
-            m_imageLayer = adoptPtr(WebImageLayer::create());
-            setupContentsLayer(m_imageLayer->layer());
+        if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForImage) {
+            WebKit::WebImageLayer imageLayer = WebKit::WebImageLayer::create();
+            setupContentsLayer(imageLayer);
             m_contentsLayerPurpose = ContentsLayerForImage;
             childrenChanged = true;
         }
+        WebKit::WebImageLayer imageLayer = m_contentsLayer.to<WebKit::WebImageLayer>();
         NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame();
-        m_imageLayer->setBitmap(nativeImage->bitmap());
-        m_imageLayer->layer()->setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
+        imageLayer.setBitmap(nativeImage->bitmap());
+        imageLayer.setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
         updateContentsRect();
     } else {
-        if (m_imageLayer) {
+        if (!m_contentsLayer.isNull()) {
             childrenChanged = true;
 
-            m_imageLayer.clear();
+            // The old contents layer will be removed via updateChildList.
+            m_contentsLayer.reset();
         }
-        // The old contents layer will be removed via updateChildList.
-        m_contentsLayer = 0;
     }
 
     if (childrenChanged)
         updateChildList();
 }
 
-void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* layer)
-{
-    setContentsTo(ContentsLayerForCanvas, layer);
-}
-
-void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
-{
-    setContentsTo(ContentsLayerForVideo, layer);
-}
-
-void GraphicsLayerChromium::setContentsTo(ContentsLayerPurpose purpose, WebKit::WebLayer* layer)
+void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* platformLayer)
 {
     bool childrenChanged = false;
-    if (layer) {
-        if (m_contentsLayerId != layer->id()) {
-            setupContentsLayer(layer);
-            m_contentsLayerPurpose = purpose;
+    if (platformLayer) {
+        if (m_contentsLayer != *platformLayer) {
+            setupContentsLayer(*platformLayer);
+            m_contentsLayerPurpose = ContentsLayerForCanvas;
             childrenChanged = true;
         }
         updateContentsRect();
     } else {
-        if (m_contentsLayer) {
+        if (!m_contentsLayer.isNull()) {
             childrenChanged = true;
 
             // The old contents layer will be removed via updateChildList.
-            m_contentsLayer = 0;
+            m_contentsLayer.reset();
         }
     }
 
@@ -503,7 +525,7 @@ void GraphicsLayerChromium::setContentsTo(ContentsLayerPurpose purpose, WebKit::
 
 bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const Animation* animation, const String& animationName, double timeOffset)
 {
-    platformLayer()->setAnimationDelegate(this);
+    primaryLayer().setAnimationDelegate(this);
 
     int animationId = mapAnimationNameToId(animationName);
     int groupId = AnimationIdVendor::getNextGroupId();
@@ -512,8 +534,8 @@ bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const
 
     if (toAdd) {
         // Remove any existing animations with the same animation id and target property.
-        platformLayer()->removeAnimation(animationId, toAdd->targetProperty());
-        return platformLayer()->addAnimation(toAdd.get());
+        primaryLayer().removeAnimation(animationId, toAdd->targetProperty());
+        return primaryLayer().addAnimation(toAdd.get());
     }
 
     return false;
@@ -521,12 +543,12 @@ bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const
 
 void GraphicsLayerChromium::pauseAnimation(const String& animationName, double timeOffset)
 {
-    platformLayer()->pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
+    primaryLayer().pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
 }
 
 void GraphicsLayerChromium::removeAnimation(const String& animationName)
 {
-    platformLayer()->removeAnimation(mapAnimationNameToId(animationName));
+    primaryLayer().removeAnimation(mapAnimationNameToId(animationName));
 }
 
 void GraphicsLayerChromium::suspendAnimations(double wallClockTime)
@@ -534,54 +556,88 @@ 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();
-    platformLayer()->suspendAnimations(monotonicTime);
+    primaryLayer().suspendAnimations(monotonicTime);
 }
 
 void GraphicsLayerChromium::resumeAnimations()
 {
-    platformLayer()->resumeAnimations(monotonicallyIncreasingTime());
+    primaryLayer().resumeAnimations(monotonicallyIncreasingTime());
 }
 
-void GraphicsLayerChromium::addLinkHighlight(const Path&)
+void GraphicsLayerChromium::addLinkHighlight(const Path& path)
 {
+    m_linkHighlight = LinkHighlight::create(this, path, AnimationIdVendor::LinkHighlightAnimationId, AnimationIdVendor::getNextGroupId());
+    updateChildList();
 }
 
 void GraphicsLayerChromium::didFinishLinkHighlight()
 {
+    if (m_linkHighlight)
+        m_linkHighlight->contentLayer()->removeFromParent();
+
+    m_linkHighlight.clear();
+}
+
+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
 {
-    return m_transformLayer ? m_transformLayer.get() : m_layer->layer();
+    return const_cast<PlatformLayer*>(m_transformLayer.isNull() ? &m_layer : &m_transformLayer);
 }
 
 void GraphicsLayerChromium::setDebugBackgroundColor(const Color& color)
 {
     if (color.isValid())
-        m_layer->layer()->setBackgroundColor(color.rgb());
+        m_layer.setBackgroundColor(color.rgb());
     else
-        m_layer->layer()->setBackgroundColor(static_cast<RGBA32>(0));
+        m_layer.setBackgroundColor(static_cast<RGBA32>(0));
 }
 
 void GraphicsLayerChromium::setDebugBorder(const Color& color, float borderWidth)
 {
     if (color.isValid()) {
-        m_layer->layer()->setDebugBorderColor(color.rgb());
-        m_layer->layer()->setDebugBorderWidth(borderWidth);
+        m_layer.setDebugBorderColor(color.rgb());
+        m_layer.setDebugBorderWidth(borderWidth);
     } else {
-        m_layer->layer()->setDebugBorderColor(static_cast<RGBA32>(0));
-        m_layer->layer()->setDebugBorderWidth(0);
+        m_layer.setDebugBorderColor(static_cast<RGBA32>(0));
+        m_layer.setDebugBorderWidth(0);
     }
 }
 
 void GraphicsLayerChromium::updateChildList()
 {
-    Vector<WebLayer*> newChildren;
+    Vector<WebLayer> newChildren;
 
-    if (m_transformLayer) {
+    if (!m_transformLayer.isNull()) {
         // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
-        newChildren.append(m_layer->layer());
-    } else if (m_contentsLayer) {
+        newChildren.append(m_layer);
+    } else if (!m_contentsLayer.isNull()) {
         // 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.
@@ -593,76 +649,79 @@ void GraphicsLayerChromium::updateChildList()
     for (size_t i = 0; i < numChildren; ++i) {
         GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);
 
-        newChildren.append(curChild->platformLayer());
+        newChildren.append(curChild->primaryLayer());
     }
 
+    if (m_linkHighlight)
+        newChildren.append(m_linkHighlight->contentLayer());
+
     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());
 
-    if (m_transformLayer) {
-        m_transformLayer->setChildren(newWebChildren);
+    if (!m_transformLayer.isNull()) {
+        m_transformLayer.setChildren(newWebChildren);
 
-        if (m_contentsLayer) {
+        if (!m_contentsLayer.isNull()) {
             // 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->layer()->removeAllChildren();
-            m_layer->layer()->addChild(m_contentsLayer);
+            m_layer.removeAllChildren();
+            m_layer.addChild(m_contentsLayer);
         }
     } else
-        m_layer->layer()->setChildren(newWebChildren);
+        m_layer.setChildren(newWebChildren);
 }
 
 void GraphicsLayerChromium::updateLayerPosition()
 {
-    platformLayer()->setPosition(m_position);
+    primaryLayer().setPosition(m_position);
 }
 
 void GraphicsLayerChromium::updateLayerSize()
 {
     IntSize layerSize(m_size.width(), m_size.height());
-    if (m_transformLayer) {
-        m_transformLayer->setBounds(layerSize);
-        m_layer->layer()->setPosition(FloatPoint());
+    if (!m_transformLayer.isNull()) {
+        m_transformLayer.setBounds(layerSize);
+        m_layer.setPosition(FloatPoint());
     }
 
-    m_layer->layer()->setBounds(layerSize);
+    m_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()
 {
-    platformLayer()->setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
-    platformLayer()->setAnchorPointZ(m_anchorPoint.z());
+    primaryLayer().setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
+    primaryLayer().setAnchorPointZ(m_anchorPoint.z());
 }
 
 void GraphicsLayerChromium::updateTransform()
 {
-    platformLayer()->setTransform(WebTransformationMatrix(m_transform));
+    primaryLayer().setTransform(WebTransformationMatrix(m_transform));
 }
 
 void GraphicsLayerChromium::updateChildrenTransform()
 {
-    platformLayer()->setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
+    primaryLayer().setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
 }
 
 void GraphicsLayerChromium::updateMasksToBounds()
 {
-    m_layer->layer()->setMasksToBounds(m_masksToBounds);
+    m_layer.setMasksToBounds(m_masksToBounds);
     updateDebugIndicators();
 }
 
 void GraphicsLayerChromium::updateLayerPreserves3D()
 {
-    if (m_preserves3D && !m_transformLayer) {
+    if (m_preserves3D && m_transformLayer.isNull()) {
         // Create the transform layer.
-        m_transformLayer = adoptPtr(WebLayer::create());
-        m_transformLayer->setPreserves3D(true);
-        m_transformLayer->setAnimationDelegate(this);
-        m_layer->layer()->transferAnimationsTo(m_transformLayer.get());
+        m_transformLayer = WebLayer::create();
+        m_transformLayer.setPreserves3D(true);
+        m_transformLayer.setAnimationDelegate(this);
+        m_layer.transferAnimationsTo(&m_transformLayer);
 
         // Copy the position from this layer.
         updateLayerPosition();
@@ -671,34 +730,34 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
         updateTransform();
         updateChildrenTransform();
 
-        m_layer->layer()->setPosition(FloatPoint::zero());
+        m_layer.setPosition(FloatPoint::zero());
 
-        m_layer->layer()->setAnchorPoint(FloatPoint(0.5f, 0.5f));
-        m_layer->layer()->setTransform(SkMatrix44());
+        m_layer.setAnchorPoint(FloatPoint(0.5f, 0.5f));
+        m_layer.setTransform(SkMatrix44());
 
         // Set the old layer to opacity of 1. Further down we will set the opacity on the transform layer.
-        m_layer->layer()->setOpacity(1);
+        m_layer.setOpacity(1);
 
-        m_layer->setContentsScale(contentsScale());
+        m_layer.setContentsScale(contentsScale());
 
         // Move this layer to be a child of the transform layer.
         if (parent())
-            parent()->platformLayer()->replaceChild(m_layer->layer(), m_transformLayer.get());
-        m_transformLayer->addChild(m_layer->layer());
+            parent()->platformLayer()->replaceChild(m_layer, m_transformLayer);
+        m_transformLayer.addChild(m_layer);
 
         updateChildList();
-    } else if (m_preserves3D && !m_transformLayer) {
+    } else if (!m_preserves3D && !m_transformLayer.isNull()) {
         // Relace the transformLayer in the parent with this layer.
-        m_layer->layer()->removeFromParent();
+        m_layer.removeFromParent();
         if (parent())
-            parent()->platformLayer()->replaceChild(m_transformLayer.get(), m_layer->layer());
+            parent()->platformLayer()->replaceChild(m_transformLayer, m_layer);
 
-        m_layer->layer()->setAnimationDelegate(this);
-        m_transformLayer->transferAnimationsTo(m_layer->layer());
+        m_layer.setAnimationDelegate(this);
+        m_transformLayer.transferAnimationsTo(&m_layer);
 
         // Release the transform layer.
-        m_transformLayer->setAnimationDelegate(0);
-        m_transformLayer.clear();
+        m_transformLayer.setAnimationDelegate(0);
+        m_transformLayer.reset();
 
         updateLayerPosition();
         updateLayerSize();
@@ -709,39 +768,39 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
         updateChildList();
     }
 
-    m_layer->layer()->setPreserves3D(m_preserves3D);
-    platformLayer()->setOpacity(m_opacity);
+    m_layer.setPreserves3D(m_preserves3D);
+    primaryLayer().setOpacity(m_opacity);
     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->layer(), these two
+    // distinction between drawsContent and contentsVisible. So, for m_layer, these two
     // flags are combined here. m_contentsLayer shouldn't receive the drawsContent flag
     // so it is only given contentsVisible.
 
-    m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
+    m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
 
-    if (m_contentsLayer)
-        m_contentsLayer->setDrawsContent(m_contentsVisible);
+    if (!m_contentsLayer.isNull())
+        m_contentsLayer.setDrawsContent(m_contentsVisible);
 
     if (m_drawsContent)
-        m_layer->layer()->invalidate();
+        m_layer.invalidate();
 
     updateDebugIndicators();
 }
 
 void GraphicsLayerChromium::updateLayerBackgroundColor()
 {
-    if (!m_contentsLayer)
+    if (m_contentsLayer.isNull())
         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
-        m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
+        m_contentsLayer.setBackgroundColor(static_cast<RGBA32>(0));
 }
 
 void GraphicsLayerChromium::updateContentsVideo()
@@ -751,42 +810,50 @@ void GraphicsLayerChromium::updateContentsVideo()
 
 void GraphicsLayerChromium::updateContentsRect()
 {
-    if (!m_contentsLayer)
+    if (m_contentsLayer.isNull())
         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.
-    if (appliesPageScale())
+    if (appliesPageScale() || m_layer.isNull())
         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_contentsLayerId = m_contentsLayer->id();
 
-    if (m_contentsLayer) {
-        m_contentsLayer->setAnchorPoint(FloatPoint(0, 0));
-        m_contentsLayer->setUseParentBackfaceVisibility(true);
+    if (!m_contentsLayer.isNull()) {
+        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().
-        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.
-        m_layer->layer()->insertChild(m_contentsLayer, 0);
+        m_layer.insertChild(m_contentsLayer, 0);
 
         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();
index 5f48a08..aa64ead 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <public/WebAnimationDelegate.h>
 #include <public/WebContentLayer.h>
-#include <public/WebImageLayer.h>
 #include <public/WebLayer.h>
 #include <wtf/HashMap.h>
 
@@ -102,7 +101,7 @@ public:
     virtual void setContentsToImage(Image*);
     virtual void setContentsToMedia(PlatformLayer*);
     virtual void setContentsToCanvas(PlatformLayer*);
-    virtual bool hasContentsLayer() const { return m_contentsLayer; }
+    virtual bool hasContentsLayer() const { return !m_contentsLayer.isNull(); }
 
     virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String&, double timeOffset);
     virtual void pauseAnimation(const String& animationName, double timeOffset);
@@ -126,13 +125,15 @@ public:
     virtual void notifyAnimationStarted(double startTime) OVERRIDE;
     virtual void notifyAnimationFinished(double finishTime) OVERRIDE;
 
-    WebKit::WebContentLayer* contentLayer() const { return m_layer.get(); }
-
     // Exposed for tests.
-    WebKit::WebLayer* contentsLayer() const { return m_contentsLayer; }
+    WebKit::WebLayer contentsLayer() const { return m_contentsLayer; }
     float contentsScale() const;
 
 private:
+    virtual void willBeDestroyed();
+
+    WebKit::WebLayer primaryLayer() const;
+
     void updateNames();
     void updateChildList();
     void updateLayerPosition();
@@ -150,37 +151,32 @@ private:
     void updateContentsRect();
     void updateContentsScale();
 
-    enum ContentsLayerPurpose {
-        NoContentsLayer = 0,
-        ContentsLayerForImage,
-        ContentsLayerForVideo,
-        ContentsLayerForCanvas,
-    };
-
-    void setContentsTo(ContentsLayerPurpose, WebKit::WebLayer*);
-    void setupContentsLayer(WebKit::WebLayer*);
+    void setupContentsLayer(WebKit::WebLayer);
 
     int mapAnimationNameToId(const String& animationName);
 
     String m_nameBase;
 
-    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;
+    WebKit::WebContentLayer m_layer;
+    WebKit::WebLayer m_transformLayer;
+    WebKit::WebLayer m_contentsLayer;
 
     OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLayerDelegate;
 
+    enum ContentsLayerPurpose {
+        NoContentsLayer = 0,
+        ContentsLayerForImage,
+        ContentsLayerForVideo,
+        ContentsLayerForCanvas,
+    };
+
     ContentsLayerPurpose m_contentsLayerPurpose;
     bool m_contentsLayerHasBackgroundColor : 1;
     bool m_inSetChildren;
     bool m_pageScaleChanged;
 
+    RefPtr<LinkHighlight> m_linkHighlight;
+
     typedef HashMap<String, int> AnimationIdMap;
     AnimationIdMap m_animationIdMap;
 };
index 4e7fa74..30c81b6 100644 (file)
@@ -234,11 +234,10 @@ void LayerChromium::setBounds(const IntSize& size)
         setNeedsCommit();
 }
 
-LayerChromium* LayerChromium::rootLayer()
+const LayerChromium* LayerChromium::rootLayer() const
 {
-    LayerChromium* layer = this;
-    while (layer->parent())
-        layer = layer->parent();
+    const LayerChromium* layer = this;
+    for (LayerChromium* parent = layer->parent(); parent; layer = parent, parent = parent->parent()) { }
     return layer;
 }
 
index 2e541ee..ec14a51 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; }
 
-    LayerChromium* rootLayer();
+    const LayerChromium* rootLayer() const;
     LayerChromium* parent() const;
     void addChild(PassRefPtr<LayerChromium>);
     void insertChild(PassRefPtr<LayerChromium>, size_t index);
index f519a6f..2e99599 100644 (file)
@@ -1,5 +1,192 @@
 2012-08-21  James Robinson  <jamesr@chromium.org>
 
+        Unreviewed, rolling out r126170.
+        http://trac.webkit.org/changeset/126170
+        https://bugs.webkit.org/show_bug.cgi?id=94614
+
+        I spoke too soon
+
+        * WebKit.gypi:
+        * src/NonCompositedContentHost.cpp:
+        (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+        (WebKit::NonCompositedContentHost::setScrollLayer):
+        (WebKit::NonCompositedContentHost::setViewport):
+        (WebKit::NonCompositedContentHost::scrollLayer):
+        * src/NonCompositedContentHost.h:
+        * src/WebContentLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp.
+        (WebKit):
+        (WebKit::WebContentLayer::create):
+        (WebKit::WebContentLayer::clearClient):
+        (WebKit::WebContentLayer::setDoubleSided):
+        (WebKit::WebContentLayer::setContentsScale):
+        (WebKit::WebContentLayer::setUseLCDText):
+        (WebKit::WebContentLayer::setDrawCheckerboardForMissingTiles):
+        (WebKit::WebContentLayer::WebContentLayer):
+        (WebKit::WebContentLayer::operator=):
+        (WebKit::WebContentLayer::operator PassRefPtr<ContentLayerChromium>):
+        * src/WebContentLayerImpl.cpp:
+        (WebKit::WebContentLayerImpl::create):
+        (WebKit::WebContentLayerImpl::WebContentLayerImpl):
+        (WebKit::WebContentLayerImpl::~WebContentLayerImpl):
+        (WebKit::WebContentLayerImpl::paintContents):
+        * src/WebContentLayerImpl.h:
+        (WebContentLayerImpl):
+        * src/WebExternalTextureLayer.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp.
+        (WebKit):
+        (WebTextureUpdaterImpl):
+        (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+        (WebExternalTextureLayerImpl):
+        (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+        (WebKit::WebExternalTextureLayer::create):
+        (WebKit::WebExternalTextureLayer::clearClient):
+        (WebKit::WebExternalTextureLayer::setTextureId):
+        (WebKit::WebExternalTextureLayer::setFlipped):
+        (WebKit::WebExternalTextureLayer::setUVRect):
+        (WebKit::WebExternalTextureLayer::setOpaque):
+        (WebKit::WebExternalTextureLayer::setPremultipliedAlpha):
+        (WebKit::WebExternalTextureLayer::willModifyTexture):
+        (WebKit::WebExternalTextureLayer::setRateLimitContext):
+        (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+        * src/WebExternalTextureLayerImpl.h: Removed.
+        * src/WebIOSurfaceLayer.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp.
+        (WebKit):
+        (WebKit::WebIOSurfaceLayer::create):
+        (WebKit::WebIOSurfaceLayer::setIOSurfaceProperties):
+        (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
+        * src/WebIOSurfaceLayerImpl.h: Removed.
+        * src/WebImageLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.h.
+        (WebKit):
+        (WebKit::WebImageLayer::create):
+        (WebKit::WebImageLayer::WebImageLayer):
+        (WebKit::WebImageLayer::setBitmap):
+        * src/WebLayer.cpp: Added.
+        (WebKit):
+        (WebKit::WebLayer::create):
+        (WebKit::WebLayer::reset):
+        (WebKit::WebLayer::assign):
+        (WebKit::WebLayer::equals):
+        (WebKit::WebLayer::invalidateRect):
+        (WebKit::WebLayer::invalidate):
+        (WebKit::WebLayer::addChild):
+        (WebKit::WebLayer::insertChild):
+        (WebKit::WebLayer::replaceChild):
+        (WebKit::WebLayer::setChildren):
+        (WebKit::WebLayer::removeFromParent):
+        (WebKit::WebLayer::removeAllChildren):
+        (WebKit::WebLayer::setAnchorPoint):
+        (WebKit::WebLayer::anchorPoint):
+        (WebKit::WebLayer::setAnchorPointZ):
+        (WebKit::WebLayer::anchorPointZ):
+        (WebKit::WebLayer::setBounds):
+        (WebKit::WebLayer::bounds):
+        (WebKit::WebLayer::setMasksToBounds):
+        (WebKit::WebLayer::masksToBounds):
+        (WebKit::WebLayer::setMaskLayer):
+        (WebKit::WebLayer::setReplicaLayer):
+        (WebKit::WebLayer::setOpacity):
+        (WebKit::WebLayer::opacity):
+        (WebKit::WebLayer::setOpaque):
+        (WebKit::WebLayer::opaque):
+        (WebKit::WebLayer::setPosition):
+        (WebKit::WebLayer::position):
+        (WebKit::WebLayer::setSublayerTransform):
+        (WebKit::WebLayer::sublayerTransform):
+        (WebKit::WebLayer::setTransform):
+        (WebKit::WebLayer::transform):
+        (WebKit::WebLayer::setDrawsContent):
+        (WebKit::WebLayer::drawsContent):
+        (WebKit::WebLayer::setPreserves3D):
+        (WebKit::WebLayer::setUseParentBackfaceVisibility):
+        (WebKit::WebLayer::setBackgroundColor):
+        (WebKit::WebLayer::setFilters):
+        (WebKit::WebLayer::setBackgroundFilters):
+        (WebKit::WebLayer::setDebugBorderColor):
+        (WebKit::WebLayer::setDebugBorderWidth):
+        (WebKit::WebLayer::setDebugName):
+        (WebKit::WebLayer::setAnimationDelegate):
+        (WebKit::WebLayer::addAnimation):
+        (WebKit::WebLayer::removeAnimation):
+        (WebKit::WebLayer::pauseAnimation):
+        (WebKit::WebLayer::suspendAnimations):
+        (WebKit::WebLayer::resumeAnimations):
+        (WebKit::WebLayer::hasActiveAnimation):
+        (WebKit::WebLayer::transferAnimationsTo):
+        (WebKit::WebLayer::setForceRenderSurface):
+        (WebKit::WebLayer::clearRenderSurface):
+        (WebKit::WebLayer::WebLayer):
+        (WebKit::WebLayer::operator=):
+        (WebKit::WebLayer::operator PassRefPtr<LayerChromium>):
+        * src/WebLayerImpl.cpp:
+        (WebKit::WebLayerImpl::create):
+        (WebKit::WebLayerImpl::WebLayerImpl):
+        (WebKit::WebLayerImpl::~WebLayerImpl):
+        * src/WebLayerImpl.h:
+        (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: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.cpp.
+        (WebKit):
+        (WebKit::WebScrollableLayer::setScrollPosition):
+        (WebKit::WebScrollableLayer::setScrollable):
+        (WebKit::WebScrollableLayer::setHaveWheelEventHandlers):
+        (WebKit::WebScrollableLayer::setShouldScrollOnMainThread):
+        (WebKit::WebScrollableLayer::setNonFastScrollableRegion):
+        (WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers):
+        (WebKit::WebScrollableLayer::setFixedToContainerLayer):
+        * src/WebScrollbarLayer.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp.
+        (WebKit):
+        (WebKit::WebScrollbarLayer::setScrollLayer):
+        (WebKit::WebScrollbarLayer::create):
+        (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+        (WebKit::WebScrollbarLayer::operator=):
+        (WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>):
+        * src/WebScrollbarLayerImpl.h: Removed.
+        * src/WebSolidColorLayer.cpp: Copied from Source/Platform/chromium/public/WebSolidColorLayer.h.
+        (WebKit):
+        (WebKit::WebSolidColorLayer::create):
+        (WebKit::WebSolidColorLayer::WebSolidColorLayer):
+        (WebKit::WebSolidColorLayer::setBackgroundColor):
+        * src/WebSolidColorLayerImpl.cpp:
+        (WebKit::WebSolidColorLayerImpl::create):
+        (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
+        * src/WebSolidColorLayerImpl.h:
+        (WebSolidColorLayerImpl):
+        * src/WebVideoLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.h.
+        (WebKit):
+        (WebKit::WebVideoLayer::create):
+        (WebKit::WebVideoLayer::WebVideoLayer):
+        (WebKit::WebVideoLayer::active):
+        * 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-21  James Robinson  <jamesr@chromium.org>
+
         Unreviewed, rolling out r126169.
         http://trac.webkit.org/changeset/126169
         https://bugs.webkit.org/show_bug.cgi?id=94614
index fc86f83..7fb0c0f 100644 (file)
             'src/WebAnimationImpl.h',
             'src/WebCompositorInputHandlerImpl.cpp',
             'src/WebCompositorInputHandlerImpl.h',
+            'src/WebContentLayer.cpp',
             'src/WebContentLayerImpl.cpp',
             'src/WebContentLayerImpl.h',
-            'src/WebExternalTextureLayerImpl.cpp',
-            'src/WebExternalTextureLayerImpl.h',
+            'src/WebExternalTextureLayer.cpp',
             'src/WebFloatAnimationCurve.cpp',
-            'src/WebIOSurfaceLayerImpl.cpp',
-            'src/WebIOSurfaceLayerImpl.h',
-            'src/WebImageLayerImpl.cpp',
-            'src/WebImageLayerImpl.h',
+            'src/WebIOSurfaceLayer.cpp',
+            'src/WebImageLayer.cpp',
+            'src/WebLayer.cpp',
             'src/WebLayerImpl.cpp',
             'src/WebLayerImpl.h',
             'src/WebLayerTreeView.cpp',
             'src/WebLayerTreeViewImpl.cpp',
             'src/WebLayerTreeViewImpl.h',
-            'src/WebScrollbarLayerImpl.cpp',
-            'src/WebScrollbarLayerImpl.h',
+            'src/WebScrollableLayer.cpp',
+            'src/WebScrollbarLayer.cpp',
+            'src/WebSolidColorLayer.cpp',
             'src/WebSolidColorLayerImpl.cpp',
             'src/WebSolidColorLayerImpl.h',
             'src/WebTransformAnimationCurve.cpp',
-            'src/WebVideoLayerImpl.cpp',
-            'src/WebVideoLayerImpl.h',
+            'src/WebVideoLayer.cpp',
         ],
 
         'conditions': [
index 4df4204..65dac62 100644 (file)
@@ -30,7 +30,6 @@
 #include "FloatPoint.h"
 #include "FloatRect.h"
 #include "GraphicsLayer.h"
-#include "GraphicsLayerChromium.h"
 #include "PlatformContextSkia.h"
 #include "WebViewImpl.h"
 #include <public/WebContentLayer.h>
@@ -49,11 +48,11 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView)
     m_graphicsLayer->setName("non-composited content");
 #endif
     m_graphicsLayer->setDrawsContent(true);
-    WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer();
-    layer->setUseLCDText(true);
-    layer->layer()->setOpaque(true);
+    WebContentLayer layer = m_graphicsLayer->platformLayer()->to<WebContentLayer>();
+    layer.setUseLCDText(true);
+    layer.setOpaque(true);
 #if !OS(ANDROID)
-    layer->setDrawCheckerboardForMissingTiles(true);
+    layer.setDrawCheckerboardForMissingTiles(true);
 #endif
 }
 
@@ -81,7 +80,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
         return;
     }
 
-    if (layer->platformLayer() == scrollLayer())
+    if (*layer->platformLayer() == scrollLayer())
         return;
 
     layer->addChildAtIndex(m_graphicsLayer.get(), 0);
@@ -96,12 +95,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
     bool visibleRectChanged = m_viewportSize != viewportSize;
 
     m_viewportSize = viewportSize;
-    WebLayer* layer = scrollLayer();
-    layer->setScrollPosition(scrollPosition + scrollOrigin);
-    layer->setPosition(WebFloatPoint(-scrollPosition));
+    WebScrollableLayer 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.
-    layer->setScrollable(true);
+    layer.setScrollable(true);
     m_deviceScaleFactor = deviceScale;
     m_graphicsLayer->deviceOrPageScaleFactorChanged();
     m_graphicsLayer->setSize(contentsSize);
@@ -128,11 +127,11 @@ bool NonCompositedContentHost::haveScrollLayer()
     return m_graphicsLayer->parent();
 }
 
-WebLayer* NonCompositedContentHost::scrollLayer()
+WebScrollableLayer NonCompositedContentHost::scrollLayer()
 {
     if (!m_graphicsLayer->parent())
-        return 0;
-    return m_graphicsLayer->parent()->platformLayer();
+        return WebScrollableLayer();
+    return m_graphicsLayer->parent()->platformLayer()->to<WebScrollableLayer>();
 }
 
 void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)
index 08b5f6a..e60e9ef 100644 (file)
@@ -29,7 +29,7 @@
 #include "GraphicsLayerClient.h"
 #include "IntSize.h"
 
-#include <public/WebLayer.h>
+#include <public/WebScrollableLayer.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();
-    WebLayer* scrollLayer();
+    WebScrollableLayer scrollLayer();
 
     OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
     WebViewImpl* m_webView;
  */
 
 #include "config.h"
-#include "WebVideoLayerImpl.h"
+#include <public/WebContentLayer.h>
 
-#include "VideoLayerChromium.h"
-#include "WebLayerImpl.h"
+#include "ContentLayerChromium.h"
+#include "WebContentLayerImpl.h"
+
+using namespace WebCore;
 
 namespace WebKit {
 
-WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider)
+WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient)
+{
+    return WebContentLayer(WebContentLayerImpl::create(contentClient));
+}
+
+void WebContentLayer::clearClient()
+{
+    unwrap<ContentLayerChromium>()->clearDelegate();
+}
+
+void WebContentLayer::setDoubleSided(bool doubleSided)
+{
+    m_private->setDoubleSided(doubleSided);
+}
+
+void WebContentLayer::setContentsScale(float scale)
+{
+    m_private->setContentsScale(scale);
+}
+
+void WebContentLayer::setUseLCDText(bool enable)
 {
-    return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider));
+    m_private->setUseLCDText(enable);
 }
 
-WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer)
-    : m_layer(adoptPtr(new WebLayerImpl(layer)))
+void WebContentLayer::setDrawCheckerboardForMissingTiles(bool enable)
 {
+    m_private->setDrawCheckerboardForMissingTiles(enable);
 }
 
-WebVideoLayerImpl::~WebVideoLayerImpl()
+WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node)
+    : WebScrollableLayer(node)
 {
 }
 
-WebLayer* WebVideoLayerImpl::layer()
+WebContentLayer& WebContentLayer::operator=(const PassRefPtr<ContentLayerChromium>& node)
 {
-    return m_layer.get();
+    m_private = node;
+    return *this;
 }
 
-bool WebVideoLayerImpl::active() const
+WebContentLayer::operator PassRefPtr<ContentLayerChromium>() const
 {
-    return m_layer->layer()->layerTreeHost();
+    return static_cast<ContentLayerChromium*>(m_private.get());
 }
 
 } // namespace WebKit
index fa21e89..69da1ea 100644 (file)
 #include "config.h"
 #include "WebContentLayerImpl.h"
 
-#include "SkMatrix44.h"
 #include <public/WebContentLayerClient.h>
-#include <public/WebFloatPoint.h>
 #include <public/WebFloatRect.h>
 #include <public/WebRect.h>
-#include <public/WebSize.h>
 
 using namespace WebCore;
 
 namespace WebKit {
 
-WebContentLayer* WebContentLayer::create(WebContentLayerClient* client)
+PassRefPtr<WebContentLayerImpl> WebContentLayerImpl::create(WebContentLayerClient* contentClient)
 {
-    return new WebContentLayerImpl(client);
+    return adoptRef(new WebContentLayerImpl(contentClient));
 }
 
-WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client)
-    : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this))))
-    , m_client(client)
+WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient)
+    : ContentLayerChromium(this)
+    , m_contentClient(contentClient)
 {
-    m_webLayerImpl->layer()->setIsDrawable(true);
+    setIsDrawable(true);
 }
 
 WebContentLayerImpl::~WebContentLayerImpl()
 {
-    static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate();
+    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)
 {
-    if (!m_client)
+    if (!m_contentClient)
         return;
     WebFloatRect webOpaque;
-    m_client->paintContents(canvas, WebRect(clip), webOpaque);
+    m_contentClient->paintContents(canvas, WebRect(clip), webOpaque);
     opaque = webOpaque;
 }
 
index 511f8e0..97729ea 100644 (file)
 #define WebContentLayerImpl_h
 
 #include "ContentLayerChromium.h"
-#include "WebLayerImpl.h"
-#include <public/WebContentLayer.h>
 #include <wtf/PassRefPtr.h>
 
 namespace WebKit {
 class WebContentLayerClient;
 
-class WebContentLayerImpl : public WebContentLayer,
-                            public WebCore::ContentLayerDelegate {
+class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate {
 public:
-    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;
+    static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient);
 
 protected:
+    explicit WebContentLayerImpl(WebContentLayerClient* contentClient);
     virtual ~WebContentLayerImpl();
 
     // ContentLayerDelegate implementation.
     virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE;
 
-    OwnPtr<WebLayerImpl> m_webLayerImpl;
-    WebContentLayerClient* m_client;
+    WebContentLayerClient* m_contentClient;
     bool m_drawsContent;
 };
 
  */
 
 #include "config.h"
-#include "WebExternalTextureLayerImpl.h"
+#include <public/WebExternalTextureLayer.h>
 
 #include "CCTextureUpdateQueue.h"
 #include "TextureLayerChromium.h"
-#include "WebLayerImpl.h"
 #include <public/WebExternalTextureLayerClient.h>
 #include <public/WebFloatRect.h>
 #include <public/WebSize.h>
@@ -37,96 +36,96 @@ using namespace WebCore;
 
 namespace WebKit {
 
-WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
-{
-    return new WebExternalTextureLayerImpl(client);
-}
+class WebTextureUpdaterImpl : public WebTextureUpdater {
+public:
+    explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue)
+        : m_queue(queue)
+    {
+    }
 
-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()));
-}
+    virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
+    {
+        TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size };
+        m_queue.appendCopy(copy);
+    }
 
-WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
-{
-    static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient();
-}
+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);
+    }
 
-WebLayer* WebExternalTextureLayerImpl::layer()
+    virtual WebKit::WebGraphicsContext3D* context() OVERRIDE
+    {
+        return m_client->context();
+    }
+
+private:
+    WebExternalTextureLayerClient* m_client;
+};
+
+WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
 {
-    return m_layer.get();
+    RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client));
+    layer->setIsDrawable(true);
+    return WebExternalTextureLayer(layer.release());
 }
 
-void WebExternalTextureLayerImpl::setTextureId(unsigned id)
+void WebExternalTextureLayer::clearClient()
 {
-    static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id);
+    unwrap<TextureLayerChromium>()->clearClient();
 }
 
-void WebExternalTextureLayerImpl::setFlipped(bool flipped)
+void WebExternalTextureLayer::setTextureId(unsigned id)
 {
-    static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped);
+    unwrap<TextureLayerChromium>()->setTextureId(id);
 }
 
-void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect)
+void WebExternalTextureLayer::setFlipped(bool flipped)
 {
-    static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect);
+    unwrap<TextureLayerChromium>()->setFlipped(flipped);
 }
 
-void WebExternalTextureLayerImpl::setOpaque(bool opaque)
+void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
 {
-    static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque);
+    unwrap<TextureLayerChromium>()->setUVRect(rect);
 }
 
-void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha)
+void WebExternalTextureLayer::setOpaque(bool opaque)
 {
-    static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha);
+    unwrap<TextureLayerChromium>()->setOpaque(opaque);
 }
 
-void WebExternalTextureLayerImpl::willModifyTexture()
+void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha)
 {
-    static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture();
+    unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha);
 }
 
-void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit)
+void WebExternalTextureLayer::willModifyTexture()
 {
-    static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(rateLimit);
+    unwrap<TextureLayerChromium>()->willModifyTexture();
 }
 
-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)
+void WebExternalTextureLayer::setRateLimitContext(bool rateLimit)
 {
-    ASSERT(m_client);
-    WebTextureUpdaterImpl updaterImpl(queue);
-    return m_client->prepareTexture(updaterImpl);
+    unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit);
 }
 
-WebGraphicsContext3D* WebExternalTextureLayerImpl::context()
+WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
+    : WebLayer(layer)
 {
-    ASSERT(m_client);
-    return m_client->context();
 }
 
 } // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h
deleted file mode 100644 (file)
index 5348895..0000000
+++ /dev/null
@@ -1,64 +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.
- */
-
-#ifndef WebExternalTextureLayerImpl_h
-#define WebExternalTextureLayerImpl_h
-
-#include "TextureLayerChromium.h"
-#include <public/WebExternalTextureLayer.h>
-
-namespace WebKit {
-
-class WebLayerImpl;
-
-class WebExternalTextureLayerImpl : public WebExternalTextureLayer,
-                                    public WebCore::TextureLayerChromiumClient {
-public:
-    explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient*);
-    virtual ~WebExternalTextureLayerImpl();
-
-    // 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;
-
-    // TextureLayerChromiumClient implementation.
-    virtual unsigned prepareTexture(WebCore::CCTextureUpdateQueue&) OVERRIDE;
-    virtual WebGraphicsContext3D* context() OVERRIDE;
-
-private:
-    WebExternalTextureLayerClient* m_client;
-    OwnPtr<WebLayerImpl> m_layer;
-};
-
-}
-
-#endif // WebExternalTextureLayerImpl_h
-
  */
 
 #include "config.h"
-#include "WebIOSurfaceLayerImpl.h"
+#include <public/WebIOSurfaceLayer.h>
 
 #include "IOSurfaceLayerChromium.h"
-#include "WebLayerImpl.h"
+#include <public/WebSize.h>
 
-using WebCore::IOSurfaceLayerChromium;
+using namespace WebCore;
 
 namespace WebKit {
 
-WebIOSurfaceLayer* WebIOSurfaceLayer::create()
+WebIOSurfaceLayer WebIOSurfaceLayer::create()
 {
     RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create();
     layer->setIsDrawable(true);
-    return new WebIOSurfaceLayerImpl(layer.release());
+    return WebIOSurfaceLayer(layer.release());
 }
 
-WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer)
-    : m_layer(adoptPtr(new WebLayerImpl(layer)))
+void WebIOSurfaceLayer::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
 {
+    unwrap<IOSurfaceLayerChromium>()->setIOSurfaceProperties(ioSurfaceId, size);
 }
 
-WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl()
+WebIOSurfaceLayer::WebIOSurfaceLayer(PassRefPtr<IOSurfaceLayerChromium> layer)
+    : WebLayer(layer)
 {
 }
 
-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
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebImageLayerImpl_h
-#define WebImageLayerImpl_h
-
+#include "config.h"
 #include <public/WebImageLayer.h>
-#include <wtf/OwnPtr.h>
 
-namespace WebCore {
-class ImageLayerChromium;
-}
+#include "ImageLayerChromium.h"
 
 namespace WebKit {
-class WebLayerImpl;
-
-class WebImageLayerImpl : public WebImageLayer {
-public:
-    explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>);
-    virtual ~WebImageLayerImpl();
 
-    // WebImageLayer implementation.
-    WebLayer* layer() OVERRIDE;
-    virtual void setBitmap(SkBitmap) OVERRIDE;
+WebImageLayer WebImageLayer::create()
+{
+    return WebImageLayer(WebCore::ImageLayerChromium::create());
+}
 
-private:
-    OwnPtr<WebLayerImpl> m_layer;
-};
+WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer)
+    : WebLayer(layer)
+{
+}
 
+void WebImageLayer::setBitmap(SkBitmap bitmap)
+{
+    unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap);
 }
 
-#endif // WebImageLayerImpl_h
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp
new file mode 100644 (file)
index 0000000..37897e6
--- /dev/null
@@ -0,0 +1,379 @@
+/*
+ * 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 40ced48..16e1206 100644 (file)
 #include "config.h"
 #include "WebLayerImpl.h"
 
-#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;
+using namespace WebCore;
 
 namespace WebKit {
 
-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()
+PassRefPtr<WebLayerImpl> WebLayerImpl::create()
 {
-    return new WebLayerImpl(LayerChromium::create());
+    return adoptRef(new WebLayerImpl());
 }
 
-WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer)
-    : m_layer(layer)
+WebLayerImpl::WebLayerImpl()
+    : LayerChromium()
 {
+    // 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()
 {
-    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
index 7e3b533..7e4e750 100644 (file)
 #ifndef WebLayerImpl_h
 #define WebLayerImpl_h
 
-#include <public/WebLayer.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-class LayerChromium;
-}
+#include "LayerChromium.h"
+#include <wtf/PassRefPtr.h>
 
 namespace WebKit {
 
-class WebLayerImpl : public WebLayer {
+class WebLayerImpl : public WebCore::LayerChromium {
 public:
-    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;
+    static PassRefPtr<WebLayerImpl> create();
 
 protected:
-    RefPtr<WebCore::LayerChromium> m_layer;
+    WebLayerImpl();
+    virtual ~WebLayerImpl();
 };
 
 } // namespace WebKit
index 7dfbcd1..f397e53 100644 (file)
@@ -31,7 +31,6 @@
 #include "CCLayerTreeHost.h"
 #include "CCRenderingStats.h"
 #include "LayerChromium.h"
-#include "WebLayerImpl.h"
 #include "WebLayerTreeViewImpl.h"
 #include <public/WebLayer.h>
 #include <public/WebPoint.h>
@@ -84,7 +83,7 @@ void WebLayerTreeView::setSurfaceReady()
 void WebLayerTreeView::setRootLayer(WebLayer *root)
 {
     if (root)
-        m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer());
+        m_private->layerTreeHost()->setRootLayer(*root);
     else
         m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>());
 }
index 1fd8239..1f1933f 100644 (file)
@@ -29,7 +29,6 @@
 #include "CCLayerTreeHost.h"
 #include "CCThreadProxy.h"
 #include "LayerChromium.h"
-#include "WebLayerImpl.h"
 #include <public/WebGraphicsContext3D.h>
 #include <public/WebLayer.h>
 #include <public/WebLayerTreeView.h>
@@ -143,7 +142,7 @@ PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewCl
     OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings));
     if (!impl->layerTreeHost())
         return nullptr;
-    impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer());
+    impl->layerTreeHost()->setRootLayer(root);
     return impl.release();
 }
 
index cb75623..4a90a98 100644 (file)
@@ -109,9 +109,9 @@ void WebMediaPlayerClientImpl::readyStateChanged()
     ASSERT(m_mediaPlayer);
     m_mediaPlayer->readyStateChanged();
 #if USE(ACCELERATED_COMPOSITING)
-    if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) {
-        m_videoLayer = adoptPtr(WebVideoLayer::create(this));
-        m_videoLayer->layer()->setOpaque(m_opaque);
+    if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) {
+        m_videoLayer = WebVideoLayer::create(this);
+        m_videoLayer.setOpaque(m_opaque);
     }
 #endif
 }
@@ -138,8 +138,8 @@ void WebMediaPlayerClientImpl::repaint()
 {
     ASSERT(m_mediaPlayer);
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_videoLayer && supportsAcceleratedRendering())
-        m_videoLayer->layer()->invalidate();
+    if (!m_videoLayer.isNull() && supportsAcceleratedRendering())
+        m_videoLayer.invalidate();
 #endif
     m_mediaPlayer->repaint();
 }
@@ -166,8 +166,8 @@ void WebMediaPlayerClientImpl::setOpaque(bool opaque)
 {
 #if USE(ACCELERATED_COMPOSITING)
     m_opaque = opaque;
-    if (m_videoLayer)
-        m_videoLayer->layer()->setOpaque(m_opaque);
+    if (!m_videoLayer.isNull())
+        m_videoLayer.setOpaque(m_opaque);
 #endif
 }
 
@@ -343,7 +343,7 @@ void WebMediaPlayerClientImpl::cancelLoad()
 WebLayer* WebMediaPlayerClientImpl::platformLayer() const
 {
     ASSERT(m_supportsAcceleratedCompositing);
-    return m_videoLayer ? m_videoLayer->layer() : 0;
+    return const_cast<WebVideoLayer*>(&m_videoLayer);
 }
 #endif
 
@@ -745,7 +745,7 @@ bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const
 
 bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
 {
-    return m_videoLayer && m_videoLayer->active();
+    return !m_videoLayer.isNull() && m_videoLayer.active();
 }
 
 void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client)
index 329fd9e..373015e 100644 (file)
@@ -205,7 +205,7 @@ private:
     WebCore::MediaPlayer::Preload m_preload;
     RefPtr<WebHelperPluginImpl> m_helperPlugin;
 #if USE(ACCELERATED_COMPOSITING)
-    OwnPtr<WebVideoLayer> m_videoLayer;
+    WebVideoLayer m_videoLayer;
     bool m_supportsAcceleratedCompositing;
     bool m_opaque;
     WebVideoFrameProvider::Client* m_videoFrameProviderClient;
index 75a97e0..a35a040 100644 (file)
@@ -366,11 +366,11 @@ void WebPluginContainerImpl::setBackingTextureId(unsigned textureId)
     if (m_textureId == textureId)
         return;
 
-    ASSERT(!m_ioSurfaceLayer);
+    ASSERT(m_ioSurfaceLayer.isNull());
 
-    if (!m_textureLayer)
-        m_textureLayer = adoptPtr(WebExternalTextureLayer::create());
-    m_textureLayer->setTextureId(textureId);
+    if (m_textureLayer.isNull())
+        m_textureLayer = 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
@@ -390,11 +390,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
     if (ioSurfaceId == m_ioSurfaceId)
         return;
 
-    ASSERT(!m_textureLayer);
+    ASSERT(m_textureLayer.isNull());
 
-    if (!m_ioSurfaceLayer)
-        m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create());
-    m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
+    if (m_ioSurfaceLayer.isNull())
+        m_ioSurfaceLayer = 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
@@ -409,11 +409,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
 void WebPluginContainerImpl::commitBackingTexture()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_textureLayer)
-        m_textureLayer->layer()->invalidate();
+    if (!m_textureLayer.isNull())
+        m_textureLayer.invalidate();
 
-    if (m_ioSurfaceLayer)
-        m_ioSurfaceLayer->layer()->invalidate();
+    if (!m_ioSurfaceLayer.isNull())
+        m_ioSurfaceLayer.invalidate();
 #endif
 }
 
@@ -480,11 +480,11 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel)
 void WebPluginContainerImpl::setOpaque(bool opaque)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_textureLayer)
-        m_textureLayer->layer()->setOpaque(opaque);
+    if (!m_textureLayer.isNull())
+        m_textureLayer.setOpaque(opaque);
 
-    if (m_ioSurfaceLayer)
-        m_ioSurfaceLayer->layer()->setOpaque(opaque);
+    if (!m_ioSurfaceLayer.isNull())
+        m_ioSurfaceLayer.setOpaque(opaque);
 #endif
 }
 
@@ -575,9 +575,9 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
 WebLayer* WebPluginContainerImpl::platformLayer() const
 {
     if (m_textureId)
-        return m_textureLayer->layer();
+        return const_cast<WebExternalTextureLayer*>(&m_textureLayer);
     if (m_ioSurfaceId)
-        return m_ioSurfaceLayer->layer();
+        return const_cast<WebIOSurfaceLayer*>(&m_ioSurfaceLayer);
     return 0;
 }
 #endif
index 998be6e..074a0cc 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;
-    OwnPtr<WebExternalTextureLayer> m_textureLayer;
+    WebExternalTextureLayer m_textureLayer;
 
     unsigned m_ioSurfaceId;
-    OwnPtr<WebIOSurfaceLayer> m_ioSurfaceLayer;
+    WebIOSurfaceLayer m_ioSurfaceLayer;
 #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
new file mode 100644 (file)
index 0000000..a20e81d
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * 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 "WebScrollbarLayerImpl.h"
+#include <public/WebScrollbarLayer.h>
 
 #include "ScrollbarLayerChromium.h"
-#include "WebLayerImpl.h"
 
-using WebCore::Scrollbar;
-using WebCore::ScrollbarLayerChromium;
+using namespace WebCore;
 
 namespace WebKit {
 
-WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
+void WebScrollbarLayer::setScrollLayer(const WebLayer layer)
 {
-    return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
+    int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id();
+    unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
 }
 
-
-WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer)
-    : m_layer(adoptPtr(new WebLayerImpl(layer)))
+WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
 {
+    return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
 }
 
-WebScrollbarLayerImpl::~WebScrollbarLayerImpl()
+WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
+    : WebLayer(layer)
 {
 }
 
-WebLayer* WebScrollbarLayerImpl::layer()
+WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
 {
-    return m_layer.get();
+    m_private = layer;
+    return *this;
 }
 
-void WebScrollbarLayerImpl::setScrollLayer(WebLayer* layer)
+WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const
 {
-    int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0;
-    static_cast<ScrollbarLayerChromium*>(m_layer->layer())->setScrollLayerId(id);
+    return unwrap<ScrollbarLayerChromium>();
 }
 
-
-
 } // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h
deleted file mode 100644 (file)
index 720f79c..0000000
+++ /dev/null
@@ -1,55 +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 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
  */
 
 #include "config.h"
-#include "WebImageLayerImpl.h"
+#include <public/WebSolidColorLayer.h>
 
-#include "ImageLayerChromium.h"
-#include "WebLayerImpl.h"
-
-using WebCore::ImageLayerChromium;
+#include "WebSolidColorLayerImpl.h"
+#include <public/WebFloatRect.h>
 
 namespace WebKit {
 
-WebImageLayer* WebImageLayer::create()
-{
-    return new WebImageLayerImpl(WebCore::ImageLayerChromium::create());
-}
-
-WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer)
-    : m_layer(adoptPtr(new WebLayerImpl(layer)))
-{
-}
-
-WebImageLayerImpl::~WebImageLayerImpl()
+WebSolidColorLayer WebSolidColorLayer::create()
 {
+    return WebSolidColorLayer(WebSolidColorLayerImpl::create());
 }
 
-WebLayer* WebImageLayerImpl::layer()
+WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node)
+    : WebLayer(node)
 {
-    return m_layer.get();
 }
 
-void WebImageLayerImpl::setBitmap(SkBitmap bitmap)
+void WebSolidColorLayer::setBackgroundColor(const WebColor& color)
 {
-    static_cast<ImageLayerChromium*>(m_layer->layer())->setBitmap(bitmap);
+    m_private->setBackgroundColor(color);
 }
 
 } // namespace WebKit
index 9440426..33b1a30 100644 (file)
 #include "config.h"
 #include "WebSolidColorLayerImpl.h"
 
-#include "SolidColorLayerChromium.h"
-#include "WebLayerImpl.h"
-
-using WebCore::SolidColorLayerChromium;
+using namespace WebCore;
 
 namespace WebKit {
 
-WebSolidColorLayer* WebSolidColorLayer::create()
+PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create()
 {
-    return new WebSolidColorLayerImpl(SolidColorLayerChromium::create());
+    return adoptRef(new WebSolidColorLayerImpl());
 }
 
-WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer)
-    : m_layer(adoptPtr(new WebLayerImpl(layer)))
+WebSolidColorLayerImpl::WebSolidColorLayerImpl()
+    : SolidColorLayerChromium()
 {
-    m_layer->layer()->setIsDrawable(true);
+    setIsDrawable(true);
 }
 
 WebSolidColorLayerImpl::~WebSolidColorLayerImpl()
 {
 }
 
-WebLayer* WebSolidColorLayerImpl::layer()
-{
-    return m_layer.get();
-}
-
-void WebSolidColorLayerImpl::setBackgroundColor(WebColor color)
-{
-    m_layer->setBackgroundColor(color);
-}
-
 } // namespace WebKit
 
index 7742ba4..d2673b4 100644 (file)
 #ifndef WebSolidColorLayerImpl_h
 #define WebSolidColorLayerImpl_h
 
-#include <public/WebSolidColorLayer.h>
-#include <wtf/OwnPtr.h>
+#include "SolidColorLayerChromium.h"
 #include <wtf/PassRefPtr.h>
 
-namespace WebCore {
-class SolidColorLayerChromium;
-}
-
 namespace WebKit {
-class WebLayerImpl;
 
-class WebSolidColorLayerImpl : public WebSolidColorLayer {
+class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium {
 public:
-    explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>);
-    virtual ~WebSolidColorLayerImpl();
+    static PassRefPtr<WebSolidColorLayerImpl> create();
 
-    // WebSolidColorLayer implementation.
-    virtual WebLayer* layer() OVERRIDE;
-    virtual void setBackgroundColor(WebColor) OVERRIDE;
-
-private:
-    OwnPtr<WebLayerImpl> m_layer;
+protected:
+    WebSolidColorLayerImpl();
+    virtual ~WebSolidColorLayerImpl();
 };
 
 } // namespace WebKit
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebVideoLayerImpl_h
-#define WebVideoLayerImpl_h
-
+#include "config.h"
+#include "VideoLayerChromium.h"
 #include <public/WebVideoLayer.h>
 
-namespace WebCore {
-class VideoLayerChromium;
-}
-
 namespace WebKit {
-class WebLayerImpl;
-
-class WebVideoLayerImpl : public WebVideoLayer {
-public:
-    explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>);
-    virtual ~WebVideoLayerImpl();
 
-    // WebVideoLayer implementation.
-    virtual WebLayer* layer() OVERRIDE;
-    virtual bool active() const OVERRIDE;
-
-private:
-    OwnPtr<WebLayerImpl> m_layer;
-};
+WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider)
+{
+    return WebVideoLayer(WebCore::VideoLayerChromium::create(provider));
+}
 
+WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer)
+    : WebLayer(layer)
+{
 }
 
-#endif // WebVideoLayerImpl_h
+bool WebVideoLayer::active() const
+{
+    return m_private->layerTreeHost();
+}
 
+} // namespace WebKit
index 97339b3..90002af 100644 (file)
@@ -408,7 +408,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
     , m_isCancelingFullScreen(false)
     , m_benchmarkSupport(this)
 #if USE(ACCELERATED_COMPOSITING)
-    , m_rootLayer(0)
     , m_rootGraphicsLayer(0)
     , m_isAcceleratedCompositingActive(false)
     , m_compositorCreationFailed(false)
@@ -3513,7 +3512,6 @@ bool WebViewImpl::allowsAcceleratedCompositing()
 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
 {
     m_rootGraphicsLayer = layer;
-    m_rootLayer = layer ? layer->platformLayer() : 0;
 
     setIsAcceleratedCompositingActive(layer);
     if (m_nonCompositedContentHost) {
@@ -3527,8 +3525,11 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
         m_nonCompositedContentHost->setScrollLayer(scrollLayer);
     }
 
+    if (layer)
+        m_rootLayer = *layer->platformLayer();
+
     if (!m_layerTreeView.isNull())
-        m_layerTreeView.setRootLayer(m_rootLayer);
+        m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0);
 
     IntRect damagedRect(0, 0, m_size.width, m_size.height);
     if (!m_isAcceleratedCompositingActive)
@@ -3641,7 +3642,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
         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());
index 431dad4..c8bf584 100644 (file)
@@ -814,7 +814,7 @@ private:
     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;
index 4948f97..a5ca551 100644 (file)
@@ -122,13 +122,13 @@ TEST(ImageLayerChromiumTest, opaqueImages)
     RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false);
     ASSERT_TRUE(nonOpaqueImage.get());
 
-    ASSERT_FALSE(graphicsLayer->contentsLayer());
+    ASSERT_TRUE(graphicsLayer->contentsLayer().isNull());
 
     graphicsLayer->setContentsToImage(opaqueImage.get());
-    ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque());
+    ASSERT_TRUE(graphicsLayer->contentsLayer().opaque());
 
     graphicsLayer->setContentsToImage(nonOpaqueImage.get());
-    ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque());
+    ASSERT_FALSE(graphicsLayer->contentsLayer().opaque());
 }
 
 } // namespace
index 9b8e58c..6672004 100644 (file)
@@ -26,7 +26,6 @@
 #include <public/WebLayer.h>
 
 #include "CompositorFakeWebGraphicsContext3D.h"
-#include "WebLayerImpl.h"
 #include <public/WebCompositor.h>
 #include <public/WebContentLayer.h>
 #include <public/WebContentLayerClient.h>
@@ -77,9 +76,9 @@ public:
     {
         // Initialize without threading support.
         WebKit::WebCompositor::initialize(0);
-        m_rootLayer = adoptPtr(WebLayer::create());
+        m_rootLayer = WebLayer::create();
         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);
     }
 
@@ -88,14 +87,14 @@ public:
         // We may get any number of scheduleComposite calls during shutdown.
         EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
         m_view.setRootLayer(0);
-        m_rootLayer.clear();
+        m_rootLayer.reset();
         m_view.reset();
         WebKit::WebCompositor::shutdown();
     }
 
 protected:
     MockWebLayerTreeViewClient m_client;
-    OwnPtr<WebLayer> m_rootLayer;
+    WebLayer m_rootLayer;
     WebLayerTreeView m_view;
 };
 
@@ -105,73 +104,73 @@ TEST_F(WebLayerTest, Client)
 {
     // Base layer.
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    OwnPtr<WebLayer> layer = adoptPtr(WebLayer::create());
-    m_rootLayer->addChild(layer.get());
+    WebLayer layer = WebLayer::create();
+    m_rootLayer.addChild(layer);
     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);
-    EXPECT_EQ(point, layer->anchorPoint());
+    EXPECT_EQ(point, layer.anchorPoint());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
     float anchorZ = 5;
-    layer->setAnchorPointZ(anchorZ);
+    layer.setAnchorPointZ(anchorZ);
     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));
-    layer->setBounds(size);
+    layer.setBounds(size);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(size, layer->bounds());
+    EXPECT_EQ(size, layer.bounds());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer->setMasksToBounds(true);
+    layer.setMasksToBounds(true);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_TRUE(layer->masksToBounds());
+    EXPECT_TRUE(layer.masksToBounds());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    OwnPtr<WebLayer> otherLayer = adoptPtr(WebLayer::create());
-    m_rootLayer->addChild(otherLayer.get());
+    WebLayer otherLayer = WebLayer::create();
+    m_rootLayer.addChild(otherLayer);
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer->setMaskLayer(otherLayer.get());
+    layer.setMaskLayer(otherLayer);
     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);
-    EXPECT_EQ(opacity, layer->opacity());
+    EXPECT_EQ(opacity, layer.opacity());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer->setOpaque(true);
+    layer.setOpaque(true);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_TRUE(layer->opaque());
+    EXPECT_TRUE(layer.opaque());
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    layer->setPosition(point);
+    layer.setPosition(point);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_EQ(point, layer->position());
+    EXPECT_EQ(point, layer.position());
 
     // Texture layer.
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create());
-    m_rootLayer->addChild(textureLayer->layer());
+    WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create();
+    m_rootLayer.addChild(textureLayer);
     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));
-    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);
-    textureLayer->setUVRect(uvRect);
+    textureLayer.setUVRect(uvRect);
     Mock::VerifyAndClearExpectations(&m_client);
 
 
@@ -179,14 +178,14 @@ TEST_F(WebLayerTest, Client)
     MockWebContentLayerClient contentClient;
     EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber());
     EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
-    OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&contentClient));
-    m_rootLayer->addChild(contentLayer->layer());
+    WebContentLayer contentLayer = WebContentLayer::create(&contentClient);
+    m_rootLayer.addChild(contentLayer);
     Mock::VerifyAndClearExpectations(&m_client);
 
     EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
-    contentLayer->layer()->setDrawsContent(false);
+    contentLayer.setDrawsContent(false);
     Mock::VerifyAndClearExpectations(&m_client);
-    EXPECT_FALSE(contentLayer->layer()->drawsContent());
+    EXPECT_FALSE(contentLayer.drawsContent());
 }
 
 }
index 1c1602c..bec2c60 100644 (file)
@@ -60,8 +60,8 @@ public:
     virtual void SetUp()
     {
         initializeCompositor();
-        m_rootLayer = adoptPtr(WebLayer::create());
-        EXPECT_TRUE(m_view.initialize(client(), *m_rootLayer, WebLayerTreeView::Settings()));
+        m_rootLayer = WebLayer::create();
+        EXPECT_TRUE(m_view.initialize(client(), m_rootLayer, WebLayerTreeView::Settings()));
         m_view.setSurfaceReady();
     }
 
@@ -70,13 +70,13 @@ public:
         Mock::VerifyAndClearExpectations(client());
 
         m_view.setRootLayer(0);
-        m_rootLayer.clear();
+        m_rootLayer.reset();
         m_view.reset();
         WebKit::WebCompositor::shutdown();
     }
 
 protected:
-    OwnPtr<WebLayer> m_rootLayer;
+    WebLayer m_rootLayer;
     WebLayerTreeView m_view;
 };