Bug 1889091 - Part 6: Remove "scratch" register parameter from emitPushArguments...
[gecko.git] / dom / ipc / CoalescedWheelData.cpp
blobc8e23ac86ddefc85ccc45cbcdaafad452527d8bc
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "base/basictypes.h"
8 #include "CoalescedWheelData.h"
10 using namespace mozilla;
11 using namespace mozilla::dom;
13 void CoalescedWheelData::Coalesce(const WidgetWheelEvent& aEvent,
14 const ScrollableLayerGuid& aGuid,
15 const uint64_t& aInputBlockId) {
16 if (IsEmpty()) {
17 mCoalescedInputEvent = MakeUnique<WidgetWheelEvent>(aEvent);
18 mGuid = aGuid;
19 mInputBlockId = aInputBlockId;
20 } else {
21 MOZ_ASSERT(mGuid == aGuid);
22 MOZ_ASSERT(mInputBlockId == aInputBlockId);
23 MOZ_ASSERT(mCoalescedInputEvent->mModifiers == aEvent.mModifiers);
24 MOZ_ASSERT(mCoalescedInputEvent->mDeltaMode == aEvent.mDeltaMode);
25 MOZ_ASSERT(mCoalescedInputEvent->mCanTriggerSwipe ==
26 aEvent.mCanTriggerSwipe);
27 mCoalescedInputEvent->mDeltaX += aEvent.mDeltaX;
28 mCoalescedInputEvent->mDeltaY += aEvent.mDeltaY;
29 mCoalescedInputEvent->mDeltaZ += aEvent.mDeltaZ;
30 mCoalescedInputEvent->mLineOrPageDeltaX += aEvent.mLineOrPageDeltaX;
31 mCoalescedInputEvent->mLineOrPageDeltaY += aEvent.mLineOrPageDeltaY;
32 mCoalescedInputEvent->mTimeStamp = aEvent.mTimeStamp;
36 bool CoalescedWheelData::CanCoalesce(const WidgetWheelEvent& aEvent,
37 const ScrollableLayerGuid& aGuid,
38 const uint64_t& aInputBlockId) {
39 MOZ_ASSERT(!IsEmpty());
40 return !mCoalescedInputEvent ||
41 (mCoalescedInputEvent->mRefPoint == aEvent.mRefPoint &&
42 mCoalescedInputEvent->mModifiers == aEvent.mModifiers &&
43 mCoalescedInputEvent->mDeltaMode == aEvent.mDeltaMode &&
44 mCoalescedInputEvent->mCanTriggerSwipe == aEvent.mCanTriggerSwipe &&
45 mGuid == aGuid && mInputBlockId == aInputBlockId);