Bug 524037, prevent mouse capture if mouse up happens before handling all of mouse down, r=enndeakin, a=blocking

--HG--
extra : rebase_source : f0a30782ef3cb97d14ca21d663b23d3eff57913d
This commit is contained in:
Olli Pettay 2010-09-08 20:41:37 +03:00
Родитель bbe054ccfc
Коммит c8266d1a17
2 изменённых файлов: 7 добавлений и 7 удалений

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

@ -184,6 +184,7 @@ static PRBool sKeyCausesActivation = PR_TRUE;
static PRUint32 sESMInstanceCount = 0; static PRUint32 sESMInstanceCount = 0;
static PRInt32 sChromeAccessModifier = 0, sContentAccessModifier = 0; static PRInt32 sChromeAccessModifier = 0, sContentAccessModifier = 0;
PRInt32 nsEventStateManager::sUserInputEventDepth = 0; PRInt32 nsEventStateManager::sUserInputEventDepth = 0;
PRBool nsEventStateManager::sNormalLMouseEventInProcess = PR_FALSE;
static PRUint32 gMouseOrKeyboardEventCounter = 0; static PRUint32 gMouseOrKeyboardEventCounter = 0;
static nsITimer* gUserInteractionTimer = nsnull; static nsITimer* gUserInteractionTimer = nsnull;
@ -778,7 +779,6 @@ nsEventStateManager::nsEventStateManager()
mLClickCount(0), mLClickCount(0),
mMClickCount(0), mMClickCount(0),
mRClickCount(0), mRClickCount(0),
mNormalLMouseEventInProcess(PR_FALSE),
m_haveShutdown(PR_FALSE), m_haveShutdown(PR_FALSE),
mLastLineScrollConsumedX(PR_FALSE), mLastLineScrollConsumedX(PR_FALSE),
mLastLineScrollConsumedY(PR_FALSE), mLastLineScrollConsumedY(PR_FALSE),
@ -1085,7 +1085,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
#endif #endif
mLClickCount = ((nsMouseEvent*)aEvent)->clickCount; mLClickCount = ((nsMouseEvent*)aEvent)->clickCount;
SetClickCount(aPresContext, (nsMouseEvent*)aEvent, aStatus); SetClickCount(aPresContext, (nsMouseEvent*)aEvent, aStatus);
mNormalLMouseEventInProcess = PR_TRUE; sNormalLMouseEventInProcess = PR_TRUE;
break; break;
case nsMouseEvent::eMiddleButton: case nsMouseEvent::eMiddleButton:
mMClickCount = ((nsMouseEvent*)aEvent)->clickCount; mMClickCount = ((nsMouseEvent*)aEvent)->clickCount;
@ -1109,7 +1109,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
#ifndef XP_OS2 #ifndef XP_OS2
StopTrackingDragGesture(); StopTrackingDragGesture();
#endif #endif
mNormalLMouseEventInProcess = PR_FALSE; sNormalLMouseEventInProcess = PR_FALSE;
case nsMouseEvent::eRightButton: case nsMouseEvent::eRightButton:
#ifdef XP_OS2 #ifdef XP_OS2
StopTrackingDragGesture(); StopTrackingDragGesture();
@ -2799,7 +2799,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
case NS_MOUSE_BUTTON_DOWN: case NS_MOUSE_BUTTON_DOWN:
{ {
if (static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton && if (static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton &&
!mNormalLMouseEventInProcess) { !sNormalLMouseEventInProcess) {
// We got a mouseup event while a mousedown event was being processed. // We got a mouseup event while a mousedown event was being processed.
// Make sure that the capturing content is cleared. // Make sure that the capturing content is cleared.
nsIPresShell::SetCapturingContent(nsnull, 0); nsIPresShell::SetCapturingContent(nsnull, 0);
@ -4493,7 +4493,7 @@ nsEventStateManager::EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK)
*aOK = PR_TRUE; *aOK = PR_TRUE;
if (aEvent->message == NS_MOUSE_BUTTON_DOWN && if (aEvent->message == NS_MOUSE_BUTTON_DOWN &&
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) { static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) {
if (!mNormalLMouseEventInProcess) { if (!sNormalLMouseEventInProcess) {
*aOK = PR_FALSE; *aOK = PR_FALSE;
} }
} }

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

@ -387,8 +387,6 @@ protected:
PRUint32 mMClickCount; PRUint32 mMClickCount;
PRUint32 mRClickCount; PRUint32 mRClickCount;
PRPackedBool mNormalLMouseEventInProcess;
PRPackedBool m_haveShutdown; PRPackedBool m_haveShutdown;
// Array for accesskey support // Array for accesskey support
@ -400,6 +398,8 @@ protected:
static PRInt32 sUserInputEventDepth; static PRInt32 sUserInputEventDepth;
static PRBool sNormalLMouseEventInProcess;
// Functions used for click hold context menus // Functions used for click hold context menus
PRBool mClickHoldContextMenu; PRBool mClickHoldContextMenu;
nsCOMPtr<nsITimer> mClickHoldTimer; nsCOMPtr<nsITimer> mClickHoldTimer;