Bug 598833 part 4. Store urltarget and dragover state directly on elements. r=dbaron

This commit is contained in:
Boris Zbarsky 2011-05-31 21:46:56 -04:00
parent 36028374d5
commit 998bcec762
2 changed files with 14 additions and 8 deletions

View File

@ -4240,12 +4240,6 @@ nsEventStateManager::GetContentState(nsIContent *aContent)
state |= NS_EVENT_STATE_FOCUSRING;
}
}
if (aContent == mDragOverContent) {
state |= NS_EVENT_STATE_DRAGOVER;
}
if (aContent == mURLTargetContent) {
state |= NS_EVENT_STATE_URLTARGET;
}
return state;
}
@ -4305,6 +4299,16 @@ nsEventStateManager::DoStateChange(Element* aElement, nsEventStates aState,
}
}
/* static */
inline void
nsEventStateManager::DoStateChange(nsIContent* aContent, nsEventStates aState,
PRBool aStateAdded)
{
if (aContent->IsElement()) {
DoStateChange(aContent->AsElement(), aState, aStateAdded);
}
}
/* static */
void
nsEventStateManager::UpdateAncestorState(nsIContent* aStartNode,
@ -4440,10 +4444,10 @@ nsEventStateManager::SetContentState(nsIContent *aContent, nsEventStates aState)
UpdateAncestorState(notifyContent1, commonAncestor, aState,
content1StateSet);
} else {
mDocument->ContentStateChanged(notifyContent1, aState);
if (notifyContent2) {
mDocument->ContentStateChanged(notifyContent2, aState);
DoStateChange(notifyContent2, aState, PR_FALSE);
}
DoStateChange(notifyContent1, aState, content1StateSet);
}
}
}

View File

@ -437,6 +437,8 @@ protected:
private:
static inline void DoStateChange(mozilla::dom::Element* aElement,
nsEventStates aState, PRBool aAddState);
static inline void DoStateChange(nsIContent* aContent, nsEventStates aState,
PRBool aAddState);
static void UpdateAncestorState(nsIContent* aStartNode,
nsIContent* aStopBefore,
nsEventStates aState,