Bug 100180 - Modal dialogs should try to cancel any drag sessions in progress. r=roc.

This commit is contained in:
Mike Conley 2014-04-23 12:35:00 -04:00
Родитель 2ad94f8051
Коммит 012fc6e157
2 изменённых файлов: 14 добавлений и 0 удалений

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

@ -8430,6 +8430,13 @@ nsGlobalWindow::EnterModalState()
}
}
// If there are any drag and drop operations in flight, try to end them.
nsCOMPtr<nsIDragService> ds =
do_GetService("@mozilla.org/widget/dragservice;1");
if (ds) {
ds->EndDragSession(true);
}
// Clear the capturing content if it is under topDoc.
// Usually the activeESM check above does that, but there are cases when
// we don't have activeESM, or it is for different document.

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

@ -591,6 +591,13 @@ nsDragService::IsCollectionObject(IDataObject* inDataObj)
NS_IMETHODIMP
nsDragService::EndDragSession(bool aDoneDrag)
{
// Bug 100180: If we've got mouse events captured, make sure we release it -
// that way, if we happen to call EndDragSession before diving into a nested
// event loop, we can still respond to mouse events.
if (::GetCapture()) {
::ReleaseCapture();
}
nsBaseDragService::EndDragSession(aDoneDrag);
NS_IF_RELEASE(mDataObject);