зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1893119: Part 2 - Make C++ callers of nsIDragService::GetCurrentSession pass a widget r=gstoll,win-reviewers,geckoview-reviewers,m_kato
Content process callers must call nsIDragService::GetCurrentSession with the correct widget under the drag. For all callers, it is a sanity check. Differential Revision: https://phabricator.services.mozilla.com/D211065
This commit is contained in:
Родитель
fe7920e682
Коммит
af0569bf6c
|
@ -2430,8 +2430,8 @@ void EventStateManager::StopTrackingDragGesture(bool aClearInChildProcesses) {
|
|||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
if (dragService) {
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
RefPtr<nsIDragSession> dragSession =
|
||||
dragService->GetCurrentSession(mPresContext->GetRootWidget());
|
||||
if (!dragSession) {
|
||||
// Only notify if there isn't a drag session active.
|
||||
dragService->RemoveAllChildProcesses();
|
||||
|
@ -2823,8 +2823,11 @@ bool EventStateManager::DoDefaultDragStart(
|
|||
// began. However, if we're handling drag session for synthesized events,
|
||||
// we need to initialize some information of the session. Therefore, we
|
||||
// need to keep going for synthesized case.
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
if (MOZ_UNLIKELY(!mPresContext)) {
|
||||
return true;
|
||||
}
|
||||
nsCOMPtr<nsIDragSession> dragSession =
|
||||
dragService->GetCurrentSession(mPresContext->GetRootWidget());
|
||||
if (dragSession && !dragSession->IsSynthesizedForTests()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -248,8 +248,12 @@ nsXULTooltipListener::HandleEvent(Event* aEvent) {
|
|||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
NS_ENSURE_TRUE(dragService, NS_OK);
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
auto* widgetGuiEvent = aEvent->WidgetEventPtr()->AsGUIEvent();
|
||||
if (!widgetGuiEvent) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDragSession> dragSession =
|
||||
dragService->GetCurrentSession(widgetGuiEvent->mWidget);
|
||||
if (dragSession) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -142,10 +142,9 @@ MockDragServiceController::SendEvent(
|
|||
ds->StartDragSession();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDragSession> currentDragSession;
|
||||
nsresult rv = ds->GetCurrentSession(getter_AddRefs(currentDragSession));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDragSession> currentDragSession = ds->GetCurrentSession(widget);
|
||||
|
||||
nsresult rv;
|
||||
switch (aEventType) {
|
||||
case EventType::eMouseDown:
|
||||
case EventType::eMouseMove:
|
||||
|
|
|
@ -2705,8 +2705,7 @@ void nsWindow::OnDragEvent(int32_t aAction, int64_t aTime, float aX, float aY,
|
|||
nsDragService::SetDropData(dropData);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
nsCOMPtr<nsIDragSession> dragSession = dragService->GetCurrentSession(this);
|
||||
if (dragSession) {
|
||||
switch (message) {
|
||||
case eDragOver:
|
||||
|
|
|
@ -3993,8 +3993,8 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
|||
- (BOOL)isDragInProgress {
|
||||
if (!mDragService) return NO;
|
||||
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
mDragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
nsCOMPtr<nsIDragSession> dragSession =
|
||||
mDragService->GetCurrentSession(mGeckoChild);
|
||||
return dragSession != nullptr;
|
||||
}
|
||||
|
||||
|
@ -4130,8 +4130,8 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
|||
mDragService->StartDragSession();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
mDragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
nsCOMPtr<nsIDragSession> dragSession =
|
||||
mDragService->GetCurrentSession(mGeckoChild);
|
||||
if (dragSession) {
|
||||
if (aMessage == eDragOver) {
|
||||
// fire the drag event at the source. Just ignore whether it was
|
||||
|
|
|
@ -4906,8 +4906,8 @@ void nsWindow::OnContainerFocusOutEvent(GdkEventFocus* aEvent) {
|
|||
const bool shouldRollupMenus = [&] {
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
nsCOMPtr<nsIDragSession> dragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(dragSession));
|
||||
nsCOMPtr<nsIDragSession> dragSession =
|
||||
dragService->GetCurrentSession(this);
|
||||
if (!dragSession) {
|
||||
return true;
|
||||
}
|
||||
|
@ -7634,7 +7634,6 @@ bool nsWindow::CheckForRollup(gdouble aMouseX, gdouble aMouseY, bool aIsWheel,
|
|||
return retVal;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool nsWindow::DragInProgress() {
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
|
@ -7642,8 +7641,8 @@ bool nsWindow::DragInProgress() {
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDragSession> currentDragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(currentDragSession));
|
||||
nsCOMPtr<nsIDragSession> currentDragSession =
|
||||
dragService->GetCurrentSession(this);
|
||||
return !!currentDragSession;
|
||||
}
|
||||
|
||||
|
@ -7651,7 +7650,8 @@ bool nsWindow::DragInProgress() {
|
|||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1622107
|
||||
// We try to detect when Wayland compositor / gtk fails to deliver
|
||||
// info about finished D&D operations and cancel it on our own.
|
||||
MOZ_CAN_RUN_SCRIPT static void WaylandDragWorkaround(GdkEventButton* aEvent) {
|
||||
MOZ_CAN_RUN_SCRIPT static void WaylandDragWorkaround(nsWindow* aWindow,
|
||||
GdkEventButton* aEvent) {
|
||||
static int buttonPressCountWithDrag = 0;
|
||||
|
||||
// We track only left button state as Firefox performs D&D on left
|
||||
|
@ -7665,8 +7665,8 @@ MOZ_CAN_RUN_SCRIPT static void WaylandDragWorkaround(GdkEventButton* aEvent) {
|
|||
if (!dragService) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDragSession> currentDragSession;
|
||||
dragService->GetCurrentSession(getter_AddRefs(currentDragSession));
|
||||
nsCOMPtr<nsIDragSession> currentDragSession =
|
||||
dragService->GetCurrentSession(aWindow);
|
||||
|
||||
if (!currentDragSession) {
|
||||
buttonPressCountWithDrag = 0;
|
||||
|
@ -8326,7 +8326,7 @@ static gboolean button_press_event_cb(GtkWidget* widget,
|
|||
window->OnButtonPressEvent(event);
|
||||
|
||||
if (GdkIsWaylandDisplay()) {
|
||||
WaylandDragWorkaround(event);
|
||||
WaylandDragWorkaround(window, event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -798,7 +798,7 @@ class nsWindow final : public nsBaseWidget {
|
|||
|
||||
InputRegion mInputRegion;
|
||||
|
||||
static bool DragInProgress(void);
|
||||
bool DragInProgress(void);
|
||||
|
||||
void DispatchMissedButtonReleases(GdkEventCrossing* aGdkEvent);
|
||||
|
||||
|
|
|
@ -166,8 +166,8 @@ void nsNativeDragTarget::ProcessDrag(EventMessage aEventMessage,
|
|||
GetGeckoDragAction(grfKeyState, pdwEffect, &geckoAction);
|
||||
|
||||
// Set the current action into the Gecko specific type
|
||||
nsCOMPtr<nsIDragSession> currSession;
|
||||
mDragService->GetCurrentSession(getter_AddRefs(currSession));
|
||||
RefPtr<nsDragSession> currSession =
|
||||
static_cast<nsDragSession*>(mDragService->GetCurrentSession(mWidget));
|
||||
if (!currSession) {
|
||||
return;
|
||||
}
|
||||
|
@ -298,8 +298,8 @@ nsNativeDragTarget::DragOver(DWORD grfKeyState, POINTL ptl, LPDWORD pdwEffect) {
|
|||
// then we should include it as an allowed effect.
|
||||
mEffectsAllowed = (*pdwEffect) | (mEffectsAllowed & DROPEFFECT_LINK);
|
||||
|
||||
nsCOMPtr<nsIDragSession> currentDragSession;
|
||||
mDragService->GetCurrentSession(getter_AddRefs(currentDragSession));
|
||||
nsCOMPtr<nsIDragSession> currentDragSession =
|
||||
mDragService->GetCurrentSession(mWidget);
|
||||
if (!currentDragSession) {
|
||||
return S_OK; // Drag was canceled.
|
||||
}
|
||||
|
@ -349,8 +349,8 @@ nsNativeDragTarget::DragLeave() {
|
|||
// dispatch the event into Gecko
|
||||
DispatchDragDropEvent(eDragExit, gDragLastPoint);
|
||||
|
||||
nsCOMPtr<nsIDragSession> currentDragSession;
|
||||
mDragService->GetCurrentSession(getter_AddRefs(currentDragSession));
|
||||
nsCOMPtr<nsIDragSession> currentDragSession =
|
||||
mDragService->GetCurrentSession(mWidget);
|
||||
|
||||
if (currentDragSession) {
|
||||
nsCOMPtr<nsINode> sourceNode;
|
||||
|
@ -426,8 +426,8 @@ nsNativeDragTarget::Drop(LPDATAOBJECT pData, DWORD grfKeyState, POINTL aPT,
|
|||
// Now process the native drag state and then dispatch the event
|
||||
ProcessDrag(eDrop, grfKeyState, aPT, pdwEffect);
|
||||
|
||||
nsCOMPtr<nsIDragSession> currentDragSession;
|
||||
serv->GetCurrentSession(getter_AddRefs(currentDragSession));
|
||||
nsCOMPtr<nsIDragSession> currentDragSession =
|
||||
serv->GetCurrentSession(mWidget);
|
||||
if (!currentDragSession) {
|
||||
return S_OK; // DragCancel() was called.
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче