[evolution-patches] patches about gtkhtml. fixed two bugzilla bugs



hi, rodo

	I have splited my patches to several parts. This time it is a small one
:) fixed bugzilla #70084 and #70087.
	Will you please review it ?


yours sincerely,
Mengjie Yu
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2062
diff -u -p -r1.2062 ChangeLog
--- ChangeLog	6 Dec 2004 16:41:35 -0000	1.2062
+++ ChangeLog	10 Dec 2004 09:33:11 -0000
@@ -1,3 +1,17 @@
+2004-12-10  Mengjie Yu  <meng-jie yu sun com>
+
+	* htmlengine-edit-table.c: (delete_column_undo_action):
+	fix #70084 Before doing undo, we need move the cursor back 
+		   to original position.
+
+	* htmlinterval.c: (do_downtree_lines_intersection),
+	(html_interval_forall):
+	fix #70084 add more judgement to avoid crash.
+
+	* htmltext.c: (html_text_get_slave_at_offset):
+	fix #70087 fixes the wrong behaviour when offset is at the end
+		   of non-last line of a paragraph
+
 2004-09-29  Radek Doulik  <rodo ximian com>
 
 	* gtkhtml.c (drag_data_received): call gdk_window_get_pointer so
Index: htmlengine-edit-table.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit-table.c,v
retrieving revision 1.75
diff -u -p -r1.75 htmlengine-edit-table.c
--- htmlengine-edit-table.c	20 Apr 2004 09:57:06 -0000	1.75
+++ htmlengine-edit-table.c	10 Dec 2004 09:33:19 -0000
@@ -340,6 +340,7 @@ delete_column_undo_action (HTMLEngine *e
 	DeleteCellsUndo *data = (DeleteCellsUndo *) undo_data;
 	HTMLTable *table;
 
+	html_cursor_jump_to_position (e->cursor, e, position_after);
 	table = html_engine_get_table (e);
 	g_assert (data->size == table->totalRows);
 	html_table_insert_column (table, e, data->pos, data->cells, html_undo_direction_reverse (dir));
Index: htmlinterval.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlinterval.c,v
retrieving revision 1.20
diff -u -p -r1.20 htmlinterval.c
--- htmlinterval.c	15 Oct 2003 14:42:23 -0000	1.20
+++ htmlinterval.c	10 Dec 2004 09:33:24 -0000
@@ -218,8 +218,6 @@ get_downtree_line (HTMLObject *o)
 static HTMLEngine *
 do_downtree_lines_intersection (GSList **l1, GSList **l2, HTMLEngine *e)
 {
-	g_assert ((*l1)->data == (*l2)->data);
-
 	while (*l1 && *l2 && (*l1)->data == (*l2)->data) {
 		e = html_object_get_engine (HTML_OBJECT ((*l1)->data), e);
 		*l1 = g_slist_remove_link (*l1, *l1);
@@ -292,14 +290,16 @@ html_interval_forall (HTMLInterval *i, H
 
 	from_downline = get_downtree_line (i->from.object);
 	to_downline   = get_downtree_line (i->to.object);
-	engine = do_downtree_lines_intersection  (&from_downline, &to_downline, e);
+	if (from_downline && to_downline) {
+		engine = do_downtree_lines_intersection  (&from_downline, &to_downline, e);
 
-	if (from_downline)
-		interval_forall    (HTML_OBJECT (from_downline->data)->parent, from_downline, to_downline,
-				    html_object_get_engine (HTML_OBJECT (from_downline->data)->parent, engine), f, data);
-	else {
-		g_assert (i->from.object == i->to.object);
-		html_object_forall (i->from.object, html_object_get_engine (i->from.object, engine), f, data);
+	if (from_downline && HTML_OBJECT (from_downline->data)->parent)
+			interval_forall    (HTML_OBJECT (from_downline->data)->parent, from_downline, to_downline,
+					    html_object_get_engine (HTML_OBJECT (from_downline->data)->parent, engine), f, data);
+		else {
+			if (i->from.object == i->to.object)
+				html_object_forall (i->from.object, html_object_get_engine (i->from.object, engine), f, data);
+		}
 	}
 
 	g_slist_free (from_downline);
Index: htmltext.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltext.c,v
retrieving revision 1.269
diff -u -p -r1.269 htmltext.c
--- htmltext.c	29 Nov 2004 15:53:09 -0000	1.269
+++ htmltext.c	10 Dec 2004 09:33:27 -0000
@@ -2914,8 +2914,7 @@ html_text_get_slave_at_offset (HTMLObjec
 
 	while (o && HTML_IS_TEXT_SLAVE (o)) {
 		if (HTML_IS_TEXT_SLAVE (o) && HTML_TEXT_SLAVE (o)->posStart <= offset
-		    && (offset < HTML_TEXT_SLAVE (o)->posStart + HTML_TEXT_SLAVE (o)->posLen
-			|| (offset == HTML_TEXT_SLAVE (o)->posStart + HTML_TEXT_SLAVE (o)->posLen && HTML_TEXT_SLAVE (o)->owner->text_len == offset)))
+		    && (offset <= HTML_TEXT_SLAVE (o)->posStart + HTML_TEXT_SLAVE (o)->posLen))
 			return HTML_TEXT_SLAVE (o);
 		o = o->next;
 	}
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/ChangeLog,v
retrieving revision 1.12
diff -u -p -r1.12 ChangeLog
--- ChangeLog	1 Nov 2004 09:41:59 -0000	1.12
+++ ChangeLog	10 Dec 2004 09:34:33 -0000
@@ -1,3 +1,16 @@
+2004-12-10  Mengjie Yu  <meng-jie yu sun com>
+
+	* table.c: (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):
+	add new function to check whether the table is valid.
+
 2004-11-01  Radek Doulik  <rodo ximian com>
 
 	* Makefile.am (AM_CFLAGS): use AM_FLAGS instead of CFLAGS
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	10 Dec 2004 09:34:34 -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);


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