[evolution-patches] GTKHTML Patch for #306238 (new)
- From: Mengjie Yu <Meng-Jie Yu Sun COM>
- To: ganesh <rganesan novell com>
- Cc: evolution-patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] GTKHTML Patch for #306238 (new)
- Date: Tue, 21 Jun 2005 17:59:59 +0800
Dear ganesh,
Here is the new patch for #306238.
the related URL is:
http://bugzilla.gnome.org/show_bug.cgi?id=306238
The patch for this bug is also available on the above URL.
As to your proposal, I signal the cursor position and get the offset of the text
inserted or deleted in the a11y part.
Because gnopernicus need to check the text deleted before it is really deleted,
I emit the text_changed::delete signal before the deleing really happens.
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.24
diff -u -p -r1.24 ChangeLog
--- ChangeLog 17 May 2005 14:47:56 -0000 1.24
+++ ChangeLog 21 Jun 2005 09:12:09 -0000
@@ -1,3 +1,16 @@
+2005-06-21 Mengjie Yu <meng-jie yu sun com>
+
+ * object.c: (gtk_html_a11y_insert_object_cb),
+ (gtk_html_a11y_delete_object_cb):
+ We should pass the correct offset of the text instead of the absolute position
+ of the whole document to the callback funtion.
+
+ * text.c: (html_a11y_text_get_text_at_offset):
+ We should assign the correct start_offset and end_offset and return the text content
+ if start_slave or end_slave doesn't exist.
+
+ Fixes #306238
+
2005-05-13 Changwoo Ryu <cwryu debian org>
* Makefile.am (INCLUDES): use I18N_LIB_CFLAGS.
Index: object.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/object.c,v
retrieving revision 1.12
diff -u -p -r1.12 object.c
--- object.c 17 May 2005 14:47:56 -0000 1.12
+++ object.c 21 Jun 2005 09:12:09 -0000
@@ -351,6 +351,10 @@ gtk_html_a11y_insert_object_cb (GtkWidge
{
AtkObject * a11y, *obj;
+
+ HTMLCursor *cursor = GTK_HTML (widget)->engine->cursor;
+
+
obj = gtk_widget_get_accessible (widget);
a11y = gtk_html_a11y_get_focus_object (widget);
g_return_if_fail (a11y != NULL);
@@ -362,7 +366,7 @@ gtk_html_a11y_insert_object_cb (GtkWidge
}
if (G_IS_HTML_A11Y_TEXT(a11y)) {
- g_signal_emit_by_name (a11y, "text_changed::insert", pos, len);
+ g_signal_emit_by_name (a11y, "text_changed::insert", cursor->offset - len, len);
}
}
@@ -371,6 +375,7 @@ static void
gtk_html_a11y_delete_object_cb (GtkWidget * widget, int pos, int len)
{
AtkObject * a11y, *obj;
+ HTMLCursor *cursor = GTK_HTML (widget)->engine->cursor;
obj = gtk_widget_get_accessible (widget);
a11y = gtk_html_a11y_get_focus_object (widget);
@@ -383,7 +388,7 @@ gtk_html_a11y_delete_object_cb (GtkWidge
}
if (G_IS_HTML_A11Y_TEXT(a11y)) {
- g_signal_emit_by_name (a11y, "text_changed::delete", pos, len);
+ g_signal_emit_by_name (a11y, "text_changed::delete", cursor->offset, len);
}
}
Index: text.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/text.c,v
retrieving revision 1.15
diff -u -p -r1.15 text.c
--- text.c 17 May 2005 14:47:56 -0000 1.15
+++ text.c 21 Jun 2005 09:12:10 -0000
@@ -532,29 +532,39 @@ html_a11y_text_get_text_at_offset (AtkTe
switch (boundary_type) {
case ATK_TEXT_BOUNDARY_LINE_START:
start_slave = html_text_get_slave_at_offset (to, NULL, offset);
- g_return_val_if_fail (start_slave, NULL);
- end_slave = (HTMLTextSlave *) HTML_OBJECT (start_slave)->next;
- if (end_slave && HTML_IS_TEXT_SLAVE (end_slave)) {
- *end_offset = end_slave->posStart;
+ if (start_slave == NULL) {
+ *start_offset = 0;
+ *end_offset = to->text_len;
} else {
- *end_offset = start_slave->posStart + start_slave->posLen;
+ end_slave = (HTMLTextSlave *) HTML_OBJECT (start_slave)->next;
+
+ if (end_slave && HTML_IS_TEXT_SLAVE (end_slave)) {
+ *end_offset = end_slave->posStart;
+ } else {
+ *end_offset = start_slave->posStart + start_slave->posLen;
+ }
+ *start_offset = start_slave->posStart;
}
- *start_offset = start_slave->posStart;
return html_a11y_text_get_text (text, *start_offset, *end_offset);
case ATK_TEXT_BOUNDARY_LINE_END:
end_slave = html_text_get_slave_at_offset (to, NULL, offset);
- g_return_val_if_fail (end_slave, NULL);
- start_slave = (HTMLTextSlave *) HTML_OBJECT (end_slave)->prev;
- if (start_slave && HTML_IS_TEXT_SLAVE (start_slave)) {
- *start_offset = start_slave->posStart + start_slave->posLen;
+ if (end_slave == NULL) {
+ *start_offset = 0;
+ *end_offset = to->text_len;
} else {
- *start_offset = end_slave->posStart;
+ start_slave = (HTMLTextSlave *) HTML_OBJECT (end_slave)->prev;
+
+ if (start_slave && HTML_IS_TEXT_SLAVE (start_slave)) {
+ *start_offset = start_slave->posStart + start_slave->posLen;
+ } else {
+ *start_offset = end_slave->posStart;
+ }
+ *end_offset = end_slave->posStart + end_slave->posLen;
}
- *end_offset = end_slave->posStart + end_slave->posLen;
return html_a11y_text_get_text (text, *start_offset, *end_offset);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2128
diff -u -p -r1.2128 ChangeLog
--- ChangeLog 3 Jun 2005 04:16:03 -0000 1.2128
+++ ChangeLog 21 Jun 2005 08:57:36 -0000
@@ -1,3 +1,10 @@
+2005-06-21 Mengjie Yu <meng-jie yu sun com>
+
+ * htmlengine-edit-cut-and-paste.c: (html_engine_delete):
+ We should emit the object_deleted signal before we really delete it.
+
+ Fixes #306238
+
2005-05-03 Srinivasa Ragavan <sragavan novell com>
* gtkhtml.c (selection_received), (drag_data_received):
Added code to support DnD of evolution mail, contacts, caldendar,
Index: htmlengine-edit-cut-and-paste.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit-cut-and-paste.c,v
retrieving revision 1.111
diff -u -p -r1.111 htmlengine-edit-cut-and-paste.c
--- htmlengine-edit-cut-and-paste.c 13 Apr 2005 15:35:32 -0000 1.111
+++ htmlengine-edit-cut-and-paste.c 21 Jun 2005 08:57:38 -0000
@@ -1769,6 +1769,10 @@ html_engine_delete (HTMLEngine *e)
gint start_position = start->position;
gint end_position = end->position;
+ if (end_position - start_position > 0) {
+ int len = end_position - start_position;
+ g_signal_emit_by_name (e->widget, "object_deleted", start_position, len);
+ }
while (start->position < end->position) {
if (check_for_simple_delete (start->object, end->object)) {
@@ -1815,10 +1819,7 @@ html_engine_delete (HTMLEngine *e)
html_cursor_destroy (end);
html_cursor_jump_to_position (e->cursor, e, start_position);
- if (end_position - start_position > 0) {
- int len = end_position - start_position;
- g_signal_emit_by_name (e->widget, "object_deleted", start_position, len);
- }
+
}
html_undo_level_end (e->undo);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]