From c1c3a067480b90a8d0747d92ea4a1bbb88228b0a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 3 Dec 2012 18:47:22 +0000 Subject: document mouse interaction a bit --- render/html_interaction.c | 62 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/render/html_interaction.c b/render/html_interaction.c index 8dd613bdf..d22869edc 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -400,12 +400,44 @@ void html_mouse_action(struct content *c, struct browser_window *bw, box_x = box->margin[LEFT]; box_y = box->margin[TOP]; + /* descend through visible boxes setting more specific values for: + * box - deepest box at point + * html_object_box - html object + * html_object_pos_x - html object + * html_object_pos_y - html object + * object - non html object + * iframe - iframe + * url - href or imagemap + * target - href or imagemap or gadget + * url_box - href or imagemap + * imagemap - imagemap + * gadget - gadget + * gadget_box - gadget + * gadget_box_x - gadget + * gadget_box_y - gadget + * title - title + * pointer + * + * drag_candidate - first box with scroll + * padding_left - box with scroll + * padding_right + * padding_top + * padding_bottom + * scrollbar - inside padding box stops decent + * scroll_mouse_x - inside padding box stops decent + * scroll_mouse_y - inside padding box stops decent + * + * text_box - text box + * text_box_x - text_box + */ while ((next_box = box_at_point(box, x, y, &box_x, &box_y)) != NULL) { box = next_box; - if (box->style && css_computed_visibility(box->style) == - CSS_VISIBILITY_HIDDEN) + if ((box->style != NULL) && + (css_computed_visibility(box->style) == + CSS_VISIBILITY_HIDDEN)) { continue; + } if (box->node != NULL) { node = box->node; @@ -421,8 +453,9 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } } - if (box->iframe) + if (box->iframe) { iframe = box->iframe; + } if (box->href) { url = box->href; @@ -448,12 +481,14 @@ void html_mouse_action(struct content *c, struct browser_window *bw, target = gadget->form->target; } - if (box->title) + if (box->title) { title = box->title; + } pointer = get_pointer_shape(box, false); - - if (box->scroll_y != NULL || box->scroll_x != NULL) { + + if ((box->scroll_x != NULL) || + (box->scroll_y != NULL)) { if (drag_candidate == NULL) { drag_candidate = box; @@ -468,12 +503,14 @@ void html_mouse_action(struct content *c, struct browser_window *bw, padding_bottom = padding_top + box->padding[TOP] + box->height + box->padding[BOTTOM]; - if (x > padding_left && x < padding_right && - y > padding_top && y < padding_bottom) { + if ((x > padding_left) && + (x < padding_right) && + (y > padding_top) && + (y < padding_bottom)) { /* mouse inside padding box */ - if (box->scroll_y != NULL && x > padding_right - - SCROLLBAR_WIDTH) { + if ((box->scroll_y != NULL) && + (x > (padding_right - SCROLLBAR_WIDTH))) { /* mouse above vertical box scroll */ scrollbar = box->scroll_y; @@ -482,9 +519,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw, scroll_mouse_y = y - padding_top; break; - } else if (box->scroll_x != NULL && - y > padding_bottom - - SCROLLBAR_WIDTH) { + } else if ((box->scroll_x != NULL) && + (y > (padding_bottom - SCROLLBAR_WIDTH))) { /* mouse above horizontal box scroll */ scrollbar = box->scroll_x; -- cgit v1.2.3