ScrollingStateNode.h [plain text]
#ifndef ScrollingStateNode_h
#define ScrollingStateNode_h
#if ENABLE(THREADED_SCROLLING) || USE(COORDINATED_GRAPHICS)
#include "PlatformLayer.h"
#include "ScrollingCoordinator.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
#endif
namespace WebCore {
class GraphicsLayer;
class ScrollingStateTree;
class TextStream;
class ScrollingStateNode {
public:
ScrollingStateNode(ScrollingStateTree*, ScrollingNodeID);
virtual ~ScrollingStateNode();
virtual bool isScrollingNode() { return false; }
virtual bool isFixedNode() { return false; }
virtual bool isStickyNode() { return false; }
virtual PassOwnPtr<ScrollingStateNode> clone() = 0;
PassOwnPtr<ScrollingStateNode> cloneAndReset();
void cloneAndResetChildren(ScrollingStateNode*);
enum {
ScrollLayer = 0,
NumStateNodeBits = 1
};
typedef unsigned ChangedProperties;
bool hasChangedProperties() const { return m_changedProperties; }
bool hasChangedProperty(unsigned propertyBit) { return m_changedProperties & (1 << propertyBit); }
void resetChangedProperties() { m_changedProperties = 0; }
void setPropertyChanged(unsigned propertyBit) { m_changedProperties |= (1 << propertyBit); }
virtual void syncLayerPositionForViewportRect(const LayoutRect& ) { }
GraphicsLayer* graphicsLayer() { return m_graphicsLayer; }
PlatformLayer* platformScrollLayer() const;
void setScrollLayer(GraphicsLayer*);
void setScrollPlatformLayer(PlatformLayer*);
ScrollingStateTree* scrollingStateTree() const { return m_scrollingStateTree; }
void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; }
ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
ScrollingStateNode* parent() const { return m_parent; }
void setParent(ScrollingStateNode* parent) { m_parent = parent; }
Vector<OwnPtr<ScrollingStateNode> >* children() const { return m_children.get(); }
void appendChild(PassOwnPtr<ScrollingStateNode>);
void removeChild(ScrollingStateNode*);
String scrollingStateTreeAsText() const;
protected:
ScrollingStateNode(const ScrollingStateNode&);
static void writeIndent(TextStream&, int indent);
ScrollingStateTree* m_scrollingStateTree;
private:
void dump(TextStream&, int indent) const;
virtual void dumpProperties(TextStream&, int indent) const = 0;
ChangedProperties changedProperties() const { return m_changedProperties; }
void willBeRemovedFromStateTree();
ScrollingNodeID m_nodeID;
ChangedProperties m_changedProperties;
ScrollingStateNode* m_parent;
OwnPtr<Vector<OwnPtr<ScrollingStateNode> > > m_children;
#if PLATFORM(MAC)
RetainPtr<PlatformLayer> m_platformScrollLayer;
#endif
GraphicsLayer* m_graphicsLayer;
};
}
#endif // ENABLE(THREADED_SCROLLING) || USE(COORDINATED_GRAPHICS)
#endif // ScrollingStateNode_h