Backout of bug 110718 to fix Tp regression and raise-on-load issues.

This commit is contained in:
bratell%lysator.liu.se 2002-12-15 19:52:22 +00:00
Родитель ee953ff974
Коммит f31eb0f706
4 изменённых файлов: 11 добавлений и 161 удалений

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

@ -3620,32 +3620,12 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent, nsIFrame*
disabled = PR_FALSE;
}
}
else if (nsHTMLAtoms::iframe==tag || nsHTMLAtoms::frame==tag) {
disabled = PR_TRUE;
if (child) {
nsCOMPtr<nsIDocument> doc, subDoc;
child->GetDocument(*getter_AddRefs(doc));
if (doc) {
doc->GetSubDocumentFor(child, getter_AddRefs(subDoc));
nsCOMPtr<nsISupports> container;
subDoc->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
nsCOMPtr<nsIContentViewer> contentViewer, zombieViewer;
docShell->GetContentViewer(getter_AddRefs(contentViewer));
if (contentViewer) {
contentViewer->GetPreviousViewer(getter_AddRefs(zombieViewer));
if (!zombieViewer) {
// If there are 2 viewers for the current docshell, that
// means the current document is a zombie document.
// Only navigate into the frame/iframe if it's not a zombie
disabled = PR_FALSE;
}
}
}
}
}
else if (nsHTMLAtoms::iframe==tag) {
disabled = PR_FALSE;
}
else if (nsHTMLAtoms::frame==tag) {
disabled = PR_FALSE;
}
}
// Check the tabindex attribute, unless the model specifies text only.
// If the model is unset then we'll depend on tabindex.
@ -4704,11 +4684,7 @@ void nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent)
{
// Focus an element in the current document, but don't switch document/window focus!
if (gLastFocusedDocument == mDocument ||
!gLastFocusedContent) {
// If we're already focused in this document,
// or if there was no last focus
// use normal focus method
if (gLastFocusedDocument == mDocument) { // If we're already in this document, use normal focus method
if (mCurrentFocus != aContent) {
if (aContent)
aContent->SetFocus(mPresContext);
@ -4717,8 +4693,7 @@ void nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent)
}
return;
}
// The last focus wasn't in this document, so we may be getting our position from the selection
// The last focus wasn't in this document, so we may be getting our postion from the selection
// while the window focus is currently somewhere else such as the find dialog
// Temporarily save the current focus globals so we can leave them undisturbed after this method

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

@ -117,7 +117,6 @@
#include "nsIExternalProtocolService.h"
#include "nsIFocusController.h"
#include "nsIEventStateManager.h"
#include "nsITextToSubURI.h"
@ -4615,22 +4614,6 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
}
}
// Eliminate the focus ring in the current docshell, which is
// now a zombie. If we key navigate, it won't be within this
// docshell, until the newly loading document is displayed.
if (mItemType == typeContent) {
nsCOMPtr<nsIPresContext> presContext;
GetPresContext(getter_AddRefs(presContext));
if (presContext) {
nsCOMPtr<nsIEventStateManager> esm;
presContext->GetEventStateManager(getter_AddRefs(esm));
if (esm) {
esm->SetFocusedContent(nsnull);
esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
}
}
}
// It is necessary to obtain the focus controller to utilize its ability
// to suppress focus. This is necessary to fix Win32-only bugs related to
// a loss of focus when mContentViewer is set to null. The internal window

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

@ -1360,11 +1360,6 @@ 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
@ -5892,52 +5887,6 @@ 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,
@ -6016,7 +5965,8 @@ PresShell::HandleEvent(nsIView *aView,
if (mSelectionFlags && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
{
return NS_OK;
} }
}
}
*/
if (nsnull != frame) {
PushCurrentEventInfo(nsnull, nsnull);
@ -6069,10 +6019,6 @@ 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

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

@ -1360,11 +1360,6 @@ 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
@ -5892,52 +5887,6 @@ 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,
@ -6016,7 +5965,8 @@ PresShell::HandleEvent(nsIView *aView,
if (mSelectionFlags && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
{
return NS_OK;
} }
}
}
*/
if (nsnull != frame) {
PushCurrentEventInfo(nsnull, nsnull);
@ -6069,10 +6019,6 @@ 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