[evolution-patches] *Updated* Patch for GTKHTML / A11Y fixes #312189



Dear ksh,


Still remember bug 312189, about the properties of the htmltext ??

I have checked my patch and found that some properties of the text can not be
shown. e.g. the color  of the link text, the size and weight of the HEADER text.

I digged into the code carefully and found we could use prepare_attrs to get the
PangoAttrList which contains the full pango information. The pango information
getting directly from the PangoAttrList of htmltext structure is not sufficient
enough actually.

So I made a new patch again.

the related URL is:
http://bugzilla.gnome.org/show_bug.cgi?id=312189
The patch for this bug is also available on the above URL.

Will you please help me to review it when you are not busy?

Thanks a lot.

Yours,
Mengjie
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/ChangeLog,v
retrieving revision 1.26
diff -u -p -r1.26 ChangeLog
--- ChangeLog	4 Aug 2005 09:19:07 -0000	1.26
+++ ChangeLog	10 Aug 2005 07:45:45 -0000
@@ -1,3 +1,13 @@
+2005-08-10  Mengjie Yu  <meng-jie yu sun com>
+
+	* text.c: (html_a11y_text_get_run_attributes):
+	Use html_text_prepare_attrs to get the PangoAttrList of a htmltext instead of
+	getting it directly from the htmltext object structure. The former's pango
+	infomation is more sufficient than the latter, e.g. the color of the link text,
+	the size and weight of the HEADER text.
+
+	Fixes #312189
+
 2005-08-04  Mengjie Yu  <meng-jie yu sun com>
 
 	* text.c: (atk_text_interface_init),
Index: text.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/text.c,v
retrieving revision 1.17
diff -u -p -r1.17 text.c
--- text.c	4 Aug 2005 09:19:07 -0000	1.17
+++ text.c	10 Aug 2005 07:45:46 -0000
@@ -738,14 +738,25 @@ html_a11y_text_get_run_attributes (AtkTe
 	glong len;
 	gchar *textstring;
 	AtkAttributeSet *attrib_set = NULL;
+	GtkHTMLA11Y *a11y;
+	GtkHTML *html;
+	HTMLEngine *e;
 	HTMLText *t = HTML_TEXT (HTML_A11Y_HTML (text));	
 	
 	g_return_val_if_fail (t, NULL);
-
 	textstring = t->text;
-	attr = t->attr_list;
+	g_return_val_if_fail (textstring, NULL);
+
+	a11y = html_a11y_get_top_gtkhtml_parent (HTML_A11Y (text));
+	g_return_val_if_fail (a11y, NULL);
+
+	html = GTK_HTML_A11Y_GTKHTML (a11y);
+	g_return_val_if_fail (html && GTK_IS_HTML(html) && html->engine, NULL);
+
+	e = html->engine;
+	attr = html_text_prepare_attrs (t, e->painter);
+	g_return_val_if_fail (attr, NULL);
 
-	g_return_val_if_fail (attr && textstring, NULL);
 
 	len = g_utf8_strlen (textstring, -1);
 	iter = pango_attr_list_get_iterator (attr);
@@ -875,6 +886,7 @@ html_a11y_text_get_run_attributes (AtkTe
 	} 
 
 	pango_attr_iterator_destroy (iter);
+	pango_attr_list_unref (attr);
 	return attrib_set;
 
 }
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2137
diff -u -p -r1.2137 ChangeLog
--- ChangeLog	8 Aug 2005 05:37:22 -0000	1.2137
+++ ChangeLog	10 Aug 2005 07:47:27 -0000
@@ -1,3 +1,13 @@
+2005-08-09  Mengjie Yu  <meng-jie yu sun com>
+
+	* htmltext.c: (html_text_prepare_attrs),
+	(html_text_get_pango_info):
+	* htmltext.h:
+	Change function name prepare_attrs to html_text_prepare_attrs and make it 
+	a new public API. We will call it in a11y part.
+
+	Fixes #312189
+
 2005-08-05  Kaushal Kumar  <kakumar novell com>
 
 	* htmlengine-edit.c (html_engine_get_insert_level_for_object): Advance clue 
Index: htmltext.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltext.c,v
retrieving revision 1.282
diff -u -p -r1.282 htmltext.c
--- htmltext.c	9 May 2005 08:09:11 -0000	1.282
+++ htmltext.c	10 Aug 2005 07:47:32 -0000
@@ -1175,8 +1175,8 @@ html_text_remove_unwanted_line_breaks (c
 	}
 }
 
-static PangoAttrList *
-prepare_attrs (HTMLText *text, HTMLPainter *painter)
+PangoAttrList *
+html_text_prepare_attrs (HTMLText *text, HTMLPainter *painter)
 {
 	PangoAttrList *attrs;
 	HTMLClueFlow *flow = NULL;
@@ -1381,7 +1381,7 @@ html_text_get_pango_info (HTMLText *text
 		PangoAttrList *attrs;
 		int i, offset;
 
-		attrs = prepare_attrs (text, painter);
+		attrs = html_text_prepare_attrs (text, painter);
 		items = pango_itemize_with_base_dir (painter->pango_context, get_pango_base_direction (text), text->text, 0, text->text_bytes, attrs, NULL);
 		pango_attr_list_unref (attrs);
 
Index: htmltext.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltext.h,v
retrieving revision 1.75
diff -u -p -r1.75 htmltext.h
--- htmltext.h	9 May 2005 08:09:11 -0000	1.75
+++ htmltext.h	10 Aug 2005 07:47:33 -0000
@@ -362,4 +362,8 @@ html_tmp_fix_pango_glyph_string_get_logi
 						    int               length,
 						    int               embedding_level,
 						    int              *logical_widths);
+
+PangoAttrList *html_text_prepare_attrs (HTMLText *text, 
+					HTMLPainter *painter);
+
 #endif /* _HTMLTEXT_H_ */


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