fix for 70224 (need nsIWebBrowserChromeFocus for embedding). r=danm, sr=hyatt, a=asa

This commit is contained in:
dr%netscape.com 2001-04-25 02:04:56 +00:00
Родитель ee9e0cc866
Коммит eec73874cf
24 изменённых файлов: 210 добавлений и 35 удалений

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

@ -2438,7 +2438,7 @@ nsEventStateManager::ShiftFocus(PRBool forward, nsIContent* aRoot)
mPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(container));
if (docShellAsWin) {
docShellAsWin->FocusAvailable(docShellAsWin, &focusTaken);
docShellAsWin->FocusAvailable(docShellAsWin, forward, &focusTaken);
}
//No one took focus and we're not already at the top of the doc

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

@ -20,6 +20,7 @@
* Travis Bogard <travis@netscape.com>
* Pierre Phaneuf <pp@ludusdesign.com>
* Peter Annema <disttsc@bart.nl>
* Dan Rosen <dr@netscape.com>
*/
#include "nsIComponentManager.h"
@ -102,6 +103,10 @@
#include "nsIFrame.h"
#include "nsIStyleContext.h"
// for embedding
#include "nsIEmbeddingSiteWindow.h"
#include "nsIWebBrowserChromeFocus.h"
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
static NS_DEFINE_CID(kDocumentCharsetInfoCID, NS_DOCUMENTCHARSETINFO_CID);
@ -2025,14 +2030,31 @@ NS_IMETHODIMP nsDocShell::SetFocus()
return NS_OK;
}
NS_IMETHODIMP nsDocShell::FocusAvailable(nsIBaseWindow* aCurrentFocus,
NS_IMETHODIMP nsDocShell::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool aForward,
PRBool* aTookFocus)
{
NS_ENSURE_ARG_POINTER(aTookFocus);
// Next person we should call is first the parent otherwise the
// docshell tree owner.
nsresult ret;
// Are we embedded?
nsCOMPtr<nsIWebBrowserChromeFocus>
chromeFocus(do_GetInterface(mTreeOwner, &ret));
if (chromeFocus) {
#ifdef DEBUG_dr
printf("dr :: nsDocShell::FocusAvailable, embedded\n");
#endif
if (aForward)
ret = chromeFocus->FocusNextElement();
else
ret = chromeFocus->FocusPrevElement();
return ret;
}
// Otherwise, first person we should call is the parent, or the
// docshell tree owner.
nsCOMPtr<nsIBaseWindow> nextCallWin(do_QueryInterface(mParent));
if(!nextCallWin)
nextCallWin = do_QueryInterface(mTreeOwner);
@ -2040,7 +2062,9 @@ NS_IMETHODIMP nsDocShell::FocusAvailable(nsIBaseWindow* aCurrentFocus,
//If the current focus is us, offer it to the next owner.
if(aCurrentFocus == NS_STATIC_CAST(nsIBaseWindow*, this)) {
if(nextCallWin) {
nsresult ret = nextCallWin->FocusAvailable(aCurrentFocus, aTookFocus);
ret = nextCallWin->FocusAvailable(aCurrentFocus,
aForward,
aTookFocus);
if (NS_SUCCEEDED(ret) && *aTookFocus)
return NS_OK;
}
@ -2094,7 +2118,7 @@ NS_IMETHODIMP nsDocShell::FocusAvailable(nsIBaseWindow* aCurrentFocus,
// Call again to offer focus upwards and to start at the beginning of our
// child list if no one above us wants focus.
return FocusAvailable(this, aTookFocus);
return FocusAvailable(this, aForward, aTookFocus);
}
NS_IMETHODIMP nsDocShell::GetTitle(PRUnichar** aTitle)

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

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file

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

@ -99,6 +99,7 @@ NS_IMPL_RELEASE(EmbedWindow)
NS_INTERFACE_MAP_BEGIN(EmbedWindow)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsITooltipListener)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
@ -232,6 +233,20 @@ EmbedWindow::ExitModalEventLoop(nsresult aStatus)
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsIWebBrowserChromeFocus
NS_IMETHODIMP
EmbedWindow::FocusNextElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
EmbedWindow::FocusPrevElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsIEmbeddingSiteWindow
NS_IMETHODIMP

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

@ -23,6 +23,7 @@
#define __EmbedWindow_h
#include <nsIWebBrowserChrome.h>
#include <nsIWebBrowserChromeFocus.h>
#include <nsIEmbeddingSiteWindow.h>
#include <nsITooltipListener.h>
#include <nsIPrompt.h>
@ -37,6 +38,7 @@
class EmbedPrivate;
class EmbedWindow : public nsIWebBrowserChrome,
public nsIWebBrowserChromeFocus,
public nsIEmbeddingSiteWindow,
public nsITooltipListener,
public nsIPrompt,
@ -56,6 +58,8 @@ class EmbedWindow : public nsIWebBrowserChrome,
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSITOOLTIPLISTENER

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

@ -782,8 +782,9 @@ NS_IMETHODIMP PhMozEmbedChrome::SetFocus(void)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP PhMozEmbedChrome::FocusAvailable(nsIBaseWindow *aCurrentFocus,
PRBool *aTookFocus)
NS_IMETHODIMP PhMozEmbedChrome::FocusAvailable(nsIBaseWindow *aCurrentFocus,
PRBool aForward,
PRBool *aTookFocus)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("PhMozEmbedChrome::FocusAvailable\n"));
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -227,6 +227,20 @@ NS_IMETHODIMP CWebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
return NS_OK;
}
//*****************************************************************************
// CWebBrowserChrome::nsIWebBrowserChromeFocus
//*****************************************************************************
NS_IMETHODIMP CWebBrowserChrome::FocusNextElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP CWebBrowserChrome::FocusPrevElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//*****************************************************************************
// CWebBrowserChrome::nsIWebProgressListener
//*****************************************************************************

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

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@ -29,6 +29,7 @@
// Interfaces Needed
#include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIWebProgressListener.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIInterfaceRequestor.h"
@ -44,18 +45,20 @@ class CBrowserWindow;
class CBrowserShell;
class CWebBrowserChrome : public nsIWebBrowserChrome,
public nsIWebProgressListener,
public nsIEmbeddingSiteWindow,
public nsIInterfaceRequestor,
public nsIContextMenuListener,
public nsITooltipListener,
public nsSupportsWeakReference
public nsIWebBrowserChromeFocus,
public nsIWebProgressListener,
public nsIEmbeddingSiteWindow,
public nsIInterfaceRequestor,
public nsIContextMenuListener,
public nsITooltipListener,
public nsSupportsWeakReference
{
friend class CBrowserWindow;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIINTERFACEREQUESTOR

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

@ -23,6 +23,7 @@
nsCWebBrowser.idl
nsIWebBrowser.idl
nsIWebBrowserChrome.idl
nsIWebBrowserChromeFocus.idl
nsIWebBrowserSetup.idl
nsIEmbeddingSiteWindow.idl
nsIWebBrowserPersist.idl

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

@ -34,6 +34,7 @@ XPIDLSRCS = \
nsCWebBrowser.idl \
nsIWebBrowser.idl \
nsIWebBrowserChrome.idl \
nsIWebBrowserChromeFocus.idl \
nsIWebBrowserSetup.idl \
nsICommandHandler.idl \
nsIContextMenuListener.idl \

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

@ -28,6 +28,7 @@ XPIDLSRCS= \
.\nsCWebBrowser.idl \
.\nsIWebBrowser.idl \
.\nsIWebBrowserChrome.idl \
.\nsIWebBrowserChromeFocus.idl \
.\nsICommandHandler.idl \
.\nsIWebBrowserSetup.idl \
.\nsIWebBrowserPersist.idl \

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

@ -57,6 +57,7 @@
#include "nsPIWindowWatcher.h"
#include "nsIPrompt.h"
#include "nsIWalletService.h"
#include "nsIWebBrowserChromeFocus.h"
static char *sWindowWatcherContractID = "@mozilla.org/embedcomp/window-watcher;1";
@ -112,6 +113,9 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
if(NS_SUCCEEDED(QueryInterface(aIID, aSink)))
return NS_OK;
if (aIID.Equals(NS_GET_IID(nsIWebBrowserChromeFocus)))
return mOwnerWin->QueryInterface(aIID, aSink);
if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
nsIPrompt *prompt;
EnsurePrompter();
@ -617,8 +621,9 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetFocus()
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool* aTookFocus)
NS_IMETHODIMP nsDocShellTreeOwner::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool aForward,
PRBool* aTookFocus)
{
return NS_ERROR_NULL_POINTER;
}

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

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 0 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Original Author:
* Dan Rosen <dr@netscape.com>
* Contributor(s):
*
*/
#include "nsISupports.idl"
/**
* The nsIWebBrowserChromeFocus is implemented by the same object as the
* nsIWebBrowserSiteWindow. It represents the focus up-calls from mozilla
* to the embedding chrome. See mozilla bug #70224 for gratuitous info.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(d2206418-1dd1-11b2-8e55-acddcd2bcfb8)]
interface nsIWebBrowserChromeFocus : nsISupports
{
/**
* Set the focus at the next focusable element in the chrome
*/
void focusNextElement();
/**
* Set the focus at the previous focusable element in the chrome
*/
void focusPrevElement();
};

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

