+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
+
+ Crashes already fixed downstream
+
+ * chromium/public/WebContentLayer.h:
+ (WebContentLayer):
+ * chromium/public/WebExternalTextureLayer.h:
+ (WebExternalTextureLayer):
+ * chromium/public/WebIOSurfaceLayer.h:
+ (WebIOSurfaceLayer):
+ * chromium/public/WebImageLayer.h:
+ (WebImageLayer):
+ * chromium/public/WebLayer.h:
+ (WebKit):
+ (WebLayer):
+ (WebKit::WebLayer::~WebLayer):
+ * chromium/public/WebScrollableLayer.h: Removed.
+ * chromium/public/WebScrollbarLayer.h:
+ (WebScrollbarLayer):
+ * chromium/public/WebSolidColorLayer.h:
+ (WebKit):
+ (WebSolidColorLayer):
+ (WebKit::WebSolidColorLayer::~WebSolidColorLayer):
+ * chromium/public/WebVideoLayer.h:
+ (WebVideoLayer):
+
2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r126076, r126099, and r126106.
#define WebContentLayer_h
#include "WebCommon.h"
-#include "WebScrollableLayer.h"
-
-namespace WebCore {
-class ContentLayerChromium;
-}
namespace WebKit {
class WebContentLayerClient;
-class WebContentLayerImpl;
-class WebContentLayer : public WebScrollableLayer {
+class WebContentLayer {
public:
- WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*);
+ // The client must outlive the WebContentLayer.
+ WEBKIT_EXPORT static WebContentLayer* create(WebContentLayerClient*);
- WebContentLayer() { }
- WebContentLayer(const WebContentLayer& layer) : WebScrollableLayer(layer) { }
virtual ~WebContentLayer() { }
- WebContentLayer& operator=(const WebContentLayer& layer)
- {
- WebLayer::assign(layer);
- return *this;
- }
- // Called when the WebContentLayerClient is going away and should not be used.
- WEBKIT_EXPORT void clearClient();
+ // The WebContentLayer has ownership of this wrapper.
+ virtual WebLayer* layer() = 0;
// Set to true if the backside of this layer's contents should be visible when composited.
// Defaults to false.
- WEBKIT_EXPORT void setDoubleSided(bool);
+ virtual void setDoubleSided(bool) = 0;
// Set to apply a scale factor used when painting and drawing this layer's content. Defaults to 1.0.
- WEBKIT_EXPORT void setContentsScale(float);
+ virtual void setContentsScale(float) = 0;
// Set to render text in this layer with LCD antialiasing. Only set if you know that this layer will be
// drawn in a way where this makes sense - i.e. opaque background, not rotated or scaled, etc.
// Defaults to false;
- WEBKIT_EXPORT void setUseLCDText(bool);
+ virtual void setUseLCDText(bool) = 0;
// Set to draw a system-defined checkerboard if the compositor would otherwise draw a tile in this layer
// and the actual contents are unavailable. If false, the compositor will draw the layer's background color
// for these tiles.
// Defaults to false.
- WEBKIT_EXPORT void setDrawCheckerboardForMissingTiles(bool);
-
-#if WEBKIT_IMPLEMENTATION
- WebContentLayer(const WTF::PassRefPtr<WebCore::ContentLayerChromium>&);
- WebContentLayer& operator=(const WTF::PassRefPtr<WebCore::ContentLayerChromium>&);
- operator WTF::PassRefPtr<WebCore::ContentLayerChromium>() const;
-#endif
+ virtual void setDrawCheckerboardForMissingTiles(bool) = 0;
};
} // namespace WebKit
#include "WebFloatRect.h"
#include "WebLayer.h"
-namespace WebCore {
-class TextureLayerChromium;
-}
-
namespace WebKit {
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 : public WebLayer {
+class WebExternalTextureLayer {
public:
// The owner of this layer may optionally provide a client. This client will
// be called whenever the compositor wishes to produce a new frame and can
// provide a new front buffer texture ID. This is useful if the client wants to
// implement a double-buffering scheme that is synchronized with the compositor, for instance.
- WEBKIT_EXPORT static WebExternalTextureLayer create(WebExternalTextureLayerClient* = 0);
-
- // Indicates that the client for this layer is going away and shouldn't be used.
- WEBKIT_EXPORT void clearClient();
+ // The client must outlive the WebExternalTextureLayer.
+ WEBKIT_EXPORT static WebExternalTextureLayer* create(WebExternalTextureLayerClient* = 0);
- WebExternalTextureLayer() { }
virtual ~WebExternalTextureLayer() { }
+ virtual WebLayer* layer() = 0;
+
// Sets the texture id that represents the layer, in the namespace of the
// compositor context.
- WEBKIT_EXPORT void setTextureId(unsigned);
+ virtual void setTextureId(unsigned) = 0;
// Sets whether or not the texture should be flipped in the Y direction when
// rendered.
- WEBKIT_EXPORT void setFlipped(bool);
+ virtual void setFlipped(bool) = 0;
// Sets the rect in UV space of the texture that is mapped to the layer
// bounds.
- WEBKIT_EXPORT void setUVRect(const WebFloatRect&);
+ virtual void setUVRect(const WebFloatRect&) = 0;
// Sets whether every pixel in this layer is opaque. Defaults to false.
- WEBKIT_EXPORT void setOpaque(bool);
+ virtual void setOpaque(bool) = 0;
// Sets whether this layer's texture has premultiplied alpha or not. Defaults to true.
- WEBKIT_EXPORT void setPremultipliedAlpha(bool);
+ virtual void setPremultipliedAlpha(bool) = 0;
// Indicates that the most recently provided texture ID is about to be modified externally.
- WEBKIT_EXPORT void willModifyTexture();
+ virtual void willModifyTexture() = 0;
// Sets whether this context should be rate limited by the compositor. Rate limiting works by blocking
// invalidate() and invalidateRect() calls if the compositor is too many frames behind.
- WEBKIT_EXPORT void setRateLimitContext(bool);
-
-private:
-#if WEBKIT_IMPLEMENTATION
- explicit WebExternalTextureLayer(PassRefPtr<WebCore::TextureLayerChromium>);
-#endif
+ virtual void setRateLimitContext(bool) = 0;
};
} // namespace WebKit
#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 : public WebLayer {
+class WebIOSurfaceLayer {
public:
- WEBKIT_EXPORT static WebIOSurfaceLayer create();
+ WEBKIT_EXPORT static WebIOSurfaceLayer* create();
- WebIOSurfaceLayer() { }
virtual ~WebIOSurfaceLayer() { }
- // Sets the IO surface id that represents this layer's contents.
- WEBKIT_EXPORT void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize);
+ virtual WebLayer* layer() = 0;
-private:
-#if WEBKIT_IMPLEMENTATION
- explicit WebIOSurfaceLayer(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
-#endif
+ // Sets the IO surface id that represents this layer's contents.
+ virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) = 0;
};
} // namespace WebKit
#include "WebCommon.h"
#include "WebLayer.h"
-namespace WebCore {
-class ImageLayerChromium;
-}
-
namespace WebKit {
-class WebImageLayer : public WebLayer {
+class WebImageLayer {
public:
- WEBKIT_EXPORT static WebImageLayer create();
+ WEBKIT_EXPORT static WebImageLayer* create();
- WebImageLayer() { }
virtual ~WebImageLayer() { }
- WEBKIT_EXPORT void setBitmap(SkBitmap);
-
-#if WEBKIT_IMPLEMENTATION
- explicit WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium>);
-#endif
+ virtual WebLayer* layer() = 0;
+ virtual void setBitmap(SkBitmap) = 0;
};
} // namespace WebKit
#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;
struct WebFloatRect;
struct WebSize;
+class WebLayerImpl;
+
class WebLayer {
public:
- WEBKIT_EXPORT static WebLayer create();
-
- WebLayer() { }
- WebLayer(const WebLayer& layer) { assign(layer); }
- virtual ~WebLayer() { reset(); }
- WebLayer& operator=(const WebLayer& layer)
- {
- assign(layer);
- return *this;
- }
- bool isNull() const { return m_private.isNull(); }
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebLayer&);
- WEBKIT_EXPORT bool equals(const WebLayer&) const;
+#define WEBLAYER_IS_PURE_VIRTUAL
+ WEBKIT_EXPORT static WebLayer* create();
+
+ virtual ~WebLayer() { }
+
+ // Returns a positive ID that will be unique across all WebLayers allocated in this process.
+ virtual int id() const = 0;
// Sets a region of the layer as invalid, i.e. needs to update its content.
- WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
+ virtual void invalidateRect(const WebFloatRect&) = 0;
// Sets the entire layer as invalid, i.e. needs to update its content.
- WEBKIT_EXPORT void invalidate();
+ virtual void invalidate() = 0;
- WEBKIT_EXPORT void addChild(const WebLayer&);
- WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index);
- WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer);
- WEBKIT_EXPORT void setChildren(const WebVector<WebLayer>&);
- WEBKIT_EXPORT void removeFromParent();
- WEBKIT_EXPORT void removeAllChildren();
+ // These functions do not take ownership of the WebLayer* parameter.
+ virtual void addChild(WebLayer*) = 0;
+ virtual void insertChild(WebLayer*, size_t index) = 0;
+ virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) = 0;
+ virtual void setChildren(const WebVector<WebLayer*>&) = 0;
+ virtual void removeFromParent() = 0;
+ virtual void removeAllChildren() = 0;
- WEBKIT_EXPORT void setAnchorPoint(const WebFloatPoint&);
- WEBKIT_EXPORT WebFloatPoint anchorPoint() const;
+ virtual void setAnchorPoint(const WebFloatPoint&) = 0;
+ virtual WebFloatPoint anchorPoint() const = 0;
- WEBKIT_EXPORT void setAnchorPointZ(float);
- WEBKIT_EXPORT float anchorPointZ() const;
+ virtual void setAnchorPointZ(float) = 0;
+ virtual float anchorPointZ() const = 0;
- WEBKIT_EXPORT void setBounds(const WebSize&);
- WEBKIT_EXPORT WebSize bounds() const;
+ virtual void setBounds(const WebSize&) = 0;
+ virtual WebSize bounds() const = 0;
- WEBKIT_EXPORT void setMasksToBounds(bool);
- WEBKIT_EXPORT bool masksToBounds() const;
+ virtual void setMasksToBounds(bool) = 0;
+ virtual bool masksToBounds() const = 0;
- WEBKIT_EXPORT void setMaskLayer(const WebLayer&);
- WEBKIT_EXPORT void setReplicaLayer(const WebLayer&);
+ virtual void setMaskLayer(WebLayer*) = 0;
+ virtual void setReplicaLayer(WebLayer*) = 0;
- WEBKIT_EXPORT void setOpacity(float);
- WEBKIT_EXPORT float opacity() const;
+ virtual void setOpacity(float) = 0;
+ virtual float opacity() const = 0;
- WEBKIT_EXPORT void setOpaque(bool);
- WEBKIT_EXPORT bool opaque() const;
+ virtual void setOpaque(bool) = 0;
+ virtual bool opaque() const = 0;
- WEBKIT_EXPORT void setPosition(const WebFloatPoint&);
- WEBKIT_EXPORT WebFloatPoint position() const;
+ virtual void setPosition(const WebFloatPoint&) = 0;
+ virtual WebFloatPoint position() const = 0;
- WEBKIT_EXPORT void setSublayerTransform(const SkMatrix44&);
- WEBKIT_EXPORT void setSublayerTransform(const WebTransformationMatrix&);
- WEBKIT_EXPORT SkMatrix44 sublayerTransform() const;
+ virtual void setSublayerTransform(const SkMatrix44&) = 0;
+ virtual void setSublayerTransform(const WebTransformationMatrix&) = 0;
+ virtual SkMatrix44 sublayerTransform() const = 0;
- WEBKIT_EXPORT void setTransform(const SkMatrix44&);
- WEBKIT_EXPORT void setTransform(const WebTransformationMatrix&);
- WEBKIT_EXPORT SkMatrix44 transform() const;
+ virtual void setTransform(const SkMatrix44&) = 0;
+ virtual void setTransform(const WebTransformationMatrix&) = 0;
+ virtual SkMatrix44 transform() const = 0;
// Sets whether the layer draws its content when compositing.
- WEBKIT_EXPORT void setDrawsContent(bool);
- WEBKIT_EXPORT bool drawsContent() const;
+ virtual void setDrawsContent(bool) = 0;
+ virtual bool drawsContent() const = 0;
- WEBKIT_EXPORT void setPreserves3D(bool);
+ virtual void setPreserves3D(bool) = 0;
// Mark that this layer should use its parent's transform and double-sided
// properties in determining this layer's backface visibility instead of
// Note: This API is to work around issues with visibility the handling of
// WebKit layers that have a contents layer (canvas, plugin, WebGL, video,
// etc).
- WEBKIT_EXPORT void setUseParentBackfaceVisibility(bool);
+ virtual void setUseParentBackfaceVisibility(bool) = 0;
- WEBKIT_EXPORT void setBackgroundColor(WebColor);
+ virtual void setBackgroundColor(WebColor) = 0;
// Clear the filters in use by passing in a newly instantiated
// WebFilterOperations object.
- WEBKIT_EXPORT void setFilters(const WebFilterOperations&);
+ virtual void setFilters(const WebFilterOperations&) = 0;
// Apply filters to pixels that show through the background of this layer.
// Note: These filters are only possible on layers that are drawn directly
// to a root render surface with an opaque background. This means if an
// ancestor of the background-filtered layer sets certain properties
// (opacity, transforms), it may conflict and hide the background filters.
- WEBKIT_EXPORT void setBackgroundFilters(const WebFilterOperations&);
+ virtual void setBackgroundFilters(const WebFilterOperations&) = 0;
- WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
- WEBKIT_EXPORT void setDebugBorderWidth(float);
- WEBKIT_EXPORT void setDebugName(WebString);
+ virtual void setDebugBorderColor(const WebColor&) = 0;
+ virtual void setDebugBorderWidth(float) = 0;
+ virtual void setDebugName(WebString) = 0;
// An animation delegate is notified when animations are started and
// stopped. The WebLayer does not take ownership of the delegate, and it is
// the responsibility of the client to reset the layer's delegate before
// deleting the delegate.
- WEBKIT_EXPORT void setAnimationDelegate(WebAnimationDelegate*);
+ virtual void setAnimationDelegate(WebAnimationDelegate*) = 0;
// Returns false if the animation cannot be added.
- WEBKIT_EXPORT bool addAnimation(WebAnimation*);
+ virtual bool addAnimation(WebAnimation*) = 0;
// Removes all animations with the given id.
- WEBKIT_EXPORT void removeAnimation(int animationId);
+ virtual void removeAnimation(int animationId) = 0;
// Removes all animations with the given id targeting the given property.
- WEBKIT_EXPORT void removeAnimation(int animationId, WebAnimation::TargetProperty);
+ virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) = 0;
// Pauses all animations with the given id.
- WEBKIT_EXPORT void pauseAnimation(int animationId, double timeOffset);
+ virtual void pauseAnimation(int animationId, double timeOffset) = 0;
// The following functions suspend and resume all animations. The given time
// is assumed to use the same time base as monotonicallyIncreasingTime().
- WEBKIT_EXPORT void suspendAnimations(double monotonicTime);
- WEBKIT_EXPORT void resumeAnimations(double monotonicTime);
+ virtual void suspendAnimations(double monotonicTime) = 0;
+ virtual void resumeAnimations(double monotonicTime) = 0;
// Returns true if this layer has any active animations - useful for tests.
- WEBKIT_EXPORT bool hasActiveAnimation();
+ virtual bool hasActiveAnimation() = 0;
// Transfers all animations running on the current layer.
- WEBKIT_EXPORT void transferAnimationsTo(WebLayer*);
+ virtual void transferAnimationsTo(WebLayer*) = 0;
+
+ // Scrolling
+ virtual void setScrollPosition(WebPoint) = 0;
+ virtual void setScrollable(bool) = 0;
+ virtual void setHaveWheelEventHandlers(bool) = 0;
+ virtual void setShouldScrollOnMainThread(bool) = 0;
+ virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) = 0;
+ virtual void setIsContainerForFixedPositionLayers(bool) = 0;
+ virtual void setFixedToContainerLayer(bool) = 0;
// Forces this layer to use a render surface. There is no benefit in doing
// so, but this is to facilitate benchmarks and tests.
- WEBKIT_EXPORT void setForceRenderSurface(bool);
-
- // Drops this layer's render surface, if it has one. Used to break cycles in some
- // cases - if you aren't sure, you don't need to call this.
- WEBKIT_EXPORT void clearRenderSurface();
-
- template<typename T> T to()
- {
- T res;
- res.WebLayer::assign(*this);
- return res;
- }
-
- template<typename T> const T toConst() const
- {
- T res;
- res.WebLayer::assign(*this);
- return res;
- }
-
-#if WEBKIT_IMPLEMENTATION
- WebLayer(const WTF::PassRefPtr<WebCore::LayerChromium>&);
- WebLayer& operator=(const WTF::PassRefPtr<WebCore::LayerChromium>&);
- operator WTF::PassRefPtr<WebCore::LayerChromium>() const;
- template<typename T> T* unwrap() const
- {
- return static_cast<T*>(m_private.get());
- }
-
- template<typename T> const T* constUnwrap() const
- {
- return static_cast<const T*>(m_private.get());
- }
-#endif
-
-protected:
- WebPrivatePtr<WebCore::LayerChromium> m_private;
+ virtual void setForceRenderSurface(bool) = 0;
};
-inline bool operator==(const WebLayer& a, const WebLayer& b)
-{
- return a.equals(b);
-}
-
-inline bool operator!=(const WebLayer& a, const WebLayer& b)
-{
- return !(a == b);
-}
-
} // namespace WebKit
#endif // WebLayer_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebScrollableLayer_h
-#define WebScrollableLayer_h
-
-#include "WebCommon.h"
-#include "WebLayer.h"
-#include "WebPoint.h"
-#include "WebRect.h"
-#include "WebVector.h"
-
-namespace WebKit {
-
-class WebScrollableLayer : public WebLayer {
-public:
- WebScrollableLayer() { }
- WebScrollableLayer(const WebScrollableLayer& layer) : WebLayer(layer) { }
- virtual ~WebScrollableLayer() { }
- WebScrollableLayer& operator=(const WebScrollableLayer& layer)
- {
- WebLayer::assign(layer);
- return *this;
- }
-
- WEBKIT_EXPORT void setScrollPosition(WebPoint);
- WEBKIT_EXPORT void setScrollable(bool);
- WEBKIT_EXPORT void setHaveWheelEventHandlers(bool);
- WEBKIT_EXPORT void setShouldScrollOnMainThread(bool);
- WEBKIT_EXPORT void setNonFastScrollableRegion(const WebVector<WebRect>&);
- WEBKIT_EXPORT void setIsContainerForFixedPositionLayers(bool);
- WEBKIT_EXPORT void setFixedToContainerLayer(bool);
-
-
-#if WEBKIT_IMPLEMENTATION
- WebScrollableLayer(const WTF::PassRefPtr<WebCore::LayerChromium>& layer) : WebLayer(layer) { }
-#endif
-};
-
-} // namespace WebKit
-
-#endif // WebScrollableLayer_h
namespace WebCore {
class Scrollbar;
-class ScrollbarLayerChromium;
}
namespace WebKit {
-class WebScrollbarLayer : public WebLayer {
+class WebScrollbarLayer {
public:
- WebScrollbarLayer() { }
- WebScrollbarLayer(const WebScrollbarLayer& layer) : WebLayer(layer) { }
virtual ~WebScrollbarLayer() { }
- WebScrollbarLayer& operator=(const WebScrollbarLayer& layer)
- {
- WebLayer::assign(layer);
- return *this;
- }
- WEBKIT_EXPORT void setScrollLayer(const WebLayer);
+ virtual WebLayer* layer() = 0;
+
+ virtual void setScrollLayer(WebLayer*) = 0;
#if WEBKIT_IMPLEMENTATION
- static WebScrollbarLayer create(WebCore::Scrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>);
- explicit WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
- WebScrollbarLayer& operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
- operator WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>() const;
+ WEBKIT_EXPORT static WebScrollbarLayer* create(WebCore::Scrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>);
#endif
};
#ifndef WebSolidColorLayer_h
#define WebSolidColorLayer_h
+#include "WebColor.h"
#include "WebCommon.h"
-#include "WebFloatRect.h"
-#include "WebLayer.h"
namespace WebKit {
-class WebSolidColorLayerImpl;
+class WebLayer;
-class WebSolidColorLayer : public WebLayer {
+class WebSolidColorLayer {
public:
- WEBKIT_EXPORT static WebSolidColorLayer create();
- WEBKIT_EXPORT void setBackgroundColor(const WebColor&);
+ WEBKIT_EXPORT static WebSolidColorLayer* create();
-#if WEBKIT_IMPLEMENTATION
- WebSolidColorLayer(const WTF::PassRefPtr<WebSolidColorLayerImpl>&);
-#endif
+ virtual ~WebSolidColorLayer() { }
+
+ virtual WebLayer* layer() = 0;
+ virtual void setBackgroundColor(WebColor) = 0;
};
} // namespace WebKit
#include "WebCommon.h"
#include "WebLayer.h"
-namespace WebCore {
-class VideoLayerChromium;
-}
-
namespace WebKit {
class WebVideoFrameProvider;
-class WebVideoLayer : public WebLayer {
+class WebVideoLayer {
public:
- WEBKIT_EXPORT static WebVideoLayer create(WebVideoFrameProvider*);
+ WEBKIT_EXPORT static WebVideoLayer* create(WebVideoFrameProvider*);
- WebVideoLayer() { }
virtual ~WebVideoLayer() { }
- // Returns true if this layer is actively rendering (e.g. currently attached to a WebLayerTreeView).
- WEBKIT_EXPORT bool active() const;
+ virtual WebLayer* layer() = 0;
-#if WEBKIT_IMPLEMENTATION
- explicit WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium>);
-#endif
+ // Returns true if this layer is actively rendering (e.g. currently attached to a WebLayerTreeView).
+ virtual bool active() const = 0;
};
} // namespace WebKit
+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
+
+ Crashes already fixed downstream
+
+ * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+ (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
+ (ScrollingCoordinatorPrivate):
+ (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+ (WebCore::scrollableLayerForGraphicsLayer):
+ (WebCore):
+ (WebCore::createScrollbarLayer):
+ (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::setScrollLayer):
+ (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
+ (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
+ (WebCore::ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers):
+ (WebCore::ScrollingCoordinator::setLayerIsFixedToContainerLayer):
+ * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+ (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::prepareForDraw):
+ (WebCore::Canvas2DLayerBridge::layer):
+ (WebCore::Canvas2DLayerBridge::contextAcquired):
+ * platform/graphics/chromium/Canvas2DLayerBridge.h:
+ (Canvas2DLayerBridge):
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::layer):
+ (DrawingBufferPrivate):
+ * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+ (WebCore::GraphicsLayerChromium::GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::updateNames):
+ (WebCore::GraphicsLayerChromium::removeFromParent):
+ (WebCore::GraphicsLayerChromium::setSize):
+ (WebCore::GraphicsLayerChromium::clearBackgroundColor):
+ (WebCore::GraphicsLayerChromium::setContentsOpaque):
+ (WebCore::GraphicsLayerChromium::setFilters):
+ (WebCore::GraphicsLayerChromium::setBackgroundFilters):
+ (WebCore::GraphicsLayerChromium::setMaskLayer):
+ (WebCore::GraphicsLayerChromium::setBackfaceVisibility):
+ (WebCore::GraphicsLayerChromium::setOpacity):
+ (WebCore::GraphicsLayerChromium::setReplicatedByLayer):
+ (WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplayInRect):
+ (WebCore::GraphicsLayerChromium::setContentsToImage):
+ (WebCore::GraphicsLayerChromium::setContentsToCanvas):
+ (WebCore):
+ (WebCore::GraphicsLayerChromium::setContentsToMedia):
+ (WebCore::GraphicsLayerChromium::setContentsTo):
+ (WebCore::GraphicsLayerChromium::addAnimation):
+ (WebCore::GraphicsLayerChromium::pauseAnimation):
+ (WebCore::GraphicsLayerChromium::removeAnimation):
+ (WebCore::GraphicsLayerChromium::suspendAnimations):
+ (WebCore::GraphicsLayerChromium::resumeAnimations):
+ (WebCore::GraphicsLayerChromium::addLinkHighlight):
+ (WebCore::GraphicsLayerChromium::didFinishLinkHighlight):
+ (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):
+ (WebCore::GraphicsLayerChromium::contentLayer):
+ (GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::contentsLayer):
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::rootLayer):
+ * platform/graphics/chromium/LayerChromium.h:
+
2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r126076, r126099, and r126106.
#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>
using WebKit::WebLayer;
using WebKit::WebRect;
-using WebKit::WebScrollableLayer;
using WebKit::WebScrollbarLayer;
using WebKit::WebVector;
class ScrollingCoordinatorPrivate {
WTF_MAKE_NONCOPYABLE(ScrollingCoordinatorPrivate);
public:
- ScrollingCoordinatorPrivate() { }
+ ScrollingCoordinatorPrivate()
+ : m_scrollLayer(0)
+ {
+ }
+
~ScrollingCoordinatorPrivate() { }
- void setScrollLayer(WebScrollableLayer layer)
+ void setScrollLayer(WebLayer* layer)
{
m_scrollLayer = layer;
- if (!m_horizontalScrollbarLayer.isNull())
- m_horizontalScrollbarLayer.setScrollLayer(layer);
- if (!m_verticalScrollbarLayer.isNull())
- m_verticalScrollbarLayer.setScrollLayer(layer);
+ if (m_horizontalScrollbarLayer)
+ m_horizontalScrollbarLayer->setScrollLayer(layer);
+ if (m_verticalScrollbarLayer)
+ m_verticalScrollbarLayer->setScrollLayer(layer);
}
- void setHorizontalScrollbarLayer(WebScrollbarLayer layer)
+ void setHorizontalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
{
m_horizontalScrollbarLayer = layer;
}
- void setVerticalScrollbarLayer(WebScrollbarLayer layer)
+ void setVerticalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
{
m_verticalScrollbarLayer = layer;
}
- bool hasScrollLayer() const { return !m_scrollLayer.isNull(); }
- WebScrollableLayer scrollLayer() const { return m_scrollLayer; }
+ WebLayer* scrollLayer() const { return m_scrollLayer; }
private:
- WebScrollableLayer m_scrollLayer;
- WebScrollbarLayer m_horizontalScrollbarLayer;
- WebScrollbarLayer m_verticalScrollbarLayer;
+ WebLayer* m_scrollLayer;
+ OwnPtr<WebScrollbarLayer> m_horizontalScrollbarLayer;
+ OwnPtr<WebScrollbarLayer> m_verticalScrollbarLayer;
};
PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
#endif
}
-static WebScrollbarLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollableLayer scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
+static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer)
+{
+ return layer->platformLayer();
+}
+
+static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar, WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
{
ASSERT(scrollbar);
ASSERT(scrollbarGraphicsLayer);
- if (scrollLayer.isNull()) {
+ if (!scrollLayer) {
// FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves.
- scrollLayer = scrollLayerForFrameView(frameView)->platformLayer()->to<WebScrollableLayer>();
- ASSERT(!scrollLayer.isNull());
+ scrollLayer = scrollableLayerForGraphicsLayer(scrollLayerForFrameView(frameView));
+ ASSERT(scrollLayer);
}
// Root layer non-overlay scrollbars should be marked opaque to disable
if (!platformSupported || scrollbar->isCustomScrollbar()) {
scrollbarGraphicsLayer->setContentsToMedia(0);
scrollbarGraphicsLayer->setDrawsContent(true);
- return WebScrollbarLayer();
+ return nullptr;
}
// All Chromium scrollbar themes derive from ScrollbarThemeComposite.
WebKit::WebScrollbarThemePainter painter(themeComposite, scrollbar);
OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarThemeGeometryNative::create(themeComposite));
- WebScrollbarLayer scrollbarLayer = WebScrollbarLayer::create(scrollbar, painter, geometry.release());
- scrollbarLayer.setScrollLayer(scrollLayer);
+ OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebScrollbarLayer::create(scrollbar, painter, geometry.release()));
+ scrollbarLayer->setScrollLayer(scrollLayer);
- scrollbarGraphicsLayer->setContentsToMedia(&scrollbarLayer);
+ scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer->layer());
scrollbarGraphicsLayer->setDrawsContent(false);
- scrollbarLayer.setOpaque(scrollbarGraphicsLayer->contentsOpaque());
+ scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaque());
- return scrollbarLayer;
+ return scrollbarLayer.release();
}
void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)
if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
return;
+ setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView));
}
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)
{
- WebScrollableLayer layer;
- if (scrollLayer)
- layer = scrollLayer->platformLayer()->to<WebScrollableLayer>();
- m_private->setScrollLayer(layer);
+ m_private->setScrollLayer(scrollLayer ? scrollableLayerForGraphicsLayer(scrollLayer) : 0);
}
void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region)
{
- if (m_private->hasScrollLayer()) {
+ // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
+ setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
+ if (m_private->scrollLayer()) {
Vector<IntRect> rects = region.rects();
WebVector<WebRect> webRects(rects.size());
for (size_t i = 0; i < rects.size(); ++i)
webRects[i] = rects[i];
- m_private->scrollLayer().setNonFastScrollableRegion(webRects);
+ m_private->scrollLayer()->setNonFastScrollableRegion(webRects);
}
}
void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
{
- if (m_private->hasScrollLayer())
- m_private->scrollLayer().setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
+ // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
+ setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
+ if (m_private->scrollLayer())
+ m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
}
void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
{
- if (m_private->hasScrollLayer())
- m_private->scrollLayer().setShouldScrollOnMainThread(should);
+ // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
+ setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
+ if (m_private->scrollLayer())
+ m_private->scrollLayer()->setShouldScrollOnMainThread(should);
}
bool ScrollingCoordinator::supportsFixedPositionLayers() const
void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer* layer, bool enable)
{
- if (WebLayer* platformLayer = layer->platformLayer())
- platformLayer->to<WebScrollableLayer>().setIsContainerForFixedPositionLayers(enable);
+ if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
+ scrollableLayer->setIsContainerForFixedPositionLayers(enable);
}
void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable)
{
- if (WebLayer* platformLayer = layer->platformLayer())
- platformLayer->to<WebScrollableLayer>().setFixedToContainerLayer(enable);
+ if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
+ scrollableLayer->setFixedToContainerLayer(enable);
}
}
grContext->resetContext();
}
- m_layer = WebExternalTextureLayer::create(this);
- m_layer.setTextureId(textureId);
- m_layer.setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
+ m_layer = adoptPtr(WebExternalTextureLayer::create(this));
+ m_layer->setTextureId(textureId);
+ m_layer->setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
}
Canvas2DLayerBridge::~Canvas2DLayerBridge()
{
if (SkDeferredCanvas* deferred = deferredCanvas())
deferred->setNotificationClient(0);
- 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()
{
ASSERT(deferredCanvas());
if (!m_useDoubleBuffering)
- m_layer.willModifyTexture();
+ m_layer->willModifyTexture();
m_context->makeContextCurrent();
}
WebKit::WebLayer* Canvas2DLayerBridge::layer()
{
- return &m_layer;
+ return m_layer->layer();
}
void Canvas2DLayerBridge::contextAcquired()
{
if (m_deferralMode == NonDeferred && !m_useDoubleBuffering)
- m_layer.willModifyTexture();
+ m_layer->willModifyTexture();
}
unsigned Canvas2DLayerBridge::backBufferTexture()
unsigned m_backBufferTexture;
IntSize m_size;
SkCanvas* m_canvas;
- WebKit::WebExternalTextureLayer m_layer;
+ OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
RefPtr<GraphicsContext3D> m_context;
};
public:
explicit DrawingBufferPrivate(DrawingBuffer* drawingBuffer)
: m_drawingBuffer(drawingBuffer)
- , m_layer(WebKit::WebExternalTextureLayer::create(this))
+ , m_layer(adoptPtr(WebKit::WebExternalTextureLayer::create(this)))
{
GraphicsContext3D::Attributes attributes = m_drawingBuffer->graphicsContext3D()->getContextAttributes();
- 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
return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_drawingBuffer->graphicsContext3D());
}
- WebKit::WebLayer* layer() { return &m_layer; }
+ WebKit::WebLayer* layer() { return m_layer->layer(); }
private:
DrawingBuffer* m_drawingBuffer;
- WebKit::WebExternalTextureLayer m_layer;
+ OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
};
#if USE(ACCELERATED_COMPOSITING)
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 = WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get());
- m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
+ m_layer = adoptPtr(WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get()));
+ m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
if (client)
deviceOrPageScaleFactorChanged();
updateDebugIndicators();
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;
void GraphicsLayerChromium::updateNames()
{
- if (!m_layer.isNull()) {
- String debugName = "Layer for " + m_nameBase;
- m_layer.setDebugName(debugName);
- }
- if (!m_transformLayer.isNull()) {
+ String debugName = "Layer for " + m_nameBase;
+ m_layer->layer()->setDebugName(debugName);
+
+ if (m_transformLayer) {
String debugName = "TransformLayer for " + m_nameBase;
- m_transformLayer.setDebugName(debugName);
+ m_transformLayer->setDebugName(debugName);
}
- if (!m_contentsLayer.isNull()) {
+ if (m_contentsLayer) {
String debugName = "ContentsLayer for " + m_nameBase;
- m_contentsLayer.setDebugName(debugName);
- }
- if (m_linkHighlight) {
- String debugName = "LinkHighlight for " + m_nameBase;
- m_linkHighlight->contentLayer()->setDebugName(debugName);
+ m_contentsLayer->setDebugName(debugName);
}
}
void GraphicsLayerChromium::removeFromParent()
{
GraphicsLayer::removeFromParent();
- primaryLayer().removeFromParent();
+ platformLayer()->removeFromParent();
}
void GraphicsLayerChromium::setPosition(const FloatPoint& point)
GraphicsLayer::setSize(clampedSize);
updateLayerSize();
- if (m_pageScaleChanged && !m_layer.isNull())
- m_layer.invalidate();
+ if (m_pageScaleChanged)
+ m_layer->layer()->invalidate();
m_pageScaleChanged = false;
}
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.setOpaque(m_contentsOpaque);
+ m_layer->layer()->setOpaque(m_contentsOpaque);
}
static bool copyWebCoreFilterOperationsToWebFilterOperations(const FilterOperations& filters, WebFilterOperations& webFilters)
if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters)) {
// Make sure the filters are removed from the platform layer, as they are
// going to fallback to software mode.
- m_layer.setFilters(WebFilterOperations());
+ m_layer->layer()->setFilters(WebFilterOperations());
GraphicsLayer::setFilters(FilterOperations());
return false;
}
- m_layer.setFilters(webFilters);
+ m_layer->layer()->setFilters(webFilters);
return GraphicsLayer::setFilters(filters);
}
WebFilterOperations webFilters;
if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
return;
- m_layer.setBackgroundFilters(webFilters);
+ m_layer->layer()->setBackgroundFilters(webFilters);
}
void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
GraphicsLayer::setMaskLayer(maskLayer);
- WebLayer maskWebLayer;
- if (m_maskLayer)
- maskWebLayer = *m_maskLayer->platformLayer();
- m_layer.setMaskLayer(maskWebLayer);
+ WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0;
+ m_layer->layer()->setMaskLayer(maskWebLayer);
}
void GraphicsLayerChromium::setBackfaceVisibility(bool visible)
{
GraphicsLayer::setBackfaceVisibility(visible);
- 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);
- primaryLayer().setOpacity(opacity);
+ platformLayer()->setOpacity(opacity);
}
void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
GraphicsLayerChromium* layerChromium = static_cast<GraphicsLayerChromium*>(layer);
GraphicsLayer::setReplicatedByLayer(layer);
- WebLayer webReplicaLayer;
- if (layerChromium)
- webReplicaLayer = layerChromium->primaryLayer();
- primaryLayer().setReplicaLayer(webReplicaLayer);
+ WebLayer* webReplicaLayer = layerChromium ? layerChromium->platformLayer() : 0;
+ platformLayer()->setReplicaLayer(webReplicaLayer);
}
void GraphicsLayerChromium::setContentsNeedsDisplay()
{
- if (!m_contentsLayer.isNull())
- m_contentsLayer.invalidate();
+ if (m_contentsLayer)
+ m_contentsLayer->invalidate();
}
void GraphicsLayerChromium::setNeedsDisplay()
{
if (drawsContent())
- m_layer.invalidate();
+ m_layer->layer()->invalidate();
}
void GraphicsLayerChromium::setNeedsDisplayInRect(const FloatRect& rect)
{
if (drawsContent())
- m_layer.invalidateRect(rect);
+ m_layer->layer()->invalidateRect(rect);
}
void GraphicsLayerChromium::setContentsRect(const IntRect& rect)
{
bool childrenChanged = false;
if (image) {
- if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForImage) {
- WebKit::WebImageLayer imageLayer = WebKit::WebImageLayer::create();
- setupContentsLayer(imageLayer);
+ if (m_contentsLayerPurpose != ContentsLayerForImage) {
+ m_imageLayer = adoptPtr(WebImageLayer::create());
+ setupContentsLayer(m_imageLayer->layer());
m_contentsLayerPurpose = ContentsLayerForImage;
childrenChanged = true;
}
- WebKit::WebImageLayer imageLayer = m_contentsLayer.to<WebKit::WebImageLayer>();
NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame();
- imageLayer.setBitmap(nativeImage->bitmap());
- imageLayer.setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
+ m_imageLayer->setBitmap(nativeImage->bitmap());
+ m_imageLayer->layer()->setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
updateContentsRect();
} else {
- if (!m_contentsLayer.isNull()) {
+ if (m_imageLayer) {
childrenChanged = true;
- // The old contents layer will be removed via updateChildList.
- m_contentsLayer.reset();
+ m_imageLayer.clear();
}
+ // The old contents layer will be removed via updateChildList.
+ m_contentsLayer = 0;
}
if (childrenChanged)
updateChildList();
}
-void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* platformLayer)
+void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* layer)
+{
+ setContentsTo(ContentsLayerForCanvas, layer);
+}
+
+void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
+{
+ setContentsTo(ContentsLayerForVideo, layer);
+}
+
+void GraphicsLayerChromium::setContentsTo(ContentsLayerPurpose purpose, WebKit::WebLayer* layer)
{
bool childrenChanged = false;
- if (platformLayer) {
- if (m_contentsLayer != *platformLayer) {
- setupContentsLayer(*platformLayer);
- m_contentsLayerPurpose = ContentsLayerForCanvas;
+ if (layer) {
+ if (m_contentsLayerId != layer->id()) {
+ setupContentsLayer(layer);
+ m_contentsLayerPurpose = purpose;
childrenChanged = true;
}
updateContentsRect();
} else {
- if (!m_contentsLayer.isNull()) {
+ if (m_contentsLayer) {
childrenChanged = true;
// The old contents layer will be removed via updateChildList.
- m_contentsLayer.reset();
+ m_contentsLayer = 0;
}
}
bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const Animation* animation, const String& animationName, double timeOffset)
{
- primaryLayer().setAnimationDelegate(this);
+ platformLayer()->setAnimationDelegate(this);
int animationId = mapAnimationNameToId(animationName);
int groupId = AnimationIdVendor::getNextGroupId();
if (toAdd) {
// Remove any existing animations with the same animation id and target property.
- primaryLayer().removeAnimation(animationId, toAdd->targetProperty());
- return primaryLayer().addAnimation(toAdd.get());
+ platformLayer()->removeAnimation(animationId, toAdd->targetProperty());
+ return platformLayer()->addAnimation(toAdd.get());
}
return false;
void GraphicsLayerChromium::pauseAnimation(const String& animationName, double timeOffset)
{
- primaryLayer().pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
+ platformLayer()->pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
}
void GraphicsLayerChromium::removeAnimation(const String& animationName)
{
- primaryLayer().removeAnimation(mapAnimationNameToId(animationName));
+ platformLayer()->removeAnimation(mapAnimationNameToId(animationName));
}
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();
- primaryLayer().suspendAnimations(monotonicTime);
+ platformLayer()->suspendAnimations(monotonicTime);
}
void GraphicsLayerChromium::resumeAnimations()
{
- primaryLayer().resumeAnimations(monotonicallyIncreasingTime());
+ platformLayer()->resumeAnimations(monotonicallyIncreasingTime());
}
-void GraphicsLayerChromium::addLinkHighlight(const Path& path)
+void GraphicsLayerChromium::addLinkHighlight(const 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 const_cast<PlatformLayer*>(m_transformLayer.isNull() ? &m_layer : &m_transformLayer);
+ return m_transformLayer ? m_transformLayer.get() : m_layer->layer();
}
void GraphicsLayerChromium::setDebugBackgroundColor(const Color& color)
{
if (color.isValid())
- m_layer.setBackgroundColor(color.rgb());
+ m_layer->layer()->setBackgroundColor(color.rgb());
else
- m_layer.setBackgroundColor(static_cast<RGBA32>(0));
+ m_layer->layer()->setBackgroundColor(static_cast<RGBA32>(0));
}
void GraphicsLayerChromium::setDebugBorder(const Color& color, float borderWidth)
{
if (color.isValid()) {
- m_layer.setDebugBorderColor(color.rgb());
- m_layer.setDebugBorderWidth(borderWidth);
+ m_layer->layer()->setDebugBorderColor(color.rgb());
+ m_layer->layer()->setDebugBorderWidth(borderWidth);
} else {
- m_layer.setDebugBorderColor(static_cast<RGBA32>(0));
- m_layer.setDebugBorderWidth(0);
+ m_layer->layer()->setDebugBorderColor(static_cast<RGBA32>(0));
+ m_layer->layer()->setDebugBorderWidth(0);
}
}
void GraphicsLayerChromium::updateChildList()
{
- Vector<WebLayer> newChildren;
+ Vector<WebLayer*> newChildren;
- if (!m_transformLayer.isNull()) {
+ if (m_transformLayer) {
// Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
- newChildren.append(m_layer);
- } else if (!m_contentsLayer.isNull()) {
+ newChildren.append(m_layer->layer());
+ } else if (m_contentsLayer) {
// FIXME: add the contents layer in the correct order with negative z-order children.
// This does not cause visible rendering issues because currently contents layers are only used
// for replaced elements that don't have children.
for (size_t i = 0; i < numChildren; ++i) {
GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);
- newChildren.append(curChild->primaryLayer());
+ newChildren.append(curChild->platformLayer());
}
- if (m_linkHighlight)
- 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.isNull()) {
- m_transformLayer.setChildren(newWebChildren);
+ if (m_transformLayer) {
+ m_transformLayer->setChildren(newWebChildren);
- if (!m_contentsLayer.isNull()) {
+ if (m_contentsLayer) {
// If we have a transform layer, then the contents layer is parented in the
// primary layer (which is itself a child of the transform layer).
- m_layer.removeAllChildren();
- m_layer.addChild(m_contentsLayer);
+ m_layer->layer()->removeAllChildren();
+ m_layer->layer()->addChild(m_contentsLayer);
}
} else
- m_layer.setChildren(newWebChildren);
+ m_layer->layer()->setChildren(newWebChildren);
}
void GraphicsLayerChromium::updateLayerPosition()
{
- primaryLayer().setPosition(m_position);
+ platformLayer()->setPosition(m_position);
}
void GraphicsLayerChromium::updateLayerSize()
{
IntSize layerSize(m_size.width(), m_size.height());
- if (!m_transformLayer.isNull()) {
- m_transformLayer.setBounds(layerSize);
- m_layer.setPosition(FloatPoint());
+ if (m_transformLayer) {
+ m_transformLayer->setBounds(layerSize);
+ m_layer->layer()->setPosition(FloatPoint());
}
- m_layer.setBounds(layerSize);
+ m_layer->layer()->setBounds(layerSize);
- // Note that we don't resize m_contentsLayer. It's up the caller to do that.
+ // Note that we don't resize m_contentsLayer-> It's up the caller to do that.
}
void GraphicsLayerChromium::updateAnchorPoint()
{
- primaryLayer().setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
- primaryLayer().setAnchorPointZ(m_anchorPoint.z());
+ platformLayer()->setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
+ platformLayer()->setAnchorPointZ(m_anchorPoint.z());
}
void GraphicsLayerChromium::updateTransform()
{
- primaryLayer().setTransform(WebTransformationMatrix(m_transform));
+ platformLayer()->setTransform(WebTransformationMatrix(m_transform));
}
void GraphicsLayerChromium::updateChildrenTransform()
{
- primaryLayer().setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
+ platformLayer()->setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
}
void GraphicsLayerChromium::updateMasksToBounds()
{
- m_layer.setMasksToBounds(m_masksToBounds);
+ m_layer->layer()->setMasksToBounds(m_masksToBounds);
updateDebugIndicators();
}
void GraphicsLayerChromium::updateLayerPreserves3D()
{
- if (m_preserves3D && m_transformLayer.isNull()) {
+ if (m_preserves3D && !m_transformLayer) {
// Create the transform layer.
- m_transformLayer = WebLayer::create();
- m_transformLayer.setPreserves3D(true);
- m_transformLayer.setAnimationDelegate(this);
- m_layer.transferAnimationsTo(&m_transformLayer);
+ m_transformLayer = adoptPtr(WebLayer::create());
+ m_transformLayer->setPreserves3D(true);
+ m_transformLayer->setAnimationDelegate(this);
+ m_layer->layer()->transferAnimationsTo(m_transformLayer.get());
// Copy the position from this layer.
updateLayerPosition();
updateTransform();
updateChildrenTransform();
- m_layer.setPosition(FloatPoint::zero());
+ m_layer->layer()->setPosition(FloatPoint::zero());
- m_layer.setAnchorPoint(FloatPoint(0.5f, 0.5f));
- m_layer.setTransform(SkMatrix44());
+ m_layer->layer()->setAnchorPoint(FloatPoint(0.5f, 0.5f));
+ m_layer->layer()->setTransform(SkMatrix44());
// Set the old layer to opacity of 1. Further down we will set the opacity on the transform layer.
- m_layer.setOpacity(1);
+ m_layer->layer()->setOpacity(1);
- m_layer.setContentsScale(contentsScale());
+ m_layer->setContentsScale(contentsScale());
// Move this layer to be a child of the transform layer.
if (parent())
- parent()->platformLayer()->replaceChild(m_layer, m_transformLayer);
- m_transformLayer.addChild(m_layer);
+ parent()->platformLayer()->replaceChild(m_layer->layer(), m_transformLayer.get());
+ m_transformLayer->addChild(m_layer->layer());
updateChildList();
- } else if (!m_preserves3D && !m_transformLayer.isNull()) {
+ } else if (m_preserves3D && !m_transformLayer) {
// Relace the transformLayer in the parent with this layer.
- m_layer.removeFromParent();
+ m_layer->layer()->removeFromParent();
if (parent())
- parent()->platformLayer()->replaceChild(m_transformLayer, m_layer);
+ parent()->platformLayer()->replaceChild(m_transformLayer.get(), m_layer->layer());
- m_layer.setAnimationDelegate(this);
- m_transformLayer.transferAnimationsTo(&m_layer);
+ m_layer->layer()->setAnimationDelegate(this);
+ m_transformLayer->transferAnimationsTo(m_layer->layer());
// Release the transform layer.
- m_transformLayer.setAnimationDelegate(0);
- m_transformLayer.reset();
+ m_transformLayer->setAnimationDelegate(0);
+ m_transformLayer.clear();
updateLayerPosition();
updateLayerSize();
updateChildList();
}
- m_layer.setPreserves3D(m_preserves3D);
- primaryLayer().setOpacity(m_opacity);
+ m_layer->layer()->setPreserves3D(m_preserves3D);
+ platformLayer()->setOpacity(m_opacity);
updateNames();
}
void GraphicsLayerChromium::updateLayerIsDrawable()
{
// For the rest of the accelerated compositor code, there is no reason to make a
- // distinction between drawsContent and contentsVisible. So, for m_layer, these two
+ // distinction between drawsContent and contentsVisible. So, for m_layer->layer(), these two
// flags are combined here. m_contentsLayer shouldn't receive the drawsContent flag
// so it is only given contentsVisible.
- m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
+ m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
- if (!m_contentsLayer.isNull())
- m_contentsLayer.setDrawsContent(m_contentsVisible);
+ if (m_contentsLayer)
+ m_contentsLayer->setDrawsContent(m_contentsVisible);
if (m_drawsContent)
- m_layer.invalidate();
+ m_layer->layer()->invalidate();
updateDebugIndicators();
}
void GraphicsLayerChromium::updateLayerBackgroundColor()
{
- if (m_contentsLayer.isNull())
+ if (!m_contentsLayer)
return;
// We never create the contents layer just for background color yet.
if (m_backgroundColorSet)
- 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()
void GraphicsLayerChromium::updateContentsRect()
{
- if (m_contentsLayer.isNull())
+ if (!m_contentsLayer)
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() || m_layer.isNull())
+ if (appliesPageScale())
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.isNull()) {
- m_contentsLayer.setAnchorPoint(FloatPoint(0, 0));
- m_contentsLayer.setUseParentBackfaceVisibility(true);
+ if (m_contentsLayer) {
+ m_contentsLayer->setAnchorPoint(FloatPoint(0, 0));
+ m_contentsLayer->setUseParentBackfaceVisibility(true);
// It is necessary to call setDrawsContent as soon as we receive the new contentsLayer, for
// the correctness of early exit conditions in setDrawsContent() and setContentsVisible().
- 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.insertChild(m_contentsLayer, 0);
+ m_layer->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();
#include <public/WebAnimationDelegate.h>
#include <public/WebContentLayer.h>
+#include <public/WebImageLayer.h>
#include <public/WebLayer.h>
#include <wtf/HashMap.h>
virtual void setContentsToImage(Image*);
virtual void setContentsToMedia(PlatformLayer*);
virtual void setContentsToCanvas(PlatformLayer*);
- virtual bool hasContentsLayer() const { return !m_contentsLayer.isNull(); }
+ virtual bool hasContentsLayer() const { return m_contentsLayer; }
virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String&, double timeOffset);
virtual void pauseAnimation(const String& animationName, double timeOffset);
virtual 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();
void updateContentsRect();
void updateContentsScale();
- void setupContentsLayer(WebKit::WebLayer);
+ enum ContentsLayerPurpose {
+ NoContentsLayer = 0,
+ ContentsLayerForImage,
+ ContentsLayerForVideo,
+ ContentsLayerForCanvas,
+ };
+
+ void setContentsTo(ContentsLayerPurpose, WebKit::WebLayer*);
+ void setupContentsLayer(WebKit::WebLayer*);
int mapAnimationNameToId(const String& animationName);
String m_nameBase;
- WebKit::WebContentLayer m_layer;
- WebKit::WebLayer m_transformLayer;
- WebKit::WebLayer m_contentsLayer;
+ OwnPtr<WebKit::WebContentLayer> m_layer;
+ OwnPtr<WebKit::WebLayer> m_transformLayer;
+ OwnPtr<WebKit::WebImageLayer> m_imageLayer;
+ WebKit::WebLayer* m_contentsLayer;
+ // We don't have ownership of m_contentsLayer, but we do want to know if a given layer is the
+ // same as our current layer in setContentsTo(). Since m_contentsLayer may be deleted at this point,
+ // we stash an ID away when we know m_contentsLayer is alive and use that for comparisons from that point
+ // on.
+ int m_contentsLayerId;
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;
};
setNeedsCommit();
}
-const LayerChromium* LayerChromium::rootLayer() const
+LayerChromium* LayerChromium::rootLayer()
{
- const LayerChromium* layer = this;
- for (LayerChromium* parent = layer->parent(); parent; layer = parent, parent = parent->parent()) { }
+ LayerChromium* layer = this;
+ while (layer->parent())
+ layer = layer->parent();
return layer;
}
// The root layer is a special case -- it operates in physical pixels.
virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; }
- const LayerChromium* rootLayer() const;
+ LayerChromium* rootLayer();
LayerChromium* parent() const;
void addChild(PassRefPtr<LayerChromium>);
void insertChild(PassRefPtr<LayerChromium>, size_t index);
+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
+
+ Crashes already fixed downstream
+
+ * WebKit.gypi:
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+ (WebKit::NonCompositedContentHost::setScrollLayer):
+ (WebKit::NonCompositedContentHost::setViewport):
+ (WebKit::NonCompositedContentHost::scrollLayer):
+ * src/NonCompositedContentHost.h:
+ * src/WebContentLayer.cpp: Removed.
+ * src/WebContentLayerImpl.cpp:
+ (WebKit::WebContentLayer::create):
+ (WebKit::WebContentLayerImpl::WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::~WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::layer):
+ (WebKit):
+ (WebKit::WebContentLayerImpl::setDoubleSided):
+ (WebKit::WebContentLayerImpl::setContentsScale):
+ (WebKit::WebContentLayerImpl::setUseLCDText):
+ (WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles):
+ (WebKit::WebContentLayerImpl::paintContents):
+ * src/WebContentLayerImpl.h:
+ (WebContentLayerImpl):
+ * src/WebExternalTextureLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp.
+ (WebKit):
+ (WebKit::WebExternalTextureLayer::create):
+ (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::layer):
+ (WebKit::WebExternalTextureLayerImpl::setTextureId):
+ (WebKit::WebExternalTextureLayerImpl::setFlipped):
+ (WebKit::WebExternalTextureLayerImpl::setUVRect):
+ (WebKit::WebExternalTextureLayerImpl::setOpaque):
+ (WebKit::WebExternalTextureLayerImpl::setPremultipliedAlpha):
+ (WebKit::WebExternalTextureLayerImpl::willModifyTexture):
+ (WebKit::WebExternalTextureLayerImpl::setRateLimitContext):
+ (WebTextureUpdaterImpl):
+ (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+ (WebKit::WebExternalTextureLayerImpl::prepareTexture):
+ (WebKit::WebExternalTextureLayerImpl::context):
+ * src/WebExternalTextureLayerImpl.h: Copied from Source/Platform/chromium/public/WebVideoLayer.h.
+ (WebKit):
+ (WebExternalTextureLayerImpl):
+ * src/WebIOSurfaceLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp.
+ (WebKit):
+ (WebKit::WebIOSurfaceLayer::create):
+ (WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl):
+ (WebKit::WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl):
+ (WebKit::WebIOSurfaceLayerImpl::setIOSurfaceProperties):
+ (WebKit::WebIOSurfaceLayerImpl::layer):
+ * src/WebIOSurfaceLayerImpl.h: Copied from Source/Platform/chromium/public/WebImageLayer.h.
+ (WebCore):
+ (WebKit):
+ (WebIOSurfaceLayerImpl):
+ * src/WebImageLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebSolidColorLayer.cpp.
+ (WebKit):
+ (WebKit::WebImageLayer::create):
+ (WebKit::WebImageLayerImpl::WebImageLayerImpl):
+ (WebKit::WebImageLayerImpl::~WebImageLayerImpl):
+ (WebKit::WebImageLayerImpl::layer):
+ (WebKit::WebImageLayerImpl::setBitmap):
+ * src/WebImageLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebImageLayer.cpp.
+ (WebCore):
+ (WebKit):
+ (WebImageLayerImpl):
+ * src/WebLayer.cpp: Removed.
+ * src/WebLayerImpl.cpp:
+ (WebKit::WebLayer::create):
+ (WebKit::WebLayerImpl::WebLayerImpl):
+ (WebKit::WebLayerImpl::~WebLayerImpl):
+ (WebKit):
+ (WebKit::WebLayerImpl::id):
+ (WebKit::WebLayerImpl::invalidateRect):
+ (WebKit::WebLayerImpl::invalidate):
+ (WebKit::WebLayerImpl::addChild):
+ (WebKit::WebLayerImpl::insertChild):
+ (WebKit::WebLayerImpl::replaceChild):
+ (WebKit::WebLayerImpl::setChildren):
+ (WebKit::WebLayerImpl::removeFromParent):
+ (WebKit::WebLayerImpl::removeAllChildren):
+ (WebKit::WebLayerImpl::setAnchorPoint):
+ (WebKit::WebLayerImpl::anchorPoint):
+ (WebKit::WebLayerImpl::setAnchorPointZ):
+ (WebKit::WebLayerImpl::anchorPointZ):
+ (WebKit::WebLayerImpl::setBounds):
+ (WebKit::WebLayerImpl::bounds):
+ (WebKit::WebLayerImpl::setMasksToBounds):
+ (WebKit::WebLayerImpl::masksToBounds):
+ (WebKit::WebLayerImpl::setMaskLayer):
+ (WebKit::WebLayerImpl::setReplicaLayer):
+ (WebKit::WebLayerImpl::setOpacity):
+ (WebKit::WebLayerImpl::opacity):
+ (WebKit::WebLayerImpl::setOpaque):
+ (WebKit::WebLayerImpl::opaque):
+ (WebKit::WebLayerImpl::setPosition):
+ (WebKit::WebLayerImpl::position):
+ (WebKit::WebLayerImpl::setSublayerTransform):
+ (WebKit::WebLayerImpl::sublayerTransform):
+ (WebKit::WebLayerImpl::setTransform):
+ (WebKit::WebLayerImpl::transform):
+ (WebKit::WebLayerImpl::setDrawsContent):
+ (WebKit::WebLayerImpl::drawsContent):
+ (WebKit::WebLayerImpl::setPreserves3D):
+ (WebKit::WebLayerImpl::setUseParentBackfaceVisibility):
+ (WebKit::WebLayerImpl::setBackgroundColor):
+ (WebKit::WebLayerImpl::setFilters):
+ (WebKit::WebLayerImpl::setBackgroundFilters):
+ (WebKit::WebLayerImpl::setDebugBorderColor):
+ (WebKit::WebLayerImpl::setDebugBorderWidth):
+ (WebKit::WebLayerImpl::setDebugName):
+ (WebKit::WebLayerImpl::setAnimationDelegate):
+ (WebKit::WebLayerImpl::addAnimation):
+ (WebKit::WebLayerImpl::removeAnimation):
+ (WebKit::WebLayerImpl::pauseAnimation):
+ (WebKit::WebLayerImpl::suspendAnimations):
+ (WebKit::WebLayerImpl::resumeAnimations):
+ (WebKit::WebLayerImpl::hasActiveAnimation):
+ (WebKit::WebLayerImpl::transferAnimationsTo):
+ (WebKit::WebLayerImpl::setForceRenderSurface):
+ (WebKit::WebLayerImpl::setScrollPosition):
+ (WebKit::WebLayerImpl::setScrollable):
+ (WebKit::WebLayerImpl::setHaveWheelEventHandlers):
+ (WebKit::WebLayerImpl::setShouldScrollOnMainThread):
+ (WebKit::WebLayerImpl::setNonFastScrollableRegion):
+ (WebKit::WebLayerImpl::setIsContainerForFixedPositionLayers):
+ (WebKit::WebLayerImpl::setFixedToContainerLayer):
+ (WebKit::WebLayerImpl::layer):
+ * src/WebLayerImpl.h:
+ (WebCore):
+ (WebLayerImpl):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::setRootLayer):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::create):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+ (WebKit::WebMediaPlayerClientImpl::repaint):
+ (WebKit::WebMediaPlayerClientImpl::setOpaque):
+ (WebKit::WebMediaPlayerClientImpl::platformLayer):
+ (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::setBackingTextureId):
+ (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+ (WebKit::WebPluginContainerImpl::commitBackingTexture):
+ (WebKit::WebPluginContainerImpl::setOpaque):
+ (WebKit::WebPluginContainerImpl::platformLayer):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+ * src/WebScrollableLayer.cpp: Removed.
+ * src/WebScrollbarLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayer.cpp.
+ (WebKit):
+ (WebKit::WebScrollbarLayer::create):
+ (WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl):
+ (WebKit::WebScrollbarLayerImpl::~WebScrollbarLayerImpl):
+ (WebKit::WebScrollbarLayerImpl::layer):
+ (WebKit::WebScrollbarLayerImpl::setScrollLayer):
+ * src/WebScrollbarLayerImpl.h: Copied from Source/WebKit/chromium/src/WebSolidColorLayerImpl.h.
+ (WebCore):
+ (WebKit):
+ (WebScrollbarLayerImpl):
+ * src/WebSolidColorLayerImpl.cpp:
+ (WebKit::WebSolidColorLayer::create):
+ (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
+ (WebKit::WebSolidColorLayerImpl::layer):
+ (WebKit):
+ (WebKit::WebSolidColorLayerImpl::setBackgroundColor):
+ * src/WebSolidColorLayerImpl.h:
+ (WebCore):
+ (WebKit):
+ (WebSolidColorLayerImpl):
+ * src/WebVideoLayerImpl.cpp: Copied from Source/WebKit/chromium/src/WebVideoLayer.cpp.
+ (WebKit):
+ (WebKit::WebVideoLayer::create):
+ (WebKit::WebVideoLayerImpl::WebVideoLayerImpl):
+ (WebKit::WebVideoLayerImpl::~WebVideoLayerImpl):
+ (WebKit::WebVideoLayerImpl::layer):
+ (WebKit::WebVideoLayerImpl::active):
+ * src/WebVideoLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebVideoLayer.cpp.
+ (WebCore):
+ (WebKit):
+ (WebVideoLayerImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::setRootGraphicsLayer):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit):
+ * src/WebViewImpl.h:
+ * tests/ImageLayerChromiumTest.cpp:
+ (WebCore::TEST):
+ * tests/WebLayerTest.cpp:
+ * tests/WebLayerTreeViewTest.cpp:
+
2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r126076, r126099, and r126106.
'src/WebAnimationImpl.h',
'src/WebCompositorInputHandlerImpl.cpp',
'src/WebCompositorInputHandlerImpl.h',
- 'src/WebContentLayer.cpp',
'src/WebContentLayerImpl.cpp',
'src/WebContentLayerImpl.h',
- 'src/WebExternalTextureLayer.cpp',
+ 'src/WebExternalTextureLayerImpl.cpp',
+ 'src/WebExternalTextureLayerImpl.h',
'src/WebFloatAnimationCurve.cpp',
- 'src/WebIOSurfaceLayer.cpp',
- 'src/WebImageLayer.cpp',
- 'src/WebLayer.cpp',
+ 'src/WebIOSurfaceLayerImpl.cpp',
+ 'src/WebIOSurfaceLayerImpl.h',
+ 'src/WebImageLayerImpl.cpp',
+ 'src/WebImageLayerImpl.h',
'src/WebLayerImpl.cpp',
'src/WebLayerImpl.h',
'src/WebLayerTreeView.cpp',
'src/WebLayerTreeViewImpl.cpp',
'src/WebLayerTreeViewImpl.h',
- 'src/WebScrollableLayer.cpp',
- 'src/WebScrollbarLayer.cpp',
- 'src/WebSolidColorLayer.cpp',
+ 'src/WebScrollbarLayerImpl.cpp',
+ 'src/WebScrollbarLayerImpl.h',
'src/WebSolidColorLayerImpl.cpp',
'src/WebSolidColorLayerImpl.h',
'src/WebTransformAnimationCurve.cpp',
- 'src/WebVideoLayer.cpp',
+ 'src/WebVideoLayerImpl.cpp',
+ 'src/WebVideoLayerImpl.h',
],
'conditions': [
#include "FloatPoint.h"
#include "FloatRect.h"
#include "GraphicsLayer.h"
+#include "GraphicsLayerChromium.h"
#include "PlatformContextSkia.h"
#include "WebViewImpl.h"
#include <public/WebContentLayer.h>
m_graphicsLayer->setName("non-composited content");
#endif
m_graphicsLayer->setDrawsContent(true);
- WebContentLayer layer = m_graphicsLayer->platformLayer()->to<WebContentLayer>();
- layer.setUseLCDText(true);
- layer.setOpaque(true);
+ WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer();
+ layer->setUseLCDText(true);
+ layer->layer()->setOpaque(true);
#if !OS(ANDROID)
- layer.setDrawCheckerboardForMissingTiles(true);
+ layer->setDrawCheckerboardForMissingTiles(true);
#endif
}
return;
}
- if (*layer->platformLayer() == scrollLayer())
+ if (layer->platformLayer() == scrollLayer())
return;
layer->addChildAtIndex(m_graphicsLayer.get(), 0);
bool visibleRectChanged = m_viewportSize != viewportSize;
m_viewportSize = viewportSize;
- WebScrollableLayer layer = scrollLayer();
- layer.setScrollPosition(scrollPosition + scrollOrigin);
- layer.setPosition(WebFloatPoint(-scrollPosition));
+ WebLayer* layer = scrollLayer();
+ layer->setScrollPosition(scrollPosition + scrollOrigin);
+ layer->setPosition(WebFloatPoint(-scrollPosition));
// Due to the possibility of pinch zoom, the noncomposited layer is always
// assumed to be scrollable.
- layer.setScrollable(true);
+ layer->setScrollable(true);
m_deviceScaleFactor = deviceScale;
m_graphicsLayer->deviceOrPageScaleFactorChanged();
m_graphicsLayer->setSize(contentsSize);
return m_graphicsLayer->parent();
}
-WebScrollableLayer NonCompositedContentHost::scrollLayer()
+WebLayer* NonCompositedContentHost::scrollLayer()
{
if (!m_graphicsLayer->parent())
- return WebScrollableLayer();
- return m_graphicsLayer->parent()->platformLayer()->to<WebScrollableLayer>();
+ return 0;
+ return m_graphicsLayer->parent()->platformLayer();
}
void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)
#include "GraphicsLayerClient.h"
#include "IntSize.h"
-#include <public/WebScrollableLayer.h>
+#include <public/WebLayer.h>
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; }
bool haveScrollLayer();
- WebScrollableLayer scrollLayer();
+ WebLayer* scrollLayer();
OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
WebViewImpl* m_webView;
#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 {
-PassRefPtr<WebContentLayerImpl> WebContentLayerImpl::create(WebContentLayerClient* contentClient)
+WebContentLayer* WebContentLayer::create(WebContentLayerClient* client)
{
- return adoptRef(new WebContentLayerImpl(contentClient));
+ return new WebContentLayerImpl(client);
}
-WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient)
- : ContentLayerChromium(this)
- , m_contentClient(contentClient)
+WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client)
+ : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this))))
+ , m_client(client)
{
- setIsDrawable(true);
+ m_webLayerImpl->layer()->setIsDrawable(true);
}
WebContentLayerImpl::~WebContentLayerImpl()
{
- clearDelegate();
+ static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate();
}
+WebLayer* WebContentLayerImpl::layer()
+{
+ return m_webLayerImpl.get();
+}
+
+void WebContentLayerImpl::setDoubleSided(bool doubleSided)
+{
+ m_webLayerImpl->layer()->setDoubleSided(doubleSided);
+}
+
+void WebContentLayerImpl::setContentsScale(float scale)
+{
+ m_webLayerImpl->layer()->setContentsScale(scale);
+}
+
+void WebContentLayerImpl::setUseLCDText(bool enable)
+{
+ m_webLayerImpl->layer()->setUseLCDText(enable);
+}
+
+void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable)
+{
+ m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable);
+}
+
+
void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque)
{
- if (!m_contentClient)
+ if (!m_client)
return;
WebFloatRect webOpaque;
- m_contentClient->paintContents(canvas, WebRect(clip), webOpaque);
+ m_client->paintContents(canvas, WebRect(clip), webOpaque);
opaque = webOpaque;
}
#define WebContentLayerImpl_h
#include "ContentLayerChromium.h"
+#include "WebLayerImpl.h"
+#include <public/WebContentLayer.h>
#include <wtf/PassRefPtr.h>
namespace WebKit {
class WebContentLayerClient;
-class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate {
+class WebContentLayerImpl : public WebContentLayer,
+ public WebCore::ContentLayerDelegate {
public:
- static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient);
+ explicit WebContentLayerImpl(WebContentLayerClient*);
+
+ // WebContentLayer implementation.
+ virtual WebLayer* layer() OVERRIDE;
+ virtual void setDoubleSided(bool) OVERRIDE;
+ virtual void setContentsScale(float) OVERRIDE;
+ virtual void setUseLCDText(bool) OVERRIDE;
+ virtual void setDrawCheckerboardForMissingTiles(bool) OVERRIDE;
protected:
- explicit WebContentLayerImpl(WebContentLayerClient* contentClient);
virtual ~WebContentLayerImpl();
// ContentLayerDelegate implementation.
virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE;
- WebContentLayerClient* m_contentClient;
+ OwnPtr<WebLayerImpl> m_webLayerImpl;
+ WebContentLayerClient* m_client;
bool m_drawsContent;
};
*/
#include "config.h"
-#include <public/WebExternalTextureLayer.h>
+#include "WebExternalTextureLayerImpl.h"
#include "CCTextureUpdateQueue.h"
#include "TextureLayerChromium.h"
+#include "WebLayerImpl.h"
#include <public/WebExternalTextureLayerClient.h>
#include <public/WebFloatRect.h>
#include <public/WebSize.h>
namespace WebKit {
-class WebTextureUpdaterImpl : public WebTextureUpdater {
-public:
- explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue)
- : m_queue(queue)
- {
- }
-
- virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
- {
- TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size };
- m_queue.appendCopy(copy);
- }
-
-private:
- CCTextureUpdateQueue& m_queue;
-};
-
-class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium {
-public:
- explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
- : TextureLayerChromium(client ? this : 0)
- , m_client(client)
- {
- }
-
- virtual unsigned prepareTexture(CCTextureUpdateQueue& queue) OVERRIDE
- {
- WebTextureUpdaterImpl updaterImpl(queue);
- return m_client->prepareTexture(updaterImpl);
- }
+WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
+{
+ return new WebExternalTextureLayerImpl(client);
+}
- virtual WebKit::WebGraphicsContext3D* context() OVERRIDE
- {
- return m_client->context();
- }
+WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
+ : m_client(client)
+{
+ RefPtr<TextureLayerChromium> layer;
+ if (m_client)
+ layer = TextureLayerChromium::create(this);
+ else
+ layer = TextureLayerChromium::create(0);
+ layer->setIsDrawable(true);
+ m_layer = adoptPtr(new WebLayerImpl(layer.release()));
+}
-private:
- WebExternalTextureLayerClient* m_client;
-};
+WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
+{
+ static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient();
+}
-WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
+WebLayer* WebExternalTextureLayerImpl::layer()
{
- RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client));
- layer->setIsDrawable(true);
- return WebExternalTextureLayer(layer.release());
+ return m_layer.get();
}
-void WebExternalTextureLayer::clearClient()
+void WebExternalTextureLayerImpl::setTextureId(unsigned id)
{
- unwrap<TextureLayerChromium>()->clearClient();
+ static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id);
}
-void WebExternalTextureLayer::setTextureId(unsigned id)
+void WebExternalTextureLayerImpl::setFlipped(bool flipped)
{
- unwrap<TextureLayerChromium>()->setTextureId(id);
+ static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped);
}
-void WebExternalTextureLayer::setFlipped(bool flipped)
+void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect)
{
- unwrap<TextureLayerChromium>()->setFlipped(flipped);
+ static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect);
}
-void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
+void WebExternalTextureLayerImpl::setOpaque(bool opaque)
{
- unwrap<TextureLayerChromium>()->setUVRect(rect);
+ static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque);
}
-void WebExternalTextureLayer::setOpaque(bool opaque)
+void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha)
{
- unwrap<TextureLayerChromium>()->setOpaque(opaque);
+ static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha);
}
-void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha)
+void WebExternalTextureLayerImpl::willModifyTexture()
{
- unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha);
+ static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture();
}
-void WebExternalTextureLayer::willModifyTexture()
+void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit)
{
- unwrap<TextureLayerChromium>()->willModifyTexture();
+ static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(rateLimit);
}
-void WebExternalTextureLayer::setRateLimitContext(bool rateLimit)
+class WebTextureUpdaterImpl : public WebTextureUpdater {
+public:
+ explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue)
+ : m_queue(queue)
+ {
+ }
+
+ virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
+ {
+ TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size };
+ m_queue.appendCopy(copy);
+ }
+
+private:
+ CCTextureUpdateQueue& m_queue;
+};
+
+unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue)
{
- unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit);
+ ASSERT(m_client);
+ WebTextureUpdaterImpl updaterImpl(queue);
+ return m_client->prepareTexture(updaterImpl);
}
-WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
- : WebLayer(layer)
+WebGraphicsContext3D* WebExternalTextureLayerImpl::context()
{
+ ASSERT(m_client);
+ return m_client->context();
}
} // namespace WebKit
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include <public/WebContentLayer.h>
+#ifndef WebExternalTextureLayerImpl_h
+#define WebExternalTextureLayerImpl_h
-#include "ContentLayerChromium.h"
-#include "WebContentLayerImpl.h"
-
-using namespace WebCore;
+#include "TextureLayerChromium.h"
+#include <public/WebExternalTextureLayer.h>
namespace WebKit {
-WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient)
-{
- return WebContentLayer(WebContentLayerImpl::create(contentClient));
-}
+class WebLayerImpl;
-void WebContentLayer::clearClient()
-{
- unwrap<ContentLayerChromium>()->clearDelegate();
-}
+class WebExternalTextureLayerImpl : public WebExternalTextureLayer,
+ public WebCore::TextureLayerChromiumClient {
+public:
+ explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient*);
+ virtual ~WebExternalTextureLayerImpl();
-void WebContentLayer::setDoubleSided(bool doubleSided)
-{
- m_private->setDoubleSided(doubleSided);
-}
+ // WebExternalTextureLayer implementation.
+ virtual WebLayer* layer() OVERRIDE;
+ virtual void setTextureId(unsigned) OVERRIDE;
+ virtual void setFlipped(bool) OVERRIDE;
+ virtual void setUVRect(const WebFloatRect&) OVERRIDE;
+ virtual void setOpaque(bool) OVERRIDE;
+ virtual void setPremultipliedAlpha(bool) OVERRIDE;
+ virtual void willModifyTexture() OVERRIDE;
+ virtual void setRateLimitContext(bool) OVERRIDE;
-void WebContentLayer::setContentsScale(float scale)
-{
- m_private->setContentsScale(scale);
-}
+ // TextureLayerChromiumClient implementation.
+ virtual unsigned prepareTexture(WebCore::CCTextureUpdateQueue&) OVERRIDE;
+ virtual WebGraphicsContext3D* context() OVERRIDE;
-void WebContentLayer::setUseLCDText(bool enable)
-{
- m_private->setUseLCDText(enable);
-}
+private:
+ WebExternalTextureLayerClient* m_client;
+ OwnPtr<WebLayerImpl> m_layer;
+};
-void WebContentLayer::setDrawCheckerboardForMissingTiles(bool enable)
-{
- m_private->setDrawCheckerboardForMissingTiles(enable);
}
-WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node)
- : WebScrollableLayer(node)
-{
-}
-
-WebContentLayer& WebContentLayer::operator=(const PassRefPtr<ContentLayerChromium>& node)
-{
- m_private = node;
- return *this;
-}
-
-WebContentLayer::operator PassRefPtr<ContentLayerChromium>() const
-{
- return static_cast<ContentLayerChromium*>(m_private.get());
-}
+#endif // WebExternalTextureLayerImpl_h
-} // namespace WebKit
*/
#include "config.h"
-#include <public/WebIOSurfaceLayer.h>
+#include "WebIOSurfaceLayerImpl.h"
#include "IOSurfaceLayerChromium.h"
-#include <public/WebSize.h>
+#include "WebLayerImpl.h"
-using namespace WebCore;
+using WebCore::IOSurfaceLayerChromium;
namespace WebKit {
-WebIOSurfaceLayer WebIOSurfaceLayer::create()
+WebIOSurfaceLayer* WebIOSurfaceLayer::create()
{
RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create();
layer->setIsDrawable(true);
- return WebIOSurfaceLayer(layer.release());
+ return new WebIOSurfaceLayerImpl(layer.release());
}
-void WebIOSurfaceLayer::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
+WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer)
+ : m_layer(adoptPtr(new WebLayerImpl(layer)))
{
- unwrap<IOSurfaceLayerChromium>()->setIOSurfaceProperties(ioSurfaceId, size);
}
-WebIOSurfaceLayer::WebIOSurfaceLayer(PassRefPtr<IOSurfaceLayerChromium> layer)
- : WebLayer(layer)
+WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl()
{
}
+void WebIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
+{
+ static_cast<IOSurfaceLayerChromium*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, size);
+}
+
+WebLayer* WebIOSurfaceLayerImpl::layer()
+{
+ return m_layer.get();
+}
+
} // namespace WebKit
--- /dev/null
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebIOSurfaceLayerImpl_h
+#define WebIOSurfaceLayerImpl_h
+
+#include <public/WebIOSurfaceLayer.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+class IOSurfaceLayerChromium;
+}
+
+namespace WebKit {
+
+class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer {
+public:
+ explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
+ virtual ~WebIOSurfaceLayerImpl();
+
+ // WebIOSurfaceLayer implementation.
+ virtual WebLayer* layer() OVERRIDE;
+ virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) OVERRIDE;
+
+private:
+ OwnPtr<WebLayerImpl> m_layer;
+};
+
+}
+
+#endif // WebIOSurfaceLayerImpl_h
+
*/
#include "config.h"
-#include <public/WebSolidColorLayer.h>
+#include "WebImageLayerImpl.h"
-#include "WebSolidColorLayerImpl.h"
-#include <public/WebFloatRect.h>
+#include "ImageLayerChromium.h"
+#include "WebLayerImpl.h"
+
+using WebCore::ImageLayerChromium;
namespace WebKit {
-WebSolidColorLayer WebSolidColorLayer::create()
+WebImageLayer* WebImageLayer::create()
+{
+ return new WebImageLayerImpl(WebCore::ImageLayerChromium::create());
+}
+
+WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer)
+ : m_layer(adoptPtr(new WebLayerImpl(layer)))
+{
+}
+
+WebImageLayerImpl::~WebImageLayerImpl()
{
- return WebSolidColorLayer(WebSolidColorLayerImpl::create());
}
-WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node)
- : WebLayer(node)
+WebLayer* WebImageLayerImpl::layer()
{
+ return m_layer.get();
}
-void WebSolidColorLayer::setBackgroundColor(const WebColor& color)
+void WebImageLayerImpl::setBitmap(SkBitmap bitmap)
{
- m_private->setBackgroundColor(color);
+ static_cast<ImageLayerChromium*>(m_layer->layer())->setBitmap(bitmap);
}
} // namespace WebKit
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
+#ifndef WebImageLayerImpl_h
+#define WebImageLayerImpl_h
+
#include <public/WebImageLayer.h>
+#include <wtf/OwnPtr.h>
-#include "ImageLayerChromium.h"
+namespace WebCore {
+class ImageLayerChromium;
+}
namespace WebKit {
+class WebLayerImpl;
-WebImageLayer WebImageLayer::create()
-{
- return WebImageLayer(WebCore::ImageLayerChromium::create());
-}
+class WebImageLayerImpl : public WebImageLayer {
+public:
+ explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>);
+ virtual ~WebImageLayerImpl();
-WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer)
- : WebLayer(layer)
-{
-}
+ // WebImageLayer implementation.
+ WebLayer* layer() OVERRIDE;
+ virtual void setBitmap(SkBitmap) OVERRIDE;
+
+private:
+ OwnPtr<WebLayerImpl> m_layer;
+};
-void WebImageLayer::setBitmap(SkBitmap bitmap)
-{
- unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap);
}
-} // namespace WebKit
+#endif // WebImageLayerImpl_h
+++ /dev/null
-/*
- * 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
#include "config.h"
#include "WebLayerImpl.h"
-using namespace WebCore;
+#include "CCActiveAnimation.h"
+#include "LayerChromium.h"
+#include "SkMatrix44.h"
+#include "WebAnimationImpl.h"
+#include <public/WebFloatPoint.h>
+#include <public/WebFloatRect.h>
+#include <public/WebSize.h>
+#include <public/WebTransformationMatrix.h>
+
+using WebCore::CCActiveAnimation;
+using WebCore::LayerChromium;
namespace WebKit {
-PassRefPtr<WebLayerImpl> WebLayerImpl::create()
+namespace {
+
+WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix)
+{
+ double data[16];
+ matrix.asColMajord(data);
+ return WebTransformationMatrix(data[0], data[1], data[2], data[3],
+ data[4], data[5], data[6], data[7],
+ data[8], data[9], data[10], data[11],
+ data[12], data[13], data[14], data[15]);
+}
+
+SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix)
+{
+ SkMatrix44 skMatrix;
+ skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11()));
+ skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12()));
+ skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13()));
+ skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14()));
+ skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21()));
+ skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22()));
+ skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23()));
+ skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24()));
+ skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31()));
+ skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32()));
+ skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33()));
+ skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34()));
+ skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41()));
+ skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42()));
+ skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43()));
+ skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44()));
+ return skMatrix;
+}
+
+} // anonymous namespace
+
+
+WebLayer* WebLayer::create()
{
- return adoptRef(new WebLayerImpl());
+ return new WebLayerImpl(LayerChromium::create());
}
-WebLayerImpl::WebLayerImpl()
- : LayerChromium()
+WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer)
+ : m_layer(layer)
{
- // Make sure that this layer does not draw content. This way we don't have to override
- // the base class implementation of drawsContent().
- ASSERT(!drawsContent());
}
WebLayerImpl::~WebLayerImpl()
{
+ 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
#ifndef WebLayerImpl_h
#define WebLayerImpl_h
-#include "LayerChromium.h"
-#include <wtf/PassRefPtr.h>
+#include <public/WebLayer.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+class LayerChromium;
+}
namespace WebKit {
-class WebLayerImpl : public WebCore::LayerChromium {
+class WebLayerImpl : public WebLayer {
public:
- static PassRefPtr<WebLayerImpl> create();
+ explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>);
+ virtual ~WebLayerImpl();
+
+ // WebLayer implementation.
+ virtual int id() const OVERRIDE;
+ virtual void invalidateRect(const WebFloatRect&) OVERRIDE;
+ virtual void invalidate() OVERRIDE;
+ virtual void addChild(WebLayer*) OVERRIDE;
+ virtual void insertChild(WebLayer*, size_t index) OVERRIDE;
+ virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) OVERRIDE;
+ virtual void setChildren(const WebVector<WebLayer*>&) OVERRIDE;
+ virtual void removeFromParent() OVERRIDE;
+ virtual void removeAllChildren() OVERRIDE;
+ virtual void setAnchorPoint(const WebFloatPoint&) OVERRIDE;
+ virtual WebFloatPoint anchorPoint() const OVERRIDE;
+ virtual void setAnchorPointZ(float) OVERRIDE;
+ virtual float anchorPointZ() const OVERRIDE;
+ virtual void setBounds(const WebSize&) OVERRIDE;
+ virtual WebSize bounds() const OVERRIDE;
+ virtual void setMasksToBounds(bool) OVERRIDE;
+ virtual bool masksToBounds() const OVERRIDE;
+ virtual void setMaskLayer(WebLayer*) OVERRIDE;
+ virtual void setReplicaLayer(WebLayer*) OVERRIDE;
+ virtual void setOpacity(float) OVERRIDE;
+ virtual float opacity() const OVERRIDE;
+ virtual void setOpaque(bool) OVERRIDE;
+ virtual bool opaque() const OVERRIDE;
+ virtual void setPosition(const WebFloatPoint&) OVERRIDE;
+ virtual WebFloatPoint position() const OVERRIDE;
+ virtual void setSublayerTransform(const SkMatrix44&) OVERRIDE;
+ virtual void setSublayerTransform(const WebTransformationMatrix&) OVERRIDE;
+ virtual SkMatrix44 sublayerTransform() const OVERRIDE;
+ virtual void setTransform(const SkMatrix44&) OVERRIDE;
+ virtual void setTransform(const WebTransformationMatrix&) OVERRIDE;
+ virtual SkMatrix44 transform() const OVERRIDE;
+ virtual void setDrawsContent(bool) OVERRIDE;
+ virtual bool drawsContent() const OVERRIDE;
+ virtual void setPreserves3D(bool) OVERRIDE;
+ virtual void setUseParentBackfaceVisibility(bool) OVERRIDE;
+ virtual void setBackgroundColor(WebColor) OVERRIDE;
+ virtual void setFilters(const WebFilterOperations&) OVERRIDE;
+ virtual void setBackgroundFilters(const WebFilterOperations&) OVERRIDE;
+ virtual void setDebugBorderColor(const WebColor&) OVERRIDE;
+ virtual void setDebugBorderWidth(float) OVERRIDE;
+ virtual void setDebugName(WebString) OVERRIDE;
+ virtual void setAnimationDelegate(WebAnimationDelegate*) OVERRIDE;
+ virtual bool addAnimation(WebAnimation*) OVERRIDE;
+ virtual void removeAnimation(int animationId) OVERRIDE;
+ virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) OVERRIDE;
+ virtual void pauseAnimation(int animationId, double timeOffset) OVERRIDE;
+ virtual void suspendAnimations(double monotonicTime) OVERRIDE;
+ virtual void resumeAnimations(double monotonicTime) OVERRIDE;
+ virtual bool hasActiveAnimation() OVERRIDE;
+ virtual void transferAnimationsTo(WebLayer*) OVERRIDE;
+ virtual void setForceRenderSurface(bool) OVERRIDE;
+ virtual void setScrollPosition(WebPoint) OVERRIDE;
+ virtual void setScrollable(bool) OVERRIDE;
+ virtual void setHaveWheelEventHandlers(bool) OVERRIDE;
+ virtual void setShouldScrollOnMainThread(bool) OVERRIDE;
+ virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) OVERRIDE;
+ virtual void setIsContainerForFixedPositionLayers(bool) OVERRIDE;
+ virtual void setFixedToContainerLayer(bool) OVERRIDE;
+
+ WebCore::LayerChromium* layer() const;
protected:
- WebLayerImpl();
- virtual ~WebLayerImpl();
+ RefPtr<WebCore::LayerChromium> m_layer;
};
} // namespace WebKit
#include "CCLayerTreeHost.h"
#include "CCRenderingStats.h"
#include "LayerChromium.h"
+#include "WebLayerImpl.h"
#include "WebLayerTreeViewImpl.h"
#include <public/WebLayer.h>
#include <public/WebPoint.h>
void WebLayerTreeView::setRootLayer(WebLayer *root)
{
if (root)
- m_private->layerTreeHost()->setRootLayer(*root);
+ m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer());
else
m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>());
}
#include "CCLayerTreeHost.h"
#include "CCThreadProxy.h"
#include "LayerChromium.h"
+#include "WebLayerImpl.h"
#include <public/WebGraphicsContext3D.h>
#include <public/WebLayer.h>
#include <public/WebLayerTreeView.h>
OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings));
if (!impl->layerTreeHost())
return nullptr;
- impl->layerTreeHost()->setRootLayer(root);
+ impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer());
return impl.release();
}
ASSERT(m_mediaPlayer);
m_mediaPlayer->readyStateChanged();
#if USE(ACCELERATED_COMPOSITING)
- if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) {
- m_videoLayer = WebVideoLayer::create(this);
- m_videoLayer.setOpaque(m_opaque);
+ if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) {
+ m_videoLayer = adoptPtr(WebVideoLayer::create(this));
+ m_videoLayer->layer()->setOpaque(m_opaque);
}
#endif
}
{
ASSERT(m_mediaPlayer);
#if USE(ACCELERATED_COMPOSITING)
- if (!m_videoLayer.isNull() && supportsAcceleratedRendering())
- m_videoLayer.invalidate();
+ if (m_videoLayer && supportsAcceleratedRendering())
+ m_videoLayer->layer()->invalidate();
#endif
m_mediaPlayer->repaint();
}
{
#if USE(ACCELERATED_COMPOSITING)
m_opaque = opaque;
- if (!m_videoLayer.isNull())
- m_videoLayer.setOpaque(m_opaque);
+ if (m_videoLayer)
+ m_videoLayer->layer()->setOpaque(m_opaque);
#endif
}
WebLayer* WebMediaPlayerClientImpl::platformLayer() const
{
ASSERT(m_supportsAcceleratedCompositing);
- return const_cast<WebVideoLayer*>(&m_videoLayer);
+ return m_videoLayer ? m_videoLayer->layer() : 0;
}
#endif
bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
{
- return !m_videoLayer.isNull() && m_videoLayer.active();
+ return m_videoLayer && m_videoLayer->active();
}
void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client)
WebCore::MediaPlayer::Preload m_preload;
RefPtr<WebHelperPluginImpl> m_helperPlugin;
#if USE(ACCELERATED_COMPOSITING)
- WebVideoLayer m_videoLayer;
+ OwnPtr<WebVideoLayer> m_videoLayer;
bool m_supportsAcceleratedCompositing;
bool m_opaque;
WebVideoFrameProvider::Client* m_videoFrameProviderClient;
if (m_textureId == textureId)
return;
- ASSERT(m_ioSurfaceLayer.isNull());
+ ASSERT(!m_ioSurfaceLayer);
- if (m_textureLayer.isNull())
- m_textureLayer = WebExternalTextureLayer::create();
- m_textureLayer.setTextureId(textureId);
+ if (!m_textureLayer)
+ m_textureLayer = adoptPtr(WebExternalTextureLayer::create());
+ m_textureLayer->setTextureId(textureId);
// If anyone of the IDs is zero we need to switch between hardware
// and software compositing. This is done by triggering a style recalc
if (ioSurfaceId == m_ioSurfaceId)
return;
- ASSERT(m_textureLayer.isNull());
+ ASSERT(!m_textureLayer);
- if (m_ioSurfaceLayer.isNull())
- m_ioSurfaceLayer = WebIOSurfaceLayer::create();
- m_ioSurfaceLayer.setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
+ if (!m_ioSurfaceLayer)
+ m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create());
+ m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
// If anyone of the IDs is zero we need to switch between hardware
// and software compositing. This is done by triggering a style recalc
void WebPluginContainerImpl::commitBackingTexture()
{
#if USE(ACCELERATED_COMPOSITING)
- if (!m_textureLayer.isNull())
- m_textureLayer.invalidate();
+ if (m_textureLayer)
+ m_textureLayer->layer()->invalidate();
- if (!m_ioSurfaceLayer.isNull())
- m_ioSurfaceLayer.invalidate();
+ if (m_ioSurfaceLayer)
+ m_ioSurfaceLayer->layer()->invalidate();
#endif
}
void WebPluginContainerImpl::setOpaque(bool opaque)
{
#if USE(ACCELERATED_COMPOSITING)
- if (!m_textureLayer.isNull())
- m_textureLayer.setOpaque(opaque);
+ if (m_textureLayer)
+ m_textureLayer->layer()->setOpaque(opaque);
- if (!m_ioSurfaceLayer.isNull())
- m_ioSurfaceLayer.setOpaque(opaque);
+ if (m_ioSurfaceLayer)
+ m_ioSurfaceLayer->layer()->setOpaque(opaque);
#endif
}
WebLayer* WebPluginContainerImpl::platformLayer() const
{
if (m_textureId)
- return const_cast<WebExternalTextureLayer*>(&m_textureLayer);
+ return m_textureLayer->layer();
if (m_ioSurfaceId)
- return const_cast<WebIOSurfaceLayer*>(&m_ioSurfaceLayer);
+ return m_ioSurfaceLayer->layer();
return 0;
}
#endif
// A composited plugin will either have no composited layer, a texture layer, or an IOSurface layer.
// It will never have both a texture and IOSurface output.
unsigned m_textureId;
- WebExternalTextureLayer m_textureLayer;
+ OwnPtr<WebExternalTextureLayer> m_textureLayer;
unsigned m_ioSurfaceId;
- WebIOSurfaceLayer m_ioSurfaceLayer;
+ OwnPtr<WebIOSurfaceLayer> m_ioSurfaceLayer;
#endif
// The associated scrollbar group object, created lazily. Used for Pepper
+++ /dev/null
-/*
- * 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 <public/WebScrollbarLayer.h>
+#include "WebScrollbarLayerImpl.h"
#include "ScrollbarLayerChromium.h"
+#include "WebLayerImpl.h"
-using namespace WebCore;
+using WebCore::Scrollbar;
+using WebCore::ScrollbarLayerChromium;
namespace WebKit {
-void WebScrollbarLayer::setScrollLayer(const WebLayer layer)
+WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
{
- int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id();
- unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
+ return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
}
-WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
+
+WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer)
+ : m_layer(adoptPtr(new WebLayerImpl(layer)))
{
- return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
}
-WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
- : WebLayer(layer)
+WebScrollbarLayerImpl::~WebScrollbarLayerImpl()
{
}
-WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
+WebLayer* WebScrollbarLayerImpl::layer()
{
- m_private = layer;
- return *this;
+ return m_layer.get();
}
-WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const
+void WebScrollbarLayerImpl::setScrollLayer(WebLayer* layer)
{
- return unwrap<ScrollbarLayerChromium>();
+ int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0;
+ static_cast<ScrollbarLayerChromium*>(m_layer->layer())->setScrollLayerId(id);
}
+
+
} // namespace WebKit
--- /dev/null
+/*
+ * 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 "WebSolidColorLayerImpl.h"
-using namespace WebCore;
+#include "SolidColorLayerChromium.h"
+#include "WebLayerImpl.h"
+
+using WebCore::SolidColorLayerChromium;
namespace WebKit {
-PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create()
+WebSolidColorLayer* WebSolidColorLayer::create()
{
- return adoptRef(new WebSolidColorLayerImpl());
+ return new WebSolidColorLayerImpl(SolidColorLayerChromium::create());
}
-WebSolidColorLayerImpl::WebSolidColorLayerImpl()
- : SolidColorLayerChromium()
+WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer)
+ : m_layer(adoptPtr(new WebLayerImpl(layer)))
{
- setIsDrawable(true);
+ m_layer->layer()->setIsDrawable(true);
}
WebSolidColorLayerImpl::~WebSolidColorLayerImpl()
{
}
+WebLayer* WebSolidColorLayerImpl::layer()
+{
+ return m_layer.get();
+}
+
+void WebSolidColorLayerImpl::setBackgroundColor(WebColor color)
+{
+ m_layer->setBackgroundColor(color);
+}
+
} // namespace WebKit
#ifndef WebSolidColorLayerImpl_h
#define WebSolidColorLayerImpl_h
-#include "SolidColorLayerChromium.h"
+#include <public/WebSolidColorLayer.h>
+#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
+namespace WebCore {
+class SolidColorLayerChromium;
+}
+
namespace WebKit {
+class WebLayerImpl;
-class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium {
+class WebSolidColorLayerImpl : public WebSolidColorLayer {
public:
- static PassRefPtr<WebSolidColorLayerImpl> create();
-
-protected:
- WebSolidColorLayerImpl();
+ explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>);
virtual ~WebSolidColorLayerImpl();
+
+ // WebSolidColorLayer implementation.
+ virtual WebLayer* layer() OVERRIDE;
+ virtual void setBackgroundColor(WebColor) OVERRIDE;
+
+private:
+ OwnPtr<WebLayerImpl> m_layer;
};
} // namespace WebKit
--- /dev/null
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebVideoLayerImpl.h"
+
+#include "VideoLayerChromium.h"
+#include "WebLayerImpl.h"
+
+namespace WebKit {
+
+WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider)
+{
+ return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider));
+}
+
+WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer)
+ : m_layer(adoptPtr(new WebLayerImpl(layer)))
+{
+}
+
+WebVideoLayerImpl::~WebVideoLayerImpl()
+{
+}
+
+WebLayer* WebVideoLayerImpl::layer()
+{
+ return m_layer.get();
+}
+
+bool WebVideoLayerImpl::active() const
+{
+ return m_layer->layer()->layerTreeHost();
+}
+
+} // namespace WebKit
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "VideoLayerChromium.h"
+#ifndef WebVideoLayerImpl_h
+#define WebVideoLayerImpl_h
+
#include <public/WebVideoLayer.h>
+namespace WebCore {
+class VideoLayerChromium;
+}
+
namespace WebKit {
+class WebLayerImpl;
-WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider)
-{
- return WebVideoLayer(WebCore::VideoLayerChromium::create(provider));
-}
+class WebVideoLayerImpl : public WebVideoLayer {
+public:
+ explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>);
+ virtual ~WebVideoLayerImpl();
-WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer)
- : WebLayer(layer)
-{
-}
+ // WebVideoLayer implementation.
+ virtual WebLayer* layer() OVERRIDE;
+ virtual bool active() const OVERRIDE;
+
+private:
+ OwnPtr<WebLayerImpl> m_layer;
+};
-bool WebVideoLayer::active() const
-{
- return m_private->layerTreeHost();
}
-} // namespace WebKit
+#endif // WebVideoLayerImpl_h
+
, m_isCancelingFullScreen(false)
, m_benchmarkSupport(this)
#if USE(ACCELERATED_COMPOSITING)
+ , m_rootLayer(0)
, m_rootGraphicsLayer(0)
, m_isAcceleratedCompositingActive(false)
, m_compositorCreationFailed(false)
void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
{
m_rootGraphicsLayer = layer;
+ m_rootLayer = layer ? layer->platformLayer() : 0;
setIsAcceleratedCompositingActive(layer);
if (m_nonCompositedContentHost) {
m_nonCompositedContentHost->setScrollLayer(scrollLayer);
}
- if (layer)
- m_rootLayer = *layer->platformLayer();
-
if (!m_layerTreeView.isNull())
- m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0);
+ m_layerTreeView.setRootLayer(m_rootLayer);
IntRect damagedRect(0, 0, m_size.width, m_size.height);
if (!m_isAcceleratedCompositingActive)
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());
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;
RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false);
ASSERT_TRUE(nonOpaqueImage.get());
- ASSERT_TRUE(graphicsLayer->contentsLayer().isNull());
+ ASSERT_FALSE(graphicsLayer->contentsLayer());
graphicsLayer->setContentsToImage(opaqueImage.get());
- 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
#include <public/WebLayer.h>
#include "CompositorFakeWebGraphicsContext3D.h"
+#include "WebLayerImpl.h"
#include <public/WebCompositor.h>
#include <public/WebContentLayer.h>
#include <public/WebContentLayerClient.h>
{
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
- m_rootLayer = WebLayer::create();
+ m_rootLayer = adoptPtr(WebLayer::create());
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- EXPECT_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);
}
// We may get any number of scheduleComposite calls during shutdown.
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
m_view.setRootLayer(0);
- m_rootLayer.reset();
+ m_rootLayer.clear();
m_view.reset();
WebKit::WebCompositor::shutdown();
}
protected:
MockWebLayerTreeViewClient m_client;
- WebLayer m_rootLayer;
+ OwnPtr<WebLayer> m_rootLayer;
WebLayerTreeView m_view;
};
{
// Base layer.
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- WebLayer layer = WebLayer::create();
- m_rootLayer.addChild(layer);
+ OwnPtr<WebLayer> layer = adoptPtr(WebLayer::create());
+ m_rootLayer->addChild(layer.get());
Mock::VerifyAndClearExpectations(&m_client);
WebFloatPoint point(3, 4);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- 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());
- WebLayer otherLayer = WebLayer::create();
- m_rootLayer.addChild(otherLayer);
+ OwnPtr<WebLayer> otherLayer = adoptPtr(WebLayer::create());
+ m_rootLayer->addChild(otherLayer.get());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- layer.setMaskLayer(otherLayer);
+ layer->setMaskLayer(otherLayer.get());
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());
- WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create();
- m_rootLayer.addChild(textureLayer);
+ OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create());
+ m_rootLayer->addChild(textureLayer->layer());
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- 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);
MockWebContentLayerClient contentClient;
EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber());
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- WebContentLayer contentLayer = WebContentLayer::create(&contentClient);
- m_rootLayer.addChild(contentLayer);
+ OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&contentClient));
+ m_rootLayer->addChild(contentLayer->layer());
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- contentLayer.setDrawsContent(false);
+ contentLayer->layer()->setDrawsContent(false);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_FALSE(contentLayer.drawsContent());
+ EXPECT_FALSE(contentLayer->layer()->drawsContent());
}
}
virtual void SetUp()
{
initializeCompositor();
- m_rootLayer = WebLayer::create();
- EXPECT_TRUE(m_view.initialize(client(), m_rootLayer, WebLayerTreeView::Settings()));
+ m_rootLayer = adoptPtr(WebLayer::create());
+ EXPECT_TRUE(m_view.initialize(client(), *m_rootLayer, WebLayerTreeView::Settings()));
m_view.setSurfaceReady();
}
Mock::VerifyAndClearExpectations(client());
m_view.setRootLayer(0);
- m_rootLayer.reset();
+ m_rootLayer.clear();
m_view.reset();
WebKit::WebCompositor::shutdown();
}
protected:
- WebLayer m_rootLayer;
+ OwnPtr<WebLayer> m_rootLayer;
WebLayerTreeView m_view;
};