Bug 401528, Must click twice to open link if fixed positioned div is removed on onmouseup: clicks pass through, r+sr=roc, a=blocking1.9+

git-svn-id: svn://10.0.0.236/trunk@239200 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi 2007-11-12 12:20:41 +00:00
parent 5f1c0350b4
commit 7355c3600a
2 changed files with 22 additions and 12 deletions

View File

@ -2265,12 +2265,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
mCurrentTarget = aTargetFrame;
mCurrentTargetContent = nsnull;
// All the events we handle below require a frame.
if (!mCurrentTarget) {
if (NS_EVENT_NEEDS_FRAME(aEvent)) {
NS_ERROR("Null frame for an event that requires a frame");
return NS_ERROR_NULL_POINTER;
}
// Most of the events we handle below require a frame.
// Add special cases here.
if (!mCurrentTarget &&
aEvent->message != NS_MOUSE_BUTTON_UP) {
return NS_OK;
}
@ -2372,9 +2370,22 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (!mCurrentTarget) {
nsIFrame* targ;
GetEventTarget(&targ);
if (!targ) return NS_ERROR_FAILURE;
}
ret = CheckForAndDispatchClick(presContext, (nsMouseEvent*)aEvent, aStatus);
if (mCurrentTarget) {
ret = CheckForAndDispatchClick(presContext, (nsMouseEvent*)aEvent, aStatus);
}
if (aView) {
// Make sure viewmanager doesn't continue capturing mouse events.
nsIViewManager* viewMan = aView->GetViewManager();
if (viewMan) {
nsIView* grabbingView;
viewMan->GetMouseEventGrabber(grabbingView);
if (grabbingView == aView) {
PRBool result;
viewMan->GrabMouseEvents(nsnull, result);
}
}
}
nsIPresShell *shell = presContext->GetPresShell();
if (shell) {
shell->FrameSelection()->SetMouseDownState(PR_FALSE);

View File

@ -5803,10 +5803,9 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
// 3. Give event to event manager for post event state changes and
// generation of synthetic events.
if (NS_SUCCEEDED (rv) &&
(GetCurrentEventFrame() || !NS_EVENT_NEEDS_FRAME(aEvent))) {
rv = manager->PostHandleEvent(mPresContext, aEvent, mCurrentEventFrame,
aStatus, aView);
if (NS_SUCCEEDED(rv)) {
rv = manager->PostHandleEvent(mPresContext, aEvent,
GetCurrentEventFrame(), aStatus, aView);
}
}
}