Bug 670058 Stop drag handling for selection when the dragging frame selection detaches presShell r=smaug

This commit is contained in:
Masayuki Nakano 2011-07-11 13:20:46 +09:00
Родитель ea574b1992
Коммит 1089ca4946
2 изменённых файлов: 29 добавлений и 2 удалений

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

@ -378,6 +378,11 @@ public:
return sDraggingFrameSelection;
}
/**
* Call AbortDragForSelection() when we abort handling the drag as selecting.
*/
void AbortDragForSelection();
/**
if we are in table cell selection mode. aka ctrl click in table cell
*/
@ -616,7 +621,11 @@ public:
nsIPresShell *GetShell()const { return mShell; }
void DisconnectFromPresShell() { StopAutoScrollTimer(); mShell = nsnull; }
void DisconnectFromPresShell()
{
AbortDragForSelection();
mShell = nsnull;
}
private:
nsresult TakeFocus(nsIContent *aNewFocus,
PRUint32 aContentOffset,

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

@ -1927,15 +1927,33 @@ nsFrameSelection::SetMouseDownState(PRBool aState)
mMouseDownState = aState;
if (mMouseDownState) {
if (sDraggingFrameSelection) {
sDraggingFrameSelection->AbortDragForSelection();
}
sDraggingFrameSelection = this;
} else {
if (sDraggingFrameSelection == this) {
sDraggingFrameSelection = nsnull;
}
mDragSelectingCells = PR_FALSE;
PostReason(nsISelectionListener::MOUSEUP_REASON);
NotifySelectionListeners(nsISelectionController::SELECTION_NORMAL); //notify that reason is mouse up please.
}
}
void
nsFrameSelection::AbortDragForSelection()
{
if (sDraggingFrameSelection == this) {
sDraggingFrameSelection = nsnull;
mMouseDownState = PR_FALSE;
mDragSelectingCells = PR_FALSE;
PostReason(nsISelectionListener::NO_REASON);
NotifySelectionListeners(nsISelectionController::SELECTION_NORMAL);
}
StopAutoScrollTimer();
}
nsISelection*
nsFrameSelection::GetSelection(SelectionType aType) const
{