[kazehakase-svn] [3344] * module/embed/gecko/kz-mozwrapper.cpp: buildable.

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
Sat Jan 5 19:18:20 JST 2008


Revision: 3344
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3344
Author:   kous
Date:     2008-01-05 19:18:19 +0900 (Sat, 05 Jan 2008)

Log Message:
-----------
* module/embed/gecko/kz-mozwrapper.cpp: buildable.

Modified Paths:
--------------
    kazehakase/trunk/ChangeLog
    kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.cpp
    kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.h
    kazehakase/trunk/module/embed/gecko/kz-mozwrapper.cpp
    kazehakase/trunk/module/embed/gecko/kz-mozwrapper.h

Modified: kazehakase/trunk/ChangeLog
===================================================================
--- kazehakase/trunk/ChangeLog	2008-01-05 07:05:21 UTC (rev 3343)
+++ kazehakase/trunk/ChangeLog	2008-01-05 10:18:19 UTC (rev 3344)
@@ -23,7 +23,7 @@
 	* macros/gecko.m4: removed needless prefix.
 
 	* module/embed/gecko/mozilla-prefs.cpp:
-	- definefd MOZILLA_CLIENT.
+	- defined MOZILLA_CLIENT.
 	- removed a needless header.
 
 	* module/embed/gecko/GtkPromptService.cpp: removed MozillaPrivate

Modified: kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.cpp
===================================================================
--- kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.cpp	2008-01-05 07:05:21 UTC (rev 3343)
+++ kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.cpp	2008-01-05 10:18:19 UTC (rev 3344)
@@ -55,11 +55,6 @@
 #include <nsIChromeEventHandler.h>
 #include <nsIDOMWindowInternal.h>
 #include <nsIDOMDocument.h>
-#ifdef HAVE_NSIPRESCONTEXT_H
-#include <nsIPresContext.h>
-#else
-#include <nsPresContext.h>
-#endif
 #include <nsIDeviceContext.h>
 #include <nsIMarkupDocumentViewer.h>
 #include <nsIContentViewer.h>
@@ -124,36 +119,6 @@
 	return TRUE;
 }
 
-gboolean
-MozillaPrivate::SetZoomOnDocShell (float aZoom, nsIDocShell *DocShell)
-{
-#ifdef HAVE_NSIPRESCONTEXT_H
-	nsCOMPtr<nsIPresContext> PresContext;
-#else
-	nsCOMPtr<nsPresContext> PresContext;
-#endif
-	nsresult rv = DocShell->GetPresContext (getter_AddRefs(PresContext));
-	if (NS_FAILED(rv) || !PresContext) return FALSE;
-
-	nsIDeviceContext *DeviceContext(nsnull);
-	DeviceContext = PresContext->DeviceContext();
-	if (!DeviceContext) return FALSE;
-
-	nsCOMPtr<nsIContentViewer> ContentViewer;
-	
-	rv = DocShell->GetContentViewer(getter_AddRefs(ContentViewer));
-	if (NS_FAILED(rv) || !ContentViewer) return FALSE;
-
-	nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(ContentViewer);
-	if (!mdv) return FALSE;
-
-	rv = mdv->SetTextZoom (aZoom);
-
-	if NS_FAILED(rv) return FALSE;
-	
-	return TRUE;
-}
-
 GdkWindow *
 MozillaPrivate::GetGdkWindow (nsIBaseWindow *window)
 {

Modified: kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.h
===================================================================
--- kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.h	2008-01-05 07:05:21 UTC (rev 3343)
+++ kazehakase/trunk/module/embed/gecko/gtkmozembed/MozillaPrivate.h	2008-01-05 10:18:19 UTC (rev 3344)
@@ -46,7 +46,6 @@
 {
 	GList    *GetPrinterList      ();
 	gboolean  CreatePrintSettings (nsIPrintSettings **options);
-        gboolean  SetZoomOnDocShell   (float aZoom, nsIDocShell *DocShell);
 	GdkWindow *GetGdkWindow       (nsIBaseWindow *window);
 	gboolean  GetEventReceiver    (nsIDOMWindow *domWindow, nsIDOMEventReceiver **receiver);
 	const char *Unescape          (const char *text);	

Modified: kazehakase/trunk/module/embed/gecko/kz-mozwrapper.cpp
===================================================================
--- kazehakase/trunk/module/embed/gecko/kz-mozwrapper.cpp	2008-01-05 07:05:21 UTC (rev 3343)
+++ kazehakase/trunk/module/embed/gecko/kz-mozwrapper.cpp	2008-01-05 10:18:19 UTC (rev 3344)
@@ -45,12 +45,15 @@
 #include <nsIDocShell.h>
 #include <nsIDocShellTreeItem.h>
 #include <nsIDocShellTreeOwner.h>
+#include <nsIContent.h>
 #include <nsIContentViewer.h>
 #include <nsIDOMHTMLDocument.h>
 #include <nsIDOMHTMLElement.h>
 #include <nsIDOMHTMLImageElement.h>
 #include <nsIDOMNSHTMLElement.h>  
 #include <nsIDOMDocumentRange.h>
+#include <nsIDOMDocumentView.h>
+#include <nsIDOMAbstractView.h>
 #include <nsIDOMNamedNodeMap.h>
 #include <nsIDOMText.h>
 #include <nsIDOMNodeList.h>
@@ -85,6 +88,16 @@
 #include <nsISupportsPrimitives.h>
 #include <nsIDOM3Document.h>
 #include <nsIDocCharset.h>
+
+#ifdef HAVE_NSIPRESCONTEXT_H
+#  include <nsIPresContext.h>
+#else
+typedef nsCString             nsAFlatCString;
+#  define nsAString_h___
+#  include <nsPresContext.h>
+#  undef nsAString_h___
+#endif
+
 #include "kz-mozprogresslistener.h"
 #include "kz-mozutils.h"
 #include "utils.h"
@@ -539,16 +552,20 @@
 	rv = GetFocusedDOMWindow (getter_AddRefs(DOMWindow));
 	if (NS_FAILED(rv) || !DOMWindow) return NS_ERROR_FAILURE;
 
-	nsCOMPtr<nsIScriptGlobalObject> scriptGlobal = do_QueryInterface(DOMWindow);
-	if (!scriptGlobal) return NS_ERROR_FAILURE;
+	nsCOMPtr<nsIDOMDocument> domDocument;
+	rv = DOMWindow->GetDocument(getter_AddRefs(domDocument));
+	if (NS_FAILED(rv) || !domDocument) return NS_ERROR_FAILURE;
 
-	nsIDocShell *docshell = scriptGlobal->GetDocShell();
-	if (!docshell)
-		return NS_ERROR_FAILURE;
-	
-	nsCOMPtr<nsIWebNavigation> wn = do_QueryInterface (docshell, &rv);
-	if (!wn || !NS_SUCCEEDED (rv)) return NS_ERROR_FAILURE;
+	nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(domDocument));
+	if (!docView) return NS_ERROR_FAILURE;
 
+	nsCOMPtr<nsIDOMAbstractView> abstractView;
+	rv = docView->GetDefaultView(getter_AddRefs(abstractView));
+	if (NS_FAILED(rv) || !abstractView) return NS_ERROR_FAILURE;
+
+	nsCOMPtr<nsIWebNavigation> wn = do_QueryInterface(abstractView, &rv);
+	if (NS_FAILED(rv) || !wn) return NS_ERROR_FAILURE;
+
 	NS_IF_ADDREF(*aWebNavigation = wn);
 	return NS_OK;
 }
