RemoteScrollingCoordinatorProxy.h [plain text]
#ifndef RemoteScrollingCoordinatorProxy_h
#define RemoteScrollingCoordinatorProxy_h
#if ENABLE(ASYNC_SCROLLING)
#include "MessageReceiver.h"
#include "RemoteScrollingCoordinator.h"
#include "RemoteScrollingTree.h"
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class FloatPoint;
class PlatformWheelEvent;
}
namespace WebKit {
class RemoteLayerTreeHost;
class RemoteScrollingCoordinatorTransaction;
class RemoteScrollingTree;
class WebPageProxy;
class RemoteScrollingCoordinatorProxy {
WTF_MAKE_NONCOPYABLE(RemoteScrollingCoordinatorProxy);
public:
explicit RemoteScrollingCoordinatorProxy(WebPageProxy&);
virtual ~RemoteScrollingCoordinatorProxy();
void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition, WebCore::SetOrSyncScrollingLayerPosition);
void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll);
bool isPointInNonFastScrollableRegion(const WebCore::IntPoint&) const;
void viewportChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::FloatRect& fixedPositionRect, double scale);
void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical);
bool handleWheelEvent(const WebCore::PlatformWheelEvent&);
WebCore::ScrollingNodeID rootScrollingNodeID() const;
const RemoteLayerTreeHost* layerTreeHost() const;
struct RequestedScrollInfo {
bool requestsScrollPositionUpdate { };
bool requestIsProgrammaticScroll { };
WebCore::FloatPoint requestedScrollPosition;
};
void updateScrollingTree(const RemoteScrollingCoordinatorTransaction&, RequestedScrollInfo&);
void setPropagatesMainFrameScrolls(bool propagatesMainFrameScrolls) { m_propagatesMainFrameScrolls = propagatesMainFrameScrolls; }
bool propagatesMainFrameScrolls() const { return m_propagatesMainFrameScrolls; }
bool hasFixedOrSticky() const { return m_scrollingTree->hasFixedOrSticky(); }
#if PLATFORM(IOS)
WebCore::FloatRect customFixedPositionRect() const;
void scrollingTreeNodeWillStartPanGesture();
void scrollingTreeNodeWillStartScroll();
void scrollingTreeNodeDidEndScroll();
#if ENABLE(CSS_SCROLL_SNAP)
void adjustTargetContentOffsetForSnapping(CGSize maxScrollDimensions, CGPoint velocity, CGFloat topInset, CGPoint* targetContentOffset);
bool hasActiveSnapPoint() const;
CGPoint nearestActiveContentInsetAdjustedSnapPoint(CGFloat topInset, const CGPoint&) const;
bool shouldSetScrollViewDecelerationRateFast() const;
#endif
#endif
private:
void connectStateNodeLayers(WebCore::ScrollingStateTree&, const RemoteLayerTreeHost&);
#if ENABLE(CSS_SCROLL_SNAP)
bool shouldSnapForMainFrameScrolling(WebCore::ScrollEventAxis) const;
float closestSnapOffsetForMainFrameScrolling(WebCore::ScrollEventAxis, float scrollDestination, float velocity, unsigned& closestIndex) const;
#endif
WebPageProxy& m_webPageProxy;
RefPtr<RemoteScrollingTree> m_scrollingTree;
RequestedScrollInfo* m_requestedScrollInfo;
#if ENABLE(CSS_SCROLL_SNAP)
unsigned m_currentHorizontalSnapPointIndex { 0 };
unsigned m_currentVerticalSnapPointIndex { 0 };
#endif
bool m_propagatesMainFrameScrolls;
};
}
#endif // ENABLE(ASYNC_SCROLLING)
#endif // RemoteScrollingCoordinatorProxy_h