Stop firing mouse events at textnodes, fix tooltips not going away onmouseout (bug 185889, bug 185965), r=bryner@netscape.com, sr=jst@netscape.com

This commit is contained in:
jkeiser%netscape.com 2003-01-21 21:26:45 +00:00
Родитель 503ba5ea46
Коммит b7baf2214d
3 изменённых файлов: 60 добавлений и 10 удалений

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

@ -2516,16 +2516,6 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
targetFrame = mCurrentTarget;
}
// Bug 103055: mouseout and mouseover apply to *elements*, not all nodes
// Get the nearest element parent and check it
while (targetElement &&
!targetElement->IsContentOfType(nsIContent::eELEMENT)) {
// Yes, this is weak, but it will stick around for this short time :)
nsIContent* temp = targetElement;
temp->GetParent(*getter_AddRefs(targetElement));
targetFrame = nsnull;
}
if (mLastMouseOverElement == targetElement) {
break;
}

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

@ -6093,6 +6093,36 @@ PresShell::HandleEvent(nsIView *aView,
}
}
}
if (mCurrentEventFrame) {
// Bug 103055, bug 185889: mouse events apply to *elements*, not all
// nodes.
// We use weak pointers because during this tight loop, the node will
// *not* go away. And this happens on every mousemove.
//
// Get the nearest element parent
nsCOMPtr<nsIContent> targetElement;
mCurrentEventFrame->GetContentForEvent(mPresContext, aEvent,
getter_AddRefs(targetElement));
while (targetElement &&
!targetElement->IsContentOfType(nsIContent::eELEMENT)) {
nsIContent* temp = targetElement;
temp->GetParent(*getter_AddRefs(targetElement));
}
// If we found an element, target it. Otherwise, target *nothing*.
if (!targetElement) {
NS_IF_RELEASE(mCurrentEventContent);
mCurrentEventFrame = nsnull;
} else if (targetElement != mCurrentEventContent) {
NS_IF_RELEASE(mCurrentEventContent);
mCurrentEventContent = targetElement;
NS_ADDREF(mCurrentEventContent);
// XXX we leave the frame the same as it was so that the text frame
// will receive the event
}
}
}
if (GetCurrentEventFrame()) {
rv = HandleEventInternal(aEvent, aView, NS_EVENT_FLAG_INIT, aEventStatus);

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

@ -6093,6 +6093,36 @@ PresShell::HandleEvent(nsIView *aView,
}
}
}
if (mCurrentEventFrame) {
// Bug 103055, bug 185889: mouse events apply to *elements*, not all
// nodes.
// We use weak pointers because during this tight loop, the node will
// *not* go away. And this happens on every mousemove.
//
// Get the nearest element parent
nsCOMPtr<nsIContent> targetElement;
mCurrentEventFrame->GetContentForEvent(mPresContext, aEvent,
getter_AddRefs(targetElement));
while (targetElement &&
!targetElement->IsContentOfType(nsIContent::eELEMENT)) {
nsIContent* temp = targetElement;
temp->GetParent(*getter_AddRefs(targetElement));
}
// If we found an element, target it. Otherwise, target *nothing*.
if (!targetElement) {
NS_IF_RELEASE(mCurrentEventContent);
mCurrentEventFrame = nsnull;
} else if (targetElement != mCurrentEventContent) {
NS_IF_RELEASE(mCurrentEventContent);
mCurrentEventContent = targetElement;
NS_ADDREF(mCurrentEventContent);
// XXX we leave the frame the same as it was so that the text frame
// will receive the event
}
}
}
if (GetCurrentEventFrame()) {
rv = HandleEventInternal(aEvent, aView, NS_EVENT_FLAG_INIT, aEventStatus);