[evolution-patches] two patches about gtkhtml, fixed two bugs (patch a11y-70629.diff)



hi,rodo

Thank you very much for your hard work!!

There are two new patches about gtkhtml, will you please review it ?

a11y-70629.diff : this fixed #70629. Addition, it fixed another two trivial bugs.

a11y-image.diff : this fixed an a11y bug. It set the atk name of an a11y image object. Thus when mail part didn't load an image, gnopernicus could speak out the ALT text of the image.

PS.
rodo, Now there are four patches waiting for your review.

src-84.diff : I sent it to you on Dec 14th.
src-87.diff : I sent it to you on Dec 14th either.

a11y-70629.diff and a11y-image.diff: here they are.

Yours,
Mengjie Yu

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/ChangeLog,v
retrieving revision 1.14
diff -u -p -r1.14 ChangeLog
--- ChangeLog	17 Dec 2004 02:30:45 -0000	1.14
+++ ChangeLog	17 Dec 2004 09:18:54 -0000
@@ -1,3 +1,30 @@
+2004-12-17  Mengjie Yu  <meng-jie yu sun com>
+
+	* html.c: (html_a11y_ref_state_set): Add SHOWING state to stateset.
+	
+	* text.c: (get_n_actions), (action_get_name), (do_action),
+	(atk_action_interface_init), (html_a11y_text_get_type): add action
+	interface to text so that it can be found by GOK.
+	(atk_component_interface_init): implement grab_focus.
+	(html_a11y_text_ref_state_set): add SENSITIVE and FOCUSABLE state.
+	(html_a11y_text_grab_focus): new function to implement grab_focus.
+
+	Above fix #70629
+
+	* table.c: (is_valid):new function to check whether the table is valid.
+	(html_a11y_table_ref_at),
+	(html_a11y_table_get_index_at),
+	(html_a11y_table_get_column_at_index),
+	(html_a11y_table_get_row_at_index),
+	(html_a11y_table_get_n_columns), (html_a11y_table_get_n_rows),
+	(html_a11y_table_get_column_extent_at),
+	(html_a11y_table_get_row_extent_at),
+	(html_a11y_table_get_column_header),
+	(html_a11y_table_get_row_header): call is_valid().
+
+	* utils.c: (create_accessible):
+	set the a11y name for the widget's atk object.
+
 2004-12-15  Mengjie Yu  <meng-jie yu sun com>
 
 	* object.c: (get_n_actions), (get_description), (action_get_name),
