зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
in order to support dispatching synthesized touch events to fission oop iframe. Depends on D112127 Differential Revision: https://phabricator.services.mozilla.com/D112128
This commit is contained in:
Родитель
1aad51035c
Коммит
58fea44e06
|
@ -29,6 +29,7 @@
|
|||
#include "mozilla/PendingAnimationTracker.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/SharedStyleSheetCache.h"
|
||||
#include "mozilla/StaticPrefs_test.h"
|
||||
#include "mozilla/InputTaskManager.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -902,7 +903,7 @@ nsresult nsDOMWindowUtils::SendTouchEventCommon(
|
|||
event.mTouches.AppendElement(t);
|
||||
}
|
||||
|
||||
nsEventStatus status;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (aToWindow) {
|
||||
RefPtr<PresShell> presShell;
|
||||
nsView* view = nsContentUtils::GetViewToDispatchEvent(
|
||||
|
@ -910,14 +911,21 @@ nsresult nsDOMWindowUtils::SendTouchEventCommon(
|
|||
if (!presShell || !view) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
status = nsEventStatus_eIgnore;
|
||||
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
|
||||
return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
|
||||
}
|
||||
|
||||
nsresult rv = widget->DispatchEvent(&event, status);
|
||||
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
|
||||
return rv;
|
||||
if (StaticPrefs::test_events_async_enabled()) {
|
||||
status = widget->DispatchInputEvent(&event).mContentStatus;
|
||||
} else {
|
||||
nsresult rv = widget->DispatchEvent(&event, status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (aPreventDefault) {
|
||||
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static_assert(
|
||||
|
|
|
@ -1674,6 +1674,25 @@ mozilla::ipc::IPCResult BrowserParent::RecvDispatchKeyboardEvent(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvDispatchTouchEvent(
|
||||
const mozilla::WidgetTouchEvent& aEvent) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
WidgetTouchEvent localEvent(aEvent);
|
||||
localEvent.mWidget = widget;
|
||||
|
||||
for (uint32_t i = 0; i < localEvent.mTouches.Length(); i++) {
|
||||
localEvent.mTouches[i]->mRefPoint =
|
||||
TransformChildToParent(localEvent.mTouches[i]->mRefPoint);
|
||||
}
|
||||
|
||||
widget->DispatchInputEvent(&localEvent);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvRequestNativeKeyBindings(
|
||||
const uint32_t& aType, const WidgetKeyboardEvent& aEvent,
|
||||
nsTArray<CommandInt>* aCommands) {
|
||||
|
|
|
@ -413,6 +413,9 @@ class BrowserParent final : public PBrowserParent,
|
|||
mozilla::ipc::IPCResult RecvDispatchKeyboardEvent(
|
||||
const mozilla::WidgetKeyboardEvent& aEvent);
|
||||
|
||||
mozilla::ipc::IPCResult RecvDispatchTouchEvent(
|
||||
const mozilla::WidgetTouchEvent& aEvent);
|
||||
|
||||
mozilla::ipc::IPCResult RecvScrollRectIntoView(
|
||||
const nsRect& aRect, const ScrollAxis& aVertical,
|
||||
const ScrollAxis& aHorizontal, const ScrollFlags& aScrollFlags,
|
||||
|
|
|
@ -641,6 +641,7 @@ parent:
|
|||
[Nested=inside_sync] sync DispatchWheelEvent(WidgetWheelEvent event);
|
||||
[Nested=inside_sync] sync DispatchMouseEvent(WidgetMouseEvent event);
|
||||
[Nested=inside_sync] sync DispatchKeyboardEvent(WidgetKeyboardEvent event);
|
||||
[Nested=inside_sync] sync DispatchTouchEvent(WidgetTouchEvent event);
|
||||
|
||||
async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
|
||||
Shmem? visualData,
|
||||
|
|
|
@ -785,11 +785,13 @@ description = legacy sync IPC - please add detailed description
|
|||
[PBrowser::RequestNativeKeyBindings]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PBrowser::DispatchWheelEvent]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
description = Only used by automation tests
|
||||
[PBrowser::DispatchMouseEvent]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
description = Only used by automation tests
|
||||
[PBrowser::DispatchKeyboardEvent]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
description = Only used by automation tests
|
||||
[PBrowser::DispatchTouchEvent]
|
||||
description = Only used by automation tests
|
||||
[PBrowser::EnsureLayersConnected]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PBrowser::SetSystemFont]
|
||||
|
|
|
@ -403,6 +403,9 @@ nsIWidget::ContentAndAPZEventStatus PuppetWidget::DispatchInputEvent(
|
|||
Unused << mBrowserChild->SendDispatchKeyboardEvent(
|
||||
*aEvent->AsKeyboardEvent());
|
||||
break;
|
||||
case eTouchEventClass:
|
||||
Unused << mBrowserChild->SendDispatchTouchEvent(*aEvent->AsTouchEvent());
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("unsupported event type");
|
||||
}
|
||||
|
|
|
@ -1161,6 +1161,15 @@ nsIWidget::ContentAndAPZEventStatus nsBaseWidget::DispatchInputEvent(
|
|||
status.mContentStatus = nsEventStatus_eConsumeDoDefault;
|
||||
return status;
|
||||
}
|
||||
if (WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent()) {
|
||||
RefPtr<Runnable> r =
|
||||
new DispatchInputOnControllerThread<MultiTouchInput,
|
||||
WidgetTouchEvent>(*touchEvent,
|
||||
mAPZC, this);
|
||||
APZThreadUtils::RunOnControllerThread(std::move(r));
|
||||
status.mContentStatus = nsEventStatus_eConsumeDoDefault;
|
||||
return status;
|
||||
}
|
||||
// Allow dispatching keyboard events on Gecko thread.
|
||||
MOZ_ASSERT(aEvent->AsKeyboardEvent());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче