commit 877f0381d7b657ce10451291fd08e54c449ba235
Author: Sam Thursfield <sam.thursfield@codethink.co.uk>
Date:   Wed May 2 16:50:49 2012 +0100

    Fix selection behaviour inside <iframe>
    
    Since kinetic scrolling was introduced in Gtk+, GtkScrolledWindow
    has had its own GdkWindow. This means we need to use the allocation
    of the GtkScrolledWindow rather than its child GtkHTML widget when we
    want to translate pointer coordinates relative to the iframe, because
    a widget's GtkAllocation is relative to the parent GdkWindow.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672582

diff --git a/gtkhtml/gtkhtml.c b/gtkhtml/gtkhtml.c
index 697b16e..6284855 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -1823,9 +1823,14 @@ shift_to_iframe_parent (GtkWidget *widget,
                         gint *y)
 {
 	while (GTK_HTML (widget)->iframe_parent) {
+		GtkWidget *scrolled_window;
 		GtkAllocation allocation;
 
-		gtk_widget_get_allocation (widget, &allocation);
+		scrolled_window = gtk_widget_get_parent (widget);
+
+		g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), widget);
+
+		gtk_widget_get_allocation (scrolled_window, &allocation);
 
 		if (x)
 			*x += allocation.x - GTK_HTML (widget)->engine->x_offset;
