Bug 1389314 Part3: Temporarily disable the input priority events when dnd is active. r=smaug.

MozReview-Commit-ID: AWfYmhjjsq0
This commit is contained in:
Stone Shih 2017-08-02 15:23:35 +08:00
Родитель 2c638fc04f
Коммит fca19b3588
3 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -4451,6 +4451,14 @@ ContentParent::RecvSetOfflinePermission(const Principal& aPrincipal)
void
ContentParent::MaybeInvokeDragSession(TabParent* aParent)
{
// dnd uses IPCBlob to transfer data to the content process and the IPC
// message is sent as normal priority. When sending input events with input
// priority, the message may be preempted by the later dnd events. To make
// sure the input events and the blob message are processed in time order
// on the content process, we temporarily send the input events with normal
// priority when there is an active dnd session.
SetInputPriorityEventEnabled(false);
nsCOMPtr<nsIDragService> dragService =
do_GetService("@mozilla.org/widget/dragservice;1");
if (dragService && dragService->MaybeAddChildProcess(this)) {

Просмотреть файл

@ -3308,6 +3308,9 @@ TabParent::RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
Unused << Manager()->AsContentParent()->SendEndDragSession(true, true,
LayoutDeviceIntPoint(),
0);
// Continue sending input events with input priority when stopping the dnd
// session.
Manager()->AsContentParent()->SetInputPriorityEventEnabled(true);
}
return IPC_OK();
}

Просмотреть файл

@ -402,6 +402,9 @@ nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers)
mUserCancelled,
mEndDragPoint,
aKeyModifiers);
// Continue sending input events with input priority when stopping the dnd
// session.
mChildProcesses[i]->SetInputPriorityEventEnabled(true);
}
mChildProcesses.Clear();