Only unset :hover in NotifyMouseOut if we're not mousing over

anything. Otherwise, let NotifyMouseOver handle changing :hover; it's faster
that way.  Bug 292472, r+sr=roc, a=dbaron
This commit is contained in:
bzbarsky%mit.edu 2005-05-03 16:05:48 +00:00
parent 2775eedb3d
commit a5df6c9834
2 changed files with 14 additions and 3 deletions

View File

@ -2570,9 +2570,15 @@ nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto)
// Store the first mouseOut event we fire and don't refire mouseOut
// to that element while the first mouseOut is still ongoing.
mFirstMouseOutEventElement = mLastMouseOverElement;
// Unset :hover
SetContentState(nsnull, NS_EVENT_STATE_HOVER);
// Don't touch hover state if aMovingInto is non-null. Caller will update
// hover state itself, and we have optimizations for hover switching between
// two nearby elements both deep in the DOM tree that would be defeated by
// switching the hover state to null here.
if (!aMovingInto) {
// Unset :hover
SetContentState(nsnull, NS_EVENT_STATE_HOVER);
}
// Fire mouseout
DispatchMouseEvent(aEvent, NS_MOUSE_EXIT_SYNTH,

View File

@ -180,6 +180,11 @@ protected:
/**
* Tell this ESM and ESMs in affected child documents that the mouse
* has exited this document's currently hovered content.
* @param aEvent the event that triggered the mouseout
* @param aMovingInto the content node we've moved into. This is used to set
* the relatedTarget for mouseout events. Also, if it's non-null
* NotifyMouseOut will NOT change the current hover content to null;
* in that case the caller is responsible for updating hover state.
*/
void NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto);
void GenerateDragDropEnterExit(nsPresContext* aPresContext, nsGUIEvent* aEvent);