Bug 587944. Save and restore the target frame when we dispatch a synth mouse enter/exit event.
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 26 Aug 2010 22:01:43 -0500
changeset 54032 ae7f89d6d8a91da72a91352b54d56845bb516e4b
parent 54031 dc7d226ae14b7a53ed0febd16c141c05e9831005
child 54033 3c7e28c28d21daede0488ca475ae27119f6faa78
push idunknown
push userunknown
push dateunknown
bugs587944
milestone2.0b5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 587944. Save and restore the target frame when we dispatch a synth mouse enter/exit event.
content/events/src/nsEventStateManager.cpp
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -3289,16 +3289,17 @@ nsEventStateManager::PostHandleEvent(nsP
     }
     break;
 #endif // ANDROID
 #endif // MOZ_IPC
   }
 
   //Reset target frame to null to avoid mistargeting after reentrant event
   mCurrentTarget = nsnull;
+  mCurrentTargetContent = nsnull;
 
   return ret;
 }
 
 #ifdef MOZ_IPC
 #ifdef ANDROID
 mozilla::dom::PBrowserParent*
 nsEventStateManager::GetCrossProcessTarget()
@@ -3607,16 +3608,18 @@ nsEventStateManager::DispatchMouseEvent(
   event.isShift = ((nsMouseEvent*)aEvent)->isShift;
   event.isControl = ((nsMouseEvent*)aEvent)->isControl;
   event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
   event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
   event.pluginEvent = ((nsMouseEvent*)aEvent)->pluginEvent;
   event.relatedTarget = aRelatedContent;
   event.inputSource = static_cast<nsMouseEvent*>(aEvent)->inputSource;
 
+  nsWeakFrame previousTarget = mCurrentTarget;
+
   mCurrentTargetContent = aTargetContent;
 
   nsIFrame* targetFrame = nsnull;
   if (aTargetContent) {
     nsESMEventCB callback(aTargetContent);
     nsEventDispatcher::Dispatch(aTargetContent, mPresContext, &event, nsnull,
                                 &status, &callback);
 
@@ -3624,16 +3627,17 @@ nsEventStateManager::DispatchMouseEvent(
     // it may not be the same object after event dispatching and handling.
     // So we need to refetch it.
     if (mPresContext) {
       targetFrame = mPresContext->GetPrimaryFrameFor(aTargetContent);
     }
   }
 
   mCurrentTargetContent = nsnull;
+  mCurrentTarget = previousTarget;
 
   return targetFrame;
 }
 
 void
 nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto)
 {
   if (!mLastMouseOverElement)