@ -1191,7 +1191,8 @@ NS_IMETHODIMP nsWebBrowser::SetFocus()
}
NS_IMETHODIMP nsWebBrowser::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool* aTookFocus)
PRBool aForward,
PRBool* aTookFocus)
{
NS_ENSURE_ARG_POINTER(aTookFocus);
@ -1205,7 +1206,8 @@ NS_IMETHODIMP nsWebBrowser::FocusAvailable(nsIBaseWindow* aCurrentFocus,
if(aCurrentFocus == NS_STATIC_CAST(nsIBaseWindow*, this))
{
if(nextCallWin)
return nextCallWin->FocusAvailable(aCurrentFocus, aTookFocus);
return nextCallWin->FocusAvailable(aCurrentFocus,
aForward, aTookFocus);
return NS_OK;
}

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

@ -59,6 +59,7 @@ NS_INTERFACE_MAP_BEGIN(WebBrowserChrome)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) //optional
// NS_INTERFACE_MAP_ENTRY(nsIPrompt)
@ -207,6 +208,19 @@ NS_IMETHODIMP WebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
return NS_ERROR_NOT_IMPLEMENTED;
}
//*****************************************************************************
// WebBrowserChrome::nsIWebBrowserChromeFocus
//*****************************************************************************
NS_IMETHODIMP WebBrowserChrome::FocusNextElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::FocusPrevElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//*****************************************************************************
// WebBrowserChrome::nsIWebProgressListener
@ -306,4 +320,3 @@ NS_IMETHODIMP WebBrowserChrome::GetSiteWindow(void ** aSiteWindow)
*aSiteWindow = mNativeWindow;
return NS_OK;
}

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

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@ -26,6 +26,7 @@
#include "nsIGenericFactory.h"
#include "nsString.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
@ -40,8 +41,8 @@
#include "nsVoidArray.h"
class WebBrowserChrome : public nsIWebBrowserChrome,
public nsIWebBrowserChromeFocus,
public nsIWebProgressListener,
public nsIEmbeddingSiteWindow,
// public nsIPrompt,
@ -56,6 +57,7 @@ public:
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
// NS_DECL_NSIPROMPT
NS_DECL_NSIINTERFACEREQUESTOR

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

