mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
Fix for bug 9140, prevent recursion of mouseover/out events. r:vidur
This commit is contained in:
parent
cf284aa411
commit
2919db4ef3
@ -1251,6 +1251,13 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
|
||||
if (mLastMouseOverContent.get() != targetContent.get()) {
|
||||
|
||||
//Before firing mouseout, check for recursion
|
||||
if (mLastMouseOverContent.get() != mFirstMouseOutEventContent.get()) {
|
||||
|
||||
//Store the first mouseOut event we fire and don't refire mouseOut
|
||||
//to that element while the first mouseOut is still ongoing.
|
||||
mFirstMouseOutEventContent = mLastMouseOverContent;
|
||||
|
||||
if (mLastMouseOverFrame) {
|
||||
//fire mouseout
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -1272,7 +1279,7 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
NS_IF_ADDREF(mCurrentRelatedContent);
|
||||
|
||||
//XXX This event should still go somewhere!!
|
||||
if (nsnull != mLastMouseOverContent) {
|
||||
if (mLastMouseOverContent) {
|
||||
mLastMouseOverContent->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
@ -1284,7 +1291,17 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
|
||||
NS_IF_RELEASE(mCurrentTargetContent);
|
||||
NS_IF_RELEASE(mCurrentRelatedContent);
|
||||
|
||||
mFirstMouseOutEventContent = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
//Before firing mouseover, check for recursion
|
||||
if (targetContent.get() != mFirstMouseOverEventContent.get()) {
|
||||
|
||||
//Store the first mouseOver event we fire and don't refire mouseOver
|
||||
//to that element while the first mouseOver is still ongoing.
|
||||
mFirstMouseOverEventContent = targetContent;
|
||||
|
||||
//fire mouseover
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -1324,6 +1341,9 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
NS_IF_RELEASE(mCurrentRelatedContent);
|
||||
mLastMouseOverFrame = mCurrentTarget;
|
||||
mLastMouseOverContent = targetContent;
|
||||
|
||||
mFirstMouseOverEventContent = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1331,6 +1351,13 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
{
|
||||
//This is actually the window mouse exit event.
|
||||
if (nsnull != mLastMouseOverFrame) {
|
||||
//Before firing mouseout, check for recursion
|
||||
if (mLastMouseOverContent.get() != mFirstMouseOutEventContent.get()) {
|
||||
|
||||
//Store the first mouseOut event we fire and don't refire mouseOut
|
||||
//to that element while the first mouseOut is still ongoing.
|
||||
mFirstMouseOutEventContent = mLastMouseOverContent;
|
||||
|
||||
//fire mouseout
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event;
|
||||
@ -1367,6 +1394,9 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mCurrentTargetContent);
|
||||
|
||||
mFirstMouseOutEventContent = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -147,8 +147,12 @@ protected:
|
||||
PRInt32 mCurrentTabIndex;
|
||||
nsIWidget * mLastWindowToHaveFocus; // last native window to get focus via the evs
|
||||
PRBool mConsumeFocusEvents;
|
||||
|
||||
//Anti-recursive stack controls
|
||||
nsIContent* mFirstBlurEvent;
|
||||
nsIContent* mFirstFocusEvent;
|
||||
nsCOMPtr<nsIContent> mFirstMouseOverEventContent;
|
||||
nsCOMPtr<nsIContent> mFirstMouseOutEventContent;
|
||||
|
||||
nsIPresContext* mPresContext; // Not refcnted
|
||||
nsIDocument* mDocument; // [OWNER], but doesn't need to be.
|
||||
|
@ -1251,6 +1251,13 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
|
||||
if (mLastMouseOverContent.get() != targetContent.get()) {
|
||||
|
||||
//Before firing mouseout, check for recursion
|
||||
if (mLastMouseOverContent.get() != mFirstMouseOutEventContent.get()) {
|
||||
|
||||
//Store the first mouseOut event we fire and don't refire mouseOut
|
||||
//to that element while the first mouseOut is still ongoing.
|
||||
mFirstMouseOutEventContent = mLastMouseOverContent;
|
||||
|
||||
if (mLastMouseOverFrame) {
|
||||
//fire mouseout
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -1272,7 +1279,7 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
NS_IF_ADDREF(mCurrentRelatedContent);
|
||||
|
||||
//XXX This event should still go somewhere!!
|
||||
if (nsnull != mLastMouseOverContent) {
|
||||
if (mLastMouseOverContent) {
|
||||
mLastMouseOverContent->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
@ -1284,7 +1291,17 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
|
||||
NS_IF_RELEASE(mCurrentTargetContent);
|
||||
NS_IF_RELEASE(mCurrentRelatedContent);
|
||||
|
||||
mFirstMouseOutEventContent = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
//Before firing mouseover, check for recursion
|
||||
if (targetContent.get() != mFirstMouseOverEventContent.get()) {
|
||||
|
||||
//Store the first mouseOver event we fire and don't refire mouseOver
|
||||
//to that element while the first mouseOver is still ongoing.
|
||||
mFirstMouseOverEventContent = targetContent;
|
||||
|
||||
//fire mouseover
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -1324,6 +1341,9 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
NS_IF_RELEASE(mCurrentRelatedContent);
|
||||
mLastMouseOverFrame = mCurrentTarget;
|
||||
mLastMouseOverContent = targetContent;
|
||||
|
||||
mFirstMouseOverEventContent = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1331,6 +1351,13 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
{
|
||||
//This is actually the window mouse exit event.
|
||||
if (nsnull != mLastMouseOverFrame) {
|
||||
//Before firing mouseout, check for recursion
|
||||
if (mLastMouseOverContent.get() != mFirstMouseOutEventContent.get()) {
|
||||
|
||||
//Store the first mouseOut event we fire and don't refire mouseOut
|
||||
//to that element while the first mouseOut is still ongoing.
|
||||
mFirstMouseOutEventContent = mLastMouseOverContent;
|
||||
|
||||
//fire mouseout
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event;
|
||||
@ -1367,6 +1394,9 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mCurrentTargetContent);
|
||||
|
||||
mFirstMouseOutEventContent = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -147,8 +147,12 @@ protected:
|
||||
PRInt32 mCurrentTabIndex;
|
||||
nsIWidget * mLastWindowToHaveFocus; // last native window to get focus via the evs
|
||||
PRBool mConsumeFocusEvents;
|
||||
|
||||
//Anti-recursive stack controls
|
||||
nsIContent* mFirstBlurEvent;
|
||||
nsIContent* mFirstFocusEvent;
|
||||
nsCOMPtr<nsIContent> mFirstMouseOverEventContent;
|
||||
nsCOMPtr<nsIContent> mFirstMouseOutEventContent;
|
||||
|
||||
nsIPresContext* mPresContext; // Not refcnted
|
||||
nsIDocument* mDocument; // [OWNER], but doesn't need to be.
|
||||
|
Loading…
Reference in New Issue
Block a user