ScrollingTreeNode.h [plain text]
#ifndef ScrollingTreeNode_h
#define ScrollingTreeNode_h
#if ENABLE(ASYNC_SCROLLING)
#include "IntRect.h"
#include "ScrollTypes.h"
#include "ScrollingCoordinator.h"
#include <wtf/RefCounted.h>
namespace WebCore {
class ScrollingStateFixedNode;
class ScrollingStateNode;
class ScrollingStateScrollingNode;
class ScrollingTreeNode : public RefCounted<ScrollingTreeNode> {
public:
virtual ~ScrollingTreeNode();
ScrollingNodeType nodeType() const { return m_nodeType; }
ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
bool isFixedNode() const { return nodeType() == FixedNode; }
bool isStickyNode() const { return nodeType() == StickyNode; }
bool isScrollingNode() const { return nodeType() == FrameScrollingNode || nodeType() == OverflowScrollingNode; }
bool isFrameScrollingNode() const { return nodeType() == FrameScrollingNode; }
bool isOverflowScrollingNode() const { return nodeType() == OverflowScrollingNode; }
virtual void updateBeforeChildren(const ScrollingStateNode&) = 0;
virtual void updateAfterChildren(const ScrollingStateNode&) { }
virtual void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) = 0;
ScrollingTreeNode* parent() const { return m_parent; }
void setParent(ScrollingTreeNode* parent) { m_parent = parent; }
typedef Vector<RefPtr<ScrollingTreeNode>> ScrollingTreeChildrenVector;
ScrollingTreeChildrenVector* children() { return m_children.get(); }
void appendChild(PassRefPtr<ScrollingTreeNode>);
void removeChild(ScrollingTreeNode*);
protected:
ScrollingTreeNode(ScrollingTree&, ScrollingNodeType, ScrollingNodeID);
ScrollingTree& scrollingTree() const { return m_scrollingTree; }
OwnPtr<ScrollingTreeChildrenVector> m_children;
private:
ScrollingTree& m_scrollingTree;
const ScrollingNodeType m_nodeType;
const ScrollingNodeID m_nodeID;
ScrollingTreeNode* m_parent;
};
#define SCROLLING_NODE_TYPE_CASTS(ToValueTypeName, predicate) \
TYPE_CASTS_BASE(ToValueTypeName, ScrollingTreeNode, value, value->predicate, value.predicate)
}
#endif // ENABLE(ASYNC_SCROLLING)
#endif // ScrollingTreeNode_h