Synthesized mouse moves shouldn't fire DOM mousemove events. b=20022 r=roc sr=bryner

This commit is contained in:
dbaron%dbaron.org 2004-02-06 23:10:32 +00:00
Родитель 81fe0f4de2
Коммит 9677d991aa
2 изменённых файлов: 22 добавлений и 2 удалений

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

@ -6047,6 +6047,13 @@ PresShell::HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent*
return NS_OK;
}
inline PRBool
IsSynthesizedMouseMove(nsEvent* aEvent)
{
return aEvent->eventStructType == NS_MOUSE_EVENT &&
NS_STATIC_CAST(nsMouseEvent*, aEvent)->reason != nsMouseEvent::eReal;
}
nsresult
PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
PRUint32 aFlags, nsEventStatus* aStatus)
@ -6085,7 +6092,10 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
aStatus, aView);
// 2. Give event to the DOM for third party and JS use.
if ((GetCurrentEventFrame()) && NS_SUCCEEDED(rv)) {
if ((GetCurrentEventFrame()) && NS_SUCCEEDED(rv) &&
// We want synthesized mouse moves to cause mouseover and mouseout
// DOM events (PreHandleEvent above), but not mousemove DOM events.
!IsSynthesizedMouseMove(aEvent)) {
if (mCurrentEventContent) {
rv = mCurrentEventContent->HandleDOMEvent(mPresContext, aEvent, nsnull,
aFlags, aStatus);

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

@ -6047,6 +6047,13 @@ PresShell::HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent*
return NS_OK;
}
inline PRBool
IsSynthesizedMouseMove(nsEvent* aEvent)
{
return aEvent->eventStructType == NS_MOUSE_EVENT &&
NS_STATIC_CAST(nsMouseEvent*, aEvent)->reason != nsMouseEvent::eReal;
}
nsresult
PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
PRUint32 aFlags, nsEventStatus* aStatus)
@ -6085,7 +6092,10 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
aStatus, aView);
// 2. Give event to the DOM for third party and JS use.
if ((GetCurrentEventFrame()) && NS_SUCCEEDED(rv)) {
if ((GetCurrentEventFrame()) && NS_SUCCEEDED(rv) &&
// We want synthesized mouse moves to cause mouseover and mouseout
// DOM events (PreHandleEvent above), but not mousemove DOM events.
!IsSynthesizedMouseMove(aEvent)) {
if (mCurrentEventContent) {
rv = mCurrentEventContent->HandleDOMEvent(mPresContext, aEvent, nsnull,
aFlags, aStatus);