2017-08-13 09:08:48 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_CoalescedInputData_h
|
|
|
|
#define mozilla_dom_CoalescedInputData_h
|
|
|
|
|
|
|
|
#include "mozilla/UniquePtr.h"
|
2018-11-01 23:15:46 +03:00
|
|
|
#include "mozilla/layers/ScrollableLayerGuid.h"
|
2017-08-13 09:08:48 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
template <class InputEventType>
|
|
|
|
class CoalescedInputData {
|
|
|
|
protected:
|
|
|
|
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
|
|
|
|
|
|
|
UniquePtr<InputEventType> mCoalescedInputEvent;
|
|
|
|
ScrollableLayerGuid mGuid;
|
|
|
|
uint64_t mInputBlockId;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CoalescedInputData() : mInputBlockId(0) {}
|
|
|
|
|
2017-10-12 04:05:40 +03:00
|
|
|
void RetrieveDataFrom(CoalescedInputData& aSource) {
|
2018-05-30 22:15:35 +03:00
|
|
|
mCoalescedInputEvent = std::move(aSource.mCoalescedInputEvent);
|
2017-10-12 04:05:40 +03:00
|
|
|
mGuid = aSource.mGuid;
|
|
|
|
mInputBlockId = aSource.mInputBlockId;
|
|
|
|
}
|
|
|
|
|
2017-08-13 09:08:48 +03:00
|
|
|
bool IsEmpty() { return !mCoalescedInputEvent; }
|
|
|
|
|
|
|
|
bool CanCoalesce(const InputEventType& aEvent,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
|
|
|
const uint64_t& aInputBlockId);
|
|
|
|
|
2017-10-12 06:22:36 +03:00
|
|
|
UniquePtr<InputEventType> TakeCoalescedEvent() {
|
2018-05-30 22:15:35 +03:00
|
|
|
return std::move(mCoalescedInputEvent);
|
2017-08-13 09:08:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ScrollableLayerGuid GetScrollableLayerGuid() { return mGuid; }
|
|
|
|
|
|
|
|
uint64_t GetInputBlockId() { return mInputBlockId; }
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_CoalescedInputData_h
|