diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-06-15 23:00:42 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-15 23:00:42 +0800 |
commit | d9dbf128b234992f938c6800f31891800c68626c (patch) | |
tree | 1c4d71356cc6cc7c82498a031765277e9182bf72 | |
parent | 3af933af0fb76029084541a4ecb0e85d9938e58e (diff) | |
download | gsoc2013-epiphany-d9dbf128b234992f938c6800f31891800c68626c.tar gsoc2013-epiphany-d9dbf128b234992f938c6800f31891800c68626c.tar.gz gsoc2013-epiphany-d9dbf128b234992f938c6800f31891800c68626c.tar.bz2 gsoc2013-epiphany-d9dbf128b234992f938c6800f31891800c68626c.tar.lz gsoc2013-epiphany-d9dbf128b234992f938c6800f31891800c68626c.tar.xz gsoc2013-epiphany-d9dbf128b234992f938c6800f31891800c68626c.tar.zst gsoc2013-epiphany-d9dbf128b234992f938c6800f31891800c68626c.zip |
Use new INIT macros (from galeon).
2003-06-15 Marco Pesenti Gritti <marco@it.gnome.org>
* configure.in:
Use new INIT macros (from galeon).
* embed/ephy-embed-event.c: (ephy_embed_event_get_coords):
* embed/ephy-embed-event.h:
* embed/mozilla/EventContext.cpp:
* embed/mozilla/EventContext.h:
* embed/mozilla/mozilla-embed.cpp:
mozilla api changes (from galeon). Untested.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | configure.in | 23 | ||||
-rw-r--r-- | embed/ephy-embed-event.c | 8 | ||||
-rw-r--r-- | embed/ephy-embed-event.h | 4 | ||||
-rw-r--r-- | embed/mozilla/EventContext.cpp | 121 | ||||
-rw-r--r-- | embed/mozilla/EventContext.h | 7 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 4 |
7 files changed, 90 insertions, 91 deletions
@@ -1,3 +1,17 @@ +2003-06-15 Marco Pesenti Gritti <marco@it.gnome.org> + + * configure.in: + + Use new INIT macros (from galeon). + + * embed/ephy-embed-event.c: (ephy_embed_event_get_coords): + * embed/ephy-embed-event.h: + * embed/mozilla/EventContext.cpp: + * embed/mozilla/EventContext.h: + * embed/mozilla/mozilla-embed.cpp: + + mozilla api changes (from galeon). Untested. + 2003-06-15 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/mozilla-embed-single: (control_encodings_list): diff --git a/configure.in b/configure.in index 2fcfd7037..282cce0e4 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,15 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(configure.in) -AC_PREREQ(2.50) +AC_INIT(epiphany, 0.7.1, + [http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany]) + +AM_CONFIG_HEADER(config.h) +AC_CONFIG_SRCDIR(configure.in) + +AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) + +dnl put the ACLOCAL flags in the Makefile +ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" GCONF_REQUIRED=1.0.4 GDK_PIXBUF_REQUIRED=0.13.0 @@ -14,7 +22,7 @@ GTK_REQUIRED=1.2.9 LIBXML_REQUIRED=1.8.14 OAF_REQUIRED=0.6.5 ORBIT_REQUIRED=0.5.7 -MOZILLA_REQUIRED=1.1 +MOZILLA_REQUIRED=1.3 SCROLLKEEPER_REQUIRED=0.1.4 LIBBONOBOUI_REQUIRED=2.1.1 @@ -30,9 +38,6 @@ AC_SUBST(LIBBONOBOUI_REQUIRED) AC_ENABLE_SHARED(yes) AC_ENABLE_STATIC(no) -AM_INIT_AUTOMAKE(epiphany, 0.7.0) -AM_CONFIG_HEADER(config.h) - AM_PROG_LIBTOOL AC_ISC_POSIX @@ -45,8 +50,6 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) AC_SUBST(AM_CXXFLAGS) -ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" - GNOME_DEBUG_CHECK GNOME_COMPILE_WARNINGS(error) @@ -194,8 +197,8 @@ case "$MOZILLA_VERSION" in 1.4a) MOZILLA_SNAPSHOT=7 ;; 1.4b) MOZILLA_SNAPSHOT=7 ;; 1.4) MOZILLA_SNAPSHOT=8 ;; - 1.5a) MOZILLA_SNAPSHOT=8 ;; -trunk) MOZILLA_SNAPSHOT=8 ;; + 1.5a) MOZILLA_SNAPSHOT=9 ;; +trunk) MOZILLA_SNAPSHOT=9 ;; *) AC_ERROR([ ***************************************************************************** Epiphany can be built using Mozilla 1.3, 1.3.1, 1.4a, 1.4b, 1.4, 1.5a or diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c index 4b3c61e4c..5ee7d2781 100644 --- a/embed/ephy-embed-event.c +++ b/embed/ephy-embed-event.c @@ -136,11 +136,11 @@ ephy_embed_event_get_mouse_button (EphyEmbedEvent *event, } gresult -ephy_embed_event_get_mouse_coords (EphyEmbedEvent *event, - guint *x, guint *y) +ephy_embed_event_get_coords (EphyEmbedEvent *event, + guint *x, guint *y) { - *x = event->mouse_x; - *y = event->mouse_y; + *x = event->x; + *y = event->y; return G_OK; } diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h index 3c5f3cca4..9291ae6ae 100644 --- a/embed/ephy-embed-event.h +++ b/embed/ephy-embed-event.h @@ -59,7 +59,7 @@ struct EphyEmbedEvent guint modifier; guint mouse_button; guint context; - guint mouse_x, mouse_y; + guint x, y; }; struct EphyEmbedEventClass @@ -76,7 +76,7 @@ guint ephy_embed_event_get_modifier (EphyEmbedEvent *event); gresult ephy_embed_event_get_mouse_button (EphyEmbedEvent *event, guint *mouse_button); -gresult ephy_embed_event_get_mouse_coords (EphyEmbedEvent *event, +gresult ephy_embed_event_get_coords (EphyEmbedEvent *event, guint *x, guint *y); gresult ephy_embed_event_get_context (EphyEmbedEvent *event, diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index e549d9378..5327db7d1 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -50,15 +50,38 @@ EventContext::~EventContext () { } -nsresult EventContext::Init (nsIDOMEvent *event, EphyWrapper *wrapper) +nsresult EventContext::Init (EphyWrapper *wrapper) { - mEvent = event; mWrapper = wrapper; mDOMDocument = nsnull; return NS_OK; } +nsresult EventContext::ResolveBaseURL (nsIDocument *doc, const nsAString &relurl, nsACString &url) +{ + nsresult rv; + nsCOMPtr<nsIURI> base; +#if MOZILLA_SNAPSHOT > 9 + rv = doc->GetBaseURL (getter_AddRefs(base)); +#else + rv = doc->GetBaseURL (*getter_AddRefs(base)); +#endif + if (NS_FAILED(rv)) return rv; + + return base->Resolve (NS_ConvertUCS2toUTF8(relurl), url); +} + +nsresult EventContext::ResolveDocumentURL (nsIDocument *doc, const nsAString &relurl, nsACString &url) +{ + nsresult rv; + nsCOMPtr<nsIURI> uri; + rv = doc->GetDocumentURL(getter_AddRefs(uri)); + if (NS_FAILED(rv)) return rv; + + return uri->Resolve (NS_ConvertUCS2toUTF8(relurl), url); +} + nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, EphyEmbedEvent *info) { @@ -131,15 +154,10 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (NS_SUCCEEDED(rv) && !img.IsEmpty()) { nsCAutoString imglongdesc; - const nsACString &src = NS_ConvertUCS2toUTF8(img); - - nsCOMPtr<nsIURI> uri; - doc->GetDocumentURL(getter_AddRefs(uri)); - - rv = uri->Resolve (src, imglongdesc); - - SetStringProperty ("image_long_desc", - NS_ConvertUTF8toUCS2(imglongdesc)); + rv = ResolveDocumentURL (doc, img, imglongdesc); + + SetStringProperty ("image_long_desc", + NS_ConvertUTF8toUCS2(imglongdesc)); } int imgwidth, imgheight; @@ -179,15 +197,10 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (NS_FAILED(rv)) return NS_ERROR_FAILURE; nsCAutoString cImg; - const nsACString &src = NS_ConvertUCS2toUTF8(img); - - nsCOMPtr<nsIURI> uri; - doc->GetDocumentURL(getter_AddRefs(uri)); - rv = uri->Resolve (src, cImg); + rv = ResolveDocumentURL (doc, img, cImg); + if (NS_FAILED(rv)) return NS_ERROR_FAILURE; SetStringProperty ("image", NS_ConvertUTF8toUCS2(cImg)); - - if (NS_FAILED (rv)) return NS_ERROR_FAILURE; } else if (!value.Equals(NS_LITERAL_STRING("radio"), nsCaseInsensitiveStringComparator()) && @@ -234,15 +247,10 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (NS_FAILED(rv)) return NS_ERROR_FAILURE; nsCAutoString cImg; - const nsACString &src = NS_ConvertUCS2toUTF8(img); + rv = ResolveDocumentURL (doc, img, cImg); + if (NS_FAILED (rv)) return NS_ERROR_FAILURE; - nsCOMPtr<nsIURI> uri; - doc->GetDocumentURL(getter_AddRefs(uri)); - rv = uri->Resolve (src, cImg); - SetStringProperty ("image", - NS_ConvertUTF8toUCS2(cImg)); - - if (NS_FAILED (rv)) return NS_ERROR_FAILURE; + SetStringProperty ("image", cImg.get()); } else { @@ -407,16 +415,11 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (!value.IsEmpty()) { nsCAutoString bgimg; - const nsACString &tmp = - NS_ConvertUCS2toUTF8(value); - nsCOMPtr<nsIURI> uri; - doc->GetDocumentURL(getter_AddRefs(uri)); - rv = uri->Resolve (tmp, bgimg); - if (NS_FAILED (rv)) - return NS_ERROR_FAILURE; - SetStringProperty ("background_image", - NS_ConvertUTF8toUCS2(bgimg)); + rv = ResolveDocumentURL (doc, value, bgimg); + if (NS_FAILED(rv)) return NS_ERROR_FAILURE; + + SetStringProperty ("background_image", bgimg.get()); } else { @@ -430,17 +433,13 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (!value.IsEmpty()) { nsCAutoString bgimg; - const nsACString &tmp = - NS_ConvertUCS2toUTF8(value); - nsIURI *uri; - doc->GetBaseURL(uri); - rv = uri->Resolve - (tmp, bgimg); + rv = ResolveBaseURL (doc, value, bgimg); + if (NS_FAILED(rv)) + return NS_ERROR_FAILURE; + SetStringProperty ("background_image", - NS_ConvertUTF8toUCS2(bgimg)); - if (NS_FAILED (rv)) - return NS_ERROR_FAILURE; + bgimg.get()); has_background = PR_TRUE; } } @@ -453,15 +452,12 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (NS_SUCCEEDED (rv)) { nsCAutoString bgimg; - const nsACString &tmp = - NS_ConvertUCS2toUTF8(cssurl); - nsIURI *uri; - doc->GetBaseURL(uri); - rv = uri->Resolve - (tmp, bgimg); + rv = ResolveBaseURL (doc, cssurl, bgimg); + if (NS_FAILED (rv)) + return NS_ERROR_FAILURE; SetStringProperty ("background_image", - NS_ConvertUTF8toUCS2(bgimg)); + bgimg.get()); if (NS_FAILED (rv)) return NS_ERROR_FAILURE; } @@ -522,10 +518,9 @@ nsresult EventContext::GetCSSBackground (nsIDOMNode *node, nsAutoString& url) return NS_OK; } -nsresult EventContext::GetMouseEventInfo (EphyEmbedEvent *info) +nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, EphyEmbedEvent *info) { nsresult result; - nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent*)mEvent; /* casting 32-bit guint* to PRUint16* below will break on big-endian */ PRUint16 btn; @@ -533,8 +528,8 @@ nsresult EventContext::GetMouseEventInfo (EphyEmbedEvent *info) info->mouse_button = (guint)btn; /* OTOH, casting only between (un)signedness is safe */ - aMouseEvent->GetScreenX ((PRInt32*)&info->mouse_x); - aMouseEvent->GetScreenY ((PRInt32*)&info->mouse_y); + aMouseEvent->GetScreenX ((PRInt32*)&info->x); + aMouseEvent->GetScreenY ((PRInt32*)&info->y); /* be sure we are not clicking on the scroolbars */ @@ -652,19 +647,5 @@ nsresult EventContext::SetStringProperty (const char *name, const char *value) nsresult EventContext::SetStringProperty (const char *name, const nsAString &value) { - GValue *val = g_new0 (GValue, 1);; - char *tmp; - - tmp = ToNewCString (NS_ConvertUCS2toUTF8(value)); - - g_value_init (val, G_TYPE_STRING); - - g_value_set_string (val, tmp); - - ephy_embed_event_set_property (mEmbedEvent, - name, - val); - nsMemory::Free (tmp); - - return NS_OK; + return SetStringProperty (name, NS_ConvertUCS2toUTF8(value).get()); } diff --git a/embed/mozilla/EventContext.h b/embed/mozilla/EventContext.h index 432bd1f53..8025fb353 100644 --- a/embed/mozilla/EventContext.h +++ b/embed/mozilla/EventContext.h @@ -42,16 +42,17 @@ public: EventContext(); ~EventContext(); - nsresult Init (nsIDOMEvent *event, EphyWrapper *wrapper); + nsresult Init (EphyWrapper *wrapper); - nsresult GetMouseEventInfo (EphyEmbedEvent *info); + nsresult GetMouseEventInfo (nsIDOMMouseEvent *event, EphyEmbedEvent *info); nsresult GetTargetDocument (nsIDOMDocument **domDoc); private: - nsIDOMEvent *mEvent; EphyWrapper *mWrapper; nsCOMPtr<nsIDOMDocument> mDOMDocument; + nsresult ResolveBaseURL (nsIDocument *doc, const nsAString &relurl, nsACString &url); + nsresult ResolveDocumentURL (nsIDocument *doc, const nsAString &relurl, nsACString &url); nsresult GetEventContext (nsIDOMEventTarget *EventTarget, EphyEmbedEvent *info); nsresult GetCSSBackground (nsIDOMNode *node, nsAutoString& url); diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index b4c04fa65..f578fb198 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -1335,8 +1335,8 @@ mozilla_embed_emit_mouse_signal (MozillaEmbed *membed, wrapper = MOZILLA_EMBED(membed)->priv->wrapper; g_return_val_if_fail (wrapper != NULL, G_FAILED); - event_context.Init ((nsIDOMEvent*)dom_event, wrapper); - result = event_context.GetMouseEventInfo (info); + event_context.Init (wrapper); + result = event_context.GetMouseEventInfo (static_cast<nsIDOMMouseEvent*>(dom_event), info); if (NS_SUCCEEDED(result)) { nsCOMPtr<nsIDOMDocument> domDoc; |