From fee226ad16084ca62dfa6bd0b320ac9d4e59bd8f Mon Sep 17 00:00:00 2001 From: "Olli.Pettay%helsinki.fi" Date: Thu, 14 Jun 2007 08:22:47 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20336160=20=C3=A2=C2=80=C2=93=20Crash=20whe?= =?UTF-8?q?n=20releasing=20mouse=20while=20dragging=20absolute=20positione?= =?UTF-8?q?d=20element=20in=20designMode=20[@=20nsHTMLEditor::MouseUp],=20?= =?UTF-8?q?r=3Dglazman,=20sr=3Dpeterv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@228039 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/libeditor/html/nsHTMLAbsPosition.cpp | 11 ++++++++--- .../editor/libeditor/html/nsHTMLAnonymousUtils.cpp | 5 +++++ mozilla/editor/libeditor/html/nsHTMLObjectResizer.cpp | 2 -- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/mozilla/editor/libeditor/html/nsHTMLAbsPosition.cpp b/mozilla/editor/libeditor/html/nsHTMLAbsPosition.cpp index dd4dde4d560..3f9716d6a5d 100644 --- a/mozilla/editor/libeditor/html/nsHTMLAbsPosition.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLAbsPosition.cpp @@ -443,14 +443,19 @@ nsHTMLEditor::EndMoving() } mMouseMotionListenerP = nsnull; - return NS_OK; + mGrabberClicked = PR_FALSE; + mIsMoving = PR_FALSE; + nsCOMPtr selection; + GetSelection(getter_AddRefs(selection)); + if (!selection) { + return NS_ERROR_NOT_INITIALIZED; + } + return CheckSelectionStateForAnonymousButtons(selection); } nsresult nsHTMLEditor::SetFinalPosition(PRInt32 aX, PRInt32 aY) { nsresult res = EndMoving(); - mGrabberClicked = PR_FALSE; - mIsMoving = PR_FALSE; if (NS_FAILED(res)) return res; // we have now to set the new width and height of the resized object diff --git a/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp b/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp index c65ff94bf39..8d0a7526f9f 100644 --- a/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLAnonymousUtils.cpp @@ -227,6 +227,11 @@ nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection) !mIsInlineTableEditingEnabled) return NS_OK; + // Don't change selection state if we're moving. + if (mIsMoving) { + return NS_OK; + } + nsCOMPtr focusElement; // let's get the containing element of the selection nsresult res = GetSelectionContainer(getter_AddRefs(focusElement)); diff --git a/mozilla/editor/libeditor/html/nsHTMLObjectResizer.cpp b/mozilla/editor/libeditor/html/nsHTMLObjectResizer.cpp index be1e0377c0a..4f76ad17560 100644 --- a/mozilla/editor/libeditor/html/nsHTMLObjectResizer.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLObjectResizer.cpp @@ -672,8 +672,6 @@ nsHTMLEditor::MouseUp(PRInt32 aClientX, PRInt32 aClientY, } if (mGrabberClicked) { EndMoving(); - mGrabberClicked = PR_FALSE; - mIsMoving = PR_FALSE; } } return NS_OK;