ScrollingTreeLatchingController.h [plain text]
#pragma once
#if ENABLE(ASYNC_SCROLLING)
#include "ScrollTypes.h"
#include <wtf/Lock.h>
#include <wtf/Markable.h>
#include <wtf/MonotonicTime.h>
#include <wtf/OptionSet.h>
#include <wtf/Optional.h>
namespace WebCore {
class PlatformWheelEvent;
enum class WheelEventProcessingSteps : uint8_t;
class ScrollingTreeLatchingController {
public:
struct ScrollingNodeAndProcessingSteps {
ScrollingNodeID scrollingNodeID;
OptionSet<WheelEventProcessingSteps> processingSteps;
};
ScrollingTreeLatchingController();
void receivedWheelEvent(const PlatformWheelEvent&, OptionSet<WheelEventProcessingSteps>, bool allowLatching);
Optional<ScrollingNodeAndProcessingSteps> latchingDataForEvent(const PlatformWheelEvent&, bool allowLatching) const;
void nodeDidHandleEvent(ScrollingNodeID, OptionSet<WheelEventProcessingSteps>, const PlatformWheelEvent&, bool allowLatching);
Optional<ScrollingNodeID> latchedNodeID() const;
Optional<ScrollingNodeAndProcessingSteps> latchedNodeAndSteps() const;
void nodeWasRemoved(ScrollingNodeID);
void clearLatchedNode();
private:
bool latchedNodeIsRelevant() const;
mutable Lock m_latchedNodeMutex;
Optional<ScrollingNodeAndProcessingSteps> m_latchedNodeAndSteps;
Optional<OptionSet<WheelEventProcessingSteps>> m_processingStepsForCurrentGesture;
MonotonicTime m_lastLatchedNodeInterationTime;
};
}
#endif // ENABLE(ASYNC_SCROLLING)