[gtkhtml/gnome-3-6] htmlobject: handle containers with non-cursor-able children
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkhtml/gnome-3-6] htmlobject: handle containers with non-cursor-able children
- Date: Thu, 15 Sep 2016 23:16:53 +0000 (UTC)
commit 507058c7dc27e0ba7f392686f6564bc515a08f9b
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Sep 15 17:40:50 2016 -0500
htmlobject: handle containers with non-cursor-able children
If the cursor is right at the beginning of a table like
<table>
<tr>
<td>
<a name="">
</a>
</td>
<td>
foo
</td>
</tr>
</table>
bar
then move_object_cursor() would find the first TableCell (the first
<td>), and its Anchor. The anchor contains nothing, so it can't take
the cursor.
However, move_object_cursor() would jump to the step where it does,
"find me the next object within the current object's parent", but for
the entire Table, not for the TableCell. Thus it would miss the second
<td> that actually contains a "foo" string, and it would skip past the
Table to its next cursor-able sibling, the "bar" string.
gtkhtml/htmlobject.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtkhtml/htmlobject.c b/gtkhtml/htmlobject.c
index 1768733..d2a679b 100644
--- a/gtkhtml/htmlobject.c
+++ b/gtkhtml/htmlobject.c
@@ -1911,13 +1911,19 @@ move_object_cursor (HTMLObject *obj,
gboolean found = FALSE;
if (((*offset == 0 && forward) || (*offset && !forward)) && html_object_is_container (obj))
if ((down = (*down_fn) (obj))) {
- down = move_object_downtree_cursor (down, down_fn, next_fn);
- if (down) {
- if (html_object_is_container (down))
+ HTMLObject *down_child;
+
+ down_child = move_object_downtree_cursor (down, down_fn, next_fn);
+ if (down_child) {
+ if (html_object_is_container (down_child))
*offset = forward ? 0 : 1;
- return down;
+
+ return down_child;
+ } else {
+ obj = down;
}
}
+ }
before = obj;
do {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]