зеркало из https://github.com/mozilla/pjs.git
PHOTON port only (not part of build)
Numerous bug fixes to allow embedding to work properly.
This commit is contained in:
Родитель
e9422f7cbc
Коммит
8b2f64280a
|
@ -54,6 +54,7 @@
|
|||
#include "nsIDOMWindow.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsMPFileLocProvider.h"
|
||||
#include "nsIFocusController.h"
|
||||
|
||||
|
||||
#include "nsIViewManager.h"
|
||||
|
@ -119,7 +120,7 @@ static void MozCreateWindow(PtMozillaWidget_t *moz)
|
|||
|
||||
// Create the webbrowser window
|
||||
moz->MyBrowser->WebBrowserAsWin = do_QueryInterface(moz->MyBrowser->WebBrowser);
|
||||
rv = moz->MyBrowser->WebBrowserAsWin->InitWindow(PtWidgetParent(moz), nsnull, 0, 0, 200, 200 );
|
||||
rv = moz->MyBrowser->WebBrowserAsWin->InitWindow( moz /* PtWidgetParent(moz) */, nsnull, 0, 0, 200, 200 );
|
||||
rv = moz->MyBrowser->WebBrowserAsWin->Create();
|
||||
|
||||
// Configure what the web browser can and cannot do
|
||||
|
@ -264,6 +265,7 @@ static void mozilla_defaults( PtWidget_t *widget )
|
|||
{
|
||||
PtMozillaWidget_t *moz = (PtMozillaWidget_t *) widget;
|
||||
PtBasicWidget_t *basic = (PtBasicWidget_t *) widget;
|
||||
PtContainerWidget_t *cntr = (PtContainerWidget_t*) widget;
|
||||
|
||||
moz->MyBrowser = new BrowserAccess();
|
||||
|
||||
|
@ -282,6 +284,8 @@ static void mozilla_defaults( PtWidget_t *widget )
|
|||
widget->resize_flags &= ~Pt_RESIZE_XY_BITS; // fixed size.
|
||||
widget->anchor_flags = Pt_TOP_ANCHORED_TOP | Pt_LEFT_ANCHORED_LEFT | \
|
||||
Pt_BOTTOM_ANCHORED_TOP | Pt_RIGHT_ANCHORED_LEFT | Pt_ANCHORS_INVALID;
|
||||
|
||||
cntr->flags |= Pt_CHILD_GETTING_FOCUS;
|
||||
}
|
||||
|
||||
static void mozilla_destroy( PtWidget_t *widget ) {
|
||||
|
@ -291,6 +295,97 @@ static void mozilla_destroy( PtWidget_t *widget ) {
|
|||
delete moz->MyBrowser;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int child_getting_focus( PtWidget_t *widget, PtWidget_t *child, PhEvent_t *ev ) {
|
||||
PtMozillaWidget_t *moz = (PtMozillaWidget_t *) widget;
|
||||
|
||||
/* ATENTIE */ printf( "!!!!!!!!!!!child_getting_focus\n\n\n" );
|
||||
|
||||
// PtSuperClassChildGettingFocus( PtContainer, widget, child, ev );
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> piWin;
|
||||
moz->MyBrowser->WebBrowserContainer->GetPIDOMWindow( getter_AddRefs( piWin ) );
|
||||
if( !piWin ) return Pt_CONTINUE;
|
||||
|
||||
piWin->Activate();
|
||||
|
||||
return Pt_CONTINUE;
|
||||
}
|
||||
|
||||
static int child_losing_focus( PtWidget_t *widget, PtWidget_t *child, PhEvent_t *ev ) {
|
||||
PtMozillaWidget_t *moz = (PtMozillaWidget_t *) widget;
|
||||
|
||||
/* ATENTIE */ printf( "!!!!!!!!!!!!child_losing_focus\n\n\n" );
|
||||
|
||||
// PtSuperClassChildLosingFocus( PtContainer, widget, child, ev );
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> piWin;
|
||||
moz->MyBrowser->WebBrowserContainer->GetPIDOMWindow( getter_AddRefs( piWin ) );
|
||||
if( !piWin ) return Pt_CONTINUE;
|
||||
|
||||
piWin->Deactivate();
|
||||
|
||||
// but the window is still active until the toplevel gets a focus out
|
||||
nsCOMPtr<nsIFocusController> focusController;
|
||||
piWin->GetRootFocusController(getter_AddRefs(focusController));
|
||||
if( focusController ) focusController->SetActive( PR_TRUE );
|
||||
|
||||
return Pt_CONTINUE;
|
||||
}
|
||||
|
||||
static int got_focus( PtWidget_t *widget, PhEvent_t *event ) {
|
||||
PtMozillaWidget_t *moz = (PtMozillaWidget_t *) widget;
|
||||
|
||||
/* ATENTIE */ printf( ">>>>>>>>>>>>>>>>>>>got_focus\n\n\n" );
|
||||
|
||||
PtSuperClassGotFocus( PtContainer, widget, event );
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> piWin;
|
||||
moz->MyBrowser->WebBrowserContainer->GetPIDOMWindow( getter_AddRefs( piWin ) );
|
||||
if( !piWin ) return Pt_CONTINUE;
|
||||
|
||||
nsCOMPtr<nsIFocusController> focusController;
|
||||
piWin->GetRootFocusController( getter_AddRefs( focusController ) );
|
||||
if( focusController ) focusController->SetActive( PR_TRUE );
|
||||
|
||||
return Pt_CONTINUE;
|
||||
}
|
||||
|
||||
static int lost_focus( PtWidget_t *widget, PhEvent_t *event ) {
|
||||
PtMozillaWidget_t *moz = (PtMozillaWidget_t *) widget;
|
||||
|
||||
/* ATENTIE */ printf( "!!!!!!!!!!!!!!!!lost_focus\n\n\n" );
|
||||
|
||||
PtSuperClassLostFocus( PtContainer, widget, event );
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> piWin;
|
||||
moz->MyBrowser->WebBrowserContainer->GetPIDOMWindow( getter_AddRefs( piWin ) );
|
||||
if( !piWin ) return Pt_CONTINUE;
|
||||
|
||||
nsCOMPtr<nsIFocusController> focusController;
|
||||
piWin->GetRootFocusController( getter_AddRefs( focusController ) );
|
||||
if( focusController ) focusController->SetActive( PR_FALSE );
|
||||
|
||||
return Pt_CONTINUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int child_getting_focus( PtWidget_t *widget, PtWidget_t *child, PhEvent_t *ev ) {
|
||||
PtMozillaWidget_t *moz = (PtMozillaWidget_t *) widget;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> piWin;
|
||||
moz->MyBrowser->WebBrowserContainer->GetPIDOMWindow( getter_AddRefs( piWin ) );
|
||||
if( !piWin ) return Pt_CONTINUE;
|
||||
|
||||
nsCOMPtr<nsIFocusController> focusController;
|
||||
piWin->GetRootFocusController(getter_AddRefs(focusController));
|
||||
if( focusController ) focusController->SetActive( PR_TRUE );
|
||||
|
||||
return Pt_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
/* this callback is invoked when the user changes video modes - it will reallocate the off screen memory */
|
||||
static int mozilla_ev_info( PtWidget_t *widget, PhEvent_t *event ) {
|
||||
|
||||
|
@ -1123,6 +1218,10 @@ PtWidgetClass_t *PtCreateMozillaClass( void )
|
|||
{ Pt_SET_FLAGS, Pt_RECTANGULAR, Pt_RECTANGULAR },
|
||||
{ Pt_SET_DESTROY_F, (long) mozilla_destroy },
|
||||
{ Pt_SET_RAW_CALLBACKS, (long) &callback, 1 },
|
||||
{ Pt_SET_CHILD_GETTING_FOCUS_F, ( long ) child_getting_focus },
|
||||
// { Pt_SET_CHILD_LOSING_FOCUS_F, ( long ) child_losing_focus },
|
||||
// { Pt_SET_GOT_FOCUS_F, ( long ) got_focus },
|
||||
// { Pt_SET_LOST_FOCUS_F, ( long ) lost_focus },
|
||||
{ Pt_SET_RESOURCES, (long) resources },
|
||||
{ Pt_SET_NUM_RESOURCES, sizeof( resources )/sizeof( resources[0] ) },
|
||||
{ Pt_SET_DESCRIPTION, (long) "PtMozilla" },
|
||||
|
|
|
@ -39,6 +39,7 @@ CWebBrowserContainer::CWebBrowserContainer(PtWidget_t *pOwner)
|
|||
m_pCurrentURI = nsnull;
|
||||
mDoingStream = PR_FALSE;
|
||||
mOffset = 0;
|
||||
mSkipOnState = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,6 +108,7 @@ NS_INTERFACE_MAP_BEGIN(CWebBrowserContainer)
|
|||
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(nsIURIContentListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
|
||||
|
@ -986,7 +988,10 @@ NS_IMETHODIMP CWebBrowserContainer::GetDimensions(PRUint32 flags, PRInt32 *x, PR
|
|||
/* void setFocus (); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::SetFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
PtMozillaWidget_t *moz = (PtMozillaWidget_t *) m_pOwner;
|
||||
nsCOMPtr<nsIBaseWindow> browserBaseWindow = do_QueryInterface( moz->MyBrowser->WebBrowser );
|
||||
/* ATENTIE */ printf( "CWebBrowserContainer::SetFocus\n" );
|
||||
return browserBaseWindow->SetFocus();
|
||||
}
|
||||
|
||||
/* attribute boolean visibility; */
|
||||
|
@ -1224,3 +1229,40 @@ NS_IMETHODIMP CWebBrowserContainer::OnEndPrinting(PRUint32 aStatus)
|
|||
InvokePrintCallback(Pt_MOZ_PRINT_COMPLETE, 0, 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* see the gtk version */
|
||||
nsresult CWebBrowserContainer::GetPIDOMWindow( nsPIDOMWindow **aPIWin ) {
|
||||
PtMozillaWidget_t *moz = ( PtMozillaWidget_t * ) m_pOwner;
|
||||
*aPIWin = nsnull;
|
||||
|
||||
// get the content DOM window for that web browser
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
moz->MyBrowser->WebBrowser->GetContentDOMWindow( getter_AddRefs( domWindow ) );
|
||||
if( !domWindow ) return NS_ERROR_FAILURE;
|
||||
|
||||
// get the private DOM window
|
||||
nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
|
||||
// and the root window for that DOM window
|
||||
nsCOMPtr<nsIDOMWindowInternal> rootWindow;
|
||||
domWindowPrivate->GetPrivateRoot(getter_AddRefs(rootWindow));
|
||||
|
||||
nsCOMPtr<nsIChromeEventHandler> chromeHandler;
|
||||
nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(rootWindow));
|
||||
|
||||
*aPIWin = piWin.get();
|
||||
|
||||
if (*aPIWin) {
|
||||
NS_ADDREF(*aPIWin);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// nsIWebBrowserChromeFocus
|
||||
NS_IMETHODIMP CWebBrowserContainer::FocusNextElement() {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP CWebBrowserContainer::FocusPrevElement() {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "stdhdrs.h"
|
||||
#include "nsIContextMenuListener.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIWebBrowserChromeFocus.h"
|
||||
#include "nsICommandHandler.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
@ -41,12 +42,17 @@
|
|||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIChromeEventHandler.h"
|
||||
#include "nsIURIContentListener.h"
|
||||
|
||||
// This is the class that handles the XPCOM side of things, callback
|
||||
// interfaces into the web shell and so forth.
|
||||
|
||||
class CWebBrowserContainer :
|
||||
public nsIWebBrowserChrome,
|
||||
public nsIWebBrowserChromeFocus,
|
||||
public nsIWebProgressListener,
|
||||
public nsIEmbeddingSiteWindow,
|
||||
public nsIRequestObserver,
|
||||
|
@ -70,6 +76,9 @@ public:
|
|||
NS_IMETHOD CloseStream( void );
|
||||
NS_IMETHOD IsStreaming( void );
|
||||
|
||||
// this will get the PIDOMWindow for this widget
|
||||
nsresult GetPIDOMWindow( nsPIDOMWindow **aPIWin );
|
||||
|
||||
virtual ~CWebBrowserContainer();
|
||||
|
||||
PtWidget_t *m_pOwner;
|
||||
|
@ -84,6 +93,7 @@ protected:
|
|||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBBROWSERCHROME
|
||||
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
|
||||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
NS_DECL_NSIDOCSHELLTREEOWNER
|
||||
NS_DECL_NSIURICONTENTLISTENER
|
||||
|
|
Загрузка…
Ссылка в новой задаче