Index: gtkhtml/ChangeLog
===================================================================
--- gtkhtml/ChangeLog	(revision 8648)
+++ gtkhtml/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2007-12-21  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #317823
+
+	* gtkhtml.h:
+	* gtkhtml.c: (gtk_html_get_image_src_at),
+	(gtk_html_get_cursor_image_src): New API functions to obtain
+	source URL for the image at the specified place in the widget.
+
 2007-11-22  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes bug #495073
Index: gtkhtml/gtkhtml.c
===================================================================
--- gtkhtml/gtkhtml.c	(revision 8648)
+++ gtkhtml/gtkhtml.c	(working copy)
@@ -6090,6 +6090,54 @@
 	return NULL;
 }
 
+char *
+gtk_html_get_image_src_at (GtkHTML *html, int x, int y)
+{
+	HTMLObject *obj;
+	gint offset;
+
+	g_return_val_if_fail (GTK_IS_HTML (html), NULL);
+
+	obj = html_engine_get_object_at (html->engine, x, y, (guint *) &offset, FALSE);
+
+	if (obj && HTML_IS_IMAGE (obj)) {
+		HTMLImage *image = (HTMLImage*)obj;
+
+		if (!image->image_ptr)
+			return NULL;
+
+		return g_strdup (image->image_ptr->url);
+	}
+
+	return NULL;
+}
+
+char *
+gtk_html_get_cursor_image_src (GtkHTML *html)
+{
+	HTMLObject *obj;
+	gint offset;
+
+	g_return_val_if_fail (GTK_IS_HTML (html), NULL);
+
+	if (html->engine->caret_mode) {
+		obj = html->engine->cursor->object;
+		offset = html->engine->cursor->offset;
+	} else
+		obj = html_engine_get_focus_object (html->engine, &offset);
+
+	if (obj && HTML_IS_IMAGE (obj)) {
+		HTMLImage *image = (HTMLImage*)obj;
+
+		if (!image->image_ptr)
+			return NULL;
+
+		return g_strdup (image->image_ptr->url);
+	}
+
+	return NULL;
+}
+
 void
 gtk_html_set_tokenizer (GtkHTML *html, HTMLTokenizer *tokenizer)
 {
Index: gtkhtml/gtkhtml.h
===================================================================
--- gtkhtml/gtkhtml.h	(revision 8648)
+++ gtkhtml/gtkhtml.h	(working copy)
@@ -327,6 +327,12 @@
 								   int                        x,
 								   int                        y);
 char *                     gtk_html_get_cursor_url                (GtkHTML                   *html);
+
+char *                     gtk_html_get_image_src_at              (GtkHTML                   *html,
+								   int                        x,
+								   int                        y);
+char *                     gtk_html_get_cursor_image_src          (GtkHTML                   *html);
+
 void                       gtk_html_set_tokenizer                 (GtkHTML                   *html,
 								   HTMLTokenizer             *tokenizer);
 
