Author: andreia
Date: 2008-01-24 19:26:52 -0500 (Thu, 24 Jan 2008)
New Revision: 93868
Modified:
trunk/gluezilla/src/BrowserWindow.cpp
trunk/gluezilla/src/ChangeLog
Log:
* BrowserWindow.cpp (OnStateChange): send progress events up
2008-01-24 Andreia Gaita <[EMAIL PROTECTED]>
Modified: trunk/gluezilla/src/BrowserWindow.cpp
===================================================================
--- trunk/gluezilla/src/BrowserWindow.cpp 2008-01-25 00:15:50 UTC (rev
93867)
+++ trunk/gluezilla/src/BrowserWindow.cpp 2008-01-25 00:26:52 UTC (rev
93868)
@@ -57,6 +57,7 @@
nsresult
BrowserWindow::Create ( Handle * hwnd, PRInt32 width, PRInt32 height)
{
+ PRINT("BrowserWindow::Create\n");
nsresult result;
webBrowser = do_CreateInstance( NS_WEBBROWSER_CONTRACTID );
@@ -115,14 +116,12 @@
baseWindow->SetVisibility( PR_TRUE );
webNav = do_QueryInterface( webBrowser, &result );
- if ( NS_FAILED( result ) || ! webNav )
- {
+ if ( NS_FAILED( result ) || ! webNav ) {
return NS_ERROR_FAILURE;
}
- if ( webBrowser )
- {
+ if ( webBrowser ) {
// I really hope we don't need this, it calls in nsIWidget.h
which calls
// in a bunch of local includes we don't want
/*
@@ -151,6 +150,7 @@
// Initialization
nsresult BrowserWindow::RegisterComponents ()
{
+ PRINT("BrowserWindow::RegisterComponents\n");
nsCOMPtr<nsIComponentRegistrar> compReg;
nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(compReg));
NS_ENSURE_SUCCESS(rv, rv);
@@ -179,6 +179,7 @@
// Layout
nsresult BrowserWindow::Focus ()
{
+ PRINT2("BrowserWindow::Focus - isFocused=%d\n",isFocused);
if (!isFocused) {
isFocused = PR_TRUE;
SetFocus ();
@@ -204,10 +205,8 @@
{
PRINT("BrowserWindow::Navigate2\n");
- if (webNav)
- {
- if (uri.Length())
- {
+ if (webNav) {
+ if (uri.Length()) {
webNav->LoadURI( (const PRUnichar*)uri.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull, nsnull, nsnull );
@@ -223,8 +222,7 @@
{
PRINT("BrowserWindow::Forward\n");
- if (webNav)
- {
+ if (webNav) {
PRBool canGoForward = PR_FALSE;
webNav->GetCanGoForward(&canGoForward);
if (canGoForward)
@@ -239,8 +237,7 @@
{
PRINT("BrowserWindow::Back\n");
- if (webNav)
- {
+ if (webNav) {
PRBool canGoBack = PR_FALSE;
webNav->GetCanGoBack(&canGoBack);
if (canGoBack)
@@ -277,10 +274,8 @@
{
PRINT("BrowserWindow::Reload\n");
- if (webNav)
- {
- switch (option)
- {
+ if (webNav) {
+ switch (option) {
case RELOAD_NONE:
return webNav->Reload
(nsIWebNavigation::LOAD_FLAGS_NONE);
break;
@@ -350,10 +345,10 @@
if (type.Equals(NS_LITERAL_STRING("click")))
ret = owner->EventMouseClick (mouseInfo, modifiers);
- else if (type.Equals (NS_LITERAL_STRING("mousedown")))
- {
- if (!isFocused)
+ else if (type.Equals (NS_LITERAL_STRING("mousedown"))) {
+ if (!isFocused) {
owner->EventFocus ();
+ }
ret = owner->EventMouseDown (mouseInfo, modifiers);
}
else if (type.Equals (NS_LITERAL_STRING("mouseup")))
@@ -394,10 +389,8 @@
NS_IMETHODIMP
BrowserWindow::GetInterface(const nsIID & aIID, void * *aInstancePtr)
{
- if ( aIID.Equals( NS_GET_IID( nsIDOMWindow ) ) )
- {
- if ( webBrowser )
- {
+ if ( aIID.Equals( NS_GET_IID( nsIDOMWindow ) ) ) {
+ if ( webBrowser ) {
return webBrowser->GetContentDOMWindow( (
nsIDOMWindow** )aInstancePtr );
};
@@ -454,7 +447,6 @@
return NS_OK;
}
-
#ifdef NS_UNIX
PRINT("BrowserWindow::CreateChromeWindow\n");
NS_ENSURE_ARG_POINTER(_retval);
@@ -499,29 +491,24 @@
BrowserWindow::OnStateChange(nsIWebProgress* progress, nsIRequest* request,
PRUint32 state, nsresult status)
{
-
-// owner->EventStateChange(status, state);
+ owner->EventStateChange(status, state);
bool netstop = ( state & STATE_STOP ) && ( state & STATE_IS_NETWORK )
&& ( status == NS_OK );
bool windowstop = ( state & STATE_STOP ) && ( state & STATE_IS_WINDOW )
&& ( status == NS_OK );
- if (netstop)
- {
+ if (netstop) {
PRBool visibility;
this->GetVisibility(&visibility);
if (visibility)
this->SetVisibility(PR_TRUE);
}
- if ( windowstop )
- {
+ if ( windowstop ) {
// page load is complete so add event listeners
nsCOMPtr< nsIDOMWindow > window;
nsresult result = progress->GetDOMWindow( getter_AddRefs(
window ) );
- if ( result == NS_OK )
- {
+ if ( result == NS_OK ) {
nsCOMPtr< nsIDOMEventTarget > target =
do_QueryInterface( window );
- if ( target )
- {
+ if ( target ) {
target->AddEventListener(NS_LITERAL_STRING(
"focus"), this, PR_TRUE );
target->AddEventListener(NS_LITERAL_STRING(
"blur"), this, PR_TRUE );
target->AddEventListener(NS_LITERAL_STRING(
"input"), this, PR_TRUE );
@@ -551,6 +538,7 @@
target->AddEventListener(NS_LITERAL_STRING(
"deactivate"), this, PR_TRUE );
target->AddEventListener(NS_LITERAL_STRING(
"focusin"), this, PR_TRUE );
target->AddEventListener(NS_LITERAL_STRING(
"focusout"), this, PR_TRUE );
+ PRINT("Setting up listeners\n");
}
}
}
@@ -562,6 +550,7 @@
NS_IMETHODIMP
BrowserWindow::HandleEvent(nsIDOMEvent *domEvent)
{
+ PRINT("HandleEvent\n");
PRBool ret = PR_FALSE;
nsCOMPtr <nsIDOMKeyEvent> keyEvent = do_QueryInterface(domEvent);
nsCOMPtr <nsIDOMMouseEvent> mouseEvent = do_QueryInterface(domEvent);
@@ -571,19 +560,19 @@
if (keyEvent)
{
+ PRINT("HandleEvent::Key\n");
ret = OnKey (keyEvent, type);
}
else if (mouseEvent)
{
+ PRINT("HandleEvent::Mouse\n");
ret = OnMouse (mouseEvent, type);
}
- //else
- //{
+ else {
+ PRINT("HandleEvent::Generic\n");
+ owner->EventGeneric(type);
+ }
- owner->EventGeneric(type);
-
- //}
-
if (ret) {
domEvent->StopPropagation();
domEvent->PreventDefault();
Modified: trunk/gluezilla/src/ChangeLog
===================================================================
--- trunk/gluezilla/src/ChangeLog 2008-01-25 00:15:50 UTC (rev 93867)
+++ trunk/gluezilla/src/ChangeLog 2008-01-25 00:26:52 UTC (rev 93868)
@@ -1,3 +1,7 @@
+2008-01-24 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * BrowserWindow.cpp (OnStateChange): send progress events up
+
2008-01-18 Andreia Gaita <[EMAIL PROTECTED]>
* Widget.cpp: don't cache navigation and document objects.
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches