This patch tries to dispatch ePointerRawUpdate with PresShell::EventHandler::DispatchPrecedingPointerEvent as same as usual pointer events. For using the path, this patch adds 2 internal events, eMouseRawUpdate and eTouchRawUpdate which are never dispatched into the DOM because PresShell::EventHandler::DispatchPrecedingPointerEvent will return false for that and then the caller will stop handling the internal events. There are 3 dispatchers of the internal raw update events. One is PresShell::EnsurePrecedingPointerRawUpdate(). This dispatches the internal event if and only if the coming event of PresShell::HandleEvent will cause ePointerMove. The reason why PresShell::HandleEvent handles the preceding raw-update event is, we should support ePointerRawUpdate events for synthesized events for tests (in-process ones) and in the main process. Additionally, if a pointerrawupdate event may destroy the target <iframe>. In such ase, the following pointermove may need to be dispatched on its parent window or another <iframe> window. Therefore, we need to dispatch the internal raw update event before considering the target window (PresShell) and handling the capturing element. The others are BrowserChild::RecvRealMouseMoveEvent and BrowserChild::RecvRealTouchMoveEvent. They dispatch the internal events when they won't dispatch the received event immediately to coalesce with further similar input. For avoiding to dispatch the internal event for same source event, this adds WidgetPointerHelper::convertToPointerRawUpdate member to check it in PresShell::HandlePrecedingPointerRawUpdate. Differential Revision: https://phabricator.services.mozilla.com/D243404
47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
/* -*- 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_CoalescedMouseData_h
|
|
#define mozilla_dom_CoalescedMouseData_h
|
|
|
|
#include "CoalescedInputData.h"
|
|
#include "mozilla/MouseEvents.h"
|
|
#include "nsRefreshObservers.h"
|
|
|
|
class nsRefreshDriver;
|
|
|
|
namespace mozilla::dom {
|
|
|
|
class CoalescedMouseData final : public CoalescedInputData<WidgetMouseEvent> {
|
|
public:
|
|
CoalescedMouseData() { MOZ_COUNT_CTOR(mozilla::dom::CoalescedMouseData); }
|
|
|
|
~CoalescedMouseData() { MOZ_COUNT_DTOR(mozilla::dom::CoalescedMouseData); }
|
|
|
|
void Coalesce(const WidgetMouseEvent& aEvent,
|
|
const ScrollableLayerGuid& aGuid,
|
|
const uint64_t& aInputBlockId);
|
|
|
|
bool CanCoalesce(const WidgetMouseEvent& aEvent,
|
|
const ScrollableLayerGuid& aGuid,
|
|
const uint64_t& aInputBlockId,
|
|
const nsRefreshDriver* aRefreshDriver);
|
|
};
|
|
|
|
class CoalescedMouseMoveFlusher final : public CoalescedInputFlusher {
|
|
public:
|
|
explicit CoalescedMouseMoveFlusher(BrowserChild* aBrowserChild);
|
|
|
|
void WillRefresh(mozilla::TimeStamp aTime) override;
|
|
|
|
private:
|
|
~CoalescedMouseMoveFlusher() override;
|
|
};
|
|
|
|
} // namespace mozilla::dom
|
|
|
|
#endif // mozilla_dom_CoalescedMouseData_h
|