[evolution-patches] [gtkhtml] #67763 aligned pasted image crasher



Hi Larry,

please review attached patch. There are also few more gtkhtml patches waiting for approval, please review these as well as we are going to release new version soon.

Cheers
Radek

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2057
diff -u -p -r1.2057 ChangeLog
--- ChangeLog	11 Nov 2004 17:09:38 -0000	1.2057
+++ ChangeLog	23 Nov 2004 14:00:23 -0000
@@ -1,3 +1,15 @@
+2004-11-23  Radek Doulik  <rodo ximian com>
+
+	* htmlimage.c (html_image_real_calc_size): use
+	html_object_get_flow instead of using o->parent which might be
+	aligned clue
+	(draw_plain): ditto
+
+	* htmlobject.c (html_object_get_flow): new helper function,
+	returns object's flow parent
+
+	Fixes #67763
+
 2004-11-11  Radek Doulik  <rodo ximian com>
 
 	* htmltablecell.c: handle direction
Index: htmlimage.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlimage.c,v
retrieving revision 1.207
diff -u -p -r1.207 htmlimage.c
--- htmlimage.c	10 Nov 2004 17:23:42 -0000	1.207
+++ htmlimage.c	23 Nov 2004 14:00:23 -0000
@@ -316,9 +316,12 @@ html_image_real_calc_size (HTMLObject *o
 
 	pixel_size = html_painter_get_pixel_size (painter);
 
-	if (o->parent && HTML_IS_CLUEFLOW (o->parent)
-	    && HTML_IS_PLAIN_PAINTER (painter) && image->alt && *image->alt) {
-		html_painter_set_font_style (painter, html_clueflow_get_default_font_style (HTML_CLUEFLOW (o->parent)));
+	if (o->parent && HTML_IS_PLAIN_PAINTER (painter) && image->alt && *image->alt) {
+		HTMLClueFlow *cf = html_object_get_flow (o);
+
+		if (cf)
+			html_painter_set_font_style (painter, html_clueflow_get_default_font_style (cf));
+
 		html_painter_set_font_face (painter, NULL);
 		/* FIXME: cache items and glyphs? */
 		html_painter_calc_text_size (painter, image->alt, g_utf8_strlen (image->alt, -1),
@@ -352,6 +355,7 @@ draw_plain (HTMLObject *o, HTMLPainter *
 		return;
 
 	if (img->alt && *img->alt) {
+		HTMLClueFlow *cf = html_object_get_flow (o);
 
 		/* FIXME: cache items and glyphs? */
 		if (o->selected) {
@@ -367,7 +371,9 @@ draw_plain (HTMLObject *o, HTMLPainter *
 										     HTMLTextColor)->color);
 		}
 		
-		html_painter_set_font_style (p, html_clueflow_get_default_font_style (HTML_CLUEFLOW (o->parent)));
+		if (cf)
+			html_painter_set_font_style (p, html_clueflow_get_default_font_style (cf));
+
 		html_painter_set_font_face (p, NULL);
 		html_painter_draw_text (p, o->x + tx, o->y + ty, img->alt, g_utf8_strlen (img->alt, -1));
 	}
Index: htmlobject.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlobject.c,v
retrieving revision 1.180
diff -u -p -r1.180 htmlobject.c
--- htmlobject.c	11 Nov 2004 17:09:38 -0000	1.180
+++ htmlobject.c	23 Nov 2004 14:00:24 -0000
@@ -2098,3 +2098,12 @@ html_object_set_id (HTMLObject *o, const
 	g_free (o->id);
 	o->id = g_strdup (id);
 }
+
+HTMLClueFlow *
+html_object_get_flow (HTMLObject *o)
+{
+	while (o && !HTML_IS_CLUEFLOW (o))
+		o = o->parent;
+
+	return HTML_CLUEFLOW (o);
+}
Index: htmlobject.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlobject.h,v
retrieving revision 1.130
diff -u -p -r1.130 htmlobject.h
--- htmlobject.h	11 Nov 2004 17:09:38 -0000	1.130
+++ htmlobject.h	23 Nov 2004 14:00:24 -0000
@@ -604,5 +604,6 @@ void        html_object_set_id  (HTMLObj
 				 const char *id);
 
 HTMLDirection html_object_get_direction (HTMLObject *o);
+HTMLClueFlow * html_object_get_flow (HTMLObject *o);
 
 #endif /* _HTMLOBJECT_H_ */


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