RemoteScrollingUIState.h [plain text]
#pragma once
#include <wtf/HashSet.h>
#include <wtf/OptionSet.h>
namespace IPC {
class Decoder;
class Encoder;
}
namespace WebCore {
using ScrollingNodeID = uint64_t;
}
namespace WebKit {
class RemoteScrollingUIState {
WTF_MAKE_FAST_ALLOCATED;
public:
enum class Changes : uint8_t {
ScrollSnapNodes = 1 << 0,
UserScrollNodes = 1 << 1,
};
void encode(IPC::Encoder&) const;
static Optional<RemoteScrollingUIState> decode(IPC::Decoder&);
OptionSet<Changes> changes() const { return m_changes; }
void clearChanges() { m_changes = { }; }
void reset();
const HashSet<WebCore::ScrollingNodeID>& nodesWithActiveScrollSnap() const { return m_nodesWithActiveScrollSnap; }
void addNodeWithActiveScrollSnap(WebCore::ScrollingNodeID);
void removeNodeWithActiveScrollSnap(WebCore::ScrollingNodeID);
const HashSet<WebCore::ScrollingNodeID>& nodesWithActiveUserScrolls() const { return m_nodesWithActiveUserScrolls; }
void addNodeWithActiveUserScroll(WebCore::ScrollingNodeID);
void removeNodeWithActiveUserScroll(WebCore::ScrollingNodeID);
private:
OptionSet<Changes> m_changes;
HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveScrollSnap;
HashSet<WebCore::ScrollingNodeID> m_nodesWithActiveUserScrolls;
};
}
namespace WTF {
template<> struct EnumTraits<WebKit::RemoteScrollingUIState::Changes> {
using values = EnumValues<
WebKit::RemoteScrollingUIState::Changes,
WebKit::RemoteScrollingUIState::Changes::ScrollSnapNodes,
WebKit::RemoteScrollingUIState::Changes::UserScrollNodes
>;
};
}