Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/3b631f473b46ab226d247b365a33187febec6c60
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/3b631f473b46ab226d247b365a33187febec6c60
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/3b631f473b46ab226d247b365a33187febec6c60

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/3b631f473b46ab226d247b365a33187febec6c60
commit 3b631f473b46ab226d247b365a33187febec6c60
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    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

_______________________________________________
netsurf-commits mailing list
[email protected]
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to