@@ -1376,7 +1393,9 @@
 	if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
 
 	print->GetGlobalPrintSettings(getter_AddRefs(options));
+#if HAVE_NSIPRINTSETTINGS_SETPAPERSIZE
 	options->SetPaperSize(nsIPrintSettings::kPaperSizeNativeData);
+#endif
 	options->SetPrintSilent(PR_FALSE);
 	
 //	KzMozProgressListener *aProgress = new KzMozProgressListener();
@@ -1397,7 +1416,9 @@
 	if (NS_FAILED(rv) || !print) return NS_ERROR_FAILURE;
 
 	print->GetGlobalPrintSettings(getter_AddRefs(options));
+#if HAVE_NSIPRINTSETTINGS_SETPAPERSIZE
 	options->SetPaperSize(nsIPrintSettings::kPaperSizeNativeData);
+#endif
 	rv = print->PrintPreview(options, mDOMWindow, nsnull);
 
 	return rv;
@@ -1502,7 +1523,7 @@
 nsresult
 KzMozWrapper::SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell)
 {
-	gboolean ret = MozillaPrivate::SetZoomOnDocShell(aZoom, DocShell);
+	gboolean ret = SetZoomOnDocShell(aZoom, DocShell);
 
 	if (!ret) return NS_ERROR_FAILURE;
 
@@ -2172,3 +2193,33 @@
 
 	return TRUE;
 }
+
+gboolean
+KzMozWrapper::SetZoomOnDocShell (float aZoom, nsIDocShell *DocShell)
+{
+#ifdef HAVE_NSIPRESCONTEXT_H
+	nsCOMPtr<nsIPresContext> PresContext;
+#else
+	nsCOMPtr<nsPresContext> PresContext;
+#endif
+	nsresult rv = DocShell->GetPresContext (getter_AddRefs(PresContext));
+	if (NS_FAILED(rv) || !PresContext) return FALSE;
+
+	nsIDeviceContext *DeviceContext(nsnull);
+	DeviceContext = PresContext->DeviceContext();
+	if (!DeviceContext) return FALSE;
+
+	nsCOMPtr<nsIContentViewer> ContentViewer;
+	
+	rv = DocShell->GetContentViewer(getter_AddRefs(ContentViewer));
+	if (NS_FAILED(rv) || !ContentViewer) return FALSE;
+
+	nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(ContentViewer);
+	if (!mdv) return FALSE;
+
+	rv = mdv->SetTextZoom (aZoom);
+
+	if NS_FAILED(rv) return FALSE;
+	
+	return TRUE;
+}

Modified: kazehakase/trunk/module/embed/gecko/kz-mozwrapper.h
===================================================================
--- kazehakase/trunk/module/embed/gecko/kz-mozwrapper.h	2008-01-05 07:05:21 UTC (rev 3343)
+++ kazehakase/trunk/module/embed/gecko/kz-mozwrapper.h	2008-01-05 10:18:19 UTC (rev 3344)
@@ -203,4 +203,5 @@
 	gboolean  GetRootRange      (nsIDOMDocument *domDoc, nsIDOMRange *range);
 	gboolean  GetSelectedRange  (nsIDOMDocument *domDoc, nsIDOMRange *range,
 				     nsISelection *selection, gboolean backward);
+        gboolean  SetZoomOnDocShell (float aZoom, nsIDocShell *DocShell);
 };




More information about the Kazehakase-cvs mailing list
Zurück zum Archiv-Index