зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1242690 - Ensure that mouse events have the callback transform applied. r=botond
MozReview-Commit-ID: 9V7xXPT8WHk
This commit is contained in:
Родитель
447b3ae749
Коммит
8792f6fbea
|
@ -1849,35 +1849,37 @@ TabChild::RecvMouseEvent(const nsString& aType,
|
|||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvRealMouseMoveEvent(const WidgetMouseEvent& event,
|
||||
TabChild::RecvRealMouseMoveEvent(const WidgetMouseEvent& aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId)
|
||||
{
|
||||
return RecvRealMouseButtonEvent(event, aGuid, aInputBlockId);
|
||||
return RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId);
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvSynthMouseMoveEvent(const WidgetMouseEvent& event,
|
||||
TabChild::RecvSynthMouseMoveEvent(const WidgetMouseEvent& aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId)
|
||||
{
|
||||
return RecvRealMouseButtonEvent(event, aGuid, aInputBlockId);
|
||||
return RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId);
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvRealMouseButtonEvent(const WidgetMouseEvent& event,
|
||||
TabChild::RecvRealMouseButtonEvent(const WidgetMouseEvent& aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId)
|
||||
{
|
||||
nsEventStatus unused;
|
||||
InputAPZContext context(aGuid, aInputBlockId, unused);
|
||||
|
||||
WidgetMouseEvent localEvent(event);
|
||||
WidgetMouseEvent localEvent(aEvent);
|
||||
localEvent.widget = mPuppetWidget;
|
||||
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
|
||||
mPuppetWidget->GetDefaultScale());
|
||||
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
||||
|
||||
if (event.mFlags.mHandledByAPZ) {
|
||||
mAPZEventState->ProcessMouseEvent(event, aGuid, aInputBlockId);
|
||||
if (aEvent.mFlags.mHandledByAPZ) {
|
||||
mAPZEventState->ProcessMouseEvent(aEvent, aGuid, aInputBlockId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1893,16 +1895,18 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
|||
mPuppetWidget, document, aEvent, aGuid, aInputBlockId);
|
||||
}
|
||||
|
||||
WidgetWheelEvent event(aEvent);
|
||||
event.widget = mPuppetWidget;
|
||||
APZCCallbackHelper::DispatchWidgetEvent(event);
|
||||
WidgetWheelEvent localEvent(aEvent);
|
||||
localEvent.widget = mPuppetWidget;
|
||||
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
|
||||
mPuppetWidget->GetDefaultScale());
|
||||
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
||||
|
||||
if (event.mCanTriggerSwipe) {
|
||||
SendRespondStartSwipeEvent(aInputBlockId, event.TriggersSwipe());
|
||||
if (localEvent.mCanTriggerSwipe) {
|
||||
SendRespondStartSwipeEvent(aInputBlockId, localEvent.TriggersSwipe());
|
||||
}
|
||||
|
||||
if (aEvent.mFlags.mHandledByAPZ) {
|
||||
mAPZEventState->ProcessWheelEvent(event, aGuid, aInputBlockId);
|
||||
mAPZEventState->ProcessWheelEvent(localEvent, aGuid, aInputBlockId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1094,10 +1094,9 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
|
|||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
// This function will be removed once metro code is modified to use the
|
||||
// InputData version of ReceiveInputEvent.
|
||||
// In general it is preferable to use the version of ReceiveInputEvent
|
||||
// that takes an InputData, as that is usable from off-main-thread.
|
||||
// that takes an InputData, as that is usable from off-main-thread. On some
|
||||
// platforms OMT input isn't possible, and there we can use this version.
|
||||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
|
|
@ -536,13 +536,19 @@ APZCCallbackHelper::ApplyCallbackTransform(const LayoutDeviceIntPoint& aPoint,
|
|||
}
|
||||
|
||||
void
|
||||
APZCCallbackHelper::ApplyCallbackTransform(WidgetTouchEvent& aEvent,
|
||||
APZCCallbackHelper::ApplyCallbackTransform(WidgetEvent& aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const CSSToLayoutDeviceScale& aScale)
|
||||
{
|
||||
for (size_t i = 0; i < aEvent.touches.Length(); i++) {
|
||||
aEvent.touches[i]->mRefPoint = ApplyCallbackTransform(
|
||||
aEvent.touches[i]->mRefPoint, aGuid, aScale);
|
||||
if (aEvent.AsTouchEvent()) {
|
||||
WidgetTouchEvent& event = *(aEvent.AsTouchEvent());
|
||||
for (size_t i = 0; i < event.touches.Length(); i++) {
|
||||
event.touches[i]->mRefPoint = ApplyCallbackTransform(
|
||||
event.touches[i]->mRefPoint, aGuid, aScale);
|
||||
}
|
||||
} else {
|
||||
aEvent.refPoint = ApplyCallbackTransform(
|
||||
aEvent.refPoint, aGuid, aScale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,9 +99,9 @@ public:
|
|||
const ScrollableLayerGuid& aGuid,
|
||||
const CSSToLayoutDeviceScale& aScale);
|
||||
|
||||
/* Convenience function for applying a callback transform to all touch
|
||||
* points of a touch event. */
|
||||
static void ApplyCallbackTransform(WidgetTouchEvent& aEvent,
|
||||
/* Convenience function for applying a callback transform to all refpoints
|
||||
* in the input event. */
|
||||
static void ApplyCallbackTransform(WidgetEvent& aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const CSSToLayoutDeviceScale& aScale);
|
||||
|
||||
|
|
|
@ -1054,14 +1054,13 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
InputAPZContext context(aGuid, aInputBlockId, aApzResponse);
|
||||
|
||||
// If this is a touch event and APZ has targeted it to an APZC in the root
|
||||
// If this is an event that the APZ has targeted to an APZC in the root
|
||||
// process, apply that APZC's callback-transform before dispatching the
|
||||
// event. If the event is instead targeted to an APZC in the child process,
|
||||
// the transform will be applied in the child process before dispatching
|
||||
// the event there (see e.g. TabChild::RecvRealTouchEvent()).
|
||||
// TODO: Do other types of events (than touch) need this?
|
||||
if (aEvent->AsTouchEvent() && aGuid.mLayersId == mCompositorParent->RootLayerTreeId()) {
|
||||
APZCCallbackHelper::ApplyCallbackTransform(*aEvent->AsTouchEvent(), aGuid,
|
||||
if (aGuid.mLayersId == mCompositorParent->RootLayerTreeId()) {
|
||||
APZCCallbackHelper::ApplyCallbackTransform(*aEvent, aGuid,
|
||||
GetDefaultScale());
|
||||
}
|
||||
|
||||
|
@ -1072,7 +1071,7 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
|||
UniquePtr<WidgetEvent> original(aEvent->Duplicate());
|
||||
DispatchEvent(aEvent, status);
|
||||
|
||||
if (mAPZC && !context.WasRoutedToChildProcess()) {
|
||||
if (mAPZC && !context.WasRoutedToChildProcess() && aInputBlockId) {
|
||||
// EventStateManager did not route the event into the child process.
|
||||
// It's safe to communicate to APZ that the event has been processed.
|
||||
// TODO: Eventually we'll be able to move the SendSetTargetAPZCNotification
|
||||
|
@ -1109,16 +1108,7 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
|||
nsEventStatus
|
||||
nsBaseWidget::DispatchInputEvent(WidgetInputEvent* aEvent)
|
||||
{
|
||||
if (mAPZC) {
|
||||
nsEventStatus result = mAPZC->ReceiveInputEvent(*aEvent, nullptr, nullptr);
|
||||
if (result == nsEventStatus_eConsumeNoDefault) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(aEvent, status);
|
||||
return status;
|
||||
return DispatchAPZAwareEvent(aEvent);
|
||||
}
|
||||
|
||||
class DispatchWheelEventOnMainThread : public Task
|
||||
|
|
Загрузка…
Ссылка в новой задаче