@ -104,6 +104,7 @@ NS_INTERFACE_MAP_BEGIN(CBrowserImpl)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener)
@ -240,6 +241,20 @@ NS_IMETHODIMP CBrowserImpl::ExitModalEventLoop(nsresult aStatus)
return NS_OK;
}
//*****************************************************************************
// CBrowserImpl::nsIWebBrowserChromeFocus
//*****************************************************************************
NS_IMETHODIMP CBrowserImpl::FocusNextElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP CBrowserImpl::FocusPrevElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//*****************************************************************************
// CBrowserImpl::nsIEmbeddingSiteWindow
//*****************************************************************************

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

@ -25,9 +25,11 @@
#define _BROWSERIMPL_H
#include "IBrowserFrameGlue.h"
#include "nsIWebBrowserChromeFocus.h"
class CBrowserImpl : public nsIInterfaceRequestor,
public nsIWebBrowserChrome,
public nsIWebBrowserChromeFocus,
public nsIEmbeddingSiteWindow,
public nsIWebProgressListener,
public nsIContextMenuListener,
@ -42,6 +44,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSICONTEXTMENULISTENER

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

@ -251,6 +251,20 @@ NS_IMETHODIMP WebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
return NS_OK;
}
//*****************************************************************************
// WebBrowserChrome::nsIWebBrowserChromeFocus
//*****************************************************************************
NS_IMETHODIMP WebBrowserChrome::FocusNextElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::FocusPrevElement()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//*****************************************************************************
// WebBrowserChrome::nsIWebProgressListener
//*****************************************************************************

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

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@ -26,6 +26,7 @@
#include "nsIGenericFactory.h"
#include "nsString.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
@ -61,6 +62,7 @@ public:
};
class WebBrowserChrome : public nsIWebBrowserChrome,
public nsIWebBrowserChromeFocus,
public nsIWebProgressListener,
public nsIEmbeddingSiteWindow,
public nsIInterfaceRequestor,
@ -77,6 +79,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIINTERFACEREQUESTOR

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

