netsurf: branch master updated. afdf72d7b58110b2848ed9be6b8c15cc45b59891
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/afdf72d7b58110b2848ed...
...commit http://git.netsurf-browser.org/netsurf.git/commit/afdf72d7b58110b2848ed9b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/afdf72d7b58110b2848ed9be6...
The branch, master has been updated
via afdf72d7b58110b2848ed9be6b8c15cc45b59891 (commit)
from 7ffe9c2b5d85057876252896219f712663f9a6fc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/afdf72d7b58110b2848...
commit afdf72d7b58110b2848ed9be6b8c15cc45b59891
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
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.
diff --git a/render/box.c b/render/box.c
index ff74478..f731558 100644
--- a/render/box.c
+++ b/render/box.c
@@ -350,7 +350,6 @@ void box_bounds(struct box *box, struct rect *r)
* to position of returned box, if any
* \param box_y position of box, in global document coordinates, updated
* to position of returned box, if any
- * \param content updated to content of object that returned box is in, if any
* \return box at given point, or 0 if none found
*
* To find all the boxes in the hierarchy at a certain point, use code like
@@ -358,17 +357,15 @@ void box_bounds(struct box *box, struct rect *r)
* \code
* struct box *box = top_of_document_to_search;
* int box_x = 0, box_y = 0;
- * struct content *content = document_to_search;
*
- * while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
+ * while ((box = box_at_point(box, x, y, &box_x, &box_y))) {
* // process box
* }
* \endcode
*/
struct box *box_at_point(struct box *box, const int x, const int y,
- int *box_x, int *box_y,
- hlcache_handle **content)
+ int *box_x, int *box_y)
{
int bx = *box_x, by = *box_y;
struct box *child, *sibling;
@@ -376,21 +373,7 @@ struct box *box_at_point(struct box *box, const int x, const int y,
assert(box);
- /* drill into HTML objects */
- if (box->object != NULL) {
- struct box *layout;
-
- if (content_get_type(box->object) == CONTENT_HTML &&
- (layout = html_get_box_tree(box->object)) !=
- NULL) {
- *content = box->object;
- box = layout;
- } else {
- goto siblings;
- }
- }
-
- /* consider floats second, since they will often overlap other boxes */
+ /* consider floats first, since they will often overlap other boxes */
for (child = box->float_children; child; child = child->next_float) {
if (box_contains_point(child, x - bx, y - by, &physically)) {
*box_x = bx + child->x -
@@ -401,8 +384,7 @@ struct box *box_at_point(struct box *box, const int x, const int y,
if (physically)
return child;
else
- return box_at_point(child, x, y, box_x, box_y,
- content);
+ return box_at_point(child, x, y, box_x, box_y);
}
}
@@ -420,8 +402,7 @@ non_float_children:
if (physically)
return child;
else
- return box_at_point(child, x, y, box_x, box_y,
- content);
+ return box_at_point(child, x, y, box_x, box_y);
}
}
@@ -435,7 +416,6 @@ non_float_children:
}
}
-siblings:
/* siblings and siblings of ancestors */
while (box) {
if (box_is_float(box)) {
@@ -457,8 +437,7 @@ siblings:
else
return box_at_point(sibling,
x, y,
- box_x, box_y,
- content);
+ box_x, box_y);
}
}
/* ascend to float's parent */
@@ -489,8 +468,7 @@ siblings:
else
return box_at_point(sibling,
x, y,
- box_x, box_y,
- content);
+ box_x, box_y);
}
}
box = box->parent;
@@ -560,66 +538,6 @@ bool box_contains_point(struct box *box, int x, int y, bool *physically)
/**
- * Find the box containing an object at the given coordinates, if any.
- *
- * \param h content to search, must have type CONTENT_HTML
- * \param x coordinates in document units
- * \param y coordinates in document units
- */
-
-struct box *box_object_at_point(hlcache_handle *h, int x, int y)
-{
- struct box *box;
- int box_x = 0, box_y = 0;
- hlcache_handle *content = h;
- struct box *object_box = 0;
-
- box = html_get_box_tree(h);
-
- while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (box->object)
- object_box = box;
- }
-
- return object_box;
-}
-
-
-/**
- * Find the box containing an href at the given coordinates, if any.
- *
- * \param h content to search, must have type CONTENT_HTML
- * \param x coordinates in document units
- * \param y coordinates in document units
- */
-
-struct box *box_href_at_point(hlcache_handle *h, int x, int y)
-{
- struct box *box;
- int box_x = 0, box_y = 0;
- hlcache_handle *content = h;
- struct box *href_box = 0;
-
- box = html_get_box_tree(h);
-
- while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (box->href)
- href_box = box;
- }
-
- return href_box;
-}
-
-
-/**
* Check whether box is nearer mouse coordinates than current nearest box
*
* \param box box to test
diff --git a/render/box.h b/render/box.h
index 30feacf..6b1d28d 100644
--- a/render/box.h
+++ b/render/box.h
@@ -324,9 +324,7 @@ void box_free_box(struct box *box);
void box_bounds(struct box *box, struct rect *r);
void box_coords(struct box *box, int *x, int *y);
struct box *box_at_point(struct box *box, const int x, const int y,
- int *box_x, int *box_y, struct hlcache_handle **content);
-struct box *box_object_at_point(struct hlcache_handle *h, int x, int y);
-struct box *box_href_at_point(struct hlcache_handle *h, int x, int y);
+ int *box_x, int *box_y);
struct box *box_pick_text_box(struct html_content *html,
int x, int y, int dir, int *dx, int *dy);
struct box *box_find_by_id(struct box *box, lwc_string *id);
diff --git a/render/form.c b/render/form.c
index 09579dc..f0596b3 100644
--- a/render/form.c
+++ b/render/form.c
@@ -1423,12 +1423,12 @@ void form_select_menu_callback(void *client_data,
* \param radio form control of type GADGET_RADIO
*/
-void form_radio_set(hlcache_handle *content,
+void form_radio_set(html_content *html,
struct form_control *radio)
{
struct form_control *control;
- assert(content);
+ assert(html);
assert(radio);
if (!radio->form)
return;
@@ -1447,12 +1447,12 @@ void form_radio_set(hlcache_handle *content,
if (control->selected) {
control->selected = false;
- html_redraw_a_box(content, control->box);
+ html__redraw_a_box(html, control->box);
}
}
radio->selected = true;
- html_redraw_a_box(content, radio->box);
+ html__redraw_a_box(html, radio->box);
}
diff --git a/render/form.h b/render/form.h
index dab6a62..c769dc9 100644
--- a/render/form.h
+++ b/render/form.h
@@ -33,6 +33,7 @@ struct box;
struct form_control;
struct form_option;
struct form_select_menu;
+struct html_content;
/** Form submit method. */
typedef enum {
@@ -175,6 +176,6 @@ void form_select_process_selection(hlcache_handle *h,
struct form_control *control, int item);
void form_submit(nsurl *page_url, struct browser_window *target,
struct form *form, struct form_control *submit_button);
-void form_radio_set(struct hlcache_handle *content, struct form_control *radio);
+void form_radio_set(struct html_content *html, struct form_control *radio);
#endif
diff --git a/render/html.c b/render/html.c
index 8d64fdf..d37a624 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 */
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 08cab5d..4a96554 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -309,12 +309,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
struct box *url_box = 0;
struct box *gadget_box = 0;
struct box *text_box = 0;
- hlcache_handle *h = bw->current_content;
struct box *box;
- hlcache_handle *content = h;
- hlcache_handle *gadget_content = h;
struct form_control *gadget = 0;
hlcache_handle *object = NULL;
+ hlcache_handle *html_object = NULL;
struct browser_window *iframe = NULL;
struct box *next_box;
struct box *drag_candidate = NULL;
@@ -398,7 +396,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
box_x = box->margin[LEFT];
box_y = box->margin[TOP];
- while ((next_box = box_at_point(box, x, y, &box_x, &box_y, &content)) !=
+ while ((next_box = box_at_point(box, x, y, &box_x, &box_y)) !=
NULL) {
box = next_box;
@@ -406,8 +404,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
CSS_VISIBILITY_HIDDEN)
continue;
- if (box->object)
- object = box->object;
+ if (box->object) {
+ if (content_get_type(box->object) == CONTENT_HTML)
+ html_object = box->object;
+ else
+ object = box->object;
+ }
if (box->iframe)
iframe = box->iframe;
@@ -428,7 +430,6 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
if (box->gadget) {
- gadget_content = content;
gadget = box->gadget;
gadget_box = box;
gadget_box_x = box_x;
@@ -516,13 +517,13 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
status = messages_get("FormCheckbox");
if (mouse & BROWSER_MOUSE_CLICK_1) {
gadget->selected = !gadget->selected;
- html_redraw_a_box(gadget_content, gadget_box);
+ html__redraw_a_box(html, gadget_box);
}
break;
case GADGET_RADIO:
status = messages_get("FormRadio");
if (mouse & BROWSER_MOUSE_CLICK_1)
- form_radio_set(gadget_content, gadget);
+ form_radio_set(html, gadget);
break;
case GADGET_IMAGE:
if (mouse & BROWSER_MOUSE_CLICK_1) {
@@ -680,6 +681,23 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
browser_window_mouse_track(iframe, mouse,
x - pos_x, y - pos_y);
}
+ } else if (html_object) {
+ int pos_x, pos_y;
+ float scale = browser_window_get_scale(bw);
+
+ browser_window_get_position(iframe, false, &pos_x, &pos_y);
+
+ pos_x /= scale;
+ pos_y /= scale;
+
+ if (mouse & BROWSER_MOUSE_CLICK_1 ||
+ mouse & BROWSER_MOUSE_CLICK_2) {
+ content_mouse_action(html_object, bw, mouse,
+ x - pos_x, y - pos_y);
+ } else {
+ content_mouse_track(html_object, bw, mouse,
+ x - pos_x, y - pos_y);
+ }
} else if (url) {
if (title) {
snprintf(status_buffer, sizeof status_buffer, "%s: %s",
-----------------------------------------------------------------------
Summary of changes:
render/box.c | 96 +++-----------------------------------------
render/box.h | 4 +-
render/form.c | 8 ++--
render/form.h | 3 +-
render/html.c | 31 ++++++++------
render/html_interaction.c | 36 +++++++++++++----
6 files changed, 59 insertions(+), 119 deletions(-)
diff --git a/render/box.c b/render/box.c
index ff74478..f731558 100644
--- a/render/box.c
+++ b/render/box.c
@@ -350,7 +350,6 @@ void box_bounds(struct box *box, struct rect *r)
* to position of returned box, if any
* \param box_y position of box, in global document coordinates, updated
* to position of returned box, if any
- * \param content updated to content of object that returned box is in, if any
* \return box at given point, or 0 if none found
*
* To find all the boxes in the hierarchy at a certain point, use code like
@@ -358,17 +357,15 @@ void box_bounds(struct box *box, struct rect *r)
* \code
* struct box *box = top_of_document_to_search;
* int box_x = 0, box_y = 0;
- * struct content *content = document_to_search;
*
- * while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
+ * while ((box = box_at_point(box, x, y, &box_x, &box_y))) {
* // process box
* }
* \endcode
*/
struct box *box_at_point(struct box *box, const int x, const int y,
- int *box_x, int *box_y,
- hlcache_handle **content)
+ int *box_x, int *box_y)
{
int bx = *box_x, by = *box_y;
struct box *child, *sibling;
@@ -376,21 +373,7 @@ struct box *box_at_point(struct box *box, const int x, const int y,
assert(box);
- /* drill into HTML objects */
- if (box->object != NULL) {
- struct box *layout;
-
- if (content_get_type(box->object) == CONTENT_HTML &&
- (layout = html_get_box_tree(box->object)) !=
- NULL) {
- *content = box->object;
- box = layout;
- } else {
- goto siblings;
- }
- }
-
- /* consider floats second, since they will often overlap other boxes */
+ /* consider floats first, since they will often overlap other boxes */
for (child = box->float_children; child; child = child->next_float) {
if (box_contains_point(child, x - bx, y - by, &physically)) {
*box_x = bx + child->x -
@@ -401,8 +384,7 @@ struct box *box_at_point(struct box *box, const int x, const int y,
if (physically)
return child;
else
- return box_at_point(child, x, y, box_x, box_y,
- content);
+ return box_at_point(child, x, y, box_x, box_y);
}
}
@@ -420,8 +402,7 @@ non_float_children:
if (physically)
return child;
else
- return box_at_point(child, x, y, box_x, box_y,
- content);
+ return box_at_point(child, x, y, box_x, box_y);
}
}
@@ -435,7 +416,6 @@ non_float_children:
}
}
-siblings:
/* siblings and siblings of ancestors */
while (box) {
if (box_is_float(box)) {
@@ -457,8 +437,7 @@ siblings:
else
return box_at_point(sibling,
x, y,
- box_x, box_y,
- content);
+ box_x, box_y);
}
}
/* ascend to float's parent */
@@ -489,8 +468,7 @@ siblings:
else
return box_at_point(sibling,
x, y,
- box_x, box_y,
- content);
+ box_x, box_y);
}
}
box = box->parent;
@@ -560,66 +538,6 @@ bool box_contains_point(struct box *box, int x, int y, bool *physically)
/**
- * Find the box containing an object at the given coordinates, if any.
- *
- * \param h content to search, must have type CONTENT_HTML
- * \param x coordinates in document units
- * \param y coordinates in document units
- */
-
-struct box *box_object_at_point(hlcache_handle *h, int x, int y)
-{
- struct box *box;
- int box_x = 0, box_y = 0;
- hlcache_handle *content = h;
- struct box *object_box = 0;
-
- box = html_get_box_tree(h);
-
- while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (box->object)
- object_box = box;
- }
-
- return object_box;
-}
-
-
-/**
- * Find the box containing an href at the given coordinates, if any.
- *
- * \param h content to search, must have type CONTENT_HTML
- * \param x coordinates in document units
- * \param y coordinates in document units
- */
-
-struct box *box_href_at_point(hlcache_handle *h, int x, int y)
-{
- struct box *box;
- int box_x = 0, box_y = 0;
- hlcache_handle *content = h;
- struct box *href_box = 0;
-
- box = html_get_box_tree(h);
-
- while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (box->href)
- href_box = box;
- }
-
- return href_box;
-}
-
-
-/**
* Check whether box is nearer mouse coordinates than current nearest box
*
* \param box box to test
diff --git a/render/box.h b/render/box.h
index 30feacf..6b1d28d 100644
--- a/render/box.h
+++ b/render/box.h
@@ -324,9 +324,7 @@ void box_free_box(struct box *box);
void box_bounds(struct box *box, struct rect *r);
void box_coords(struct box *box, int *x, int *y);
struct box *box_at_point(struct box *box, const int x, const int y,
- int *box_x, int *box_y, struct hlcache_handle **content);
-struct box *box_object_at_point(struct hlcache_handle *h, int x, int y);
-struct box *box_href_at_point(struct hlcache_handle *h, int x, int y);
+ int *box_x, int *box_y);
struct box *box_pick_text_box(struct html_content *html,
int x, int y, int dir, int *dx, int *dy);
struct box *box_find_by_id(struct box *box, lwc_string *id);
diff --git a/render/form.c b/render/form.c
index 09579dc..f0596b3 100644
--- a/render/form.c
+++ b/render/form.c
@@ -1423,12 +1423,12 @@ void form_select_menu_callback(void *client_data,
* \param radio form control of type GADGET_RADIO
*/
-void form_radio_set(hlcache_handle *content,
+void form_radio_set(html_content *html,
struct form_control *radio)
{
struct form_control *control;
- assert(content);
+ assert(html);
assert(radio);
if (!radio->form)
return;
@@ -1447,12 +1447,12 @@ void form_radio_set(hlcache_handle *content,
if (control->selected) {
control->selected = false;
- html_redraw_a_box(content, control->box);
+ html__redraw_a_box(html, control->box);
}
}
radio->selected = true;
- html_redraw_a_box(content, radio->box);
+ html__redraw_a_box(html, radio->box);
}
diff --git a/render/form.h b/render/form.h
index dab6a62..c769dc9 100644
--- a/render/form.h
+++ b/render/form.h
@@ -33,6 +33,7 @@ struct box;
struct form_control;
struct form_option;
struct form_select_menu;
+struct html_content;
/** Form submit method. */
typedef enum {
@@ -175,6 +176,6 @@ void form_select_process_selection(hlcache_handle *h,
struct form_control *control, int item);
void form_submit(nsurl *page_url, struct browser_window *target,
struct form *form, struct form_control *submit_button);
-void form_radio_set(struct hlcache_handle *content, struct form_control *radio);
+void form_radio_set(struct html_content *html, struct form_control *radio);
#endif
diff --git a/render/html.c b/render/html.c
index 8d64fdf..d37a624 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 */
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 08cab5d..4a96554 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -309,12 +309,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
struct box *url_box = 0;
struct box *gadget_box = 0;
struct box *text_box = 0;
- hlcache_handle *h = bw->current_content;
struct box *box;
- hlcache_handle *content = h;
- hlcache_handle *gadget_content = h;
struct form_control *gadget = 0;
hlcache_handle *object = NULL;
+ hlcache_handle *html_object = NULL;
struct browser_window *iframe = NULL;
struct box *next_box;
struct box *drag_candidate = NULL;
@@ -398,7 +396,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
box_x = box->margin[LEFT];
box_y = box->margin[TOP];
- while ((next_box = box_at_point(box, x, y, &box_x, &box_y, &content)) !=
+ while ((next_box = box_at_point(box, x, y, &box_x, &box_y)) !=
NULL) {
box = next_box;
@@ -406,8 +404,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
CSS_VISIBILITY_HIDDEN)
continue;
- if (box->object)
- object = box->object;
+ if (box->object) {
+ if (content_get_type(box->object) == CONTENT_HTML)
+ html_object = box->object;
+ else
+ object = box->object;
+ }
if (box->iframe)
iframe = box->iframe;
@@ -428,7 +430,6 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
if (box->gadget) {
- gadget_content = content;
gadget = box->gadget;
gadget_box = box;
gadget_box_x = box_x;
@@ -516,13 +517,13 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
status = messages_get("FormCheckbox");
if (mouse & BROWSER_MOUSE_CLICK_1) {
gadget->selected = !gadget->selected;
- html_redraw_a_box(gadget_content, gadget_box);
+ html__redraw_a_box(html, gadget_box);
}
break;
case GADGET_RADIO:
status = messages_get("FormRadio");
if (mouse & BROWSER_MOUSE_CLICK_1)
- form_radio_set(gadget_content, gadget);
+ form_radio_set(html, gadget);
break;
case GADGET_IMAGE:
if (mouse & BROWSER_MOUSE_CLICK_1) {
@@ -680,6 +681,23 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
browser_window_mouse_track(iframe, mouse,
x - pos_x, y - pos_y);
}
+ } else if (html_object) {
+ int pos_x, pos_y;
+ float scale = browser_window_get_scale(bw);
+
+ browser_window_get_position(iframe, false, &pos_x, &pos_y);
+
+ pos_x /= scale;
+ pos_y /= scale;
+
+ if (mouse & BROWSER_MOUSE_CLICK_1 ||
+ mouse & BROWSER_MOUSE_CLICK_2) {
+ content_mouse_action(html_object, bw, mouse,
+ x - pos_x, y - pos_y);
+ } else {
+ content_mouse_track(html_object, bw, mouse,
+ x - pos_x, y - pos_y);
+ }
} else if (url) {
if (title) {
snprintf(status_buffer, sizeof status_buffer, "%s: %s",
--
NetSurf Browser
10 years, 7 months
netsurf: branch master updated. 7ffe9c2b5d85057876252896219f712663f9a6fc
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7ffe9c2b5d85057876252...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7ffe9c2b5d8505787625289...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7ffe9c2b5d850578762528962...
The branch, master has been updated
via 7ffe9c2b5d85057876252896219f712663f9a6fc (commit)
via 1086fc5246d0bec95228437cf2a2eabf84a3f5b3 (commit)
from f0392b0790cae721ee50c8de75ef1308c34dbeb5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/7ffe9c2b5d850578762...
commit 7ffe9c2b5d85057876252896219f712663f9a6fc
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove Makefile.resources.
diff --git a/Makefile.resources b/Makefile.resources
deleted file mode 100644
index 519499d..0000000
--- a/Makefile.resources
+++ /dev/null
@@ -1,19 +0,0 @@
-# Makefile for NetSurf's resources
-#
-# Copyright 2009 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
-#
-#
-# This file provides the rules and setup for built-in resources for
-# the NetSurf browser binary.
-
-ifeq ($(TARGET),framebuffer)
-
-
-# End of framebuffer resource definitions
-endif
-
-ifeq ($(TARGET),windows)
-
-
-# End of windows resource definitions
-endif
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/1086fc5246d0bec9522...
commit 1086fc5246d0bec95228437cf2a2eabf84a3f5b3
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Change order of libs.
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index 488b849..0fd0acf 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -13,23 +13,22 @@ NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP
-NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
+NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
-# add a line similar to below for each optional pkg-configed lib here
+# add a line similar to below for each optional lib here
+# note: webp lacks pkg-config file
+$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
+$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
+$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG))
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
-$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
-$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
-$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
-$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
+$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
-
-# no pkg-config for this library
-$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
+$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
ifeq ($(NETSURF_USE_MOZJS),YES)
NETSURF_USE_JS:=YES
-----------------------------------------------------------------------
Summary of changes:
Makefile.resources | 19 -------------------
gtk/Makefile.target | 17 ++++++++---------
2 files changed, 8 insertions(+), 28 deletions(-)
delete mode 100644 Makefile.resources
diff --git a/Makefile.resources b/Makefile.resources
deleted file mode 100644
index 519499d..0000000
--- a/Makefile.resources
+++ /dev/null
@@ -1,19 +0,0 @@
-# Makefile for NetSurf's resources
-#
-# Copyright 2009 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
-#
-#
-# This file provides the rules and setup for built-in resources for
-# the NetSurf browser binary.
-
-ifeq ($(TARGET),framebuffer)
-
-
-# End of framebuffer resource definitions
-endif
-
-ifeq ($(TARGET),windows)
-
-
-# End of windows resource definitions
-endif
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index 488b849..0fd0acf 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -13,23 +13,22 @@ NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP
-NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
+NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
-# add a line similar to below for each optional pkg-configed lib here
+# add a line similar to below for each optional lib here
+# note: webp lacks pkg-config file
+$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
+$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
+$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG))
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
-$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
-$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
-$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
-$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
+$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
-
-# no pkg-config for this library
-$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
+$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
ifeq ($(NETSURF_USE_MOZJS),YES)
NETSURF_USE_JS:=YES
--
NetSurf Browser
10 years, 7 months
toolchains: branch master updated. 57c395a6cd921b9126243fdecc0b41c6588fb691
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/57c395a6cd921b9126...
...commit http://git.netsurf-browser.org/toolchains.git/commit/57c395a6cd921b912624...
...tree http://git.netsurf-browser.org/toolchains.git/tree/57c395a6cd921b9126243f...
The branch, master has been updated
via 57c395a6cd921b9126243fdecc0b41c6588fb691 (commit)
from e0a630f80ce3f3288415bf0752359a634ddf7f0f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commitdiff/57c395a6cd921b91...
commit 57c395a6cd921b9126243fdecc0b41c6588fb691
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
add freetype2 build
diff --git a/sdk/Makefile b/sdk/Makefile
index 3bb8b79..3b26028 100644
--- a/sdk/Makefile
+++ b/sdk/Makefile
@@ -39,6 +39,7 @@ VERSION_LIBCF := CVS-20120227
VERSION_LDG := 2.32
VERSION_WINDOM := 2.0.1
VERSION_HERMES := 1.3.3
+VERSION_FREETYPE := 2.4.10
# Path
path__ := $(GCCSDK_INSTALL_CROSSBIN):$(PATH)
@@ -81,7 +82,7 @@ endif
ifeq ($(TARGET),m68k-atari-mint)
EXTRAARGS_LIBXML := --enable-ipv6=no
- SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, libiconv.d $(COMMON_SDK_ITEMS) libcf.d ldg.d windom.d hermes.d)
+ SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, libiconv.d $(COMMON_SDK_ITEMS) libcf.d ldg.d windom.d hermes.d freetype.d)
EXTRAARGS_LIBCARES := --disable-shared
EXTRAARGS_LIBCURL := --enable-nonblocking --enable-ares
endif
@@ -239,6 +240,21 @@ $(BUILDSTEPS)/hermes-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/hermes-$(VERS
$(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.bz2:
wget -q -O $@ "http://clanlib.org/download/legacy/Hermes-$(VERSION_HERMES).tar.bz2"
+# freetype font lib
+$(BUILDSTEPS)/freetype.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/freetype-src.d
+ cd $(BUILDDIR)/freetype/freetype-$(VERSION_FREETYPE) && $(env) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared
+ cd $(BUILDDIR)/freetype/freetype-$(VERSION_FREETYPE) && $(env) make install
+ touch $@
+
+$(BUILDSTEPS)/freetype-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/freetype-$(VERSION_FREETYPE).tar.bz2
+ $(RM) -rf $(BUILDDIR)/freetype
+ mkdir -p $(BUILDDIR)/freetype
+ cd $(BUILDDIR)/freetype && tar xaf $(SOURCEDIR)/freetype-$(VERSION_FREETYPE).tar.bz2
+ touch $@
+
+$(SOURCEDIR)/freetype-$(VERSION_FREETYPE).tar.bz2:
+ wget -q -O $@ "http://download.savannah.gnu.org/releases/freetype/freetype-$(VERSION_FRE..."
+
# regex
$(BUILDSTEPS)/libtre.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libtre-src.d
mkdir -p $(BUILDDIR)/libtre
-----------------------------------------------------------------------
Summary of changes:
sdk/Makefile | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/sdk/Makefile b/sdk/Makefile
index 3bb8b79..3b26028 100644
--- a/sdk/Makefile
+++ b/sdk/Makefile
@@ -39,6 +39,7 @@ VERSION_LIBCF := CVS-20120227
VERSION_LDG := 2.32
VERSION_WINDOM := 2.0.1
VERSION_HERMES := 1.3.3
+VERSION_FREETYPE := 2.4.10
# Path
path__ := $(GCCSDK_INSTALL_CROSSBIN):$(PATH)
@@ -81,7 +82,7 @@ endif
ifeq ($(TARGET),m68k-atari-mint)
EXTRAARGS_LIBXML := --enable-ipv6=no
- SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, libiconv.d $(COMMON_SDK_ITEMS) libcf.d ldg.d windom.d hermes.d)
+ SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, libiconv.d $(COMMON_SDK_ITEMS) libcf.d ldg.d windom.d hermes.d freetype.d)
EXTRAARGS_LIBCARES := --disable-shared
EXTRAARGS_LIBCURL := --enable-nonblocking --enable-ares
endif
@@ -239,6 +240,21 @@ $(BUILDSTEPS)/hermes-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/hermes-$(VERS
$(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.bz2:
wget -q -O $@ "http://clanlib.org/download/legacy/Hermes-$(VERSION_HERMES).tar.bz2"
+# freetype font lib
+$(BUILDSTEPS)/freetype.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/freetype-src.d
+ cd $(BUILDDIR)/freetype/freetype-$(VERSION_FREETYPE) && $(env) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared
+ cd $(BUILDDIR)/freetype/freetype-$(VERSION_FREETYPE) && $(env) make install
+ touch $@
+
+$(BUILDSTEPS)/freetype-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/freetype-$(VERSION_FREETYPE).tar.bz2
+ $(RM) -rf $(BUILDDIR)/freetype
+ mkdir -p $(BUILDDIR)/freetype
+ cd $(BUILDDIR)/freetype && tar xaf $(SOURCEDIR)/freetype-$(VERSION_FREETYPE).tar.bz2
+ touch $@
+
+$(SOURCEDIR)/freetype-$(VERSION_FREETYPE).tar.bz2:
+ wget -q -O $@ "http://download.savannah.gnu.org/releases/freetype/freetype-$(VERSION_FRE..."
+
# regex
$(BUILDSTEPS)/libtre.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libtre-src.d
mkdir -p $(BUILDDIR)/libtre
--
Cross-compilation toolchains and environments
10 years, 7 months
netsurf: branch master updated. f0392b0790cae721ee50c8de75ef1308c34dbeb5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/f0392b0790cae721ee50c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/f0392b0790cae721ee50c8d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/f0392b0790cae721ee50c8de7...
The branch, master has been updated
via f0392b0790cae721ee50c8de75ef1308c34dbeb5 (commit)
from cd28d4179523d388361fec7a17cef3333df6a81f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/f0392b0790cae721ee5...
commit f0392b0790cae721ee50c8de75ef1308c34dbeb5
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Need render/form.h
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index a915e92..efd1f78 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -45,6 +45,7 @@
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/tree_url_node.h"
+#include "render/form.h"
#include "utils/utf8.h"
#include "utils/messages.h"
#include "utils/utils.h"
-----------------------------------------------------------------------
Summary of changes:
amiga/context_menu.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index a915e92..efd1f78 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -45,6 +45,7 @@
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/tree_url_node.h"
+#include "render/form.h"
#include "utils/utf8.h"
#include "utils/messages.h"
#include "utils/utils.h"
--
NetSurf Browser
10 years, 7 months
netsurf: branch master updated. cd28d4179523d388361fec7a17cef3333df6a81f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/cd28d4179523d388361fe...
...commit http://git.netsurf-browser.org/netsurf.git/commit/cd28d4179523d388361fec7...
...tree http://git.netsurf-browser.org/netsurf.git/tree/cd28d4179523d388361fec7a1...
The branch, master has been updated
via cd28d4179523d388361fec7a17cef3333df6a81f (commit)
from d76e7db6fef96598713de096782468f042d519db (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/cd28d4179523d388361...
commit cd28d4179523d388361fec7a17cef3333df6a81f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
More fixing.
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index 4213eb9..a915e92 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -124,7 +124,7 @@ enum {
struct ami_file_input_menu_data {
int x;
int y;
- struct browser_window bw;
+ struct browser_window *bw;
};
struct Library *PopupMenuBase = NULL;
@@ -679,10 +679,10 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
if(ccdata.form_features == CTX_FORM_FILE)
{
struct ami_file_input_menu_data file_input = {
- .x = x;
- .y = y;
- .bw = gwin->bw;
- }
+ .x = x,
+ .y = y,
+ .bw = gwin->bw
+ };
ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, &file_input);
menuhascontent = true;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/context_menu.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index 4213eb9..a915e92 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -124,7 +124,7 @@ enum {
struct ami_file_input_menu_data {
int x;
int y;
- struct browser_window bw;
+ struct browser_window *bw;
};
struct Library *PopupMenuBase = NULL;
@@ -679,10 +679,10 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
if(ccdata.form_features == CTX_FORM_FILE)
{
struct ami_file_input_menu_data file_input = {
- .x = x;
- .y = y;
- .bw = gwin->bw;
- }
+ .x = x,
+ .y = y,
+ .bw = gwin->bw
+ };
ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, &file_input);
menuhascontent = true;
}
--
NetSurf Browser
10 years, 7 months
netsurf: branch master updated. 634b8f642e10dbb3c2c08281cea5170cf50ed785
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/634b8f642e10dbb3c2c08...
...commit http://git.netsurf-browser.org/netsurf.git/commit/634b8f642e10dbb3c2c0828...
...tree http://git.netsurf-browser.org/netsurf.git/tree/634b8f642e10dbb3c2c08281c...
The branch, master has been updated
via 634b8f642e10dbb3c2c08281cea5170cf50ed785 (commit)
from 3b631f473b46ab226d247b365a33187febec6c60 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/634b8f642e10dbb3c2c...
commit 634b8f642e10dbb3c2c08281cea5170cf50ed785
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Don't need to set everything to zero since it's static
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 7973cc7..2b00367 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -162,8 +162,7 @@ nsgtk_scaffolding *scaf_list = NULL;
/** holds the context data for what's under the pointer, when the contextual
* menu is opened. */
-static struct contextual_content current_menu_ctx = {
- NULL, NULL, NULL, CTX_FORM_NONE };
+static struct contextual_content current_menu_ctx;
/**
-----------------------------------------------------------------------
Summary of changes:
gtk/scaffolding.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 7973cc7..2b00367 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -162,8 +162,7 @@ nsgtk_scaffolding *scaf_list = NULL;
/** holds the context data for what's under the pointer, when the contextual
* menu is opened. */
-static struct contextual_content current_menu_ctx = {
- NULL, NULL, NULL, CTX_FORM_NONE };
+static struct contextual_content current_menu_ctx;
/**
--
NetSurf Browser
10 years, 7 months
netsurf: branch master updated. 3b631f473b46ab226d247b365a33187febec6c60
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/3b631f473b46ab226d247...
...commit http://git.netsurf-browser.org/netsurf.git/commit/3b631f473b46ab226d247b3...
...tree http://git.netsurf-browser.org/netsurf.git/tree/3b631f473b46ab226d247b365...
The branch, master has been updated
via 3b631f473b46ab226d247b365a33187febec6c60 (commit)
from f67a1ab4cf3fc59bc9314623a6fbf41f7772d7bd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/3b631f473b46ab226d2...
commit 3b631f473b46ab226d247b365a33187febec6c60
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Avoid using HTML internal for form file input handling. Note: untested.
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index c3b9cf7..0f39603 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -45,9 +45,6 @@
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/tree_url_node.h"
-#include "render/box.h"
-#include "render/form.h"
-#include "render/html.h"
#include "utils/utf8.h"
#include "utils/messages.h"
#include "utils/utils.h"
@@ -124,6 +121,12 @@ enum {
CMID_LAST
};
+struct ami_file_input_menu_data {
+ int x;
+ int y;
+ struct browser_window bw;
+}
+
struct Library *PopupMenuBase = NULL;
struct PopupMenuIFace *IPopupMenu = NULL;
static char *ctxmenulab[CMID_LAST];
@@ -218,7 +221,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
* CMSUB_OBJECT - userdata = hlcache_object *
* CMSUB_SEL - userdata = browser_window *
* CMSUB_NAVIGATE - userdata = browser_window * (only for menu construction)
- * CMID_SELECTFILE - userdata = box *
+ * CMID_SELECTFILE - userdata = ami_file_input_menu_data *
*/
struct browser_window *bw = NULL;
@@ -582,7 +585,6 @@ BOOL ami_context_menu_mouse_trap(struct gui_window_2 *gwin, BOOL trap)
void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
{
struct hlcache_handle *cc = gwin->bw->current_content;
- struct box *curbox;
int box_x=0;
int box_y=0;
bool no_more_menus = false;
@@ -649,30 +651,6 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
}
else
{
- if(content_get_type(cc) == CONTENT_HTML)
- {
- curbox = html_get_box_tree(gwin->bw->current_content);
-
- while(curbox = box_at_point(curbox, x, y, &box_x, &box_y, &cc))
- {
- if (curbox->style &&
- css_computed_visibility(curbox->style) == CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (curbox->gadget)
- {
- switch (curbox->gadget->type)
- {
- case GADGET_FILE:
- ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, curbox);
- menuhascontent = true;
- no_more_menus = true;
- break;
- }
- }
- }
- }
-
if(no_more_menus == false)
{
browser_window_get_contextual_content(gwin->bw, x, y, &ccdata);
@@ -698,6 +676,17 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
menuhascontent = true;
}
+ if(ccdata.form_features == CTX_FORM_FILE)
+ {
+ struct ami_file_input_menu_data file_input = {
+ .x = x;
+ .y = y;
+ .bw = gwin->bw;
+ }
+ ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, &file_input);
+ menuhascontent = true;
+ }
+
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_NAVIGATE, gwin->bw);
menuhascontent = true;
@@ -741,7 +730,8 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
ASLFR_DoSaveMode,FALSE,
TAG_DONE))
{
- struct box *box = userdata;
+ struct ami_file_input_menu_data
+ *file_input = userdata;
char *utf8_fn;
char fname[1024];
int x,y;
@@ -755,15 +745,11 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
break;
}
- free(box->gadget->value);
- box->gadget->value = utf8_fn;
-
- box_coords(box, (int *)&x, (int *)&y);
- ami_do_redraw_limits(gwin->bw->window,
- gwin->bw->window->shared->bw,
- x,y,
- x + box->width,
- y + box->height);
+ browser_window_drop_file_at_point(
+ file_input->bw,
+ file_input->x,
+ file_input->y,
+ utf8_fn);
}
break;
-----------------------------------------------------------------------
Summary of changes:
amiga/context_menu.c | 64 +++++++++++++++++++------------------------------
1 files changed, 25 insertions(+), 39 deletions(-)
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index c3b9cf7..0f39603 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -45,9 +45,6 @@
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/tree_url_node.h"
-#include "render/box.h"
-#include "render/form.h"
-#include "render/html.h"
#include "utils/utf8.h"
#include "utils/messages.h"
#include "utils/utils.h"
@@ -124,6 +121,12 @@ enum {
CMID_LAST
};
+struct ami_file_input_menu_data {
+ int x;
+ int y;
+ struct browser_window bw;
+}
+
struct Library *PopupMenuBase = NULL;
struct PopupMenuIFace *IPopupMenu = NULL;
static char *ctxmenulab[CMID_LAST];
@@ -218,7 +221,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
* CMSUB_OBJECT - userdata = hlcache_object *
* CMSUB_SEL - userdata = browser_window *
* CMSUB_NAVIGATE - userdata = browser_window * (only for menu construction)
- * CMID_SELECTFILE - userdata = box *
+ * CMID_SELECTFILE - userdata = ami_file_input_menu_data *
*/
struct browser_window *bw = NULL;
@@ -582,7 +585,6 @@ BOOL ami_context_menu_mouse_trap(struct gui_window_2 *gwin, BOOL trap)
void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
{
struct hlcache_handle *cc = gwin->bw->current_content;
- struct box *curbox;
int box_x=0;
int box_y=0;
bool no_more_menus = false;
@@ -649,30 +651,6 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
}
else
{
- if(content_get_type(cc) == CONTENT_HTML)
- {
- curbox = html_get_box_tree(gwin->bw->current_content);
-
- while(curbox = box_at_point(curbox, x, y, &box_x, &box_y, &cc))
- {
- if (curbox->style &&
- css_computed_visibility(curbox->style) == CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (curbox->gadget)
- {
- switch (curbox->gadget->type)
- {
- case GADGET_FILE:
- ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, curbox);
- menuhascontent = true;
- no_more_menus = true;
- break;
- }
- }
- }
- }
-
if(no_more_menus == false)
{
browser_window_get_contextual_content(gwin->bw, x, y, &ccdata);
@@ -698,6 +676,17 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
menuhascontent = true;
}
+ if(ccdata.form_features == CTX_FORM_FILE)
+ {
+ struct ami_file_input_menu_data file_input = {
+ .x = x;
+ .y = y;
+ .bw = gwin->bw;
+ }
+ ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, &file_input);
+ menuhascontent = true;
+ }
+
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_NAVIGATE, gwin->bw);
menuhascontent = true;
@@ -741,7 +730,8 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
ASLFR_DoSaveMode,FALSE,
TAG_DONE))
{
- struct box *box = userdata;
+ struct ami_file_input_menu_data
+ *file_input = userdata;
char *utf8_fn;
char fname[1024];
int x,y;
@@ -755,15 +745,11 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
break;
}
- free(box->gadget->value);
- box->gadget->value = utf8_fn;
-
- box_coords(box, (int *)&x, (int *)&y);
- ami_do_redraw_limits(gwin->bw->window,
- gwin->bw->window->shared->bw,
- x,y,
- x + box->width,
- y + box->height);
+ browser_window_drop_file_at_point(
+ file_input->bw,
+ file_input->x,
+ file_input->y,
+ utf8_fn);
}
break;
--
NetSurf Browser
10 years, 7 months
netsurf: branch master updated. f67a1ab4cf3fc59bc9314623a6fbf41f7772d7bd
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/f67a1ab4cf3fc59bc9314...
...commit http://git.netsurf-browser.org/netsurf.git/commit/f67a1ab4cf3fc59bc931462...
...tree http://git.netsurf-browser.org/netsurf.git/tree/f67a1ab4cf3fc59bc9314623a...
The branch, master has been updated
via f67a1ab4cf3fc59bc9314623a6fbf41f7772d7bd (commit)
from 45736594a173d7a715b217a5236e33fb89c95436 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/f67a1ab4cf3fc59bc93...
commit f67a1ab4cf3fc59bc9314623a6fbf41f7772d7bd
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Avoid box_at_point.
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index 25b3c84..2230e00 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -32,11 +32,8 @@
#include "desktop/textinput.h"
#include "content/content.h"
#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "render/html.h"
+#include "content/urldb.h"
#include "css/css.h"
-#include "render/box.h"
-#include "render/form.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -68,12 +65,10 @@ struct s_context_info ctxinfo;
static struct s_context_info * get_context_info( struct gui_window * gw, short mx, short my )
{
- struct box *box;
hlcache_handle *h;
- int box_x, box_y;
LGRECT bwrect;
struct contextual_content ccdata;
- struct browser_window * bw = gw->browser->bw;
+ struct browser_window * bw = gw->browser->bw;
h = bw->current_content;
ctxinfo.flags = 0;
@@ -107,31 +102,8 @@ static struct s_context_info * get_context_info( struct gui_window * gw, short m
ctxinfo.flags |= CNT_IMG;
}
}
-
- box = html_get_box_tree(h);
- box_x = box->margin[LEFT];
- box_y = box->margin[TOP];
-
- while ((box = box_at_point(box, mx+gw->browser->scroll.current.x, my+gw->browser->scroll.current.y, &box_x, &box_y, &h)))
- {
- if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN)
- continue;
- if (box->gadget)
- {
- switch (box->gadget->type)
- {
- case GADGET_TEXTBOX:
- case GADGET_TEXTAREA:
- case GADGET_PASSWORD:
- // TODO: check if there is really an selection, but it
- // doesn't hurt for now...:
- ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
- break;
-
- default: break;
- }
- }
- }
+ if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT )
+ ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
return( &ctxinfo );
}
@@ -259,7 +231,7 @@ void context_popup( struct gui_window * gw, short x, short y )
case POP_CTX_VIEW_SOURCE:
editor = nsoption_charp(atari_editor);
if (editor != NULL && strlen(editor)>0) {
- data = content_get_source_data(gw->browser->bw->current_content,
+ data = content_get_source_data(gw->browser->bw->current_content,
&size);
if (size > 0 && data != NULL){
tempfile = tmpnam( NULL );
-----------------------------------------------------------------------
Summary of changes:
atari/ctxmenu.c | 38 +++++---------------------------------
1 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index 25b3c84..2230e00 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -32,11 +32,8 @@
#include "desktop/textinput.h"
#include "content/content.h"
#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "render/html.h"
+#include "content/urldb.h"
#include "css/css.h"
-#include "render/box.h"
-#include "render/form.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -68,12 +65,10 @@ struct s_context_info ctxinfo;
static struct s_context_info * get_context_info( struct gui_window * gw, short mx, short my )
{
- struct box *box;
hlcache_handle *h;
- int box_x, box_y;
LGRECT bwrect;
struct contextual_content ccdata;
- struct browser_window * bw = gw->browser->bw;
+ struct browser_window * bw = gw->browser->bw;
h = bw->current_content;
ctxinfo.flags = 0;
@@ -107,31 +102,8 @@ static struct s_context_info * get_context_info( struct gui_window * gw, short m
ctxinfo.flags |= CNT_IMG;
}
}
-
- box = html_get_box_tree(h);
- box_x = box->margin[LEFT];
- box_y = box->margin[TOP];
-
- while ((box = box_at_point(box, mx+gw->browser->scroll.current.x, my+gw->browser->scroll.current.y, &box_x, &box_y, &h)))
- {
- if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN)
- continue;
- if (box->gadget)
- {
- switch (box->gadget->type)
- {
- case GADGET_TEXTBOX:
- case GADGET_TEXTAREA:
- case GADGET_PASSWORD:
- // TODO: check if there is really an selection, but it
- // doesn't hurt for now...:
- ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
- break;
-
- default: break;
- }
- }
- }
+ if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT )
+ ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
return( &ctxinfo );
}
@@ -259,7 +231,7 @@ void context_popup( struct gui_window * gw, short x, short y )
case POP_CTX_VIEW_SOURCE:
editor = nsoption_charp(atari_editor);
if (editor != NULL && strlen(editor)>0) {
- data = content_get_source_data(gw->browser->bw->current_content,
+ data = content_get_source_data(gw->browser->bw->current_content,
&size);
if (size > 0 && data != NULL){
tempfile = tmpnam( NULL );
--
NetSurf Browser
10 years, 7 months
netsurf: branch master updated. 45736594a173d7a715b217a5236e33fb89c95436
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/45736594a173d7a715b21...
...commit http://git.netsurf-browser.org/netsurf.git/commit/45736594a173d7a715b217a...
...tree http://git.netsurf-browser.org/netsurf.git/tree/45736594a173d7a715b217a52...
The branch, master has been updated
via 45736594a173d7a715b217a5236e33fb89c95436 (commit)
via b1342796448c01515d8dcb4d992f804a5f2f4fb4 (commit)
from 74a9ec6de4e4180a1279633de6a4611e57ef2995 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/45736594a173d7a715b...
commit 45736594a173d7a715b217a5236e33fb89c95436
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Get presence of text input cleanly.
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index 8354830..8ecc4ef 100755
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -20,7 +20,6 @@
#include "desktop/plotters.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
-#include "render/box.h"
#include "utils/utf8.h"
#include "amiga/bitmap.h"
@@ -345,7 +344,6 @@ struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin)
void ami_drag_selection(struct selection *s)
{
- struct box *text_box;
int x;
int y;
char *utf8text;
@@ -362,7 +360,7 @@ void ami_drag_selection(struct selection *s)
x = gwin->win->MouseX;
y = gwin->win->MouseY;
- if(text_box = ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
+ if(ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
{
iffh = ami_clipboard_init_internal(1);
diff --git a/amiga/gui.c b/amiga/gui.c
index 8aef21a..bbbb3ba 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -30,9 +30,6 @@
#include "desktop/textinput.h"
#include "desktop/tree.h"
#include "image/ico.h"
-#include "render/box.h"
-#include "render/form.h"
-#include "render/html.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utf8.h"
@@ -4113,17 +4110,12 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
/* return the text box at posn x,y in window coordinates
x,y are updated to be document co-ordinates */
-struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
+bool *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
{
struct IBox *bbox;
ULONG xs,ys,width,height;
- struct box *box,*text_box=0;
- hlcache_handle *content;
int box_x=0,box_y=0;
-
- content = gwin->bw->current_content;
-
- if(content_get_type(content) != CONTENT_HTML) return NULL;
+ struct contextual_content data;
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
(ULONG *)&bbox);
@@ -4137,27 +4129,12 @@ struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
width=bbox->Width;
height=bbox->Height;
- box = html_get_box_tree(content);
- while ((box = box_at_point(box, *x, *y, &box_x, &box_y, &content)))
- {
- if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) continue;
+ browser_window_get_contextual_content(gwin->bw, x, y, &data);
- if (box->gadget)
- {
- switch (box->gadget->type)
- {
- case GADGET_TEXTBOX:
- case GADGET_TEXTAREA:
- case GADGET_PASSWORD:
- text_box = box;
- break;
+ if (data.form_features == CTX_FORM_TEXT)
+ return true;
- default:
- break;
- }
- }
- }
- return text_box;
+ return false;
}
BOOL ami_gadget_hit(Object *obj, int x, int y)
diff --git a/amiga/gui.h b/amiga/gui.h
index 013be50..498e270 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -143,7 +143,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw,
int x0, int y0, int x1, int y1);
STRPTR ami_locale_langs(void);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
-struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
+bool *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
BOOL ami_gadget_hit(Object *obj, int x, int y);
void ami_gui_history(struct gui_window_2 *gwin, bool back);
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/b1342796448c01515d8...
commit b1342796448c01515d8dcb4d992f804a5f2f4fb4
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Allow the presence of form inputs to be obtained without knowledge of html content internals.
diff --git a/desktop/browser.c b/desktop/browser.c
index a33bbff..42acc34 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -549,6 +549,7 @@ void browser_window_get_contextual_content(struct browser_window *bw,
data->link_url = NULL;
data->object = NULL;
data->main = NULL;
+ data->form_features = CTX_FORM_NONE;
browser_window__get_contextual_content(bw, x, y, data);
}
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 84c20ee..7973cc7 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -162,7 +162,8 @@ nsgtk_scaffolding *scaf_list = NULL;
/** holds the context data for what's under the pointer, when the contextual
* menu is opened. */
-static struct contextual_content current_menu_ctx = { NULL, NULL, NULL };
+static struct contextual_content current_menu_ctx = {
+ NULL, NULL, NULL, CTX_FORM_NONE };
/**
diff --git a/render/html.c b/render/html.c
index 17ca801..8d64fdf 100644
--- a/render/html.c
+++ b/render/html.c
@@ -2670,6 +2670,23 @@ html_get_contextual_content(struct content *c,
box->usemap, box_x, box_y, x, y,
&target));
}
+ if (box->gadget) {
+ switch (box->gadget->type) {
+ case GADGET_TEXTBOX:
+ case GADGET_TEXTAREA:
+ case GADGET_PASSWORD:
+ data->form_features = CTX_FORM_TEXT;
+ break;
+
+ case GADGET_FILE:
+ data->form_features = CTX_FORM_FILE;
+ break;
+
+ default:
+ data->form_features = CTX_FORM_NONE;
+ break;
+ }
+ }
}
}
diff --git a/utils/types.h b/utils/types.h
index 3500968..617b493 100644
--- a/utils/types.h
+++ b/utils/types.h
@@ -52,6 +52,11 @@ struct contextual_content {
const char *link_url;
struct hlcache_handle *object;
struct hlcache_handle *main;
+ enum {
+ CTX_FORM_NONE,
+ CTX_FORM_TEXT,
+ CTX_FORM_FILE
+ } form_features;
};
#endif
-----------------------------------------------------------------------
Summary of changes:
amiga/clipboard.c | 4 +---
amiga/gui.c | 35 ++++++-----------------------------
amiga/gui.h | 2 +-
desktop/browser.c | 1 +
gtk/scaffolding.c | 3 ++-
render/html.c | 17 +++++++++++++++++
utils/types.h | 5 +++++
7 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index 8354830..8ecc4ef 100755
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -20,7 +20,6 @@
#include "desktop/plotters.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
-#include "render/box.h"
#include "utils/utf8.h"
#include "amiga/bitmap.h"
@@ -345,7 +344,6 @@ struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin)
void ami_drag_selection(struct selection *s)
{
- struct box *text_box;
int x;
int y;
char *utf8text;
@@ -362,7 +360,7 @@ void ami_drag_selection(struct selection *s)
x = gwin->win->MouseX;
y = gwin->win->MouseY;
- if(text_box = ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
+ if(ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
{
iffh = ami_clipboard_init_internal(1);
diff --git a/amiga/gui.c b/amiga/gui.c
index 8aef21a..bbbb3ba 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -30,9 +30,6 @@
#include "desktop/textinput.h"
#include "desktop/tree.h"
#include "image/ico.h"
-#include "render/box.h"
-#include "render/form.h"
-#include "render/html.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utf8.h"
@@ -4113,17 +4110,12 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
/* return the text box at posn x,y in window coordinates
x,y are updated to be document co-ordinates */
-struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
+bool *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
{
struct IBox *bbox;
ULONG xs,ys,width,height;
- struct box *box,*text_box=0;
- hlcache_handle *content;
int box_x=0,box_y=0;
-
- content = gwin->bw->current_content;
-
- if(content_get_type(content) != CONTENT_HTML) return NULL;
+ struct contextual_content data;
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
(ULONG *)&bbox);
@@ -4137,27 +4129,12 @@ struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
width=bbox->Width;
height=bbox->Height;
- box = html_get_box_tree(content);
- while ((box = box_at_point(box, *x, *y, &box_x, &box_y, &content)))
- {
- if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) continue;
+ browser_window_get_contextual_content(gwin->bw, x, y, &data);
- if (box->gadget)
- {
- switch (box->gadget->type)
- {
- case GADGET_TEXTBOX:
- case GADGET_TEXTAREA:
- case GADGET_PASSWORD:
- text_box = box;
- break;
+ if (data.form_features == CTX_FORM_TEXT)
+ return true;
- default:
- break;
- }
- }
- }
- return text_box;
+ return false;
}
BOOL ami_gadget_hit(Object *obj, int x, int y)
diff --git a/amiga/gui.h b/amiga/gui.h
index 013be50..498e270 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -143,7 +143,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw,
int x0, int y0, int x1, int y1);
STRPTR ami_locale_langs(void);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
-struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
+bool *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
BOOL ami_gadget_hit(Object *obj, int x, int y);
void ami_gui_history(struct gui_window_2 *gwin, bool back);
diff --git a/desktop/browser.c b/desktop/browser.c
index a33bbff..42acc34 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -549,6 +549,7 @@ void browser_window_get_contextual_content(struct browser_window *bw,
data->link_url = NULL;
data->object = NULL;
data->main = NULL;
+ data->form_features = CTX_FORM_NONE;
browser_window__get_contextual_content(bw, x, y, data);
}
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 84c20ee..7973cc7 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -162,7 +162,8 @@ nsgtk_scaffolding *scaf_list = NULL;
/** holds the context data for what's under the pointer, when the contextual
* menu is opened. */
-static struct contextual_content current_menu_ctx = { NULL, NULL, NULL };
+static struct contextual_content current_menu_ctx = {
+ NULL, NULL, NULL, CTX_FORM_NONE };
/**
diff --git a/render/html.c b/render/html.c
index 17ca801..8d64fdf 100644
--- a/render/html.c
+++ b/render/html.c
@@ -2670,6 +2670,23 @@ html_get_contextual_content(struct content *c,
box->usemap, box_x, box_y, x, y,
&target));
}
+ if (box->gadget) {
+ switch (box->gadget->type) {
+ case GADGET_TEXTBOX:
+ case GADGET_TEXTAREA:
+ case GADGET_PASSWORD:
+ data->form_features = CTX_FORM_TEXT;
+ break;
+
+ case GADGET_FILE:
+ data->form_features = CTX_FORM_FILE;
+ break;
+
+ default:
+ data->form_features = CTX_FORM_NONE;
+ break;
+ }
+ }
}
}
diff --git a/utils/types.h b/utils/types.h
index 3500968..617b493 100644
--- a/utils/types.h
+++ b/utils/types.h
@@ -52,6 +52,11 @@ struct contextual_content {
const char *link_url;
struct hlcache_handle *object;
struct hlcache_handle *main;
+ enum {
+ CTX_FORM_NONE,
+ CTX_FORM_TEXT,
+ CTX_FORM_FILE
+ } form_features;
};
#endif
--
NetSurf Browser
10 years, 7 months