diff options
Diffstat (limited to 'embed/mozilla/EphyBrowser.cpp')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 4268cc983..9b357b235 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -482,6 +482,9 @@ nsresult EphyBrowser::Init (GtkMozEmbed *mozembed) getter_AddRefs(mWebBrowser)); NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); + mWebBrowserFocus = do_QueryInterface (mWebBrowser); + NS_ENSURE_TRUE (mWebBrowserFocus, NS_ERROR_FAILURE); + mWebBrowser->GetContentDOMWindow (getter_AddRefs (mDOMWindow)); NS_ENSURE_TRUE (mDOMWindow, NS_ERROR_FAILURE); @@ -803,13 +806,9 @@ nsresult EphyBrowser::GetTargetDocument (nsIDOMDocument **aDOMDocument) } /* Use the focused document */ - nsCOMPtr<nsIWebBrowserFocus> webBrowserFocus; - webBrowserFocus = do_QueryInterface (mWebBrowser); - NS_ENSURE_TRUE (webBrowserFocus, NS_ERROR_FAILURE); - nsresult rv; nsCOMPtr<nsIDOMWindow> DOMWindow; - rv = webBrowserFocus->GetFocusedWindow (getter_AddRefs(DOMWindow)); + rv = mWebBrowserFocus->GetFocusedWindow (getter_AddRefs(DOMWindow)); if (NS_SUCCEEDED (rv) && DOMWindow) { return DOMWindow->GetDocument (aDOMDocument); @@ -1295,3 +1294,21 @@ EphyBrowser::GetDocumentType () return type; } + +#ifdef GTKMOZEMBED_BROKEN_FOCUS +nsresult +EphyBrowser::FocusActivate () +{ + NS_ENSURE_STATE (mWebBrowserFocus); + + return mWebBrowserFocus->Activate(); +} + +nsresult +EphyBrowser::FocusDeactivate () +{ + NS_ENSURE_STATE (mWebBrowserFocus); + + return mWebBrowserFocus->Deactivate(); +} +#endif /* GTKMOZEMBED_BROKEN_FOCUS */ |