aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-10-23 07:32:21 +0800
committerXan Lopez <xan@src.gnome.org>2003-10-23 07:32:21 +0800
commitd92e40e0fb9d3eaabb4984111887fa54b1aeb0d0 (patch)
tree79366211be635d263be5bf22e08de7c1237204ce
parent30c4cba685f031e7b5d61ab7f86de8547d234b37 (diff)
downloadgsoc2013-epiphany-d92e40e0fb9d3eaabb4984111887fa54b1aeb0d0.tar
gsoc2013-epiphany-d92e40e0fb9d3eaabb4984111887fa54b1aeb0d0.tar.gz
gsoc2013-epiphany-d92e40e0fb9d3eaabb4984111887fa54b1aeb0d0.tar.bz2
gsoc2013-epiphany-d92e40e0fb9d3eaabb4984111887fa54b1aeb0d0.tar.lz
gsoc2013-epiphany-d92e40e0fb9d3eaabb4984111887fa54b1aeb0d0.tar.xz
gsoc2013-epiphany-d92e40e0fb9d3eaabb4984111887fa54b1aeb0d0.tar.zst
gsoc2013-epiphany-d92e40e0fb9d3eaabb4984111887fa54b1aeb0d0.zip
Every time you change API God kills a kitten. Think of the kitten!! (That
* embed/mozilla/EphyEventListener.cpp: * embed/mozilla/EphyWrapper.cpp: * embed/mozilla/EphyWrapper.h: * embed/mozilla/EventContext.cpp: Every time you change API God kills a kitten. Think of the kitten!! (That means you, Mozilla :)
-rw-r--r--ChangeLog10
-rw-r--r--embed/mozilla/EphyEventListener.cpp10
-rw-r--r--embed/mozilla/EphyWrapper.cpp51
-rw-r--r--embed/mozilla/EphyWrapper.h1
-rw-r--r--embed/mozilla/EventContext.cpp16
5 files changed, 70 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 26d83c3cf..5947ac08d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-10-23 Xan Lopez <xan@masilla.org>
+
+ * embed/mozilla/EphyEventListener.cpp:
+ * embed/mozilla/EphyWrapper.cpp:
+ * embed/mozilla/EphyWrapper.h:
+ * embed/mozilla/EventContext.cpp:
+
+ Every time you change API God kills a kitten.
+ Think of the kitten!! (That means you, Mozilla :)
+
2003-10-22 Marco Pesenti Gritti <marco@gnome.org>
* data/ui/Makefile.am:
diff --git a/embed/mozilla/EphyEventListener.cpp b/embed/mozilla/EphyEventListener.cpp
index de696bf1e..d2fb70864 100644
--- a/embed/mozilla/EphyEventListener.cpp
+++ b/embed/mozilla/EphyEventListener.cpp
@@ -16,6 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <nsCOMPtr.h>
#include "EphyEventListener.h"
@@ -80,9 +84,15 @@ EphyEventListener::HandleFaviconLink (nsIDOMNode *node)
nsCOMPtr<nsIDocument> doc = do_QueryInterface (domDoc);
if(!doc) return NS_ERROR_FAILURE;
+#if MOZILLA_SNAPSHOT > 11
+ nsIURI *uri;
+ uri = doc->GetDocumentURL ();
+ if (uri == NULL) return NS_ERROR_FAILURE;
+#else
nsCOMPtr<nsIURI> uri;
result = doc->GetDocumentURL(getter_AddRefs(uri));
if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+#endif
const nsACString &link = NS_ConvertUCS2toUTF8(value);
nsCAutoString favicon_url;
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp
index 605c3183a..5cb399201 100644
--- a/embed/mozilla/EphyWrapper.cpp
+++ b/embed/mozilla/EphyWrapper.cpp
@@ -24,7 +24,6 @@
#include "EphyWrapper.h"
#include "GlobalHistory.h"
-//#include "ProgressListener.h"
#include "ephy-embed.h"
#include "ephy-string.h"
@@ -74,6 +73,7 @@
#include "nsIPresContext.h"
#include "nsIAtom.h"
#include "nsIDocumentCharsetInfo.h"
+#include "nsPromiseFlatString.h"
#include "ContentHandler.h"
#include "EphyEventListener.h"
@@ -590,8 +590,13 @@ nsresult EphyWrapper::GetMainDocumentUrl (nsCString &url)
nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument);
if(!doc) return NS_ERROR_FAILURE;
+#if MOZILLA_SNAPSHOT > 11
+ nsIURI *uri;
+ uri = doc->GetDocumentURL ();
+#else
nsCOMPtr<nsIURI> uri;
doc->GetDocumentURL(getter_AddRefs(uri));
+#endif
return uri->GetSpec (url);
}
@@ -608,8 +613,13 @@ nsresult EphyWrapper::GetDocumentUrl (nsCString &url)
nsCOMPtr<nsIDocument> doc = do_QueryInterface(DOMDocument);
if(!doc) return NS_ERROR_FAILURE;
+#if MOZILLA_SNAPSHOT > 11
+ nsIURI *uri;
+ uri = doc->GetDocumentURL ();
+#else
nsCOMPtr<nsIURI> uri;
doc->GetDocumentURL(getter_AddRefs(uri));
+#endif
uri->GetSpec (url);
@@ -773,23 +783,13 @@ nsresult EphyWrapper::GetEncodingInfo (EphyEncodingInfo **infoptr)
info = g_new0 (EphyEncodingInfo, 1);
*infoptr = info;
-#if MOZILLA_SNAPSHOT >= 10
- nsCAutoString enc;
- result = doc->GetDocumentCharacterSet (enc);
- if (NS_FAILED (result)) return NS_ERROR_FAILURE;
-
- info->encoding = g_strdup (enc.get());
-#else
- nsAutoString enc;
- result = doc->GetDocumentCharacterSet (enc);
- if (NS_FAILED (result)) return NS_ERROR_FAILURE;
-
- info->encoding = g_strdup (NS_ConvertUCS2toUTF8(enc).get());
-#endif
-
PRInt32 source;
+#if MOZILLA_SNAPSHOT > 11
+ source = doc->GetDocumentCharacterSetSource ();
+#else
result = doc->GetDocumentCharacterSetSource (&source);
if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+#endif
info->encoding_source = (EphyEncodingSource) source;
nsCOMPtr<nsIDocShell> ds;
@@ -831,7 +831,28 @@ nsresult EphyWrapper::GetEncodingInfo (EphyEncodingInfo **infoptr)
&result);
if (NS_FAILED(result) || !mdv) return NS_ERROR_FAILURE;
+#if MOZILLA_SNAPSHOT > 11
+ const nsACString& charsetEnc = doc->GetDocumentCharacterSet ();
+ if (charsetEnc.IsEmpty()) return NS_ERROR_FAILURE;
+
+ info->encoding = g_strdup (PromiseFlatCString(charsetEnc).get());
+#elif MOZILLA_SNAPSHOT >= 10
+ nsCAutoString charsetEnc;
+ result = doc->GetDocumentCharacterSet (charsetEnc);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ info->encoding = g_strdup (charsetEnc.get());
+#else
+ nsAutoString charsetEnc;
+ result = doc->GetDocumentCharacterSet (charsetEnc);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ info->encoding = g_strdup (NS_ConvertUCS2toUTF8(charsetEnc).get());
+#endif
+
#if MOZILLA_SNAPSHOT >= 10
+ nsCAutoString enc;
+
result = mdv->GetDefaultCharacterSet (enc);
if (NS_FAILED (result)) return NS_ERROR_FAILURE;
info->default_encoding = g_strdup (enc.get());
diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h
index 5f5ed7bf3..64cf99026 100644
--- a/embed/mozilla/EphyWrapper.h
+++ b/embed/mozilla/EphyWrapper.h
@@ -24,7 +24,6 @@
#include "ephy-encodings.h"
#include "nsIDocShell.h"
-//#include "ProgressListener.h"
#include "nsIWebNavigation.h"
#include "nsIWebPageDescriptor.h"
#include "nsISHistory.h"
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index 8aaf2db1f..bfce49e2e 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -145,13 +145,19 @@ nsresult EventContext::GatherTextUnder (nsIDOMNode* aNode, nsString& aResult)
nsresult EventContext::ResolveBaseURL (nsIDocument *doc, const nsAString &relurl, nsACString &url)
{
nsresult rv;
+#if MOZILLA_SNAPSHOT > 11
+ nsIURI *base;
+ base = doc->GetBaseURL ();
+ if (base == NULL) return NS_ERROR_FAILURE;
+#elif MOZILLA_SNAPSHOT > 9
nsCOMPtr<nsIURI> base;
-#if MOZILLA_SNAPSHOT > 9
rv = doc->GetBaseURL (getter_AddRefs(base));
+ if (NS_FAILED(rv)) return rv;
#else
+ nsCOMPtr<nsIURI> base;
rv = doc->GetBaseURL (*getter_AddRefs(base));
-#endif
if (NS_FAILED(rv)) return rv;
+#endif
return base->Resolve (NS_ConvertUCS2toUTF8(relurl), url);
}
@@ -159,9 +165,15 @@ nsresult EventContext::ResolveBaseURL (nsIDocument *doc, const nsAString &relurl
nsresult EventContext::ResolveDocumentURL (nsIDocument *doc, const nsAString &relurl, nsACString &url)
{
nsresult rv;
+#if MOZILLA_SNAPSHOT > 11
+ nsIURI *uri;
+ uri = doc->GetDocumentURL ();
+ if (uri == NULL) return NS_ERROR_FAILURE;
+#else
nsCOMPtr<nsIURI> uri;
rv = doc->GetDocumentURL(getter_AddRefs(uri));
if (NS_FAILED(rv)) return rv;
+#endif
return uri->Resolve (NS_ConvertUCS2toUTF8(relurl), url);
}