RenderLayerBacking.h [plain text]
#ifndef RenderLayerBacking_h
#define RenderLayerBacking_h
#if USE(ACCELERATED_COMPOSITING)
#include "FloatPoint.h"
#include "FloatPoint3D.h"
#include "GraphicsLayer.h"
#include "GraphicsLayerClient.h"
#include "RenderLayer.h"
#include "TransformationMatrix.h"
namespace WebCore {
class KeyframeList;
class RenderLayerCompositor;
enum CompositingLayerType {
NormalCompositingLayer, TiledCompositingLayer, MediaCompositingLayer, ContainerCompositingLayer };
class RenderLayerBacking : public GraphicsLayerClient {
WTF_MAKE_NONCOPYABLE(RenderLayerBacking); WTF_MAKE_FAST_ALLOCATED;
public:
RenderLayerBacking(RenderLayer*);
~RenderLayerBacking();
void layerWillBeDestroyed();
RenderLayer* owningLayer() const { return m_owningLayer; }
enum UpdateDepth { CompositingChildren, AllDescendants };
void updateAfterLayout(UpdateDepth, bool isUpdateRoot);
bool updateGraphicsLayerConfiguration();
void updateGraphicsLayerGeometry(); void updateDrawsContent();
GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
bool hasClippingLayer() const { return m_clippingLayer != 0; }
GraphicsLayer* clippingLayer() const { return m_clippingLayer.get(); }
bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != 0; }
GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); }
bool hasContentsLayer() const { return m_foregroundLayer != 0; }
GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); }
bool hasScrollingLayer() const { return m_scrollingLayer; }
GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); }
GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
bool hasMaskLayer() const { return m_maskLayer != 0; }
GraphicsLayer* parentForSublayers() const;
GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer.get() : m_graphicsLayer.get(); }
bool paintsIntoWindow() const;
bool paintsIntoCompositedAncestor() const { return !m_requiresOwnBackingStore; }
void setRequiresOwnBackingStore(bool);
void setContentsNeedDisplay();
void setContentsNeedDisplayInRect(const IntRect&);
void contentChanged(ContentChangeType);
bool startTransition(double, CSSPropertyID, const RenderStyle* fromStyle, const RenderStyle* toStyle);
void transitionPaused(double timeOffset, CSSPropertyID);
void transitionFinished(CSSPropertyID);
bool startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes);
void animationPaused(double timeOffset, const String& name);
void animationFinished(const String& name);
void suspendAnimations(double time = 0);
void resumeAnimations();
IntRect compositedBounds() const;
void setCompositedBounds(const IntRect&);
void updateCompositedBounds();
void updateAfterWidgetResize();
virtual bool shouldUseTileCache(const GraphicsLayer*) const;
virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime);
virtual void notifySyncRequired(const GraphicsLayer*);
virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip);
virtual float deviceScaleFactor() const;
virtual float pageScaleFactor() const;
virtual void didCommitChangesForLayer(const GraphicsLayer*) const;
virtual bool showDebugBorders(const GraphicsLayer*) const;
virtual bool showRepaintCounter(const GraphicsLayer*) const;
virtual void platformLayerChanged(GraphicsLayer*, PlatformLayer* oldPlatformLayer, PlatformLayer* newPlatformLayer) OVERRIDE;
virtual float minimumDocumentScale() const OVERRIDE;
virtual bool allowCompositingLayerVisualDegradation() const OVERRIDE;
#ifndef NDEBUG
virtual void verifyNotPainting();
#endif
IntRect contentsBox() const;
CompositingLayerType compositingLayerType() const;
GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
#if ENABLE(CSS_FILTERS)
bool canCompositeFilters() const { return m_canCompositeFilters; }
#endif
double backingStoreMemoryEstimate() const;
String nameForLayer() const;
private:
void createPrimaryGraphicsLayer();
void destroyGraphicsLayers();
PassOwnPtr<GraphicsLayer> createGraphicsLayer(const String&);
RenderBoxModelObject* renderer() const { return m_owningLayer->renderer(); }
RenderLayerCompositor* compositor() const { return m_owningLayer->compositor(); }
void updateInternalHierarchy();
bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer);
bool updateForegroundLayer(bool needsForegroundLayer);
bool updateMaskLayer(bool needsMaskLayer);
bool requiresHorizontalScrollbarLayer() const;
bool requiresVerticalScrollbarLayer() const;
bool requiresScrollCornerLayer() const;
bool updateScrollingLayers(bool scrollingLayers);
GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
IntSize contentOffsetInCompostingLayer() const;
FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const;
void updateLayerOpacity(const RenderStyle*);
void updateLayerTransform(const RenderStyle*);
#if ENABLE(CSS_FILTERS)
void updateLayerFilters(const RenderStyle*);
#endif
float compositingOpacity(float rendererOpacity) const;
bool isMainFrameRenderViewLayer() const;
bool paintsBoxDecorations() const;
bool paintsChildren() const;
bool isSimpleContainerCompositingLayer() const;
bool containsPaintedContent() const;
bool isDirectlyCompositedImage() const;
void updateImageContents();
Color rendererBackgroundColor() const;
void updateBackgroundColor();
bool containsNonEmptyRenderers() const;
bool hasVisibleNonCompositingDescendantLayers() const;
bool shouldClipCompositedBounds() const;
void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
static CSSPropertyID graphicsLayerToCSSProperty(AnimatedPropertyID);
static AnimatedPropertyID cssToGraphicsLayerProperty(CSSPropertyID);
RenderLayer* m_owningLayer;
OwnPtr<GraphicsLayer> m_ancestorClippingLayer; OwnPtr<GraphicsLayer> m_graphicsLayer;
OwnPtr<GraphicsLayer> m_foregroundLayer; OwnPtr<GraphicsLayer> m_clippingLayer; OwnPtr<GraphicsLayer> m_maskLayer;
OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
OwnPtr<GraphicsLayer> m_layerForScrollCorner;
OwnPtr<GraphicsLayer> m_scrollingLayer; OwnPtr<GraphicsLayer> m_scrollingContentsLayer;
IntRect m_compositedBounds;
bool m_artificiallyInflatedBounds; bool m_isMainFrameRenderViewLayer;
bool m_usingTiledCacheLayer;
bool m_requiresOwnBackingStore;
#if ENABLE(CSS_FILTERS)
bool m_canCompositeFilters;
#endif
};
}
#endif // USE(ACCELERATED_COMPOSITING)
#endif // RenderLayerBacking_h