Index: html.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/html.c,v
retrieving revision 1.5
diff -u -p -r1.5 html.c
--- html.c	19 Nov 2004 10:19:51 -0000	1.5
+++ html.c	17 Dec 2004 09:18:56 -0000
@@ -200,7 +200,7 @@ html_a11y_ref_state_set (AtkObject *acce
 
 	atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
 	atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
-
+	atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
 	/* printf ("html_a11y_ref_state_set resolves to %p\n", state_set); */
 
 	return state_set;
Index: table.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/table.c,v
retrieving revision 1.2
diff -u -p -r1.2 table.c
--- table.c	1 Nov 2002 15:34:27 -0000	1.2
+++ table.c	17 Dec 2004 09:18:59 -0000
@@ -26,8 +26,11 @@
 
 #include "htmltable.h"
 #include "htmltablecell.h"
+#include "gtkhtml.h"
+#include "htmlengine.h"
 
 #include "html.h"
+#include "object.h"
 #include "table.h"
 #include "utils.h"
 
@@ -149,6 +152,30 @@ html_a11y_table_new (HTMLObject *html_ob
 	return accessible;
 }
 
+static gboolean
+is_valid (AtkObject *table)
+{
+	GtkHTMLA11Y * htmla11y = html_a11y_get_gtkhtml_parent (HTML_A11Y (table));
+	GtkHTML *html = GTK_HTML_A11Y_GTKHTML (htmla11y);
+	AtkStateSet *ss;
+
+	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
+	if (!to)
+		return FALSE;
+
+	if (html->engine->parsing)
+		return FALSE;
+
+	ss = atk_object_ref_state_set (ATK_OBJECT (htmla11y));
+	if (atk_state_set_contains_state (ss, ATK_STATE_DEFUNCT)) {
+		g_object_unref (ss);
+		return FALSE;
+	}
+        g_object_unref (ss);
+
+	return TRUE;
+}
+
 /*
  * AtkTable interface
  */
@@ -160,6 +187,10 @@ html_a11y_table_ref_at (AtkTable *table,
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 	HTMLTableCell *cell;
 
+
+	if (!is_valid (ATK_OBJECT (table)))
+		return NULL;
+
 	g_return_val_if_fail (row < to->totalRows, NULL);
 	g_return_val_if_fail (column < to->totalCols, NULL);
 
@@ -179,6 +210,9 @@ html_a11y_table_get_index_at (AtkTable *
 {
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return -1;
+
 	g_return_val_if_fail (row < to->totalRows, -1);
 	g_return_val_if_fail (column < to->totalCols, -1);
 	g_return_val_if_fail (to->cells [row][column], -1);
@@ -192,6 +226,9 @@ html_a11y_table_get_column_at_index (Atk
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 	HTMLTableCell *cell;
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return -1;
+
 	cell = HTML_TABLE_CELL (html_object_get_child (HTML_OBJECT (to), index));
 
 	return cell ? cell->col : -1;
@@ -203,6 +240,9 @@ html_a11y_table_get_row_at_index (AtkTab
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 	HTMLTableCell *cell;
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return -1;
+
 	cell = HTML_TABLE_CELL (html_object_get_child (HTML_OBJECT (to), index));
 
 	return cell ? cell->row : -1;
@@ -213,6 +253,9 @@ html_a11y_table_get_n_columns (AtkTable 
 {
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return -1;
+
 	return to->totalCols;
 }
 
@@ -221,6 +264,9 @@ html_a11y_table_get_n_rows (AtkTable *ta
 {
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return -1;
+
 	return to->totalRows;
 }
 
@@ -229,6 +275,9 @@ html_a11y_table_get_column_extent_at (At
 {
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return -1;
+
 	g_return_val_if_fail (row < to->totalRows, -1);
 	g_return_val_if_fail (column < to->totalCols, -1);
 	g_return_val_if_fail (to->cells [row][column], -1);
@@ -241,6 +290,9 @@ html_a11y_table_get_row_extent_at (AtkTa
 {
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return -1;
+
 	g_return_val_if_fail (row < to->totalRows, -1);
 	g_return_val_if_fail (column < to->totalCols, -1);
 	g_return_val_if_fail (to->cells [row][column], -1);
@@ -254,6 +306,9 @@ html_a11y_table_get_column_header (AtkTa
 {
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
 
+	if (!is_valid (ATK_OBJECT (table)))
+		return NULL;
+
 	g_return_val_if_fail (column < to->totalCols, NULL);
 	g_return_val_if_fail (to->cells [0][column], NULL);
 
@@ -265,6 +320,9 @@ static AtkObject *
 html_a11y_table_get_row_header (AtkTable *table, gint row)
 {
 	HTMLTable *to = HTML_TABLE (HTML_A11Y_HTML (table));
+
+	if (!is_valid (ATK_OBJECT (table)))
+		return NULL;
 
 	g_return_val_if_fail (row < to->totalRows, NULL);
 	g_return_val_if_fail (to->cells [row][0], NULL);
Index: text.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/text.c,v
retrieving revision 1.10
diff -u -p -r1.10 text.c
--- text.c	9 Aug 2004 05:50:30 -0000	1.10
+++ text.c	17 Dec 2004 09:19:02 -0000
@@ -24,6 +24,7 @@
 #include <config.h>
 #include <atk/atkcomponent.h>
 #include <atk/atktext.h>
+#include <glib/gi18n.h>
 
 #include "gtkhtml.h"
 #include "htmlengine.h"
@@ -48,6 +49,8 @@ static void atk_text_interface_init     
 static void html_a11y_text_get_extents   (AtkComponent *component,
 					  gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type);
 static void html_a11y_text_get_size      (AtkComponent *component, gint *width, gint *height);
+static gboolean html_a11y_text_grab_focus (AtkComponent *comp);
+
 static gchar * html_a11y_text_get_text (AtkText *text, gint start_offset, gint end_offset);
 static gchar * html_a11y_text_get_text_after_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type,
 						     gint *start_offset, gint *end_offset);
@@ -87,9 +90,45 @@ static void	html_a11y_text_paste_text	(A
 
 static AtkStateSet* html_a11y_text_ref_state_set	(AtkObject	*accessible);
 
-
 static AtkObjectClass *parent_class = NULL;
 
+static gint
+get_n_actions (AtkAction *action)
+{
+        return 1;
+}
+
+static G_CONST_RETURN gchar*
+action_get_name (AtkAction *action, gint      i)
+{
+        if (i == 0)
+                return _("grab focus");
+
+        return NULL;
+}
+
+static gboolean
+do_action (AtkAction * action, gint i)
+{
+        switch (i) {
+        case 0:
+		return html_a11y_text_grab_focus (ATK_COMPONENT (action));
+        default:
+                return FALSE;
+        }
+}
+
+static void
+atk_action_interface_init (AtkActionIface *iface)
+{
+        g_return_if_fail (iface != NULL);
+
+        iface->do_action = do_action;
+        iface->get_n_actions = get_n_actions;
+        iface->get_name = action_get_name;
+}
+
+
 GType
 html_a11y_text_get_type (void)
 {
@@ -128,10 +167,18 @@ html_a11y_text_get_type (void)
 			NULL
 		};
 
+		static const GInterfaceInfo atk_action_info = {
+			(GInterfaceInitFunc) atk_action_interface_init,
+			(GInterfaceFinalizeFunc) NULL,
+			NULL
+		};
+
+
 		type = g_type_register_static (G_TYPE_HTML_A11Y, "HTMLA11YText", &tinfo, 0);
 		g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
 		g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
 		g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
+		g_type_add_interface_static (type, ATK_TYPE_ACTION, &atk_action_info);
 	}
 
 	return type;
@@ -144,6 +191,7 @@ atk_component_interface_init (AtkCompone
 
 	iface->get_extents = html_a11y_text_get_extents;
 	iface->get_size = html_a11y_text_get_size;
+	iface->grab_focus = html_a11y_text_grab_focus;
 }
 
 static void
@@ -248,7 +296,8 @@ html_a11y_text_ref_state_set (AtkObject 
 		atk_state_set_add_state (state_set, ATK_STATE_EDITABLE);
 
 	atk_state_set_add_state (state_set, ATK_STATE_MULTI_LINE);
-	atk_state_set_add_state (state_set, ATK_STATE_MULTI_LINE);
+	atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
+	atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
 
 	return state_set;
 }
@@ -295,6 +344,20 @@ html_a11y_text_get_size (AtkComponent *c
 
 	html_a11y_get_size (component, width, height);
 	get_size (obj, width, height);
+}
+
+
+static gboolean
+html_a11y_text_grab_focus (AtkComponent *comp)
+{
+	GtkHTML *html;
+
+	html = GTK_HTML_A11Y_GTKHTML (html_a11y_get_gtkhtml_parent (HTML_A11Y (comp)));
+	g_return_val_if_fail (html && html->engine && html_engine_get_editable (html->engine), FALSE);
+
+	g_signal_emit_by_name (html, "grab_focus");
+
+        return TRUE;
 }
 
 /*
Index: utils.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/utils.c,v
retrieving revision 1.5
diff -u -p -r1.5 utils.c
--- utils.c	1 Sep 2003 04:43:40 -0000	1.5
+++ utils.c	17 Dec 2004 09:19:02 -0000
@@ -67,8 +67,15 @@ create_accessible (HTMLObject *o, AtkObj
 	case HTML_TYPE_TEXTINPUT:
 	case HTML_TYPE_BUTTON:
 	case HTML_TYPE_CHECKBOX:
-		if (HTML_EMBEDDED (o)-> widget)
+	case HTML_TYPE_IFRAME:
+		if (HTML_EMBEDDED (o)-> widget) {
 			accessible = gtk_widget_get_accessible (HTML_EMBEDDED (o)->widget);
+
+			if (HTML_EMBEDDED (o)->name) {
+				if ((accessible != NULL) && (atk_object_get_name (accessible) == NULL))
+					atk_object_set_name (accessible, HTML_EMBEDDED (o)->name);
+			}
+		}
 		break;
 	case HTML_TYPE_TEXTSLAVE: /* ignore */
 		break;


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