Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/3be2b98cc2d5c4e7c97a6caba86d1869893f25eb
...commit
http://git.netsurf-browser.org/netsurf.git/commit/3be2b98cc2d5c4e7c97a6caba86d1869893f25eb
...tree
http://git.netsurf-browser.org/netsurf.git/tree/3be2b98cc2d5c4e7c97a6caba86d1869893f25eb
The branch, master has been updated
via 3be2b98cc2d5c4e7c97a6caba86d1869893f25eb (commit)
from c88a55999a93f80462b01d25388172c67df0dc72 (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/commit/?id=3be2b98cc2d5c4e7c97a6caba86d1869893f25eb
commit 3be2b98cc2d5c4e7c97a6caba86d1869893f25eb
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
change browser_window_drop_file_at_point() to take unscaled coordinates
diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index 1bbb4c6..7280ff6 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -1925,11 +1925,11 @@ html_get_contextual_content(struct content *c, int x,
int y,
}
if (box->iframe) {
- browser_window_get_features(
- box->iframe,
- (x - box_x) *
browser_window_get_scale(box->iframe),
- (y - box_y) *
browser_window_get_scale(box->iframe),
- data);
+ float scale = browser_window_get_scale(box->iframe);
+ browser_window_get_features(box->iframe,
+ (x - box_x) * scale,
+ (y - box_y) * scale,
+ data);
}
if (box->object)
@@ -2004,13 +2004,15 @@ html_scroll_at_point(struct content *c, int x, int y,
int scrx, int scry)
continue;
/* Pass into iframe */
- if (box->iframe &&
- browser_window_scroll_at_point(
- box->iframe,
- (x - box_x) * browser_window_get_scale(box->iframe),
- (y - box_y) * browser_window_get_scale(box->iframe),
- scrx, scry) == true)
- return true;
+ if (box->iframe) {
+ float scale = browser_window_get_scale(box->iframe);
+
+ if (browser_window_scroll_at_point(box->iframe,
+ (x - box_x) * scale,
+ (y - box_y) * scale,
+ scrx, scry) == true)
+ return true;
+ }
/* Pass into textarea widget */
if (box->gadget && (box->gadget->type == GADGET_TEXTAREA ||
@@ -2146,15 +2148,21 @@ static bool html_drop_file_at_point(struct content *c,
int x, int y, char *file)
&box_x, &box_y)) != NULL) {
box = next;
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
+ if (box->style &&
+ css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)
continue;
- if (box->iframe)
- return browser_window_drop_file_at_point(box->iframe,
- x - box_x, y - box_y, file);
+ if (box->iframe) {
+ float scale = browser_window_get_scale(box->iframe);
+ return browser_window_drop_file_at_point(
+ box->iframe,
+ (x - box_x) * scale,
+ (y - box_y) * scale,
+ file);
+ }
- if (box->object && content_drop_file_at_point(box->object,
+ if (box->object &&
+ content_drop_file_at_point(box->object,
x - box_x, y - box_y, file) == true)
return true;
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index 9d8a5e3..f3b173f 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -1819,6 +1819,13 @@ browser_window_mouse_track_internal(struct
browser_window *bw,
}
+/**
+ * perform a scroll operation at a given coordinate
+ *
+ * \param bw The browsing context receiving the event
+ * \param x The scaled x co-ordinate of the event
+ * \param y The scaled y co-ordinate of the event
+ */
static bool
browser_window_scroll_at_point_internal(struct browser_window *bw,
int x, int y,
@@ -1876,6 +1883,60 @@ browser_window_scroll_at_point_internal(struct
browser_window *bw,
}
+/**
+ * allows a dragged file to be dropped into a browser window at a position
+ *
+ * \param bw The browsing context receiving the event
+ * \param x The scaled x co-ordinate of the event
+ * \param y The scaled y co-ordinate of the event
+ * \param file filename to be put in the widget
+ */
+static bool
+browser_window_drop_file_at_point_internal(struct browser_window *bw,
+ int x, int y,
+ char *file)
+{
+ assert(bw != NULL);
+
+ /* Handle (i)frame scroll offset (core-managed browser windows only) */
+ x += scrollbar_get_offset(bw->scroll_x);
+ y += scrollbar_get_offset(bw->scroll_y);
+
+ if (bw->children) {
+ /* Browser window has children, so pass request on to
+ * appropriate child */
+ struct browser_window *bwc;
+ int cur_child;
+ int children = bw->rows * bw->cols;
+
+ /* Loop through all children of bw */
+ for (cur_child = 0; cur_child < children; cur_child++) {
+ /* Set current child */
+ bwc = &bw->children[cur_child];
+
+ /* Skip this frame if (x, y) coord lies outside */
+ if (x < bwc->x || bwc->x + bwc->width < x ||
+ y < bwc->y || bwc->y + bwc->height < y)
+ continue;
+
+ /* Pass request into this child */
+ return browser_window_drop_file_at_point_internal(bwc,
+ (x - bwc->x),
+ (y - bwc->y),
+ file);
+ }
+ }
+
+ /* Pass file drop on to any content */
+ if (bw->current_content != NULL) {
+ return content_drop_file_at_point(bw->current_content,
+ x, y, file);
+ }
+
+ return false;
+}
+
+
/* exported interface, documented in netsurf/browser_window.h */
nserror
browser_window_get_name(struct browser_window *bw, const char **out_name)
@@ -2366,44 +2427,10 @@ browser_window_drop_file_at_point(struct browser_window
*bw,
int x, int y,
char *file)
{
- assert(bw != NULL);
-
- /* Handle (i)frame scroll offset (core-managed browser windows only) */
- x += scrollbar_get_offset(bw->scroll_x);
- y += scrollbar_get_offset(bw->scroll_y);
-
- if (bw->children) {
- /* Browser window has children, so pass request on to
- * appropriate child */
- struct browser_window *bwc;
- int cur_child;
- int children = bw->rows * bw->cols;
-
- /* Loop through all children of bw */
- for (cur_child = 0; cur_child < children; cur_child++) {
- /* Set current child */
- bwc = &bw->children[cur_child];
-
- /* Skip this frame if (x, y) coord lies outside */
- if (x < bwc->x || bwc->x + bwc->width < x ||
- y < bwc->y || bwc->y + bwc->height < y)
- continue;
-
- /* Pass request into this child */
- return browser_window_drop_file_at_point(bwc,
- (x - bwc->x),
- (y - bwc->y),
- file);
- }
- }
-
- /* Pass file drop on to any content */
- if (bw->current_content != NULL) {
- return content_drop_file_at_point(bw->current_content,
- x, y, file);
- }
-
- return false;
+ return browser_window_drop_file_at_point_internal(bw,
+ x / bw->scale,
+ y / bw->scale,
+ file);
}
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 5a46529..ab46f28 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -4365,7 +4365,7 @@ bool ro_gui_window_dataload(struct gui_window *g,
wimp_message *message)
message->data.data_xfer.pos.y, &pos))
return false;
- if (browser_window_drop_file_at_point(g->bw, pos.x/g->scale,
pos.y/g->scale,
+ if (browser_window_drop_file_at_point(g->bw, pos.x, pos.y,
message->data.data_xfer.file_name) == false)
return false;
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/html.c | 44 ++++++++++--------
desktop/browser_window.c | 103 ++++++++++++++++++++++++++----------------
frontends/riscos/window.c | 2 +-
3 files changed, 92 insertions(+), 57 deletions(-)
diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index 1bbb4c6..7280ff6 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -1925,11 +1925,11 @@ html_get_contextual_content(struct content *c, int x,
int y,
}
if (box->iframe) {
- browser_window_get_features(
- box->iframe,
- (x - box_x) *
browser_window_get_scale(box->iframe),
- (y - box_y) *
browser_window_get_scale(box->iframe),
- data);
+ float scale = browser_window_get_scale(box->iframe);
+ browser_window_get_features(box->iframe,
+ (x - box_x) * scale,
+ (y - box_y) * scale,
+ data);
}
if (box->object)
@@ -2004,13 +2004,15 @@ html_scroll_at_point(struct content *c, int x, int y,
int scrx, int scry)
continue;
/* Pass into iframe */
- if (box->iframe &&
- browser_window_scroll_at_point(
- box->iframe,
- (x - box_x) * browser_window_get_scale(box->iframe),
- (y - box_y) * browser_window_get_scale(box->iframe),
- scrx, scry) == true)
- return true;
+ if (box->iframe) {
+ float scale = browser_window_get_scale(box->iframe);
+
+ if (browser_window_scroll_at_point(box->iframe,
+ (x - box_x) * scale,
+ (y - box_y) * scale,
+ scrx, scry) == true)
+ return true;
+ }
/* Pass into textarea widget */
if (box->gadget && (box->gadget->type == GADGET_TEXTAREA ||
@@ -2146,15 +2148,21 @@ static bool html_drop_file_at_point(struct content *c,
int x, int y, char *file)
&box_x, &box_y)) != NULL) {
box = next;
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
+ if (box->style &&
+ css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)
continue;
- if (box->iframe)
- return browser_window_drop_file_at_point(box->iframe,
- x - box_x, y - box_y, file);
+ if (box->iframe) {
+ float scale = browser_window_get_scale(box->iframe);
+ return browser_window_drop_file_at_point(
+ box->iframe,
+ (x - box_x) * scale,
+ (y - box_y) * scale,
+ file);
+ }
- if (box->object && content_drop_file_at_point(box->object,
+ if (box->object &&
+ content_drop_file_at_point(box->object,
x - box_x, y - box_y, file) == true)
return true;
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index 9d8a5e3..f3b173f 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -1819,6 +1819,13 @@ browser_window_mouse_track_internal(struct
browser_window *bw,
}
+/**
+ * perform a scroll operation at a given coordinate
+ *
+ * \param bw The browsing context receiving the event
+ * \param x The scaled x co-ordinate of the event
+ * \param y The scaled y co-ordinate of the event
+ */
static bool
browser_window_scroll_at_point_internal(struct browser_window *bw,
int x, int y,
@@ -1876,6 +1883,60 @@ browser_window_scroll_at_point_internal(struct
browser_window *bw,
}
+/**
+ * allows a dragged file to be dropped into a browser window at a position
+ *
+ * \param bw The browsing context receiving the event
+ * \param x The scaled x co-ordinate of the event
+ * \param y The scaled y co-ordinate of the event
+ * \param file filename to be put in the widget
+ */
+static bool
+browser_window_drop_file_at_point_internal(struct browser_window *bw,
+ int x, int y,
+ char *file)
+{
+ assert(bw != NULL);
+
+ /* Handle (i)frame scroll offset (core-managed browser windows only) */
+ x += scrollbar_get_offset(bw->scroll_x);
+ y += scrollbar_get_offset(bw->scroll_y);
+
+ if (bw->children) {
+ /* Browser window has children, so pass request on to
+ * appropriate child */
+ struct browser_window *bwc;
+ int cur_child;
+ int children = bw->rows * bw->cols;
+
+ /* Loop through all children of bw */
+ for (cur_child = 0; cur_child < children; cur_child++) {
+ /* Set current child */
+ bwc = &bw->children[cur_child];
+
+ /* Skip this frame if (x, y) coord lies outside */
+ if (x < bwc->x || bwc->x + bwc->width < x ||
+ y < bwc->y || bwc->y + bwc->height < y)
+ continue;
+
+ /* Pass request into this child */
+ return browser_window_drop_file_at_point_internal(bwc,
+ (x - bwc->x),
+ (y - bwc->y),
+ file);
+ }
+ }
+
+ /* Pass file drop on to any content */
+ if (bw->current_content != NULL) {
+ return content_drop_file_at_point(bw->current_content,
+ x, y, file);
+ }
+
+ return false;
+}
+
+
/* exported interface, documented in netsurf/browser_window.h */
nserror
browser_window_get_name(struct browser_window *bw, const char **out_name)
@@ -2366,44 +2427,10 @@ browser_window_drop_file_at_point(struct browser_window
*bw,
int x, int y,
char *file)
{
- assert(bw != NULL);
-
- /* Handle (i)frame scroll offset (core-managed browser windows only) */
- x += scrollbar_get_offset(bw->scroll_x);
- y += scrollbar_get_offset(bw->scroll_y);
-
- if (bw->children) {
- /* Browser window has children, so pass request on to
- * appropriate child */
- struct browser_window *bwc;
- int cur_child;
- int children = bw->rows * bw->cols;
-
- /* Loop through all children of bw */
- for (cur_child = 0; cur_child < children; cur_child++) {
- /* Set current child */
- bwc = &bw->children[cur_child];
-
- /* Skip this frame if (x, y) coord lies outside */
- if (x < bwc->x || bwc->x + bwc->width < x ||
- y < bwc->y || bwc->y + bwc->height < y)
- continue;
-
- /* Pass request into this child */
- return browser_window_drop_file_at_point(bwc,
- (x - bwc->x),
- (y - bwc->y),
- file);
- }
- }
-
- /* Pass file drop on to any content */
- if (bw->current_content != NULL) {
- return content_drop_file_at_point(bw->current_content,
- x, y, file);
- }
-
- return false;
+ return browser_window_drop_file_at_point_internal(bw,
+ x / bw->scale,
+ y / bw->scale,
+ file);
}
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 5a46529..ab46f28 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -4365,7 +4365,7 @@ bool ro_gui_window_dataload(struct gui_window *g,
wimp_message *message)
message->data.data_xfer.pos.y, &pos))
return false;
- if (browser_window_drop_file_at_point(g->bw, pos.x/g->scale,
pos.y/g->scale,
+ if (browser_window_drop_file_at_point(g->bw, pos.x, pos.y,
message->data.data_xfer.file_name) == false)
return false;
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org