зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1893119: apply code formatting via Lando
# ignore-this-changeset
This commit is contained in:
Родитель
ce04c3bf58
Коммит
f27ae4577c
|
@ -1922,12 +1922,12 @@ mozilla::ipc::IPCResult BrowserChild::RecvRealDragEvent(
|
|||
|
||||
DispatchWidgetEventViaAPZ(localEvent);
|
||||
|
||||
if (aEvent.mMessage == eDragLeave ||
|
||||
aEvent.mMessage == eDragExit) {
|
||||
if (aEvent.mMessage == eDragLeave || aEvent.mMessage == eDragExit) {
|
||||
// If session is still active, remove its target.
|
||||
dragSession = GetDragSession();
|
||||
if (dragSession) {
|
||||
static_cast<nsDragSessionProxy*>(dragSession.get())->SetDragTarget(nullptr);
|
||||
static_cast<nsDragSessionProxy*>(dragSession.get())
|
||||
->SetDragTarget(nullptr);
|
||||
}
|
||||
}
|
||||
return IPC_OK();
|
||||
|
|
|
@ -85,11 +85,11 @@ class SessionStoreChild;
|
|||
class RequestData;
|
||||
class WebProgressData;
|
||||
|
||||
#define DOM_BROWSERCHILD_IID \
|
||||
{ \
|
||||
0x58a5775d, 0xba05, 0x45bf, { \
|
||||
0xbd, 0xb8, 0xd7, 0x61, 0xf9, 0x01, 0x01, 0x31 \
|
||||
} \
|
||||
#define DOM_BROWSERCHILD_IID \
|
||||
{ \
|
||||
0x58a5775d, 0xba05, 0x45bf, { \
|
||||
0xbd, 0xb8, 0xd7, 0x61, 0xf9, 0x01, 0x01, 0x31 \
|
||||
} \
|
||||
}
|
||||
|
||||
class BrowserChildMessageManager : public ContentFrameMessageManager,
|
||||
|
@ -679,8 +679,7 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
|||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
mozilla::ipc::IPCResult RecvEndDragSession(
|
||||
const bool& aDoneDrag,
|
||||
const bool& aUserCancelled,
|
||||
const bool& aDoneDrag, const bool& aUserCancelled,
|
||||
const mozilla::LayoutDeviceIntPoint& aEndDragPoint,
|
||||
const uint32_t& aKeyModifiers, const uint32_t& aDropEffect);
|
||||
|
||||
|
|
|
@ -1628,8 +1628,7 @@ bool BrowserParent::QueryDropLinksForVerification() {
|
|||
// Before sending the dragEvent, we query the links being dragged and
|
||||
// store them on the parent, to make sure the child can not modify links.
|
||||
RefPtr<nsIWidget> widget = GetTopLevelWidget();
|
||||
nsCOMPtr<nsIDragSession> dragSession =
|
||||
nsContentUtils::GetDragSession(widget);
|
||||
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession(widget);
|
||||
if (!dragSession) {
|
||||
NS_WARNING("No dragSession to query links for verification");
|
||||
return false;
|
||||
|
@ -3870,9 +3869,8 @@ mozilla::ipc::IPCResult BrowserParent::RecvInvokeDragSession(
|
|||
const MaybeDiscarded<WindowContext>& aSourceTopWindowContext) {
|
||||
PresShell* presShell = mFrameElement->OwnerDoc()->GetPresShell();
|
||||
if (!presShell) {
|
||||
Unused << SendEndDragSession(
|
||||
true, true, LayoutDeviceIntPoint(), 0,
|
||||
nsIDragService::DRAGDROP_ACTION_NONE);
|
||||
Unused << SendEndDragSession(true, true, LayoutDeviceIntPoint(), 0,
|
||||
nsIDragService::DRAGDROP_ACTION_NONE);
|
||||
// Continue sending input events with input priority when stopping the dnd
|
||||
// session.
|
||||
Manager()->SetInputPriorityEventEnabled(true);
|
||||
|
@ -3974,8 +3972,8 @@ void BrowserParent::MaybeInvokeDragSession(EventMessage aMessage) {
|
|||
// We need to send transferable data to child process.
|
||||
nsTArray<IPCTransferableData> ipcTransferables;
|
||||
GetIPCTransferableData(session, ipcTransferables);
|
||||
mozilla::Unused << SendUpdateDragSession(
|
||||
std::move(ipcTransferables), aMessage);
|
||||
mozilla::Unused << SendUpdateDragSession(std::move(ipcTransferables),
|
||||
aMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,12 +78,11 @@ namespace ipc {
|
|||
class StructuredCloneData;
|
||||
} // namespace ipc
|
||||
|
||||
|
||||
#define DOM_BROWSERPARENT_IID \
|
||||
{ \
|
||||
0x58b47b52, 0x77dc, 0x44cf, { \
|
||||
0x8b, 0xe5, 0x8e, 0x78, 0x24, 0xd9, 0xae, 0xc5 \
|
||||
} \
|
||||
#define DOM_BROWSERPARENT_IID \
|
||||
{ \
|
||||
0x58b47b52, 0x77dc, 0x44cf, { \
|
||||
0x8b, 0xe5, 0x8e, 0x78, 0x24, 0xd9, 0xae, 0xc5 \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4623,8 +4623,7 @@ nsresult EditorBase::HandleDropEvent(DragEvent* aDropEvent) {
|
|||
}
|
||||
|
||||
RefPtr<nsIWidget> widget = GetWidget();
|
||||
nsCOMPtr<nsIDragSession> dragSession =
|
||||
nsContentUtils::GetDragSession(widget);
|
||||
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession(widget);
|
||||
if (NS_WARN_IF(!dragSession)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -4935,7 +4934,6 @@ nsresult EditorBase::DeleteSelectionByDragAsAction(bool aDispatchInputEvent) {
|
|||
RefPtr<nsIWidget> widget = GetWidget();
|
||||
if (nsCOMPtr<nsIDragSession> dragSession =
|
||||
nsContentUtils::GetDragSession(widget)) {
|
||||
|
||||
dragSession->MaybeEditorDeletedSourceNode(editingHost);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ void nsTextControlFrame::Destroy(DestroyContext& aContext) {
|
|||
// text control because another text node may be recreated soon if the text
|
||||
// control is just reframed.
|
||||
if (nsCOMPtr<nsIDragSession> dragSession =
|
||||
nsContentUtils::GetDragSession(PresContext())) {
|
||||
nsContentUtils::GetDragSession(PresContext())) {
|
||||
if (dragSession->IsDraggingTextInTextControl() && mRootNode &&
|
||||
mRootNode->GetFirstChild()) {
|
||||
nsCOMPtr<nsINode> sourceNode;
|
||||
|
@ -483,7 +483,7 @@ bool nsTextControlFrame::ShouldInitializeEagerly() const {
|
|||
// new source node for the drag session (TextEditor creates the text node
|
||||
// in the anonymous <div> element.
|
||||
if (nsCOMPtr<nsIDragSession> dragSession =
|
||||
nsContentUtils::GetDragSession(PresContext())) {
|
||||
nsContentUtils::GetDragSession(PresContext())) {
|
||||
if (dragSession->IsDraggingTextInTextControl()) {
|
||||
nsCOMPtr<nsINode> sourceNode;
|
||||
if (NS_SUCCEEDED(
|
||||
|
@ -1219,7 +1219,7 @@ nsTextControlFrame::EditorInitializer::Run() {
|
|||
// In this case we should restore the source node of the drag session to
|
||||
// new text node because it's required for dispatching `dragend` event.
|
||||
if (nsCOMPtr<nsIDragSession> dragSession =
|
||||
nsContentUtils::GetDragSession(mFrame->PresContext())) {
|
||||
nsContentUtils::GetDragSession(mFrame->PresContext())) {
|
||||
if (dragSession->IsDraggingTextInTextControl()) {
|
||||
nsCOMPtr<nsINode> sourceNode;
|
||||
if (NS_SUCCEEDED(
|
||||
|
|
|
@ -201,8 +201,8 @@ MockDragServiceController::SendEvent(
|
|||
} break;
|
||||
case EventType::eDragOver:
|
||||
NS_ENSURE_TRUE(currentDragSession, NS_ERROR_UNEXPECTED);
|
||||
rv = currentDragSession->FireDragEventAtSource(
|
||||
EventMessage::eDrag, aKeyModifiers);
|
||||
rv = currentDragSession->FireDragEventAtSource(EventMessage::eDrag,
|
||||
aKeyModifiers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
currentDragSession->SetDragAction(nsIDragService::DRAGDROP_ACTION_MOVE);
|
||||
widget->DispatchInputEvent(widgetEvent.get());
|
||||
|
|
|
@ -170,8 +170,7 @@ nsresult nsDragSession::EndDragSessionImpl(bool aDoneDrag,
|
|||
uint32_t aKeyModifiers) {
|
||||
java::GeckoDragAndDrop::EndDragSession();
|
||||
|
||||
nsresult rv =
|
||||
nsBaseDragSession::EndDragSessionImpl(aDoneDrag, aKeyModifiers);
|
||||
nsresult rv = nsBaseDragSession::EndDragSessionImpl(aDoneDrag, aKeyModifiers);
|
||||
mTransferable = nullptr;
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ class nsDragSession : public nsBaseDragSession {
|
|||
|
||||
virtual bool MustUpdateDataTransfer(mozilla::EventMessage aMessage) override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT nsresult EndDragSessionImpl(
|
||||
bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
MOZ_CAN_RUN_SCRIPT nsresult
|
||||
EndDragSessionImpl(bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
|
||||
protected:
|
||||
virtual ~nsDragSession() = default;
|
||||
|
|
|
@ -4359,11 +4359,10 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
|||
if (dragService) {
|
||||
RefPtr<nsIDragSession> dragSession;
|
||||
nsIWidget* widget = mGeckoChild;
|
||||
dragService->GetCurrentSession(widget,
|
||||
getter_AddRefs(dragSession));
|
||||
dragService->GetCurrentSession(widget, getter_AddRefs(dragSession));
|
||||
if (dragSession) {
|
||||
MOZ_ASSERT(aSession == static_cast<nsDragSession*>(dragSession.get())
|
||||
->GetNSDraggingSession());
|
||||
->GetNSDraggingSession());
|
||||
dragSession->DragMoved(aPoint.x, aPoint.y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ class nsDragSession : public nsBaseDragSession {
|
|||
|
||||
NSDraggingSession* GetNSDraggingSession() { return mNSDraggingSession; }
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT nsresult EndDragSessionImpl(
|
||||
bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
MOZ_CAN_RUN_SCRIPT nsresult
|
||||
EndDragSessionImpl(bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
|
||||
protected:
|
||||
// nsBaseDragSession
|
||||
|
|
|
@ -502,8 +502,7 @@ nsresult nsDragSession::EndDragSessionImpl(bool aDoneDrag,
|
|||
|
||||
mUserCancelled = gUserCancelledDrag;
|
||||
|
||||
nsresult rv =
|
||||
nsBaseDragSession::EndDragSessionImpl(aDoneDrag, aKeyModifiers);
|
||||
nsresult rv = nsBaseDragSession::EndDragSessionImpl(aDoneDrag, aKeyModifiers);
|
||||
mDataItems = nullptr;
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -977,8 +977,8 @@ nsresult nsDragSession::EndDragSessionImpl(bool aDoneDrag,
|
|||
// Manually addref this and pass to TaskRemoveTempFiles where it is
|
||||
// derefed.
|
||||
AddRef();
|
||||
mTempFileTimerID = g_timeout_add(NS_DND_TMP_CLEANUP_TIMEOUT,
|
||||
TaskRemoveTempFiles, this);
|
||||
mTempFileTimerID =
|
||||
g_timeout_add(NS_DND_TMP_CLEANUP_TIMEOUT, TaskRemoveTempFiles, this);
|
||||
mTempFileUrls.Clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ class nsDragSession : public nsBaseDragSession, public nsIObserver {
|
|||
// mTargetDragContextForRemote context.
|
||||
NS_IMETHOD UpdateDragEffect() override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT nsresult EndDragSessionImpl(
|
||||
bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
MOZ_CAN_RUN_SCRIPT nsresult
|
||||
EndDragSessionImpl(bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
|
||||
class AutoEventLoop {
|
||||
RefPtr<nsDragSession> mSession;
|
||||
|
|
|
@ -5473,8 +5473,8 @@ void nsWindow::OnDragDataReceivedEvent(GtkWidget* aWidget,
|
|||
static_cast<nsDragSession*>(dragService->GetCurrentSession(this));
|
||||
if (dragSession) {
|
||||
nsDragSession::AutoEventLoop loop(dragSession);
|
||||
dragSession->TargetDataReceived(aWidget, aDragContext, aX, aY, aSelectionData,
|
||||
aInfo, aTime);
|
||||
dragSession->TargetDataReceived(aWidget, aDragContext, aX, aY,
|
||||
aSelectionData, aInfo, aTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,9 +75,7 @@ uint32_t GetSuppressLevel() {
|
|||
nsBaseDragService::nsBaseDragService() = default;
|
||||
nsBaseDragService::~nsBaseDragService() = default;
|
||||
|
||||
nsBaseDragSession::nsBaseDragSession() {
|
||||
TakeSessionBrowserListFromService();
|
||||
}
|
||||
nsBaseDragSession::nsBaseDragSession() { TakeSessionBrowserListFromService(); }
|
||||
nsBaseDragSession::~nsBaseDragSession() = default;
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsBaseDragService, nsIDragService)
|
||||
|
@ -614,7 +612,8 @@ nsBaseDragService::GetCurrentSession(nsISupports* aWidgetProvider,
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
nsIDragSession* nsBaseDragService::StartDragSession(nsISupports* aWidgetProvider) {
|
||||
nsIDragSession* nsBaseDragService::StartDragSession(
|
||||
nsISupports* aWidgetProvider) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
if (!aWidgetProvider) {
|
||||
return nullptr;
|
||||
|
@ -706,9 +705,8 @@ nsresult nsBaseDragSession::EndDragSessionImpl(bool aDoneDrag,
|
|||
if (NS_WARN_IF(!bp)) {
|
||||
continue;
|
||||
}
|
||||
mozilla::Unused << bp->SendEndDragSession(aDoneDrag, mUserCancelled,
|
||||
mEndDragPoint, aKeyModifiers,
|
||||
dropEffect);
|
||||
mozilla::Unused << bp->SendEndDragSession(
|
||||
aDoneDrag, mUserCancelled, mEndDragPoint, aKeyModifiers, dropEffect);
|
||||
// Continue sending input events with input priority when stopping the dnd
|
||||
// session.
|
||||
bp->Manager()->SetInputPriorityEventEnabled(true);
|
||||
|
@ -723,7 +721,8 @@ nsresult nsBaseDragSession::EndDragSessionImpl(bool aDoneDrag,
|
|||
nsCOMPtr<nsIDragService> svc =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
if (svc) {
|
||||
static_cast<nsBaseDragService*>(svc.get())->ClearCurrentParentDragSession();
|
||||
static_cast<nsBaseDragService*>(svc.get())
|
||||
->ClearCurrentParentDragSession();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1113,8 @@ nsBaseDragSession::DragEventDispatchedToChildProcess() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static bool MaybeAddBrowser(nsTArray<nsWeakPtr>& aBrowsers, BrowserParent* aBP) {
|
||||
static bool MaybeAddBrowser(nsTArray<nsWeakPtr>& aBrowsers,
|
||||
BrowserParent* aBP) {
|
||||
nsWeakPtr browser = do_GetWeakReference(aBP);
|
||||
|
||||
// Equivalent to `InsertElementSorted`, avoiding inserting a duplicate
|
||||
|
@ -1230,11 +1230,13 @@ void nsBaseDragSession::TakeSessionBrowserListFromService() {
|
|||
nsCOMPtr<nsIDragService> svc =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
NS_ENSURE_TRUE_VOID(svc);
|
||||
mBrowsers = static_cast<nsBaseDragService*>(svc.get())->TakeSessionBrowserList();
|
||||
mBrowsers =
|
||||
static_cast<nsBaseDragService*>(svc.get())->TakeSessionBrowserList();
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsIWidget* nsBaseDragService::GetWidgetFromWidgetProvider(nsISupports* aWidgetProvider) {
|
||||
nsIWidget* nsBaseDragService::GetWidgetFromWidgetProvider(
|
||||
nsISupports* aWidgetProvider) {
|
||||
nsCOMPtr<nsIWidget> widget = do_QueryObject(aWidgetProvider);
|
||||
if (widget) {
|
||||
return widget;
|
||||
|
|
|
@ -283,13 +283,9 @@ class nsBaseDragService : public nsIDragService {
|
|||
|
||||
uint32_t GetSuppressLevel() { return mSuppressLevel; };
|
||||
|
||||
nsTArray<nsWeakPtr> TakeSessionBrowserList() {
|
||||
return std::move(mBrowsers);
|
||||
}
|
||||
nsTArray<nsWeakPtr> TakeSessionBrowserList() { return std::move(mBrowsers); }
|
||||
|
||||
void ClearCurrentParentDragSession() {
|
||||
mCurrentParentDragSession = nullptr;
|
||||
}
|
||||
void ClearCurrentParentDragSession() { mCurrentParentDragSession = nullptr; }
|
||||
|
||||
static nsIWidget* GetWidgetFromWidgetProvider(nsISupports* aWidgetProvider);
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@ nsresult nsDragSessionProxy::InvokeDragSession(
|
|||
[[maybe_unused]] RefPtr<nsIDragSession> sourceSession =
|
||||
sourceBrowser->GetDragSession();
|
||||
MOZ_ASSERT(!sourceSession);
|
||||
nsresult rv = nsBaseDragSession::InvokeDragSession(aWidget, aDOMNode,
|
||||
aPrincipal, aCsp, aCookieJarSettings, aTransferableArray, aActionType,
|
||||
aContentPolicyType);
|
||||
nsresult rv = nsBaseDragSession::InvokeDragSession(
|
||||
aWidget, aDOMNode, aPrincipal, aCsp, aCookieJarSettings,
|
||||
aTransferableArray, aActionType, aContentPolicyType);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MOZ_ALWAYS_SUCCEEDS(sourceBrowser->GetWeakReference(getter_AddRefs(mSourceBrowser)));
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
sourceBrowser->GetWeakReference(getter_AddRefs(mSourceBrowser)));
|
||||
sourceBrowser->SetDragSession(this);
|
||||
}
|
||||
return rv;
|
||||
|
@ -118,8 +119,8 @@ nsresult nsDragSessionProxy::InvokeDragSessionImpl(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDragSession*
|
||||
nsDragServiceProxy::StartDragSession(nsISupports* aWidgetProvider) {
|
||||
nsIDragSession* nsDragServiceProxy::StartDragSession(
|
||||
nsISupports* aWidgetProvider) {
|
||||
nsIWidget* widget = GetWidgetFromWidgetProvider(aWidgetProvider);
|
||||
NS_ENSURE_TRUE(widget, nullptr);
|
||||
BrowserChild* targetBrowser = widget->GetOwningBrowserChild();
|
||||
|
@ -170,10 +171,10 @@ void nsDragSessionProxy::SetDragTarget(BrowserChild* aTarget) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
[[maybe_unused]] RefPtr<nsIDragSession> session =
|
||||
aTarget->GetDragSession();
|
||||
[[maybe_unused]] RefPtr<nsIDragSession> session = aTarget->GetDragSession();
|
||||
MOZ_ASSERT(!session);
|
||||
MOZ_ALWAYS_SUCCEEDS(aTarget->GetWeakReference(getter_AddRefs(mTargetBrowser)));
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
aTarget->GetWeakReference(getter_AddRefs(mTargetBrowser)));
|
||||
}
|
||||
|
||||
nsresult nsDragSessionProxy::EndDragSessionImpl(bool aDoneDrag,
|
||||
|
|
|
@ -35,8 +35,8 @@ class nsDragSession : public nsBaseDragSession {
|
|||
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||
uint32_t aActionType);
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT nsresult EndDragSessionImpl(
|
||||
bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
MOZ_CAN_RUN_SCRIPT nsresult
|
||||
EndDragSessionImpl(bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT nsresult StartInvokingDragSession(nsIWidget* aWidget,
|
||||
IDataObject* aDataObj,
|
||||
|
@ -66,7 +66,6 @@ class nsDragSession : public nsBaseDragSession {
|
|||
class nsDragService final : public nsBaseDragService {
|
||||
public:
|
||||
already_AddRefed<nsIDragSession> CreateDragSession() override;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsDragService_h__
|
||||
|
|
|
@ -384,8 +384,7 @@ void nsNativeDragTarget::DragCancel() {
|
|||
}
|
||||
if (mDragService) {
|
||||
ModifierKeyState modifierKeyState;
|
||||
RefPtr<nsIDragSession> session =
|
||||
mDragService->GetCurrentSession(mWidget);
|
||||
RefPtr<nsIDragSession> session = mDragService->GetCurrentSession(mWidget);
|
||||
if (session) {
|
||||
session->EndDragSession(false, modifierKeyState.GetModifiers());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче