Bug 110718. During the 'transferring' when the currently visible document is a zombie, the keyboard is dead for the entire document. r=bryner, sr=hyatt+scc
git-svn-id: svn://10.0.0.236/trunk@135298 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1360,6 +1360,11 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
PRBool InZombieDocument(nsIContent *aContent);
|
||||
nsresult RetargetEventToParent(nsIView *aView, nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus, PRBool aForceHandle,
|
||||
PRBool& aHandled);
|
||||
|
||||
void FreeDynamicStack();
|
||||
|
||||
//helper funcs for disabing autoscrolling
|
||||
@@ -5864,6 +5869,52 @@ PresShell::PopCurrentEventInfo()
|
||||
}
|
||||
}
|
||||
|
||||
PRBool PresShell::InZombieDocument(nsIContent *aContent)
|
||||
{
|
||||
// If a content node points to a null document, it is a
|
||||
// zombie document, about to be replaced by a newly loading document.
|
||||
// Such documents cannot handle DOM events.
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mCurrentEventContent->GetDocument(*getter_AddRefs(doc));
|
||||
return !doc;
|
||||
}
|
||||
|
||||
nsresult PresShell::RetargetEventToParent(nsIView *aView,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus,
|
||||
PRBool aForceHandle,
|
||||
PRBool& aHandled)
|
||||
{
|
||||
// Sent this events straight up to the parent pres shell.
|
||||
// We do this for non-mouse events in zombie documents.
|
||||
// That way at least the UI key bindings can work.
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
do_QueryInterface(container);
|
||||
if (treeItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentTreeItem));
|
||||
nsCOMPtr<nsIDocShell> parentDocShell =
|
||||
do_QueryInterface(parentTreeItem);
|
||||
if (parentDocShell && treeItem != parentTreeItem) {
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
parentDocShell->GetPresShell(getter_AddRefs(parentPresShell));
|
||||
nsCOMPtr<nsIViewObserver> parentViewObserver =
|
||||
do_QueryInterface(parentPresShell);
|
||||
if (parentViewObserver) {
|
||||
PopCurrentEventInfo();
|
||||
return parentViewObserver->HandleEvent(aView, aEvent,
|
||||
aEventStatus,
|
||||
aForceHandle,
|
||||
aHandled);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::HandleEvent(nsIView *aView,
|
||||
nsGUIEvent* aEvent,
|
||||
@@ -5942,8 +5993,7 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
if (mSelectionFlags && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
} }
|
||||
*/
|
||||
if (nsnull != frame) {
|
||||
PushCurrentEventInfo(nsnull, nsnull);
|
||||
@@ -5996,6 +6046,10 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
#endif /* defined(MOZ_X11) */
|
||||
mCurrentEventFrame = nsnull;
|
||||
}
|
||||
if (mCurrentEventContent && InZombieDocument(mCurrentEventContent)) {
|
||||
return RetargetEventToParent(aView, aEvent, aEventStatus,
|
||||
aForceHandle, aHandled);
|
||||
}
|
||||
}
|
||||
else if (!InClipRect(frame, aEvent->point)) {
|
||||
// we only check for the clip rect on this frame ... all frames with clip have views so any
|
||||
|
||||
Reference in New Issue
Block a user