@ -410,8 +410,9 @@ NS_IMETHODIMP nsBrowserWindow::SetFocus()
return NS_OK;
}
NS_IMETHODIMP nsBrowserWindow::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool* aTookFocus)
NS_IMETHODIMP nsBrowserWindow::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool aForward,
PRBool* aTookFocus)
{
//XXX First Check In
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");

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

@ -310,10 +310,11 @@ NS_IMETHODIMP nsChromeTreeOwner::SetFocus()
return mXULWindow->SetFocus();
}
NS_IMETHODIMP nsChromeTreeOwner::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool* aTookFocus)
NS_IMETHODIMP nsChromeTreeOwner::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool aForward,
PRBool* aTookFocus)
{
return mXULWindow->FocusAvailable(aCurrentFocus, aTookFocus);
return mXULWindow->FocusAvailable(aCurrentFocus, aForward, aTookFocus);
}
NS_IMETHODIMP nsChromeTreeOwner::GetTitle(PRUnichar** aTitle)

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

@ -511,10 +511,11 @@ NS_IMETHODIMP nsContentTreeOwner::SetFocus()
return mXULWindow->SetFocus();
}
NS_IMETHODIMP nsContentTreeOwner::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool* aTookFocus)
NS_IMETHODIMP nsContentTreeOwner::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool aForward,
PRBool* aTookFocus)
{
return mXULWindow->FocusAvailable(aCurrentFocus, aTookFocus);
return mXULWindow->FocusAvailable(aCurrentFocus, aForward, aTookFocus);
}
NS_IMETHODIMP nsContentTreeOwner::GetTitle(PRUnichar** aTitle)

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

@ -588,8 +588,9 @@ NS_IMETHODIMP nsXULWindow::SetFocus()
return NS_OK;
}
NS_IMETHODIMP nsXULWindow::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool* aTookFocus)
NS_IMETHODIMP nsXULWindow::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool aForward,
PRBool* aTookFocus)
{
return NS_OK;
}