diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2012-08-21 15:27:52 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2012-08-21 15:27:52 +0100 |
commit | afdf72d7b58110b2848ed9be6b8c15cc45b59891 (patch) | |
tree | cf6833e477b774ccdecd6716ea1eb45cc119d2da /render/html.c | |
parent | 7ffe9c2b5d85057876252896219f712663f9a6fc (diff) | |
download | netsurf-afdf72d7b58110b2848ed9be6b8c15cc45b59891.tar.gz netsurf-afdf72d7b58110b2848ed9be6b8c15cc45b59891.tar.bz2 |
Confine box_at_point to the document it's given. Callers are now responsible for calling whatever functionality for object boxes. Remove last bw dereference from render directory. Remove a couple of unused functions.
Diffstat (limited to 'render/html.c')
-rw-r--r-- | render/html.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/render/html.c b/render/html.c index 8d64fdf7d..d37a6246c 100644 --- a/render/html.c +++ b/render/html.c @@ -2644,10 +2644,8 @@ html_get_contextual_content(struct content *c, struct box *box = html->layout; struct box *next; int box_x = 0, box_y = 0; - hlcache_handle *containing_content = NULL; - while ((next = box_at_point(box, x, y, &box_x, &box_y, - &containing_content)) != NULL) { + while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) { box = next; if (box->style && css_computed_visibility(box->style) == @@ -2659,6 +2657,10 @@ html_get_contextual_content(struct content *c, x - box_x, y - box_y, data); if (box->object) + content_get_contextual_content(box->object, + x - box_x, y - box_y, data); + + if (box->object) data->object = box->object; if (box->href) @@ -2709,13 +2711,11 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx, int scry) struct box *box = html->layout; struct box *next; int box_x = 0, box_y = 0; - hlcache_handle *containing_content = NULL; bool handled_scroll = false; /* TODO: invert order; visit deepest box first */ - while ((next = box_at_point(box, x, y, &box_x, &box_y, - &containing_content)) != NULL) { + while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) { box = next; if (box->style && css_computed_visibility(box->style) == @@ -2727,6 +2727,12 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx, int scry) x - box_x, y - box_y, scrx, scry) == true) return true; + /* Pass into object */ + if (box->object != NULL && content_scroll_at_point( + box->object, x - box_x, y - box_y, + scrx, scry) == true) + return true; + /* Handle box scrollbars */ if (box->scroll_y && scrollbar_scroll(box->scroll_y, scry)) handled_scroll = true; @@ -2761,11 +2767,9 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) struct box *file_box = NULL; struct box *text_box = NULL; int box_x = 0, box_y = 0; - hlcache_handle *containing_content = NULL; /* Scan box tree for boxes that can handle drop */ - while ((next = box_at_point(box, x, y, &box_x, &box_y, - &containing_content)) != NULL) { + while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) { box = next; if (box->style && css_computed_visibility(box->style) == @@ -2776,6 +2780,10 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) return browser_window_drop_file_at_point(box->iframe, x - box_x, y - box_y, file); + if (box->object && content_drop_file_at_point(box->object, + x - box_x, y - box_y, file) == true) + return true; + if (box->gadget) { switch (box->gadget->type) { case GADGET_FILE: @@ -2823,10 +2831,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) file_box->gadget->value = utf8_fn; /* Redraw box. */ - if (containing_content == NULL) - html__redraw_a_box(html, file_box); - else - html_redraw_a_box(containing_content, file_box); + html__redraw_a_box(html, file_box); } else if (html->bw != NULL) { /* File dropped on text input */ |