ScrollingTreeScrollingNode.h [plain text]
#ifndef ScrollingTreeScrollingNode_h
#define ScrollingTreeScrollingNode_h
#if ENABLE(ASYNC_SCROLLING)
#include "IntRect.h"
#include "ScrollTypes.h"
#include "ScrollingCoordinator.h"
#include "ScrollingTreeNode.h"
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class ScrollingTree;
class ScrollingStateScrollingNode;
class ScrollingTreeScrollingNode : public ScrollingTreeNode {
public:
virtual ~ScrollingTreeScrollingNode();
virtual void updateBeforeChildren(const ScrollingStateNode&) override;
virtual void updateAfterChildren(const ScrollingStateNode&) override;
virtual void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override;
virtual void handleWheelEvent(const PlatformWheelEvent&) = 0;
virtual void setScrollPosition(const FloatPoint&);
virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&);
virtual void updateLayersAfterViewportChange(const FloatRect& fixedPositionRect, double scale) = 0;
virtual void updateLayersAfterDelegatedScroll(const FloatPoint&) { }
virtual FloatPoint scrollPosition() const = 0;
protected:
ScrollingTreeScrollingNode(ScrollingTree&, ScrollingNodeType, ScrollingNodeID);
virtual FloatPoint minimumScrollPosition() const;
virtual FloatPoint maximumScrollPosition() const;
virtual void setScrollLayerPosition(const FloatPoint&) = 0;
FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; }
const FloatSize& scrollableAreaSize() const { return m_scrollableAreaSize; }
const FloatSize& totalContentsSize() const { return m_totalContentsSize; }
const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; }
const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
const FloatSize& totalContentsSizeForRubberBand() const { return m_totalContentsSizeForRubberBand; }
void setTotalContentsSizeForRubberBand(const FloatSize& totalContentsSizeForRubberBand) { m_totalContentsSizeForRubberBand = totalContentsSizeForRubberBand; }
ScrollElasticity horizontalScrollElasticity() const { return m_scrollableAreaParameters.horizontalScrollElasticity; }
ScrollElasticity verticalScrollElasticity() const { return m_scrollableAreaParameters.verticalScrollElasticity; }
bool hasEnabledHorizontalScrollbar() const { return m_scrollableAreaParameters.hasEnabledHorizontalScrollbar; }
bool hasEnabledVerticalScrollbar() const { return m_scrollableAreaParameters.hasEnabledVerticalScrollbar; }
bool canHaveScrollbars() const { return m_scrollableAreaParameters.horizontalScrollbarMode != ScrollbarAlwaysOff || m_scrollableAreaParameters.verticalScrollbarMode != ScrollbarAlwaysOff; }
private:
FloatSize m_scrollableAreaSize;
FloatSize m_totalContentsSize;
FloatSize m_totalContentsSizeForRubberBand;
FloatSize m_reachableContentsSize;
FloatPoint m_lastCommittedScrollPosition;
IntPoint m_scrollOrigin;
ScrollableAreaParameters m_scrollableAreaParameters;
};
SCROLLING_NODE_TYPE_CASTS(ScrollingTreeScrollingNode, isScrollingNode());
}
#endif // ENABLE(ASYNC_SCROLLING)
#endif // ScrollingTreeScrollingNode_h