--- mozilla/dom/public/idl/base/nsIDOMWindow.idl 2004-04-18 03:20:08.000000000 +0530 +++ mozilla/dom/public/idl/base/nsIDOMWindow.idl 2009-04-03 17:13:58.000000000 +0530 @@ -137,6 +137,7 @@ interface nsIDOMWindow : nsISupports * Method for accessing this window's selection object. */ nsISelection getSelection(); + PRInt32 getPageHeight(); /** * Method for scrolling this window by a number of lines. --- mozilla/dom/src/base/nsGlobalWindow.cpp 2008-12-20 11:17:42.000000000 +0530 +++ mozilla/dom/src/base/nsGlobalWindow.cpp 2009-04-05 00:10:58.000000000 +0530 @@ -2806,6 +2806,29 @@ nsGlobalWindow::GetScrollbars(nsIDOMBarP } NS_IMETHODIMP +nsGlobalWindow::GetPageHeight(PRInt32 *height) +{ + nsIScrollableView *view = nsnull; + nsresult rv; + nsSize scrolledSize; + + *height = 0; + + FlushPendingNotifications(Flush_Layout); + GetScrollInfo(&view); + if (!view) + return NS_OK; + + rv = view->GetContainerSize(&scrolledSize.width, &scrolledSize.height); + NS_ENSURE_SUCCESS(rv, rv); + nsRect portRect = view->View()->GetBounds(); + *height = (int) nsPresContext::AppUnitsToFloatCSSPixels(scrolledSize.height); + + return NS_OK; +} + + +NS_IMETHODIMP nsGlobalWindow::GetDirectories(nsIDOMBarProp** aDirectories) { return GetPersonalbar(aDirectories); @@ -3586,7 +3609,6 @@ nsGlobalWindow::GetScrollMaxXY(PRInt32* nsSize scrolledSize; rv = view->GetContainerSize(&scrolledSize.width, &scrolledSize.height); NS_ENSURE_SUCCESS(rv, rv); - nsRect portRect = view->View()->GetBounds(); if (aScrollMaxX) --- mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp 2008-01-30 09:58:26.000000000 +0530 +++ mozilla/embedding/browser/gtk/src/EmbedPrivate.cpp 2009-04-05 00:12:37.000000000 +0530 @@ -483,6 +483,25 @@ EmbedPrivate::ApplyChromeMask() } } +int +EmbedPrivate::GetPageHeight() +{ + nsresult rv; + PRInt32 h; + + nsCOMPtr webBrowser; + rv = mWindow->GetWebBrowser(getter_AddRefs(webBrowser)); + if (NS_FAILED(rv)) + return -1; + + nsCOMPtr webBrowserFocus(do_QueryInterface(webBrowser)); + if (!webBrowserFocus) + return -1; + webBrowserFocus->GetPageHeight (&h); + + return h; +} + void EmbedPrivate::SetChromeMask(PRUint32 aChromeMask) @@ -808,7 +827,7 @@ EmbedPrivate::ChildFocusOut(void) nsCOMPtr webBrowserFocus(do_QueryInterface(webBrowser)); if (!webBrowserFocus) return; - + webBrowserFocus->Deactivate(); } --- mozilla/embedding/browser/gtk/src/EmbedPrivate.h 2008-01-30 09:58:26.000000000 +0530 +++ mozilla/embedding/browser/gtk/src/EmbedPrivate.h 2009-04-03 16:46:58.000000000 +0530 @@ -82,6 +82,7 @@ class EmbedPrivate { void SetChromeMask (PRUint32 chromeMask); void ApplyChromeMask (); + int GetPageHeight (); static void PushStartup (void); static void PopStartup (void); --- mozilla/embedding/browser/gtk/src/gtkmozembed2.cpp 2008-01-30 09:58:26.000000000 +0530 +++ mozilla/embedding/browser/gtk/src/gtkmozembed2.cpp 2009-04-05 00:13:16.000000000 +0530 @@ -711,6 +711,20 @@ gtk_moz_embed_stop_load(GtkMozEmbed *emb embedPrivate->mNavigation->Stop(nsIWebNavigation::STOP_ALL); } +int +gtk_moz_embed_get_page_height(GtkMozEmbed *embed) +{ + EmbedPrivate *embedPrivate; + + g_return_val_if_fail(embed != NULL, 0); + g_return_val_if_fail(GTK_IS_MOZ_EMBED(embed), 0); + + embedPrivate = (EmbedPrivate *)embed->data; + + return embedPrivate->GetPageHeight(); +} + + gboolean gtk_moz_embed_can_go_back(GtkMozEmbed *embed) { --- mozilla/embedding/browser/gtk/src/gtkmozembed.h 2008-01-12 03:46:15.000000000 +0530 +++ mozilla/embedding/browser/gtk/src/gtkmozembed.h 2009-04-05 00:13:47.000000000 +0530 @@ -156,6 +156,8 @@ GTKMOZEMBED_API(gboolean, gtk_moz_embed GTKMOZEMBED_API(gboolean, gtk_moz_embed_can_go_forward, (GtkMozEmbed *embed)) GTKMOZEMBED_API(void, gtk_moz_embed_go_back, (GtkMozEmbed *embed)) GTKMOZEMBED_API(void, gtk_moz_embed_go_forward, (GtkMozEmbed *embed)) +GTKMOZEMBED_API(int, gtk_moz_embed_get_page_height, (GtkMozEmbed *embed)) + GTKMOZEMBED_API(void, gtk_moz_embed_render_data, (GtkMozEmbed *embed, const char *data, guint32 len, --- mozilla/embedding/browser/webBrowser/nsIWebBrowserFocus.idl 2004-04-19 03:30:41.000000000 +0530 +++ mozilla/embedding/browser/webBrowser/nsIWebBrowserFocus.idl 2009-04-04 15:28:46.000000000 +0530 @@ -85,7 +85,7 @@ interface nsIWebBrowserFocus : nsISuppor * correctly. */ void deactivate(); - + PRInt32 getPageHeight(); /** * Give the first element focus within mozilla * (i.e. TAB was pressed and focus should enter mozilla) --- mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp 2008-04-06 17:58:36.000000000 +0530 +++ mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp 2009-04-05 00:15:11.000000000 +0530 @@ -1804,7 +1804,7 @@ NS_IMETHODIMP nsWebBrowser::Deactivate(v the presumed other newly active window to set it when it comes in. This seems harmless and maybe safer, but we have no real evidence either way just yet. */ - + nsCOMPtr domWindow; GetContentDOMWindow(getter_AddRefs(domWindow)); if (domWindow) { @@ -1818,6 +1818,24 @@ NS_IMETHODIMP nsWebBrowser::Deactivate(v } } + return NS_OK; +} + +/* void GetPageHeight (); */ +NS_IMETHODIMP nsWebBrowser::GetPageHeight(PRInt32 *h) +{ + nsCOMPtr domWindow; + GetContentDOMWindow(getter_AddRefs(domWindow)); + if (domWindow) { + nsCOMPtr privateDOMWindow = do_QueryInterface(domWindow); + if(privateDOMWindow) { + nsIFocusController *focusController = + privateDOMWindow->GetRootFocusController(); + privateDOMWindow->GetPageHeight(h); + + } + } + return NS_OK; }