[evolution-patches] [gtkhtml + addressbook] #54152 vcard control not displaying all of the fields for the contact



attached patches fix the bug http://bugzilla.ximian.com/show_bug.cgi?id=54152.

the gtkhtml part changes gtkhtml's size/allocation process to allow child widgets to resize and allows deriving widgets from gtkhtml without need to call gtk_html_construct separately.

the addressbook part removes scrolled window from vcard control so that contact display may request the size directly from parent gtkhtml where it's embedded. the contact display widget is now based directly on gtkhtml and scrolled window is put around it in e-addressbook-view.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1793
diff -u -p -r1.1793 ChangeLog
--- ChangeLog	16 Jul 2004 08:13:51 -0000	1.1793
+++ ChangeLog	19 Jul 2004 16:53:23 -0000
@@ -1,3 +1,14 @@
+2004-07-19  Radek Doulik  <rodo ximian com>
+
+	* gui/widgets/eab-vcard-control.c (eab_vcard_control_new): but
+	buttons to button box, use vbox instead of table
+
+	* gui/widgets/eab-contact-display.c: base this widget directly on
+	gtkhtml
+
+	* gui/widgets/e-addressbook-view.c (eab_view_new): put contact
+	display in scrolled window
+
 2004-07-14  Chris Toshok  <toshok ximian com>
 
 	[ fixes #60873, and possibly other crashes ]
Index: gui/widgets/e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.145
diff -u -p -r1.145 e-addressbook-view.c
--- gui/widgets/e-addressbook-view.c	23 Jun 2004 22:40:24 -0000	1.145
+++ gui/widgets/e-addressbook-view.c	19 Jul 2004 16:53:23 -0000
@@ -414,6 +414,7 @@ GtkWidget*
 eab_view_new (void)
 {
 	GtkWidget *widget = GTK_WIDGET (g_object_new (E_TYPE_AB_VIEW, NULL));
+	GtkWidget *scrolled_window;
 	EABView *eav = EAB_VIEW (widget);
 	FilterPart *part;
 
@@ -480,9 +481,12 @@ eab_view_new (void)
 	gtk_widget_show (eav->widget);
 
 	eav->contact_display = eab_contact_display_new ();
-	gtk_container_add (GTK_CONTAINER (eav->paned), eav->contact_display);
+	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+	gtk_container_add (GTK_CONTAINER (scrolled_window), eav->contact_display);
+	gtk_container_add (GTK_CONTAINER (eav->paned), scrolled_window);
 	gtk_widget_show (eav->contact_display);
-
+	gtk_widget_show (scrolled_window);
 	gtk_widget_show (eav->paned);
 
 	/* gtk selection crap */
Index: gui/widgets/eab-contact-display.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-contact-display.c,v
retrieving revision 1.14
diff -u -p -r1.14 eab-contact-display.c
--- gui/widgets/eab-contact-display.c	14 Jun 2004 19:12:48 -0000	1.14
+++ gui/widgets/eab-contact-display.c	19 Jul 2004 16:53:24 -0000
@@ -35,10 +35,9 @@
 
 /*#define HANDLE_MAILTO_INTERNALLY 1*/
 
-#define PARENT_TYPE (gtk_vbox_get_type ())
+#define PARENT_TYPE (GTK_TYPE_HTML)
 
 struct _EABContactDisplayPrivate {
-	GtkHTML *html;
 	EContact *contact;
 };
 
@@ -390,7 +389,7 @@ eab_contact_display_render_normal (EABCo
 	if (display->priv->contact)
 		g_object_ref (display->priv->contact);
 
-	html_stream = gtk_html_begin (display->priv->html);
+	html_stream = gtk_html_begin (GTK_HTML (display));
 	gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
 	gtk_html_stream_write (html_stream, "<body>\n", 7);
 
@@ -429,7 +428,7 @@ eab_contact_display_render_normal (EABCo
 	}
 
 	gtk_html_stream_write (html_stream, "</body></html>\n", 15);
-	gtk_html_end (display->priv->html, html_stream, GTK_HTML_STREAM_OK);
+	gtk_html_end (GTK_HTML (display), html_stream, GTK_HTML_STREAM_OK);
 }
 
 static void
@@ -443,7 +442,7 @@ eab_contact_display_render_compact (EABC
 	if (display->priv->contact)
 		g_object_ref (display->priv->contact);
 
-	html_stream = gtk_html_begin (display->priv->html);
+	html_stream = gtk_html_begin (GTK_HTML (display));
 	gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
 	gtk_html_stream_write (html_stream, "<body>\n", 7);
 
@@ -585,7 +584,7 @@ eab_contact_display_render_compact (EABC
 	}
 
 	gtk_html_stream_write (html_stream, "</body></html>\n", 15);
-	gtk_html_end (display->priv->html, html_stream, GTK_HTML_STREAM_OK);
+	gtk_html_end (GTK_HTML (display), html_stream, GTK_HTML_STREAM_OK);
 }
 
 void
@@ -618,38 +617,31 @@ eab_contact_display_new (void)
 					GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
 
-	display->priv->html = GTK_HTML (gtk_html_new ());
+	gtk_html_set_default_content_type (GTK_HTML (display), "text/html; charset=utf-8");
 	
-	gtk_html_set_default_content_type (display->priv->html, "text/html; charset=utf-8");
-	
-	gtk_html_set_editable (display->priv->html, FALSE);
+	gtk_html_set_editable (GTK_HTML (display), FALSE);
 
-	g_signal_connect (display->priv->html, "url_requested",
+	g_signal_connect (display, "url_requested",
 			  G_CALLBACK (on_url_requested),
 			  display);
-	g_signal_connect (display->priv->html, "link_clicked",
+	g_signal_connect (display, "link_clicked",
 			  G_CALLBACK (on_link_clicked),
 			  display);
 #if 0
-	g_signal_connect (display->priv->html, "object_requested",
+	g_signal_connect (display, "object_requested",
 			  G_CALLBACK (on_object_requested),
 			  mail_display);
-	g_signal_connect (display->priv->html, "button_press_event",
+	g_signal_connect (display, "button_press_event",
 			  G_CALLBACK (html_button_press_event), mail_display);
-	g_signal_connect (display->priv->html, "motion_notify_event",
+	g_signal_connect (display, "motion_notify_event",
 			  G_CALLBACK (html_motion_notify_event), mail_display);
-	g_signal_connect (display->priv->html, "enter_notify_event",
+	g_signal_connect (display, "enter_notify_event",
 			  G_CALLBACK (html_enter_notify_event), mail_display);
-	g_signal_connect (display->priv->html, "iframe_created",
+	g_signal_connect (display, "iframe_created",
 			  G_CALLBACK (html_iframe_created), mail_display);
-	g_signal_connect (display->priv->html, "on_url",
+	g_signal_connect (display, "on_url",
 			  G_CALLBACK (html_on_url), mail_display);
 #endif
-
-	gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (display->priv->html));
-
-	gtk_box_pack_start_defaults (GTK_BOX (display), scrolled_window);
-	gtk_widget_show_all (scrolled_window);
 
 	return GTK_WIDGET (display);
 }
Index: gui/widgets/eab-contact-display.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-contact-display.h,v
retrieving revision 1.3
diff -u -p -r1.3 eab-contact-display.h
--- gui/widgets/eab-contact-display.h	7 Nov 2003 05:51:41 -0000	1.3
+++ gui/widgets/eab-contact-display.h	19 Jul 2004 16:53:24 -0000
@@ -23,7 +23,6 @@
 #ifndef _EAB_CONTACT_DISPLAY_H_
 #define _EAB_CONTACT_DISPLAY_H_
 
-#include <gtk/gtkvbox.h>
 #include <gtkhtml/gtkhtml.h>
 #include <libebook/e-contact.h>
 
@@ -43,13 +42,13 @@ typedef enum {
 } EABContactDisplayRenderMode;
 
 struct _EABContactDisplay {
-	GtkVBox parent;
+	GtkHTML parent;
 	
 	EABContactDisplayPrivate *priv;
 };
 
 struct _EABContactDisplayClass {
-	GtkVBoxClass parent_class;
+	GtkHTMLClass parent_class;
 };
 
 GtkType        eab_contact_display_get_type    (void);
Index: gui/widgets/eab-vcard-control.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-vcard-control.c,v
retrieving revision 1.6
diff -u -p -r1.6 eab-vcard-control.c
--- gui/widgets/eab-vcard-control.c	17 Jun 2004 21:59:36 -0000	1.6
+++ gui/widgets/eab-vcard-control.c	19 Jul 2004 16:53:24 -0000
@@ -247,8 +247,8 @@ eab_vcard_control_new (void)
 	BonoboPersistStream *stream;
 	GtkWidget	    *display;
 	GtkWidget           *button1, *button2;
-	GtkWidget           *label;
-	GtkWidget           *table;
+	GtkWidget           *bbox;
+	GtkWidget           *vbox;
 
 	EABVCardControl    *vcard_control = g_new (EABVCardControl, 1);
 
@@ -263,31 +263,34 @@ eab_vcard_control_new (void)
 	/* Create the control. */
 
 	display = eab_contact_display_new ();
-	gtk_widget_show (display);
 	vcard_control->display = EAB_CONTACT_DISPLAY (display);
 
-	/* This is intentionally not shown. */
-	label = gtk_label_new ("");
-	vcard_control->label = label;
+	bbox = gtk_hbutton_box_new ();
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
+	gtk_box_set_spacing (GTK_BOX (bbox), 12);
 
 	button1 = gtk_button_new_with_label(_("Show Full VCard"));
 	g_signal_connect (button1, "clicked",
 			  G_CALLBACK (toggle_full_vcard), vcard_control);
-	gtk_widget_show (button1);
+	gtk_box_pack_start (GTK_BOX (bbox), button1, FALSE, FALSE, 0);
 
 	button2 = gtk_button_new_with_label(_("Save in addressbook"));
 	g_signal_connect (button2, "clicked",
 			  G_CALLBACK (save_in_addressbook), vcard_control);
-	gtk_widget_show (button2);
+	gtk_box_pack_start (GTK_BOX (bbox), button2, FALSE, FALSE, 0);
 
-	table = gtk_table_new (6, 6, FALSE);
-	gtk_table_attach (GTK_TABLE (table), display, 0, 6, 3, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-	gtk_table_attach (GTK_TABLE (table), label, 0, 3, 2, 3, GTK_FILL, 0, 0, 0);
-	gtk_table_attach (GTK_TABLE (table), button1, 0, 1, 1, 2, 0, 0, 0, 0);
-	gtk_table_attach (GTK_TABLE (table), button2, 1, 2, 1, 2, 0, 0, 0, 0);
-	gtk_widget_show (table);
+	/* This is intentionally not shown. */
+	vcard_control->label = gtk_label_new ("");
+
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), display, TRUE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), vcard_control->label, TRUE, TRUE, 0);
+	gtk_widget_show_all (bbox);
+	gtk_widget_show (display);
+	gtk_widget_show (vbox);
 
-	control = bonobo_control_new (table);
+	control = bonobo_control_new (vbox);
 
 	g_object_weak_ref (G_OBJECT (control), free_struct, vcard_control);
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2024
diff -u -p -r1.2024 ChangeLog
--- ChangeLog	19 Jul 2004 13:40:37 -0000	1.2024
+++ ChangeLog	19 Jul 2004 17:40:15 -0000
@@ -1,5 +1,20 @@
 2004-07-19  Radek Doulik  <rodo ximian com>
 
+	* htmlframe.c (html_frame_real_calc_size): as below
+
+	* htmliframe.c (html_iframe_real_calc_size): do not queue size
+	request to avoid infinite loop
+
+	* htmlengine.c (html_engine_stream_end): queue resize after
+	content is loaded
+
+	* htmlembedded.c: set size of requisition to 0x0 before calling
+	size request
+
+	* gtkhtml.c: handle size request, do own size allocate for
+	children widgets. move construct call from _new methods to init so
+	that it's easy to derive widget from us
+
 	* htmltext.c (save_open_attrs): save <TT>
 	(save_close_attrs): save </TT>
 
Index: gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.571
diff -u -p -r1.571 gtkhtml.c
--- gtkhtml.c	21 Jun 2004 16:38:54 -0000	1.571
+++ gtkhtml.c	19 Jul 2004 17:40:16 -0000
@@ -1032,19 +1032,55 @@ expose (GtkWidget *widget, GdkEventExpos
 }
 
 static void
+gtk_html_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+	HTMLEngine *e = GTK_HTML (widget)->engine;
+
+	if (!e->writing) {
+		e->width = requisition->width;
+		e->height = requisition->height;
+		html_engine_calc_size (e, NULL);
+		requisition->width = html_engine_get_doc_width (e);
+		requisition->height = html_engine_get_doc_height (e);
+	}
+}
+
+static void
+child_size_allocate (HTMLObject *o, HTMLEngine *e, gpointer data)
+{
+	if (html_object_is_embedded (o)) {
+		HTMLEmbedded *eo = HTML_EMBEDDED (o);
+
+		if (eo->widget) {
+			GtkAllocation allocation;
+
+			html_object_calc_abs_position (o, &allocation.x, &allocation.y);
+			allocation.y -= o->ascent;
+			allocation.width = o->width;
+			allocation.height = o->ascent + o->descent;
+			gtk_widget_size_allocate (eo->widget, &allocation);
+		}
+	}
+}
+
+static void
 size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 {
 	GtkHTML *html;
 	gboolean changed_x = FALSE, changed_y = FALSE;
+	GList *children;
 
 	g_return_if_fail (widget != NULL);
 	g_return_if_fail (GTK_IS_HTML (widget));
 	g_return_if_fail (allocation != NULL);
 	
-	if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
-		( *GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
-
-	/* printf ("size allocate\n"); */
+	/* isolate childs from layout - we want to set them after calc size is performed
+	   and we know the children positions */
+	children = GTK_LAYOUT (widget)->children;
+	GTK_LAYOUT (widget)->children = NULL;
+ 	if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
+ 		(*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
+	GTK_LAYOUT (widget)->children = children;
 
 	html = GTK_HTML (widget);
 
@@ -1058,12 +1094,10 @@ size_allocate (GtkWidget *widget, GtkAll
 		old_width = e->width;
 		old_height = e->height;
 
-		/* printf ("allocate %d x %d\n", allocation->width, allocation->height); */
-
 		e->width  = allocation->width;
 		e->height = allocation->height;
 
-		html_engine_calc_size (html->engine, FALSE);
+		html_engine_calc_size (html->engine, NULL);
 		gtk_html_update_scrollbars_on_resize (html, old_doc_width, old_doc_height, old_width, old_height,
 						      &changed_x, &changed_y);
 	}
@@ -1076,6 +1110,9 @@ size_allocate (GtkWidget *widget, GtkAll
 		if (changed_y)
 			gtk_adjustment_value_changed (GTK_LAYOUT (html)->vadjustment);
 	}
+
+	if (html->engine->clue)
+		html_object_forall (html->engine->clue, html->engine, child_size_allocate, NULL);
 }
 
 static void
@@ -2886,6 +2923,7 @@ gtk_html_class_init (GtkHTMLClass *klass
 	widget_class->key_press_event = key_press_event;
 	widget_class->key_release_event = key_release_event;
 	widget_class->expose_event  = expose;
+	widget_class->size_request = gtk_html_size_request;
 	widget_class->size_allocate = size_allocate;
 	widget_class->motion_notify_event = motion_notify_event;
 	widget_class->visibility_notify_event = visibility_notify_event;
@@ -3197,6 +3235,8 @@ gtk_html_init (GtkHTML* html)
 	html->priv->notify_monospace_font_id =
 		gconf_client_notify_add (gconf_client_get_default (), "/desktop/gnome/interface/monospace_font_name",
 					 client_notify_monospace_font, html, NULL, &gconf_error);
+
+	gtk_html_construct (html);
 }
 
 GType
@@ -3238,7 +3278,7 @@ gtk_html_new (void)
 	GtkWidget *html;
 
 	html = g_object_new (GTK_TYPE_HTML, NULL);
-	gtk_html_construct (html);
+
 	return html;
 }
 
@@ -3260,23 +3300,18 @@ gtk_html_new_from_string (const gchar *s
 	GtkWidget *html;
 
 	html = g_object_new (GTK_TYPE_HTML, NULL);
-	gtk_html_construct  (html);
 	gtk_html_load_from_string (GTK_HTML (html), str, len);
 
 	return html;
 }
 
 void
-gtk_html_construct (GtkWidget *widget)
+gtk_html_construct (GtkHTML *html)
 {
-	GtkHTML *html;
-
-	g_return_if_fail (widget != NULL);
-	g_return_if_fail (GTK_IS_HTML (widget));
-
-	html = GTK_HTML (widget);
+	g_return_if_fail (html != NULL);
+	g_return_if_fail (GTK_IS_HTML (html));
 
-	html->engine        = html_engine_new (widget);
+	html->engine        = html_engine_new (GTK_WIDGET (html));
 	html->iframe_parent = NULL;
 	
 	g_signal_connect (G_OBJECT (html->engine), "title_changed",
Index: gtkhtml.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.h,v
retrieving revision 1.152
diff -u -p -r1.152 gtkhtml.h
--- gtkhtml.h	18 Mar 2004 20:48:09 -0000	1.152
+++ gtkhtml.h	19 Jul 2004 17:40:17 -0000
@@ -130,7 +130,7 @@ struct _GtkHTMLEditorAPI
 
 /* Creation.  */
 GtkType                    gtk_html_get_type                      (void);
-void                       gtk_html_construct                     (GtkWidget                 *html);
+void                       gtk_html_construct                     (GtkHTML                   *html);
 GtkWidget                 *gtk_html_new                           (void);
 void                       gtk_html_set_editor_api                (GtkHTML                   *html,
 								   GtkHTMLEditorAPI          *api,
Index: htmlembedded.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlembedded.c,v
retrieving revision 1.51
diff -u -p -r1.51 htmlembedded.c
--- htmlembedded.c	26 May 2004 18:59:18 -0000	1.51
+++ htmlembedded.c	19 Jul 2004 17:40:17 -0000
@@ -145,6 +145,7 @@ calc_min_width (HTMLObject *self,
 	if (widget == NULL || !GTK_WIDGET_REALIZED (widget)) 
 		return 0;
      
+	requisition.width = requisition.height = 0;
 	gtk_widget_size_request (widget, &requisition);
 	pixel_size = html_painter_get_pixel_size (painter);
 
@@ -172,6 +173,7 @@ html_embedded_real_calc_size (HTMLObject
 	old_ascent = self->ascent;
 	old_descent = self->descent;
 
+	requisition.width = requisition.height = 0;
 	gtk_widget_size_request (widget, &requisition);
 	
 	if (GTK_IS_HTML_EMBEDDED(widget))
@@ -384,8 +386,8 @@ html_embedded_allocate (GtkWidget *w, Gt
 		}
 		e->height = allocation->height;
 		
-		g_assert (GTK_IS_HTML (w->parent));
-		html_engine_schedule_update (GTK_HTML (w->parent)->engine);
+		if (GTK_IS_HTML (w->parent))
+			html_engine_schedule_update (GTK_HTML (w->parent)->engine);
 	}
 }
 
Index: htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.614
diff -u -p -r1.614 htmlengine.c
--- htmlengine.c	18 Jun 2004 14:45:14 -0000	1.614
+++ htmlengine.c	19 Jul 2004 17:40:18 -0000
@@ -4613,10 +4613,12 @@ html_engine_stream_end (GtkHTMLStream *s
 		e->newPage = FALSE;
 	}
 
+	gtk_widget_queue_resize (GTK_WIDGET (e->widget));
+
 	g_signal_emit (e, signals [LOAD_DONE], 0);
 }
 
-static void
+void
 html_engine_draw_real (HTMLEngine *e, gint x, gint y, gint width, gint height, gboolean expose)
 {
 	gint x1, x2, y1, y2;
Index: htmlframe.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlframe.c,v
retrieving revision 1.37
diff -u -p -r1.37 htmlframe.c
--- htmlframe.c	17 Jun 2004 13:48:18 -0000	1.37
+++ htmlframe.c	19 Jul 2004 17:40:18 -0000
@@ -221,7 +221,6 @@ html_frame_real_calc_size (HTMLObject *o
 {
 	HTMLFrame *frame;
 	HTMLEngine *e;
-	gint width, height;
 	gint old_width, old_ascent, old_descent;
 	
 	old_width = o->width;
@@ -232,19 +231,15 @@ html_frame_real_calc_size (HTMLObject *o
 	e     = GTK_HTML (frame->html)->engine;
 
 	if ((frame->width < 0) && (frame->height < 0)) {
-		e->width = o->max_width;
-		html_engine_calc_size (e, changed_objs);
-
-		height = html_engine_get_doc_height (e);
-		width = html_engine_get_doc_width (e);
-
-		gtk_widget_set_size_request (frame->scroll, width, height);
-		gtk_widget_queue_resize (frame->scroll);
-		
+		if (e->clue) {
+			html_engine_calc_size (e, changed_objs);
+			e->width = html_engine_get_doc_width (e);
+			e->height = html_engine_get_doc_height (e);
+		}
 		html_frame_set_scrolling (frame, GTK_POLICY_NEVER);
 
-		o->width = width;
-		o->ascent = height;
+		o->width = e->width;
+		o->ascent = e->height;
 		o->descent = 0;
 	} else
 		return (* HTML_OBJECT_CLASS (parent_class)->calc_size) (o, painter, changed_objs);
Index: htmliframe.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmliframe.c,v
retrieving revision 1.85
diff -u -p -r1.85 htmliframe.c
--- htmliframe.c	17 Jun 2004 13:48:18 -0000	1.85
+++ htmliframe.c	19 Jul 2004 17:40:18 -0000
@@ -29,6 +29,7 @@
 #include "htmlgdkpainter.h"
 #include "htmlprinter.h"
 #include "htmliframe.h"
+#include "htmlengine.h"
 #include "htmlengine-search.h"
 #include "htmlengine-save.h"
 #include "htmlsearch.h"
@@ -140,8 +141,10 @@ set_max_width (HTMLObject *o, HTMLPainte
 {
 	HTMLEngine *e = GTK_HTML (HTML_IFRAME (o)->html)->engine;
 
-	o->max_width = max_width;
-	html_object_set_max_width (e->clue, e->painter, max_width - (html_engine_get_left_border (e) + html_engine_get_right_border (e)));
+	if (o->max_width != max_width) {
+		o->max_width = max_width;
+		html_object_set_max_width (e->clue, e->painter, max_width - (html_engine_get_left_border (e) + html_engine_get_right_border (e)));
+	}
 }
 
 static void
@@ -306,7 +309,6 @@ html_iframe_real_calc_size (HTMLObject *
 {
 	HTMLIFrame *iframe;
 	HTMLEngine *e;
-	gint width, height;
 	gint old_width, old_ascent, old_descent;
 	
 	old_width = o->width;
@@ -320,21 +322,15 @@ html_iframe_real_calc_size (HTMLObject *
 		return TRUE;
 
 	if ((iframe->width < 0) && (iframe->height < 0)) {
-		e->width = o->max_width;
-		html_engine_calc_size (e, changed_objs);
-
-		height = html_engine_get_doc_height (e);
-		width = html_engine_get_doc_width (e);
-
-		gtk_widget_set_size_request (iframe->scroll, width, height);
-		gtk_widget_queue_resize (iframe->scroll);
-		
+		if (e->clue) {
+			html_engine_calc_size (e, changed_objs);
+			e->width = html_engine_get_doc_width (e);
+			e->height = html_engine_get_doc_height (e);
+		}
 		html_iframe_set_scrolling (iframe, GTK_POLICY_NEVER);
 
-		e->width = width;
-		e->height = height;
-		o->width = width;
-		o->ascent = height;
+		o->width = e->width;
+		o->ascent = e->height;
 		o->descent = 0;
 	} else
 		return (* HTML_OBJECT_CLASS (parent_class)->calc_size) (o, painter, changed_objs);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]