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();
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 hasMaskLayer() const { return m_maskLayer != 0; }
GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer.get() : m_graphicsLayer.get(); }
GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer.get() : m_graphicsLayer.get(); }
bool paintingGoesToWindow() const;
void setContentsNeedDisplay();
void setContentsNeedDisplayInRect(const IntRect& r);
void contentChanged(RenderLayer::ContentChangeType);
bool startTransition(double timeOffset, int property, const RenderStyle* fromStyle, const RenderStyle* toStyle);
void transitionPaused(double timeOffset, int property);
void transitionFinished(int property);
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 void notifyAnimationStarted(const GraphicsLayer*, double startTime);
virtual void notifySyncRequired(const GraphicsLayer*);
virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip);
virtual bool showDebugBorders() const;
virtual bool showRepaintCounter() const;
IntRect contentsBox() const;
CompositingLayerType compositingLayerType() const;
void updateContentsScale(float);
GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
private:
void createGraphicsLayer();
void destroyGraphicsLayer();
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;
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*);
float compositingOpacity(float rendererOpacity) const;
bool isSimpleContainerCompositingLayer() const;
bool containsPaintedContent() const;
bool isDirectlyCompositedImage() const;
void updateImageContents();
bool rendererHasBackground() const;
const Color rendererBackgroundColor() const;
void updateBackgroundColor();
bool hasNonCompositingDescendants() const;
void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
PaintBehavior paintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
static int graphicsLayerToCSSProperty(AnimatedPropertyID);
static AnimatedPropertyID cssToGraphicsLayerProperty(int);
#ifndef NDEBUG
String nameForLayer() const;
#endif
private:
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;
IntRect m_compositedBounds;
bool m_artificiallyInflatedBounds; };
}
#endif // USE(ACCELERATED_COMPOSITING)
#endif // RenderLayerBacking_h