summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-12-03 18:47:22 +0000
committerVincent Sanders <vince@netsurf-browser.org>2012-12-10 08:49:54 +0000
commitc1c3a067480b90a8d0747d92ea4a1bbb88228b0a (patch)
treee54a362150c1a6062ac23a7beaf4f14ce00ddf17 /render
parent47579b468cb02886b2113e5bfcdee05978c7c940 (diff)
downloadnetsurf-c1c3a067480b90a8d0747d92ea4a1bbb88228b0a.tar.gz
netsurf-c1c3a067480b90a8d0747d92ea4a1bbb88228b0a.tar.bz2
document mouse interaction a bit
Diffstat (limited to 'render')
-rw-r--r--render/html_interaction.c62
1 files 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;