From b1ca83ad8c68f18194d47c06bdcb410064ca8c25 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 12:14:44 +0000 Subject: implement firstElementChild --- javascript/jsapi/htmlelement.bnd | 51 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 18e343f68..3b533ebef 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -20,7 +20,7 @@ hdrcomment " http://www.opensource.org/licenses/mit-license"; preamble %{ #include - + #include "utils/config.h" #include "utils/log.h" @@ -35,16 +35,57 @@ binding htmlelement { interface HTMLElement; /* Web IDL interface to generate */ private "dom_element *" node; - private "struct html_content *" htmlc; + private "struct html_content *" htmlc; } api finalise %{ - if (private != NULL) { - dom_node_unref(private->node); - } + if (private != NULL) { + dom_node_unref(private->node); + } %} +/* interface Element in dom idl */ + +/* + * DOM 3 has these as the element traversal extension + * + * http://dev.w3.org/2006/webapi/ElementTraversal/publish/ElementTraversal.html + */ + getter firstElementChild %{ + dom_node *element; + dom_exception exc; + dom_node_type node_type; + dom_node *next_node; + + exc = dom_node_get_first_child(private->node, &element); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + while (element != NULL) { + exc = dom_node_get_node_type(element, &node_type); + if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { + /* found it */ + jsret = jsapi_new_HTMLElement(cx, + NULL, + NULL, + (dom_element *)element, + private->htmlc); + break; + } + + exc = dom_node_get_next_sibling(element, &next_node); + dom_node_unref(element); + if (exc == DOM_NO_ERR) { + element = next_node; + } else { + element = NULL; + } + + } + + %} getter lastElementChild %{ -- cgit v1.2.3 From bec871152864b1cfb42484505a6622f7f524a405 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 12:38:07 +0000 Subject: implement lastElementChild --- javascript/jsapi/htmlelement.bnd | 31 ++++++++++++++++++++++++++++++ test/js/doc-dom1.html | 11 ----------- test/js/dom-element-firstElementChild.html | 11 +++++++++++ test/js/dom-element-lastElementChild.html | 11 +++++++++++ test/js/index.html | 3 ++- 5 files changed, 55 insertions(+), 12 deletions(-) delete mode 100644 test/js/doc-dom1.html create mode 100644 test/js/dom-element-firstElementChild.html create mode 100644 test/js/dom-element-lastElementChild.html diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 3b533ebef..898f78188 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -89,6 +89,37 @@ getter firstElementChild %{ %} getter lastElementChild %{ + dom_node *element; + dom_exception exc; + dom_node_type node_type; + dom_node *sib_node; + + exc = dom_node_get_last_child(private->node, &element); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + while (element != NULL) { + exc = dom_node_get_node_type(element, &node_type); + if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { + /* found it */ + jsret = jsapi_new_HTMLElement(cx, + NULL, + NULL, + (dom_element *)element, + private->htmlc); + break; + } + + exc = dom_node_get_previous_sibling(element, &sib_node); + dom_node_unref(element); + if (exc == DOM_NO_ERR) { + element = sib_node; + } else { + element = NULL; + } + + } %} getter previousElementSibling %{ diff --git a/test/js/doc-dom1.html b/test/js/doc-dom1.html deleted file mode 100644 index 2d7762d00..000000000 --- a/test/js/doc-dom1.html +++ /dev/null @@ -1,11 +0,0 @@ - - -DOM firstElementChild reference - - - -

DOM firstElementChild reference

-

head.firstElementChild:

-

body.firstElementChild:

- - diff --git a/test/js/dom-element-firstElementChild.html b/test/js/dom-element-firstElementChild.html new file mode 100644 index 000000000..2d7762d00 --- /dev/null +++ b/test/js/dom-element-firstElementChild.html @@ -0,0 +1,11 @@ + + +DOM firstElementChild reference + + + +

DOM firstElementChild reference

+

head.firstElementChild:

+

body.firstElementChild:

+ + diff --git a/test/js/dom-element-lastElementChild.html b/test/js/dom-element-lastElementChild.html new file mode 100644 index 000000000..e4e9f11cb --- /dev/null +++ b/test/js/dom-element-lastElementChild.html @@ -0,0 +1,11 @@ + + + +DOM lastElementChild reference + + +

DOM lastElementChild reference

+

head.lastElementChild:

+

body.lastElementChild:

+ + diff --git a/test/js/index.html b/test/js/index.html index f02c4df32..70e4088cf 100644 --- a/test/js/index.html +++ b/test/js/index.html @@ -24,7 +24,8 @@

DOM tests

Reference method tests

    -
  • firstElementChild
  • +
  • firstElementChild
  • +
  • lastElementChild
  • getElementById
  • getElementsByTagName
  • -- cgit v1.2.3 From 99d3633e0348fcff3f99d87696b57a70cbdcaf4d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 12:59:10 +0000 Subject: implement previousElementSibling and nextElementSibling --- javascript/jsapi/htmlelement.bnd | 64 ++++++++++++++++++++++- test/js/dom-element-next_prev_ElementSibling.html | 14 +++++ test/js/index.html | 1 + 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 test/js/dom-element-next_prev_ElementSibling.html diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 898f78188..0730ad44b 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -123,7 +123,67 @@ getter lastElementChild %{ %} getter previousElementSibling %{ - %} + dom_node *element; + dom_exception exc; + dom_node_type node_type; + dom_node *sib_node; + + exc = dom_node_get_previous_sibling(private->node, &element); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + while (element != NULL) { + exc = dom_node_get_node_type(element, &node_type); + if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { + /* found it */ + jsret = jsapi_new_HTMLElement(cx, + NULL, + NULL, + (dom_element *)element, + private->htmlc); + break; + } + + exc = dom_node_get_previous_sibling(element, &sib_node); + dom_node_unref(element); + if (exc == DOM_NO_ERR) { + element = sib_node; + } else { + element = NULL; + } + } +%} getter nextElementSibling %{ - %} + dom_node *element; + dom_exception exc; + dom_node_type node_type; + dom_node *sib_node; + + exc = dom_node_get_next_sibling(private->node, &element); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + while (element != NULL) { + exc = dom_node_get_node_type(element, &node_type); + if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { + /* found it */ + jsret = jsapi_new_HTMLElement(cx, + NULL, + NULL, + (dom_element *)element, + private->htmlc); + break; + } + + exc = dom_node_get_next_sibling(element, &sib_node); + dom_node_unref(element); + if (exc == DOM_NO_ERR) { + element = sib_node; + } else { + element = NULL; + } + } +%} diff --git a/test/js/dom-element-next_prev_ElementSibling.html b/test/js/dom-element-next_prev_ElementSibling.html new file mode 100644 index 000000000..85263cc17 --- /dev/null +++ b/test/js/dom-element-next_prev_ElementSibling.html @@ -0,0 +1,14 @@ + + +DOM previousElementSibling and nextElementSibling reference + + + + +

    DOM previousElementSibling and nextElementSibling reference

    + +

    head.lastElementChild.previousElementSibling:

    + +

    body.firstElementChild.nextElementSibling:

    + + diff --git a/test/js/index.html b/test/js/index.html index 70e4088cf..5341a7482 100644 --- a/test/js/index.html +++ b/test/js/index.html @@ -26,6 +26,7 @@
    • firstElementChild
    • lastElementChild
    • +
    • previousElementSibling nextElementSibling
    • getElementById
    • getElementsByTagName
    • -- cgit v1.2.3 From fa9046fc97cb73329652c86d3c77376d32935333 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 17:35:52 +0000 Subject: implement childElementCount --- javascript/jsapi/htmlelement.bnd | 27 +++++++++++++++++++++++++++ test/js/dom-element-childElementCount.html | 11 +++++++++++ test/js/index.html | 1 + 3 files changed, 39 insertions(+) create mode 100644 test/js/dom-element-childElementCount.html diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 0730ad44b..71bb31bc1 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -187,3 +187,30 @@ getter nextElementSibling %{ } } %} + +getter childElementCount %{ + dom_node *element; + dom_exception exc; + dom_node_type node_type; + dom_node *next_node; + + exc = dom_node_get_first_child(private->node, &element); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + while (element != NULL) { + exc = dom_node_get_node_type(element, &node_type); + if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { + jsret += 1; + } + + exc = dom_node_get_next_sibling(element, &next_node); + dom_node_unref(element); + if (exc == DOM_NO_ERR) { + element = next_node; + } else { + element = NULL; + } + } +%} diff --git a/test/js/dom-element-childElementCount.html b/test/js/dom-element-childElementCount.html new file mode 100644 index 000000000..ec4b7f89a --- /dev/null +++ b/test/js/dom-element-childElementCount.html @@ -0,0 +1,11 @@ + + + +DOM childElementCount reference + + +

      DOM childElementCount reference

      +

      head.childElementCount:

      +

      body.childElementCount:

      + + diff --git a/test/js/index.html b/test/js/index.html index 5341a7482..c59b54157 100644 --- a/test/js/index.html +++ b/test/js/index.html @@ -27,6 +27,7 @@
    • firstElementChild
    • lastElementChild
    • previousElementSibling nextElementSibling
    • +
    • childElementCount
    • getElementById
    • getElementsByTagName
    • -- cgit v1.2.3 From ba867955a2fc4be2e17cade11dbd0a1be86ad26e Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 21:12:49 +0000 Subject: add nodeType --- javascript/jsapi/dom.bnd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/javascript/jsapi/dom.bnd b/javascript/jsapi/dom.bnd index 3a355256f..e11e07131 100644 --- a/javascript/jsapi/dom.bnd +++ b/javascript/jsapi/dom.bnd @@ -4,6 +4,17 @@ webidlfile "dom.idl"; /* interface Node members */ +getter nodeType %{ + dom_exception exc; + dom_node_type node_type; + + exc = dom_node_get_node_type(private->node, &node_type); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + jsret = node_type; + +%} getter textContent %{ dom_exception exc; -- cgit v1.2.3 From 8810bc01635996fc6afa33a84ffb004aca6095e3 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 21:24:29 +0000 Subject: add nodeName implementation --- javascript/jsapi/dom.bnd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/javascript/jsapi/dom.bnd b/javascript/jsapi/dom.bnd index e11e07131..8020e7a8f 100644 --- a/javascript/jsapi/dom.bnd +++ b/javascript/jsapi/dom.bnd @@ -16,6 +16,23 @@ getter nodeType %{ %} + +getter nodeName %{ + dom_exception exc; + dom_string *name; + + exc = dom_node_get_node_name(private->node, &name); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + if (name != NULL) { + jsret = JS_NewStringCopyN(cx, dom_string_data(name), dom_string_length(name)); + dom_string_unref(name); + + } +%} + getter textContent %{ dom_exception exc; dom_string *content; -- cgit v1.2.3 From 4769698d13ca82c535896d7b168ee956709b12a8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 21:49:25 +0000 Subject: add enumeration test on the document node --- test/js/dom-document-enumerate.html | 26 ++++++++++++++++++++++++++ test/js/index.html | 1 + 2 files changed, 27 insertions(+) create mode 100644 test/js/dom-document-enumerate.html diff --git a/test/js/dom-document-enumerate.html b/test/js/dom-document-enumerate.html new file mode 100644 index 000000000..18146ab8a --- /dev/null +++ b/test/js/dom-document-enumerate.html @@ -0,0 +1,26 @@ + + +document interface enumeration + + + +

      Document interface enumeration

      + + + + diff --git a/test/js/index.html b/test/js/index.html index c59b54157..75008701b 100644 --- a/test/js/index.html +++ b/test/js/index.html @@ -36,6 +36,7 @@

      Document element specific

        -- cgit v1.2.3 From 6797e1f8ef51e7e22020797b68f07e0c295091ff Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 18 Nov 2012 21:50:11 +0000 Subject: add nodeValue implementation --- javascript/jsapi/dom.bnd | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/javascript/jsapi/dom.bnd b/javascript/jsapi/dom.bnd index 8020e7a8f..89d0d8449 100644 --- a/javascript/jsapi/dom.bnd +++ b/javascript/jsapi/dom.bnd @@ -13,7 +13,6 @@ getter nodeType %{ return JS_FALSE; } jsret = node_type; - %} @@ -27,9 +26,27 @@ getter nodeName %{ } if (name != NULL) { - jsret = JS_NewStringCopyN(cx, dom_string_data(name), dom_string_length(name)); + jsret = JS_NewStringCopyN(cx, + dom_string_data(name), + dom_string_length(name)); dom_string_unref(name); + } +%} + +getter nodeValue %{ + dom_exception exc; + dom_string *value; + + exc = dom_node_get_node_value(private->node, &value); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + if (value != NULL) { + jsret = JS_NewStringCopyN(cx, + dom_string_data(value), + dom_string_length(value)); + dom_string_unref(value); } %} -- cgit v1.2.3 From 47c0ce6f14417da5c169e3a79a4396c7d2d5eea5 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sun, 18 Nov 2012 23:15:21 +0100 Subject: Revert "Added missing Makefile changes for recent deskmenu commit." This reverts commit c5fb16d56df03580d99fae44d9fea44868f33cc5. This change belongs into a new branch --- atari/Makefile.target | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atari/Makefile.target b/atari/Makefile.target index f7e1a6301..ad908075b 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -81,7 +81,7 @@ S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \ redrawslots.c encoding.c \ browser_win.c toolbar.c statusbar.c browser.c \ global_evnt.c osspec.c dragdrop.c system_colour.c \ - ctxmenu.c settings.c msgbox.c deskmenu.c + ctxmenu.c settings.c msgbox.c S_ATARI := $(addprefix atari/,$(S_ATARI)) # This is the final source build list -- cgit v1.2.3 From e042008f2b7295243d2e6c72f948febe3cad0516 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sun, 18 Nov 2012 23:15:48 +0100 Subject: Revert "Refactored menu event handling and got rid of several windom calls." This reverts commit d1a5c738e62a9f0cb85658b435eefa8749006edc. this change belongs into a new branch --- atari/deskmenu.c | 660 ---------------------------------------------------- atari/deskmenu.h | 12 - atari/global_evnt.c | 534 ++++++++++++++++++++++++++++++++++++++++-- atari/global_evnt.h | 23 +- atari/gui.c | 47 ++-- atari/misc.c | 3 +- atari/settings.c | 5 +- 7 files changed, 563 insertions(+), 721 deletions(-) delete mode 100644 atari/deskmenu.c delete mode 100644 atari/deskmenu.h diff --git a/atari/deskmenu.c b/atari/deskmenu.c deleted file mode 100644 index 38e35391c..000000000 --- a/atari/deskmenu.c +++ /dev/null @@ -1,660 +0,0 @@ -#include -#include - -#include "utils/log.h" -#include "utils/messages.h" -#include "utils/url.h" -#include "desktop/browser.h" -#include "desktop/browser_private.h" -#include "desktop/options.h" -#include "desktop/save_complete.h" - -#include "atari/res/netsurf.rsh" -#include "atari/deskmenu.h" -#include "atari/hotlist.h" -#include "atari/history.h" -#include "atari/toolbar.h" -#include "atari/settings.h" -#include "atari/search.h" -#include "atari/misc.h" -#include "atari/gui.h" -#include "atari/findfile.h" -#include "atari/browser.h" -#include "atari/browser_win.h" - -typedef void __CDECL (*menu_evnt_func)(short item, short title, void * data); - -struct s_accelerator -{ - char ascii; /* either ascii or */ - long keycode; /* normalised keycode is valid */ - short mod; /* shift / ctrl etc */ -}; - -struct s_menu_item_evnt { - short title; /* to which menu this item belongs */ - short rid; /* resource ID */ - menu_evnt_func menu_func; /* click handler */ - struct s_accelerator accel; /* accelerator info */ - char * menustr; -}; - -static void register_menu_str(struct s_menu_item_evnt * mi); -static void __CDECL evnt_menu(WINDOW * win, short buff[8]); - -extern void *h_gem_rsrc; -extern bool html_redraw_debug; -extern struct gui_window * input_window; -extern char options[PATH_MAX]; -extern const char * option_homepage_url; -extern int option_window_width; -extern int option_window_height; -extern int option_window_x; -extern int option_window_y; - -static OBJECT * h_gem_menu; - - -/* Zero based resource tree ids: */ -#define T_ABOUT 0 -#define T_FILE MAINMENU_T_FILE - MAINMENU_T_FILE + 1 -#define T_EDIT MAINMENU_T_EDIT - MAINMENU_T_FILE + 1 -#define T_VIEW MAINMENU_T_VIEW - MAINMENU_T_FILE + 1 -#define T_NAV MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1 -#define T_UTIL MAINMENU_T_UTIL - MAINMENU_T_FILE + 1 -#define T_HELP MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1 -/* Count of the above defines: */ -#define NUM_MENU_TITLES 7 - - -static void __CDECL menu_about(short item, short title, void *data); -static void __CDECL menu_new_win(short item, short title, void *data); -static void __CDECL menu_open_url(short item, short title, void *data); -static void __CDECL menu_open_file(short item, short title, void *data); -static void __CDECL menu_close_win(short item, short title, void *data); -static void __CDECL menu_save_page(short item, short title, void *data); -static void __CDECL menu_quit(short item, short title, void *data); -static void __CDECL menu_cut(short item, short title, void *data); -static void __CDECL menu_copy(short item, short title, void *data); -static void __CDECL menu_paste(short item, short title, void *data); -static void __CDECL menu_find(short item, short title, void *data); -static void __CDECL menu_choices(short item, short title, void *data); -static void __CDECL menu_stop(short item, short title, void *data); -static void __CDECL menu_reload(short item, short title, void *data); -static void __CDECL menu_toolbars(short item, short title, void *data); -static void __CDECL menu_savewin(short item, short title, void *data); -static void __CDECL menu_debug_render(short item, short title, void *data); -static void __CDECL menu_fg_images(short item, short title, void *data); -static void __CDECL menu_bg_images(short item, short title, void *data); -static void __CDECL menu_back(short item, short title, void *data); -static void __CDECL menu_forward(short item, short title, void *data); -static void __CDECL menu_home(short item, short title, void *data); -static void __CDECL menu_lhistory(short item, short title, void *data); -static void __CDECL menu_ghistory(short item, short title, void *data); -static void __CDECL menu_add_bookmark(short item, short title, void *data); -static void __CDECL menu_bookmarks(short item, short title, void *data); -static void __CDECL menu_vlog(short item, short title, void *data); -static void __CDECL menu_help_content(short item, short title, void *data); - -struct s_menu_item_evnt menu_evnt_tbl[] = -{ - {T_ABOUT,MAINMENU_M_ABOUT, menu_about, {0,0,0}, NULL }, - {T_FILE, MAINMENU_M_NEWWIN, menu_new_win, {0,0,0}, NULL}, - {T_FILE, MAINMENU_M_OPENURL, menu_open_url, {'G',0,K_CTRL}, NULL}, - {T_FILE, MAINMENU_M_OPENFILE, menu_open_file, {'O',0,K_CTRL}, NULL}, - {T_FILE, MAINMENU_M_CLOSEWIN, menu_close_win, {0,0,0}, NULL}, - {T_FILE, MAINMENU_M_SAVEPAGE, menu_save_page, {0,NK_F3,0}, NULL}, - {T_FILE, MAINMENU_M_QUIT, menu_quit, {'Q',0,K_CTRL}, NULL}, - {T_EDIT, MAINMENU_M_CUT, menu_cut, {'X',0,K_CTRL}, NULL}, - {T_EDIT, MAINMENU_M_COPY, menu_copy, {'C',0,K_CTRL}, NULL}, - {T_EDIT, MAINMENU_M_PASTE, menu_paste, {'V',0,K_CTRL}, NULL}, - {T_EDIT, MAINMENU_M_FIND, menu_find, {0,NK_F4,0}, NULL}, - {T_VIEW, MAINMENU_M_RELOAD, menu_reload, {0,NK_F5,0}, NULL}, - {T_VIEW, MAINMENU_M_TOOLBARS, menu_toolbars, {0,NK_F1,K_CTRL}, NULL}, - {T_VIEW, MAINMENU_M_SAVEWIN, menu_savewin, {0,0,0}, NULL}, - {T_VIEW, MAINMENU_M_DEBUG_RENDER, menu_debug_render, {0,0,0}, NULL}, - {T_VIEW, MAINMENU_M_FG_IMAGES, menu_fg_images, {0,0,0}, NULL}, - {T_VIEW, MAINMENU_M_BG_IMAGES, menu_bg_images, {0,0,0}, NULL}, - {T_VIEW, MAINMENU_M_STOP, menu_stop, {0,NK_ESC,K_ALT}, NULL}, - {T_NAV, MAINMENU_M_BACK, menu_back, {0,NK_LEFT,K_ALT}, NULL}, - {T_NAV, MAINMENU_M_FORWARD, menu_forward, {0,NK_RIGHT,K_ALT}, NULL}, - {T_NAV, MAINMENU_M_HOME, menu_home, {0,NK_CLRHOME,0}, NULL}, - {T_UTIL, MAINMENU_M_LHISTORY,menu_lhistory, {0,NK_F7,0}, NULL}, - {T_UTIL, MAINMENU_M_GHISTORY, menu_ghistory, {0,NK_F7,K_CTRL}, NULL}, - {T_UTIL, MAINMENU_M_ADD_BOOKMARK, menu_add_bookmark, {'D',0,K_CTRL}, NULL}, - {T_UTIL, MAINMENU_M_BOOKMARKS, menu_bookmarks, {0,NK_F6,0}, NULL}, - {T_UTIL, MAINMENU_M_CHOICES, menu_choices, {0,0,0}, NULL}, - {T_UTIL, MAINMENU_M_VLOG, menu_vlog, {'V',0,K_ALT}, NULL}, - {T_HELP, MAINMENU_M_HELP_CONTENT, menu_help_content, {0,NK_F1,0}, NULL}, - {-1, -1, NULL,{0,0,0}, NULL } -}; - - -/* - Parse encoded menu key shortcut - - The format is: - - "[" - marks start of the shortcut - "@,^,<" - If the keyshortcut is only valid - with modifier keys, one of these characters must directly - follow the start mark. - Meaning: - @ -> Alternate - ^ -> Control - "#" - keycode or ascii character. - The value is handled as keycode if the character value - is <= 28 ( Atari chracter table ) - or if it is interpreted as function key string. - (strings: F1 - F10) - -*/ -static void register_menu_str( struct s_menu_item_evnt * mi ) -{ - OBJECT *gem_menu = deskmenu_get_obj_tree(); - - assert(gem_menu != NULL); - - char * str = ObjcString( gem_menu, mi->rid, NULL ); - int l = strlen(str); - int i = l; - int x = -1; - struct s_accelerator * accel = &mi->accel; - - while (i > 2) { - if( str[i] == '['){ - x = i; - break; - } - i--; - } - if( x > -1 ){ - mi->menustr = malloc( l+1 ); - strcpy(mi->menustr, str ); - mi->menustr[x]=' '; - x++; - if( str[x] == '@' ){ - accel->mod = K_ALT; - mi->menustr[x] = 0x07; - x++; - } - else if( str[x] == '^' ) { - accel->mod = K_CTRL; - x++; - } - if( str[x] <= 28 ){ - // parse symbol - unsigned short keycode=0; - switch( str[x] ){ - case 0x03: - accel->keycode = NK_RIGHT; - break; - case 0x04: - accel->keycode = NK_LEFT; - break; - case 0x1B: - accel->keycode = NK_ESC; - break; - default: - break; - } - } else { - if(str[x] == 'F' && ( str[x+1] >= '1' && str[x+1] <= '9') ){ - // parse function key - short fkey = atoi( &str[x+1] ); - if( (fkey >= 0) && (fkey <= 10) ){ - accel->keycode = NK_F1 - 1 + fkey; - } - } else { - accel->ascii = str[x]; - } - } - } -} - -static void __CDECL evnt_menu(WINDOW * win, short buff[8]) -{ - int title = buff[3]; - INT16 x,y; - char *str; - struct gui_window * gw = window_list; - int i=0; - - deskmenu_dispatch_item(buff[3], buff[4]); -} - -/* - Menu item event handlers: -*/ - -static void __CDECL menu_about(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - char buf[PATH_MAX]; - strcpy((char*)&buf, "file://"); - strncat((char*)&buf, (char*)"./doc/README.TXT", - PATH_MAX - (strlen("file://")+1) ); - browser_window_create((char*)&buf, 0, 0, true, false); -} - -static void __CDECL menu_new_win(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - browser_window_create(option_homepage_url, 0, 0, true, false); -} - -static void __CDECL menu_open_url(short item, short title, void *data) -{ - struct gui_window * gw; - struct browser_window * bw ; - LOG(("%s", __FUNCTION__)); - - gw = input_window; - if( gw == NULL ) { - bw = browser_window_create("", 0, 0, true, false); - gw = bw->window; - - } - /* Loose focus: */ - window_set_focus( gw, WIDGET_NONE, NULL ); - - /* trigger on-focus event (select all text): */ - window_set_focus( gw, URL_WIDGET, &gw->root->toolbar->url ); - - /* delete selection: */ - tb_url_input( gw, NK_DEL ); -} - -static void __CDECL menu_open_file(short item, short title, void *data) -{ - struct gui_window * gw; - struct browser_window * bw ; - - LOG(("%s", __FUNCTION__)); - - const char * filename = file_select( messages_get("OpenFile"), "" ); - if( filename != NULL ){ - char * url = local_file_to_url( filename ); - if( url ){ - bw = browser_window_create(url, NULL, NULL, true, false); - free( url ); - } - } -} - -static void __CDECL menu_close_win(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window == NULL ) - return; - gui_window_destroy( input_window ); -} - -static void __CDECL menu_save_page(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - static bool init = true; - bool is_folder=false; - const char * path; - - if( !input_window ) - return; - - if( init ){ - init = false; - save_complete_init(); - } - - do { - // TODO: localize string - path = file_select("Select folder", ""); - if (path) - is_folder = is_dir(path); - } while( !is_folder && path != NULL ); - - if( path != NULL ){ - save_complete( input_window->browser->bw->current_content, path, NULL ); - } - -} - -static void __CDECL menu_quit(short item, short title, void *data) -{ - short buff[8]; - memset( &buff, 0, sizeof(short)*8 ); - LOG(("%s", __FUNCTION__)); - netsurf_quit = true; -} - -static void __CDECL menu_cut(short item, short title, void *data) -{ - if( input_window != NULL ) - browser_window_key_press( input_window->browser->bw, KEY_CUT_SELECTION); -} - -static void __CDECL menu_copy(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window != NULL ) - browser_window_key_press( input_window->browser->bw, KEY_COPY_SELECTION); -} - -static void __CDECL menu_paste(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window != NULL ) - browser_window_key_press( input_window->browser->bw, KEY_PASTE); -} - -static void __CDECL menu_find(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window != NULL ) - open_browser_search( input_window ); -} - -static void __CDECL menu_choices(short item, short title, void *data) -{ - static WINDOW * settings_dlg = NULL; - LOG(("%s", __FUNCTION__)); - settings_dlg = open_settings(); -} - -static void __CDECL menu_stop(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window == NULL ) - return; - tb_stop_click( input_window ); - -} - -static void __CDECL menu_reload(short item, short title, void *data) -{ - if( input_window == NULL) - return; - tb_reload_click( input_window ); - LOG(("%s", __FUNCTION__)); -} - -static void __CDECL menu_toolbars(short item, short title, void *data) -{ - static int state = 0; - LOG(("%s", __FUNCTION__)); - if( input_window != null && input_window->root->toolbar != null ){ - state = !state; - tb_hide( input_window, state ); - } -} - -static void __CDECL menu_savewin(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if (input_window && input_window->browser) { - GRECT rect; - wind_get_grect(input_window->root->handle->handle, WF_CURRXYWH, &rect); - option_window_width = rect.g_w; - option_window_height = rect.g_h; - option_window_x = rect.g_x; - option_window_y = rect.g_y; - nsoption_set_int(window_width, rect.g_w); - nsoption_set_int(window_height, rect.g_h); - nsoption_set_int(window_x, rect.g_x); - nsoption_set_int(window_y, rect.g_y); - nsoption_write((const char*)&options); - } - -} - -static void __CDECL menu_debug_render(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - html_redraw_debug = !html_redraw_debug; - if( input_window != NULL ) { - if ( input_window->browser != NULL - && input_window->browser->bw != NULL) { - LGRECT rect; - browser_get_rect( input_window, BR_CONTENT, &rect ); - browser_window_reformat(input_window->browser->bw, false, - rect.g_w, rect.g_h ); - MenuIcheck(NULL, MAINMENU_M_DEBUG_RENDER, - (html_redraw_debug) ? 1 : 0 ); - } - } -} - -static void __CDECL menu_fg_images(short item, short title, void *data) -{ - nsoption_set_bool(foreground_images, !nsoption_bool(foreground_images)); - MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, - (nsoption_bool(foreground_images)) ? 1 : 0); -} - -static void __CDECL menu_bg_images(short item, short title, void *data) -{ - nsoption_set_bool(background_images, !nsoption_bool(background_images)); - MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, - (nsoption_bool(background_images)) ? 1 : 0); -} - -static void __CDECL menu_back(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window == NULL ) - return; - tb_back_click( input_window ); -} - -static void __CDECL menu_forward(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window == NULL ) - return; - tb_forward_click( input_window ); -} - -static void __CDECL menu_home(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window == NULL ) - return; - tb_home_click( input_window ); -} - -static void __CDECL menu_lhistory(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if( input_window == NULL ) - return; -} - -static void __CDECL menu_ghistory(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - global_history_open(); -} - -static void __CDECL menu_add_bookmark(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - if (input_window) { - if( input_window->browser->bw->current_content != NULL ){ - atari_hotlist_add_page( - nsurl_access(hlcache_handle_get_url(input_window->browser->bw->current_content)), - NULL - ); - } - } -} - -static void __CDECL menu_bookmarks(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - hotlist_open(); -} - -static void __CDECL menu_vlog(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); - verbose_log = !verbose_log; - MenuIcheck(NULL, MAINMENU_M_VLOG, (verbose_log) ? 1 : 0 ); -} - -static void __CDECL menu_help_content(short item, short title, void *data) -{ - LOG(("%s", __FUNCTION__)); -} - -/* - Public deskmenu interface: -*/ - - -/** -* Setup & display an desktop menu. -*/ - -void deskmenu_init(void) -{ - int i; - - h_gem_menu = get_tree(MAINMENU); - - // TODO: remove that call somehow... - - /* parse and update menu items: */ - i = 0; - while( menu_evnt_tbl[i].rid != -1 ) { - char * str = ObjcString(h_gem_menu, menu_evnt_tbl[i].rid, NULL ); - register_menu_str( &menu_evnt_tbl[i] ); - /* Update menu string if not null: */ - if( menu_evnt_tbl[i].menustr != NULL ){ - menu_text(h_gem_menu, menu_evnt_tbl[i].rid, - menu_evnt_tbl[i].menustr); - } - i++; - } - deskmenu_update(); - - menu_bar(h_gem_menu, 100); - menu_bar(h_gem_menu, 1); - - // TODO: remove windom dependency. - EvntAttach(NULL, MN_SELECTED, evnt_menu); -} - -/** -* Uninstall the desktop menu -*/ -void deskmenu_destroy(void) -{ - int i; - - /* Remove menu from desktop: */ - menu_bar(h_gem_menu, 0); - - /* Free modified menu titles: */ - i=0; - while(menu_evnt_tbl[i].rid != -1) { - if( menu_evnt_tbl[i].menustr != NULL ) - free(menu_evnt_tbl[i].menustr); - i++; - } -} - -/** -* Return the deskmenu AES OBJECT tree -*/ -OBJECT * deskmenu_get_obj_tree(void) -{ - return(h_gem_menu); -} - -/** -* Handle an menu item event -*/ -int deskmenu_dispatch_item(short title, short item) -{ - int i=0; - int retval = 0; - OBJECT * menu_root = deskmenu_get_obj_tree(); - - menu_tnormal(menu_root, item, 1); - menu_tnormal(menu_root, title, 1); - menu_bar(menu_root, 1); - - // legacy code, is this sensible?: - /* - while( gw ) { - window_set_focus( gw, WIDGET_NONE, NULL ); - gw = gw->next; - } - */ - - - while (menu_evnt_tbl[i].rid != -1) { - if (menu_evnt_tbl[i].rid == item) { - if (menu_evnt_tbl[i].menu_func != NULL) { - menu_evnt_tbl[i].menu_func(item, title, NULL); - } - break; - } - i++; - } - - return(retval); -} - -/** -* Handle an keypress (check for accelerator) -*/ -int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short kstate, - unsigned short nkc) -{ - char sascii; - bool done = 0; - int i = 0; - - sascii = keybd2ascii(kcode, K_LSHIFT); - - /* Iterate through the menu function table: */ - while( menu_evnt_tbl[i].rid != -1 && done == false) { - if( kstate == menu_evnt_tbl[i].accel.mod - && menu_evnt_tbl[i].accel.ascii != 0) { - if( menu_evnt_tbl[i].accel.ascii == sascii) { - deskmenu_dispatch_item(menu_evnt_tbl[i].title, - menu_evnt_tbl[i].rid); - done = true; - break; - } - } else { - /* the accel code hides in the keycode: */ - if( menu_evnt_tbl[i].accel.keycode != 0) { - if( menu_evnt_tbl[i].accel.keycode == (nkc & 0xFF) && - kstate == menu_evnt_tbl[i].accel.mod) { - deskmenu_dispatch_item(menu_evnt_tbl[i].title, - menu_evnt_tbl[i].rid); - done = true; - break; - } - } - } - i++; - } - return((done==true) ? 1 : 0); -} - -/** -* Refresh the desk menu, reflecting netsurf current state. -*/ -void deskmenu_update(void) -{ - OBJECT * gem_menu = deskmenu_get_obj_tree(); - - menu_icheck(gem_menu, MAINMENU_M_DEBUG_RENDER, (html_redraw_debug) ? 1 : 0); - menu_icheck(gem_menu, MAINMENU_M_FG_IMAGES, - (nsoption_bool(foreground_images)) ? 1 : 0); - menu_icheck(gem_menu, MAINMENU_M_BG_IMAGES, - (nsoption_bool(background_images)) ? 1 : 0); -} - diff --git a/atari/deskmenu.h b/atari/deskmenu.h deleted file mode 100644 index 6ab00dcc9..000000000 --- a/atari/deskmenu.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef DESKMENU_H_INCLUDED -#define DESKMENU_H_INCLUDED - -void deskmenu_init(void); -void deskmenu_destroy(void); -int deskmenu_dispatch_item(short title, short item); -int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short kstate, - unsigned short nkc); -OBJECT * deskmenu_get_obj_tree(void); -void deskmenu_update( void ); - -#endif // DESKMENU_H_INCLUDED diff --git a/atari/global_evnt.c b/atari/global_evnt.c index e3a93a0e6..3b15af877 100755 --- a/atari/global_evnt.c +++ b/atari/global_evnt.c @@ -26,31 +26,379 @@ #include #include "desktop/gui.h" +#include "desktop/netsurf.h" +#include "desktop/browser.h" +#include "desktop/browser_private.h" +#include "desktop/mouse.h" +#include "desktop/textinput.h" +#include "desktop/hotlist.h" +#include "desktop/save_complete.h" +#include "desktop/options.h" #include "utils/log.h" +#include "utils/messages.h" +#include "utils/url.h" -#include "atari/misc.h" #include "atari/gui.h" #include "atari/browser_win.h" #include "atari/toolbar.h" #include "atari/browser.h" +#include "atari/hotlist.h" +#include "atari/history.h" +#include "atari/misc.h" #include "atari/global_evnt.h" +#include "atari/browser_win.h" #include "atari/res/netsurf.rsh" -#include "atari/deskmenu.h" +#include "atari/search.h" +#include "atari/findfile.h" +#include "atari/settings.h" #include "cflib.h" extern struct gui_window *input_window; +extern OBJECT * h_gem_menu; extern int mouse_click_time[3]; extern int mouse_hold_start[3]; extern browser_mouse_state bmstate; extern short last_drag_x; extern short last_drag_y; +extern bool html_redraw_debug; + +extern const char * option_homepage_url; +extern int option_window_width; +extern int option_window_height; +extern int option_window_x; +extern int option_window_y; +extern char options[PATH_MAX]; + +/* Zero based resource tree ids: */ +#define T_ABOUT 0 +#define T_FILE MAINMENU_T_FILE - MAINMENU_T_FILE + 1 +#define T_EDIT MAINMENU_T_EDIT - MAINMENU_T_FILE + 1 +#define T_VIEW MAINMENU_T_VIEW - MAINMENU_T_FILE + 1 +#define T_NAV MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1 +#define T_UTIL MAINMENU_T_UTIL - MAINMENU_T_FILE + 1 +#define T_HELP MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1 +/* Count of the above defines: */ +#define NUM_MENU_TITLES 7 /* Global event handlers: */ static void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] ); +static void __CDECL global_evnt_menu( WINDOW * win, short buff[8] ); static void __CDECL global_evnt_m1( WINDOW * win, short buff[8] ); static void __CDECL global_evnt_keybd( WINDOW * win, short buff[8],void * data); -void __CDECL global_evnt_apterm(WINDOW * win, short buff[8]) +/* Menu event handlers: */ +static void __CDECL menu_about(WINDOW *win, int item, int title, void *data); + + +/* Menu event handlers: */ +static void __CDECL menu_about(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + char buf[PATH_MAX]; + strcpy((char*)&buf, "file://"); + strncat((char*)&buf, (char*)"./doc/README.TXT", PATH_MAX - (strlen("file://")+1) ); + browser_window_create((char*)&buf, 0, 0, true, false); +} + +static void __CDECL menu_new_win(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + browser_window_create(option_homepage_url, 0, 0, true, false); +} + +static void __CDECL menu_open_url(WINDOW *win, int item, int title, void *data) +{ + struct gui_window * gw; + struct browser_window * bw ; + LOG(("%s", __FUNCTION__)); + + gw = input_window; + if( gw == NULL ) { + bw = browser_window_create("", 0, 0, true, false); + gw = bw->window; + + } + /* Loose focus: */ + window_set_focus( gw, WIDGET_NONE, NULL ); + + /* trigger on-focus event (select all text): */ + window_set_focus( gw, URL_WIDGET, &gw->root->toolbar->url ); + + /* delete selection: */ + tb_url_input( gw, NK_DEL ); +} + +static void __CDECL menu_open_file(WINDOW *win, int item, int title, void *data) +{ + struct gui_window * gw; + struct browser_window * bw ; + + LOG(("%s", __FUNCTION__)); + + const char * filename = file_select( messages_get("OpenFile"), "" ); + if( filename != NULL ){ + char * url = local_file_to_url( filename ); + if( url ){ + bw = browser_window_create(url, NULL, NULL, true, false); + free( url ); + } + } +} + +static void __CDECL menu_close_win(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window == NULL ) + return; + gui_window_destroy( input_window ); +} + +static void __CDECL menu_save_page(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + static bool init = true; + bool is_folder=false; + const char * path; + + if( !input_window ) + return; + + if( init ){ + init = false; + save_complete_init(); + } + + do { + // TODO: localize string + path = file_select("Select folder", ""); + if (path) + is_folder = is_dir(path); + } while( !is_folder && path != NULL ); + + if( path != NULL ){ + save_complete( input_window->browser->bw->current_content, path, NULL ); + } + +} + +static void __CDECL menu_quit(WINDOW *win, int item, int title, void *data) +{ + short buff[8]; + memset( &buff, 0, sizeof(short)*8 ); + LOG(("%s", __FUNCTION__)); + global_evnt_apterm( NULL, buff ); +} + +static void __CDECL menu_cut(WINDOW *win, int item, int title, void *data) +{ + if( input_window != NULL ) + browser_window_key_press( input_window->browser->bw, KEY_CUT_SELECTION); +} + +static void __CDECL menu_copy(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window != NULL ) + browser_window_key_press( input_window->browser->bw, KEY_COPY_SELECTION); +} + +static void __CDECL menu_paste(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window != NULL ) + browser_window_key_press( input_window->browser->bw, KEY_PASTE); +} + +static void __CDECL menu_find(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window != NULL ) + open_browser_search( input_window ); +} + +static void __CDECL menu_choices(WINDOW *win, int item, int title, void *data) +{ + static WINDOW * settings_dlg = NULL; + LOG(("%s", __FUNCTION__)); + settings_dlg = open_settings(); +} + +static void __CDECL menu_stop(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window == NULL ) + return; + tb_stop_click( input_window ); + +} + +static void __CDECL menu_reload(WINDOW *win, int item, int title, void *data) +{ + if( input_window == NULL) + return; + tb_reload_click( input_window ); + LOG(("%s", __FUNCTION__)); +} + +static void __CDECL menu_toolbars(WINDOW *win, int item, int title, void *data) +{ + static int state = 0; + LOG(("%s", __FUNCTION__)); + if( input_window != null && input_window->root->toolbar != null ){ + state = !state; + tb_hide( input_window, state ); + } +} + +static void __CDECL menu_savewin(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if (input_window && input_window->browser) { + GRECT rect; + wind_get_grect(input_window->root->handle->handle, WF_CURRXYWH, &rect); + option_window_width = rect.g_w; + option_window_height = rect.g_h; + option_window_x = rect.g_x; + option_window_y = rect.g_y; + nsoption_set_int(window_width, rect.g_w); + nsoption_set_int(window_height, rect.g_h); + nsoption_set_int(window_x, rect.g_x); + nsoption_set_int(window_y, rect.g_y); + nsoption_write((const char*)&options); + } + +} + +static void __CDECL menu_debug_render(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + html_redraw_debug = !html_redraw_debug; + if( input_window != NULL ) { + if ( input_window->browser != NULL && input_window->browser->bw != NULL) { + LGRECT rect; + browser_get_rect( input_window, BR_CONTENT, &rect ); + browser_window_reformat(input_window->browser->bw, false, + rect.g_w, rect.g_h ); + MenuIcheck(NULL, MAINMENU_M_DEBUG_RENDER, + (html_redraw_debug) ? 1 : 0 ); + } + } +} + +static void __CDECL menu_fg_images(WINDOW *win, int item, int title, void *data) +{ + nsoption_set_bool(foreground_images, !nsoption_bool(foreground_images)); + MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (nsoption_bool(foreground_images)) ? 1 : 0); +} + +static void __CDECL menu_bg_images(WINDOW *win, int item, int title, void *data) +{ + nsoption_set_bool(background_images, !nsoption_bool(background_images)); + MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (nsoption_bool(background_images)) ? 1 : 0); +} + +static void __CDECL menu_back(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window == NULL ) + return; + tb_back_click( input_window ); +} + +static void __CDECL menu_forward(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window == NULL ) + return; + tb_forward_click( input_window ); +} + +static void __CDECL menu_home(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window == NULL ) + return; + tb_home_click( input_window ); +} + +static void __CDECL menu_lhistory(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window == NULL ) + return; +} + +static void __CDECL menu_ghistory(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + global_history_open(); +} + +static void __CDECL menu_add_bookmark(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + if( input_window ) { + if( input_window->browser->bw->current_content != NULL ){ + atari_hotlist_add_page( + nsurl_access(hlcache_handle_get_url( input_window->browser->bw->current_content)), + NULL + ); + } + } +} + +static void __CDECL menu_bookmarks(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + hotlist_open(); +} + +static void __CDECL menu_vlog(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); + verbose_log = !verbose_log; + MenuIcheck(NULL, MAINMENU_M_VLOG, (verbose_log) ? 1 : 0 ); +} + +static void __CDECL menu_help_content(WINDOW *win, int item, int title, void *data) +{ + LOG(("%s", __FUNCTION__)); +} + +static struct s_menu_item_evnt menu_evnt_tbl[] = +{ + {T_ABOUT,MAINMENU_M_ABOUT, menu_about, {0,0,0}, NULL }, + {T_FILE, MAINMENU_M_NEWWIN, menu_new_win, {0,0,0}, NULL}, + {T_FILE, MAINMENU_M_OPENURL, menu_open_url, {'G',0,K_CTRL}, NULL}, + {T_FILE, MAINMENU_M_OPENFILE, menu_open_file, {'O',0,K_CTRL}, NULL}, + {T_FILE, MAINMENU_M_CLOSEWIN, menu_close_win, {0,0,0}, NULL}, + {T_FILE, MAINMENU_M_SAVEPAGE, menu_save_page, {0,NK_F3,0}, NULL}, + {T_FILE, MAINMENU_M_QUIT, menu_quit, {'Q',0,K_CTRL}, NULL}, + {T_EDIT, MAINMENU_M_CUT, menu_cut, {'X',0,K_CTRL}, NULL}, + {T_EDIT, MAINMENU_M_COPY, menu_copy, {'C',0,K_CTRL}, NULL}, + {T_EDIT, MAINMENU_M_PASTE, menu_paste, {'V',0,K_CTRL}, NULL}, + {T_EDIT, MAINMENU_M_FIND, menu_find, {0,NK_F4,0}, NULL}, + {T_VIEW, MAINMENU_M_RELOAD, menu_reload, {0,NK_F5,0}, NULL}, + {T_VIEW, MAINMENU_M_TOOLBARS, menu_toolbars, {0,NK_F1,K_CTRL}, NULL}, + {T_VIEW, MAINMENU_M_SAVEWIN, menu_savewin, {0,0,0}, NULL}, + {T_VIEW, MAINMENU_M_DEBUG_RENDER, menu_debug_render, {0,0,0}, NULL}, + {T_VIEW, MAINMENU_M_FG_IMAGES, menu_fg_images, {0,0,0}, NULL}, + {T_VIEW, MAINMENU_M_BG_IMAGES, menu_bg_images, {0,0,0}, NULL}, + {T_VIEW, MAINMENU_M_STOP, menu_stop, {0,NK_ESC,K_ALT}, NULL}, + {T_NAV, MAINMENU_M_BACK, menu_back, {0,NK_LEFT,K_ALT}, NULL}, + {T_NAV, MAINMENU_M_FORWARD, menu_forward, {0,NK_RIGHT,K_ALT}, NULL}, + {T_NAV, MAINMENU_M_HOME, menu_home, {0,NK_CLRHOME,0}, NULL}, + {T_UTIL, MAINMENU_M_LHISTORY,menu_lhistory, {0,NK_F7,0}, NULL}, + {T_UTIL, MAINMENU_M_GHISTORY, menu_ghistory, {0,NK_F7,K_CTRL}, NULL}, + {T_UTIL, MAINMENU_M_ADD_BOOKMARK, menu_add_bookmark, {'D',0,K_CTRL}, NULL}, + {T_UTIL, MAINMENU_M_BOOKMARKS, menu_bookmarks, {0,NK_F6,0}, NULL}, + {T_UTIL, MAINMENU_M_CHOICES, menu_choices, {0,0,0}, NULL}, + {T_UTIL, MAINMENU_M_VLOG, menu_vlog, {'V',0,K_ALT}, NULL}, + {T_HELP, MAINMENU_M_HELP_CONTENT, menu_help_content, {0,NK_F1,0}, NULL}, + {T_HELP, -1, NULL,{0,0,0}, NULL } +}; + +void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] ) { int i = 0; LOG(("")); @@ -58,7 +406,7 @@ void __CDECL global_evnt_apterm(WINDOW * win, short buff[8]) } -static void __CDECL global_evnt_m1(WINDOW * win, short buff[8]) +static void __CDECL global_evnt_m1( WINDOW * win, short buff[8] ) { struct gui_window * gw = input_window; static bool prev_url = false; @@ -68,23 +416,23 @@ static void __CDECL global_evnt_m1(WINDOW * win, short buff[8]) LGRECT urlbox, bwbox, sbbox; int nx, ny; - if (gw == NULL) + if( gw == NULL) return; - if (prev_x == evnt.mx && prev_y == evnt.my) { + if( prev_x == evnt.mx && prev_y == evnt.my ){ return; } short ghandle = wind_find( evnt.mx, evnt.my ); - if (input_window->root->handle->handle == ghandle) { + if( input_window->root->handle->handle == ghandle ){ // The window found at x,y is an gui_window // and it's the input window. browser_get_rect( gw, BR_CONTENT, &bwbox ); - if (evnt.mx > bwbox.g_x && evnt.mx < bwbox.g_x + bwbox.g_w && - evnt.my > bwbox.g_y && evnt.my < bwbox.g_y + bwbox.g_h) { + if( evnt.mx > bwbox.g_x && evnt.mx < bwbox.g_x + bwbox.g_w && + evnt.my > bwbox.g_y && evnt.my < bwbox.g_y + bwbox.g_h ){ within = true; browser_window_mouse_track( input_window->browser->bw, @@ -94,7 +442,7 @@ static void __CDECL global_evnt_m1(WINDOW * win, short buff[8]) ); } - if (gw->root->toolbar && within == false) { + if( gw->root->toolbar && within == false ) { mt_CompGetLGrect(&app, gw->root->toolbar->url.comp, WF_WORKXYWH, &urlbox); if( (evnt.mx > urlbox.g_x && evnt.mx < urlbox.g_x + urlbox.g_w ) && (evnt.my > urlbox.g_y && evnt.my < + urlbox.g_y + urlbox.g_h )) { @@ -118,6 +466,7 @@ static void __CDECL global_evnt_m1(WINDOW * win, short buff[8]) void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data) { + char sascii; long kstate = 0; long kcode = 0; unsigned short nkc = 0; @@ -151,23 +500,178 @@ void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data) gw_tmp = gw_tmp->next; } } - } - if(!done) - deskmenu_dispatch_keypress(evnt.keybd, kstate, nkc); + } + sascii = keybd2ascii( evnt.keybd, K_LSHIFT); + while( menu_evnt_tbl[i].rid != -1 && done == false) { + if( kstate == menu_evnt_tbl[i].accel.mod && menu_evnt_tbl[i].accel.ascii != 0) { + if( menu_evnt_tbl[i].accel.ascii == sascii) { + menu_evnt_tbl[i].menu_func( NULL, menu_evnt_tbl[i].rid, MAINMENU, buff); + done = true; + break; + } + } else { + /* the accel code hides in the keycode: */ + if( menu_evnt_tbl[i].accel.keycode != 0) { + if( menu_evnt_tbl[i].accel.keycode == (nkc & 0xFF) && + kstate == menu_evnt_tbl[i].accel.mod && + menu_evnt_tbl[i].menu_func != NULL) { + menu_evnt_tbl[i].menu_func( NULL, + menu_evnt_tbl[i].rid, + MAINMENU, buff + ); + done = true; + break; + } + } + } + i++; + } } +/* + Parse encoded menu key shortcut + + The format is: + + "[" - marks start of the shortcut + "@,^,<" - If the keyshortcut is only valid + with modifier keys, one of these characters must directly + follow the start mark. + Meaning: + @ -> Alternate + ^ -> Control + "#" - keycode or ascii character. + The value is handled as keycode if the character value + is <= 28 ( Atari chracter table ) + or if it is interpreted as function key string. + (strings: F1 - F10) + +*/ +static void register_menu_str( struct s_menu_item_evnt * mi ) +{ + char * str = ObjcString( h_gem_menu, mi->rid, NULL ); + int l = strlen(str); + int i = l; + int x = -1; + struct s_accelerator * accel = &mi->accel; + + + + while( i>2 ){ + if( str[i] == '['){ + x = i; + break; + } + i--; + } + if( x > -1 ){ + mi->menustr = malloc( l+1 ); + strcpy(mi->menustr, str ); + mi->menustr[x]=' '; + x++; + if( str[x] == '@' ){ + accel->mod = K_ALT; + mi->menustr[x] = 0x07; + x++; + } + else if( str[x] == '^' ) { + accel->mod = K_CTRL; + x++; + } + if( str[x] <= 28 ){ + // parse symbol + unsigned short keycode=0; + switch( str[x] ){ + case 0x03: + accel->keycode = NK_RIGHT; + break; + case 0x04: + accel->keycode = NK_LEFT; + break; + case 0x1B: + accel->keycode = NK_ESC; + break; + default: + break; + } + } else { + if(str[x] == 'F' && ( str[x+1] >= '1' && str[x+1] <= '9') ){ + // parse function key + short fkey = atoi( &str[x+1] ); + if( (fkey >= 0) && (fkey <= 10) ){ + accel->keycode = NK_F1 - 1 + fkey; + } + } else { + accel->ascii = str[x]; + } + } + } +} + + +void __CDECL global_evnt_menu( WINDOW * win, short buff[8] ) +{ + int title = buff[ 3]; + INT16 x,y; + char *str; + struct gui_window * gw = window_list; + int i=0; + MenuTnormal( NULL, title, 1); + while( gw ) { + window_set_focus( gw, WIDGET_NONE, NULL ); + gw = gw->next; + } + while( menu_evnt_tbl[i].rid != -1) { + if( menu_evnt_tbl[i].rid == buff[4] ) { + menu_evnt_tbl[i].menu_func(win, (int)buff[4], (int)buff[3], NULL ); + break; + } + i++; + } +} + +void main_menu_update( void ) +{ + MenuIcheck( NULL, MAINMENU_M_DEBUG_RENDER, (html_redraw_debug) ? 1 : 0); + MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (nsoption_bool(foreground_images)) ? 1 : 0); + MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (nsoption_bool(background_images)) ? 1 : 0); +} + /* Bind global and menu events to event handler functions, create accelerators */ void bind_global_events( void ) { + int i, len; + int maxlen[NUM_MENU_TITLES]={0}; + char * m, *u, *t; + char spare[128]; memset( (void*)&evnt_data, 0, sizeof(struct s_evnt_data) ); EvntDataAttach( NULL, WM_XKEYBD, global_evnt_keybd, (void*)&evnt_data ); - EvntAttach( NULL, AP_TERM, global_evnt_apterm ); + EvntAttach( NULL, AP_TERM, global_evnt_apterm ); + EvntAttach( NULL, MN_SELECTED, global_evnt_menu ); EvntAttach( NULL, WM_XM1, global_evnt_m1 ); + + /* parse and update menu items: */ + i = 0; + while( menu_evnt_tbl[i].rid != -1 ) { + char * str = ObjcString( h_gem_menu, menu_evnt_tbl[i].rid, NULL ); + register_menu_str( &menu_evnt_tbl[i] ); + if( menu_evnt_tbl[i].menustr != NULL ){ + MenuText( NULL, menu_evnt_tbl[i].rid, menu_evnt_tbl[i].menustr ); + } + i++; + } + main_menu_update(); } void unbind_global_events( void ) { - + int i; + i=0; + while(menu_evnt_tbl[i].rid != -1) { + if( menu_evnt_tbl[i].menustr != NULL ) + free(menu_evnt_tbl[i].menustr); + i++; + } } diff --git a/atari/global_evnt.h b/atari/global_evnt.h index 76e73fc6b..1e13264a2 100755 --- a/atari/global_evnt.h +++ b/atari/global_evnt.h @@ -18,8 +18,6 @@ #ifndef NS_ATARI_GLOBAL_EVNT_H #define NS_ATARI_GLOBAL_EVNT_H - -#include struct s_keybd_evnt_data { @@ -34,14 +32,31 @@ struct s_evnt_data } u; }; -struct s_evnt_data evnt_data; +struct s_evnt_data evnt_data; + +struct s_accelerator +{ + char ascii; /* either ascii or */ + long keycode; /* normalised keycode is valid */ + short mod; /* shift / ctrl etc */ +}; + +typedef void __CDECL (*menu_evnt_func)(WINDOW * win, int item, int title, void * data); +struct s_menu_item_evnt { + short title; /* to which menu this item belongs */ + short rid; /* resource ID */ + menu_evnt_func menu_func; /* click handler */ + struct s_accelerator accel; /* accelerator info */ + char * menustr; +}; /* - Global event handlers + Global & Menu event handlers */ void bind_global_events( void ); void unbind_global_events( void ); +void main_menu_update( void ); #endif diff --git a/atari/gui.c b/atari/gui.c index fdcb75275..c2158e05e 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -73,8 +73,7 @@ #include "atari/plot/plot.h" #include "atari/clipboard.h" #include "atari/osspec.h" -#include "atari/search.h" -#include "atari/deskmenu.h" +#include "atari/search.h" #include "cflib.h" #define TODO() (0)/*printf("%s Unimplemented!\n", __FUNCTION__)*/ @@ -83,8 +82,9 @@ char *tmp_clipboard; struct gui_window *input_window = NULL; struct gui_window *window_list = NULL; void * h_gem_rsrc; -//OBJECT **rsc_trindex; -//short rsc_ntree; +OBJECT * h_gem_menu; +OBJECT **rsc_trindex; +short rsc_ntree; long next_poll; bool rendering = false; @@ -789,8 +789,6 @@ void gui_quit(void) struct gui_window * gw = window_list; struct gui_window * tmp = window_list; - - unbind_global_events(); while( gw ) { tmp = gw->next; @@ -804,8 +802,10 @@ void gui_quit(void) urldb_save_cookies(nsoption_charp(cookie_file)); urldb_save(nsoption_charp(url_file)); - - deskmenu_destroy(); + + RsrcXtype( 0, rsc_trindex, rsc_ntree); + unbind_global_events(); + MenuBar( h_gem_menu , 0 ); if( h_gem_rsrc != NULL ) { RsrcXfree(h_gem_rsrc ); } @@ -885,8 +885,7 @@ process_cmdline(int argc, char** argv) return true; } -static inline void create_cursor(int flags, short mode, void * form, - MFORM_EX * m) +static inline void create_cursor(int flags, short mode, void * form, MFORM_EX * m) { m->flags = flags; m->number = mode; @@ -929,18 +928,16 @@ static void gui_init(int argc, char** argv) OBJECT * cursors; atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc"); - LOG(("%s ", (char*)&buf)); - if (rsrc_load(buf)==0) { - die("Uable to open GEM Resource file!"); - } - //h_gem_rsrc = RsrcXload( (char*) &buf ); + LOG(("%s ", (char*)&buf)); + h_gem_rsrc = RsrcXload( (char*) &buf ); - //if( !h_gem_rsrc ) - // die("Uable to open GEM Resource file!"); - //rsc_trindex = RsrcGhdr(h_gem_rsrc)->trindex; - //rsc_ntree = RsrcGhdr(h_gem_rsrc)->ntree; + if( !h_gem_rsrc ) + die("Uable to open GEM Resource file!"); + rsc_trindex = RsrcGhdr(h_gem_rsrc)->trindex; + rsc_ntree = RsrcGhdr(h_gem_rsrc)->ntree; - //RsrcXtype( RSRC_XTYPE, rsc_trindex, rsc_ntree); + RsrcGaddr( h_gem_rsrc, R_TREE, MAINMENU , &h_gem_menu ); + RsrcXtype( RSRC_XTYPE, rsc_trindex, rsc_ntree); create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand ); create_cursor(0, TEXT_CRSR, NULL, &gem_cursors.ibeam ); @@ -984,19 +981,19 @@ static void gui_init(int argc, char** argv) die("unable to process command line.\n"); nkc_init(); - plot_init(nsoption_charp(atari_font_driver)); - tree_set_icon_dir( nsoption_charp(tree_icons_path) ); + plot_init(nsoption_charp(atari_font_driver)); } static char *theapp = (char*)"NetSurf"; static void gui_init2(int argc, char** argv) { - deskmenu_init(); + MenuBar( h_gem_menu , 1 ); + bind_global_events(); menu_register( -1, theapp); if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) { menu_register( _AESapid, (char*)" NetSurf "); - } - bind_global_events(); + } + tree_set_icon_dir( nsoption_charp(tree_icons_path) ); global_history_init(); hotlist_init(); toolbar_init(); diff --git a/atari/misc.c b/atari/misc.c index e5b0dc137..8b745fd2f 100755 --- a/atari/misc.c +++ b/atari/misc.c @@ -273,8 +273,7 @@ char *get_rsc_string( int idx) { OBJECT *get_tree( int idx) { OBJECT *tree; - rsrc_gaddr(R_TREE, idx, &tree); - //RsrcGaddr( h_gem_rsrc, R_TREE, idx, &tree); + RsrcGaddr( h_gem_rsrc, R_TREE, idx, &tree); return tree; } diff --git a/atari/settings.c b/atari/settings.c index 25e0c0fe1..8143cdcc6 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -31,8 +31,7 @@ #include "desktop/plot_style.h" #include "atari/res/netsurf.rsh" #include "atari/settings.h" -//#include "atari/global_evnt.h" -#include "atari/deskmenu.h" +#include "atari/global_evnt.h" #include "atari/misc.h" #include "atari/plot/plot.h" #include "atari/bitmap.h" @@ -233,7 +232,7 @@ saveform( WINDOW *win, int index, int unused, void *unused2) close_settings(); ObjcChange( OC_FORM, win, index, NORMAL, TRUE); form_alert(1, "[1][Some options require an netsurf restart!][OK]"); - deskmenu_update(); + main_menu_update(); } static void __CDECL clear_history( WINDOW *win, int index, int unused, -- cgit v1.2.3 From bb6b546b4be757cd515253cd10eccadf78e9afb6 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 19 Nov 2012 17:23:24 +0000 Subject: cleanup formatting in binding files --- javascript/jsapi/console.bnd | 12 ------------ javascript/jsapi/location.bnd | 21 +++++---------------- javascript/jsapi/window.bnd | 8 +------- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/javascript/jsapi/console.bnd b/javascript/jsapi/console.bnd index 6aef9dcb8..7c3484529 100644 --- a/javascript/jsapi/console.bnd +++ b/javascript/jsapi/console.bnd @@ -30,18 +30,6 @@ binding navigator { interface Console; /* Web IDL interface to generate */ - /* private members: - * - stored in private context structure. - * - passed as parameters to constructor and stored automatically. - * - are *not* considered for property getters/setters. - * - * internal members: - * - value stored in private context structure - * - not passed to constructor - * - must be instantiated by constructor - * - are considered for property getters/setters. - */ - internal "void *" gui_console; } operation log %{ diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd index c83fe46e3..db7a247bc 100644 --- a/javascript/jsapi/location.bnd +++ b/javascript/jsapi/location.bnd @@ -30,24 +30,13 @@ preamble %{ %} binding location { - type js_libdom; /* the binding type */ - - interface Location; /* Web IDL interface to generate */ - - /* private members: - * - stored in private context structure. - * - passed as parameters to constructor and stored automatically. - * - are *not* considered for property getters/setters. - * - * internal members: - * - value stored in private context structure - * - not passed to constructor - * - must be instantiated by constructor - * - are considered for property getters/setters. - */ + type js_libdom; /* the binding type */ + + interface Location; /* Web IDL interface to generate */ + private "struct browser_window *" bw; } operation reload %{ - browser_window_reload(private->bw, false); + browser_window_reload(private->bw, false); %} diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index 767b94f1b..c4e6e88cb 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -23,15 +23,9 @@ binding window { interface Window; /* Web IDL interface to generate */ - /* private are parameters to constructor stored in private - * context structure. - * - * internal are value stored in private context structure but not - * passed to constructor but are considered for property - * getters/setters. - */ private "struct browser_window *" bw; private "struct html_content *" htmlc; + internal "JSObject *" document; internal "JSObject *" navigator; internal "JSObject *" console; -- cgit v1.2.3 From 7757008433c414974c527c4745e64aa5976d606a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 19 Nov 2012 17:26:23 +0000 Subject: add window enumeration test --- test/js/event-onload.html | 29 +++++++++++++++++++++++++++++ test/js/index.html | 1 + test/js/window-enumerate.html | 26 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 test/js/event-onload.html create mode 100644 test/js/window-enumerate.html diff --git a/test/js/event-onload.html b/test/js/event-onload.html new file mode 100644 index 000000000..aede985a4 --- /dev/null +++ b/test/js/event-onload.html @@ -0,0 +1,29 @@ + + +createTextNode onload example + + + + + +
        +

        First line of paragraph.

        +

        + + + + + + + diff --git a/test/js/index.html b/test/js/index.html index 75008701b..7a17c95d3 100644 --- a/test/js/index.html +++ b/test/js/index.html @@ -8,6 +8,7 @@

        Window

        Document write

        diff --git a/test/js/window-enumerate.html b/test/js/window-enumerate.html new file mode 100644 index 000000000..92a3111ae --- /dev/null +++ b/test/js/window-enumerate.html @@ -0,0 +1,26 @@ + + +window interface enumeration + + + +

        window interface enumeration

        + + + + -- cgit v1.2.3 From a159a4a79b1facc77ae41983e9f96f8117f07f21 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 20 Nov 2012 19:17:54 +0000 Subject: update JSAPI_PS() signature to cope with new nsgenbind --- javascript/jsapi.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/javascript/jsapi.h b/javascript/jsapi.h index 8b7fe51eb..c10029159 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -82,12 +82,12 @@ #define JS_SET_RVAL(cx, vp, v) (*(vp) = (v)) /* native property specifier */ -#define JSAPI_PS(name, tinyid, flags) \ - { #name , tinyid , flags , jsapi_property_##name##_get , jsapi_property_##name##_set } +#define JSAPI_PS(name, fnname, tinyid, flags) \ + { name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set } /* native property specifier with no setter */ -#define JSAPI_PS_RO(name, tinyid, flags) \ - { #name , tinyid , flags | JSPROP_READONLY, jsapi_property_##name##_get , NULL } +#define JSAPI_PS_RO(name, fnname, tinyid, flags) \ + { name , tinyid , flags | JSPROP_READONLY, jsapi_property_##fnname##_get , NULL } /* native property specifier list end */ #define JSAPI_PS_END { NULL, 0, 0, NULL, NULL } @@ -187,11 +187,11 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, jsapi_property_##name##_set(cx, obj, jsval id, vp) /* property specifier */ -#define JSAPI_PS(name, tinyid, flags) \ - { #name , tinyid , flags , jsapi_property_##name##_get , jsapi_property_##name##_set } +#define JSAPI_PS(name, fnname, tinyid, flags) \ + { name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set } -#define JSAPI_PS_RO(name, tinyid, flags) \ - { #name , tinyid , flags | JSPROP_READONLY, jsapi_property_##name##_get , NULL } +#define JSAPI_PS_RO(name, fnname, tinyid, flags) \ + { name , tinyid , flags | JSPROP_READONLY, jsapi_property_##fnname##_get , NULL } #define JSAPI_PS_END { NULL, 0, 0, NULL, NULL } @@ -284,19 +284,19 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, jsapi_property_##name##_set(cx, obj, jsid id, JSBool strict, vp) /* property specifier */ -#define JSAPI_PS(name, tinyid, flags) { \ - #name , \ - tinyid , \ - flags , \ - jsapi_property_##name##_get , \ - jsapi_property_##name##_set \ +#define JSAPI_PS(name, fnname, tinyid, flags) { \ + name, \ + tinyid, \ + flags, \ + jsapi_property_##fnname##_get, \ + jsapi_property_##fnname##_set \ } -#define JSAPI_PS_RO(name, tinyid, flags) { \ - #name , \ - tinyid , \ +#define JSAPI_PS_RO(name, fnname, tinyid, flags) { \ + name, \ + tinyid, \ flags | JSPROP_READONLY, \ - jsapi_property_##name##_get , \ + jsapi_property_##fnname##_get, \ NULL \ } -- cgit v1.2.3 From c2cd36fda86b9bdfbb36cc340e35cfbc6609fd32 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 21 Nov 2012 18:51:44 +0000 Subject: improve location interface implementation --- javascript/jsapi/binding.h | 3 +- javascript/jsapi/location.bnd | 95 ++++++++++++++++++++++++++++++++++++++++- javascript/jsapi/window.bnd | 3 +- test/js/location-enumerate.html | 26 +++++++++++ 4 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 test/js/location-enumerate.html diff --git a/javascript/jsapi/binding.h b/javascript/jsapi/binding.h index 6400217c8..6d069b973 100644 --- a/javascript/jsapi/binding.h +++ b/javascript/jsapi/binding.h @@ -45,7 +45,8 @@ JSObject *jsapi_InitClass_Location(JSContext *cx, JSObject *parent); JSObject *jsapi_new_Location(JSContext *cx, JSObject *window, JSObject *parent, - struct browser_window *bw); + struct browser_window *bw, + nsurl *url); JSObject *jsapi_InitClass_Document(JSContext *cx, JSObject *parent); diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd index db7a247bc..e91094f2d 100644 --- a/javascript/jsapi/location.bnd +++ b/javascript/jsapi/location.bnd @@ -8,8 +8,6 @@ * http://www.opensource.org/licenses/mit-license */ -#include "dom.bnd" - webidlfile "html.idl"; hdrcomment "Copyright 2012 Vincent Sanders "; @@ -35,8 +33,101 @@ binding location { interface Location; /* Web IDL interface to generate */ private "struct browser_window *" bw; + private "nsurl *" url; } operation reload %{ browser_window_reload(private->bw, false); %} + + +getter href %{ + char *url_s = NULL; + size_t url_l; + nsurl_get(private->url, NSURL_COMPLETE, &url_s, &url_l); + if (url_s != NULL) { + jsret = JS_NewStringCopyN(cx, url_s, url_l); + free(url_s); + } +%} + +getter protocol %{ + lwc_string *component; + component = nsurl_get_component(private->url, NSURL_SCHEME); + if (component != NULL) { + jsret = JS_NewStringCopyN(cx, + lwc_string_data(component), + lwc_string_length(component)); + dom_string_unref(component); + } +%} + +getter host %{ + lwc_string *component; + component = nsurl_get_component(private->url, NSURL_HOST); + if (component != NULL) { + jsret = JS_NewStringCopyN(cx, + lwc_string_data(component), + lwc_string_length(component)); + dom_string_unref(component); + } +%} + +getter hostname %{ + lwc_string *component; + component = nsurl_get_component(private->url, NSURL_HOST); + if (component != NULL) { + jsret = JS_NewStringCopyN(cx, + lwc_string_data(component), + lwc_string_length(component)); + dom_string_unref(component); + } + +%} + +getter port %{ + lwc_string *component; + component = nsurl_get_component(private->url, NSURL_PORT); + if (component != NULL) { + jsret = JS_NewStringCopyN(cx, + lwc_string_data(component), + lwc_string_length(component)); + dom_string_unref(component); + } + +%} + +getter pathname %{ + lwc_string *component; + component = nsurl_get_component(private->url, NSURL_PATH); + if (component != NULL) { + jsret = JS_NewStringCopyN(cx, + lwc_string_data(component), + lwc_string_length(component)); + dom_string_unref(component); + } + +%} + +getter search %{ + lwc_string *component; + component = nsurl_get_component(private->url, NSURL_QUERY); + if (component != NULL) { + jsret = JS_NewStringCopyN(cx, + lwc_string_data(component), + lwc_string_length(component)); + dom_string_unref(component); + } + +%} + +getter hash %{ + lwc_string *component; + component = nsurl_get_component(private->url, NSURL_FRAGMENT); + if (component != NULL) { + jsret = JS_NewStringCopyN(cx, + lwc_string_data(component), + lwc_string_length(component)); + dom_string_unref(component); + } +%} diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index c4e6e88cb..dbc38a796 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -160,7 +160,8 @@ api new %{ return NULL; } - private->location = jsapi_new_Location(cx, NULL, newobject, bw); + private->location = jsapi_new_Location(cx, NULL, newobject, bw, + llcache_handle_get_url(private->htmlc->base.llcache)); if (private->location == NULL) { free(private); return NULL; diff --git a/test/js/location-enumerate.html b/test/js/location-enumerate.html new file mode 100644 index 000000000..d455c7535 --- /dev/null +++ b/test/js/location-enumerate.html @@ -0,0 +1,26 @@ + + +location interface enumeration + + + +

        location interface enumeration

        + + + + -- cgit v1.2.3 From 054984099fd8867da92fa685dce728e1cc665fd0 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 21 Nov 2012 22:08:18 +0000 Subject: use correct unref functions --- javascript/jsapi/location.bnd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd index e91094f2d..a381db111 100644 --- a/javascript/jsapi/location.bnd +++ b/javascript/jsapi/location.bnd @@ -58,7 +58,7 @@ getter protocol %{ jsret = JS_NewStringCopyN(cx, lwc_string_data(component), lwc_string_length(component)); - dom_string_unref(component); + lwc_string_unref(component); } %} @@ -69,7 +69,7 @@ getter host %{ jsret = JS_NewStringCopyN(cx, lwc_string_data(component), lwc_string_length(component)); - dom_string_unref(component); + lwc_string_unref(component); } %} @@ -80,7 +80,7 @@ getter hostname %{ jsret = JS_NewStringCopyN(cx, lwc_string_data(component), lwc_string_length(component)); - dom_string_unref(component); + lwc_string_unref(component); } %} @@ -92,7 +92,7 @@ getter port %{ jsret = JS_NewStringCopyN(cx, lwc_string_data(component), lwc_string_length(component)); - dom_string_unref(component); + lwc_string_unref(component); } %} @@ -104,7 +104,7 @@ getter pathname %{ jsret = JS_NewStringCopyN(cx, lwc_string_data(component), lwc_string_length(component)); - dom_string_unref(component); + lwc_string_unref(component); } %} @@ -116,7 +116,7 @@ getter search %{ jsret = JS_NewStringCopyN(cx, lwc_string_data(component), lwc_string_length(component)); - dom_string_unref(component); + lwc_string_unref(component); } %} @@ -128,6 +128,6 @@ getter hash %{ jsret = JS_NewStringCopyN(cx, lwc_string_data(component), lwc_string_length(component)); - dom_string_unref(component); + lwc_string_unref(component); } %} -- cgit v1.2.3 From 966fb9f215915567d44cff97a73cf3730dd8c431 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 22 Nov 2012 14:00:13 +0000 Subject: rationalise the JSAPI macro usage requires nsgenbind changes --- javascript/jsapi.h | 63 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/javascript/jsapi.h b/javascript/jsapi.h index c10029159..718dd2021 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -47,24 +47,24 @@ */ /* native function definition with five parameters */ -#define JSAPI_NATIVE(name, cx, argc, vp) \ - jsapi_native_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval) +#define JSAPI_FUNC(name, cx, argc, vp) \ + jsapi_func_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval) -/* native function return value */ -#define JSAPI_RVAL(cx, vp) (jsapi_rval) +/* native function return value - No macro available */ +#define JSAPI_FUNC_RVAL(cx, vp) (jsapi_rval) -/* native function return value setter with no JS_SET_RVAL */ -#define JSAPI_SET_RVAL(cx, vp, v) (*jsapi_rval = (v)) +/* native function return value setter - No macro available */ +#define JSAPI_FUNC_SET_RVAL(cx, vp, v) (*jsapi_rval = (v)) /* arguments */ -#define JSAPI_ARGV(cx, vp) (vp) +#define JSAPI_FUNC_ARGV(cx, vp) (vp) /* check if a jsval is an object */ #define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v) /* native function specifier with five parameters and no JS_FS macro */ #define JSAPI_FS(name, nargs, flags) \ - { #name, jsapi_native_##name, nargs, flags, 0 } + { #name, jsapi_func_##name, nargs, flags, 0 } /* native function specifier list end */ #define JSAPI_FS_END { NULL, NULL, 0, 0, 0 } @@ -73,13 +73,16 @@ /* native proprty definition */ -#define JSAPI_PROPERTYGET(name, cx, obj, vp) \ +#define JSAPI_PROP_GETTER(name, cx, obj, vp) \ jsapi_property_##name##_get(cx, obj, jsval id, vp) -#define JSAPI_PROPERTYSET(name, cx, obj, vp) \ +#define JSAPI_PROP_SETTER(name, cx, obj, vp) \ jsapi_property_##name##_set(cx, obj, jsval id, vp) +/* native property return value */ +#define JSAPI_PROP_RVAL(cx, vp) (vp) + /* native property getter return value */ -#define JS_SET_RVAL(cx, vp, v) (*(vp) = (v)) +#define JSAPI_PROP_SET_RVAL(cx, vp, v) (*(vp) = (v)) /* native property specifier */ #define JSAPI_PS(name, fnname, tinyid, flags) \ @@ -155,12 +158,12 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, */ /* five parameter jsapi native call */ -#define JSAPI_NATIVE(name, cx, argc, vp) \ - jsapi_native_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval) +#define JSAPI_FUNC(name, cx, argc, vp) \ + jsapi_func_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval) /* five parameter function descriptor */ #define JSAPI_FS(name, nargs, flags) \ - JS_FS(#name, jsapi_native_##name, nargs, flags, 0) + JS_FS(#name, jsapi_func_##name, nargs, flags, 0) /* function descriptor end */ #define JSAPI_FS_END JS_FS_END @@ -169,10 +172,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_RVAL(cx, vp) JS_RVAL(cx, jsapi_rval) /* return value setter */ -#define JSAPI_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsapi_rval, v) +#define JSAPI_FUNC_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsapi_rval, v) /* arguments */ -#define JSAPI_ARGV(cx, vp) (vp) +#define JSAPI_FUNC_ARGV(cx, vp) (vp) /* check if a jsval is an object */ #define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v) @@ -181,11 +184,17 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_THIS_OBJECT(cx,vp) jsapi_this /* proprty native calls */ -#define JSAPI_PROPERTYGET(name, cx, obj, vp) \ +#define JSAPI_PROP_GETTER(name, cx, obj, vp) \ jsapi_property_##name##_get(cx, obj, jsval id, vp) -#define JSAPI_PROPERTYSET(name, cx, obj, vp) \ +#define JSAPI_PROP_SETTER(name, cx, obj, vp) \ jsapi_property_##name##_set(cx, obj, jsval id, vp) +/* native property return value */ +#define JSAPI_PROP_RVAL JS_RVAL + +/* native property return value setter */ +#define JSAPI_PROP_SET_RVAL JS_SET_RVAL + /* property specifier */ #define JSAPI_PS(name, fnname, tinyid, flags) \ { name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set } @@ -248,11 +257,11 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, /************************** Spidermonkey 1.8.5 **************************/ /* three parameter jsapi native call */ -#define JSAPI_NATIVE(name, cx, argc, vp) jsapi_native_##name(cx, argc, vp) +#define JSAPI_FUNC(name, cx, argc, vp) jsapi_func_##name(cx, argc, vp) /* three parameter function descriptor */ #define JSAPI_FS(name, nargs, flags) \ - JS_FS(#name, jsapi_native_##name, nargs, flags) + JS_FS(#name, jsapi_func_##name, nargs, flags) /* function descriptor end */ #define JSAPI_FS_END JS_FS_END @@ -261,10 +270,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_RVAL JS_RVAL /* return value setter */ -#define JSAPI_SET_RVAL JS_SET_RVAL +#define JSAPI_FUNC_SET_RVAL JS_SET_RVAL /* arguments */ -#define JSAPI_ARGV(cx, vp) JS_ARGV(cx,vp) +#define JSAPI_FUNC_ARGV(cx, vp) JS_ARGV(cx,vp) /* check if a jsval is an object */ #define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v) @@ -278,11 +287,17 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_THIS_OBJECT(cx,vp) JS_THIS_OBJECT(cx,vp) /* proprty native calls */ -#define JSAPI_PROPERTYGET(name, cx, obj, vp) \ +#define JSAPI_PROP_GETTER(name, cx, obj, vp) \ jsapi_property_##name##_get(cx, obj, jsid id, vp) -#define JSAPI_PROPERTYSET(name, cx, obj, vp) \ +#define JSAPI_PROP_SETTER(name, cx, obj, vp) \ jsapi_property_##name##_set(cx, obj, jsid id, JSBool strict, vp) +/* native property return value */ +#define JSAPI_PROP_RVAL JS_RVAL + +/* native property getter return value */ +#define JSAPI_PROP_SET_RVAL JS_SET_RVAL + /* property specifier */ #define JSAPI_PS(name, fnname, tinyid, flags) { \ name, \ -- cgit v1.2.3 From 7d83151d1adb03eaa28df9ae05d0d8e8fb7e7f54 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 22 Nov 2012 17:04:26 +0000 Subject: make nsurl_access() not assert with being passed a NULL url as it is assumed elsewhere this will never fail. --- utils/nsurl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/nsurl.c b/utils/nsurl.c index 18577b65d..eeaf202a7 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -1564,7 +1564,9 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part) /* exported interface, documented in nsurl.h */ const char *nsurl_access(const nsurl *url) { - assert(url != NULL); + if (url == NULL) { + return NULL; + } return url->string; } -- cgit v1.2.3 From 8bccf1615876f7c0ddf62c05f1b9fbc78b011b94 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 22 Nov 2012 17:40:20 +0000 Subject: Check if box with imagemap at point has area at point. --- render/html.c | 9 ++++++--- utils/nsurl.c | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/render/html.c b/render/html.c index f6e3fda56..6c6dcdfca 100644 --- a/render/html.c +++ b/render/html.c @@ -2622,9 +2622,12 @@ html_get_contextual_content(struct content *c, if (box->usemap) { const char *target = NULL; - data->link_url = nsurl_access(imagemap_get(html, - box->usemap, box_x, box_y, x, y, - &target)); + nsurl *url = imagemap_get(html, box->usemap, box_x, + box_y, x, y, &target); + /* Box might have imagemap, but no actual link area + * at point */ + if (url != NULL) + data->link_url = nsurl_access(url); } if (box->gadget) { switch (box->gadget->type) { diff --git a/utils/nsurl.c b/utils/nsurl.c index eeaf202a7..18577b65d 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -1564,9 +1564,7 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part) /* exported interface, documented in nsurl.h */ const char *nsurl_access(const nsurl *url) { - if (url == NULL) { - return NULL; - } + assert(url != NULL); return url->string; } -- cgit v1.2.3 From ec43456e4bf0968bc68b437733199ad2af609c1e Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 23 Nov 2012 13:48:11 +0000 Subject: use unshared type handler for all events on window --- javascript/jsapi.h | 27 +++++++++++++++++++++------ javascript/jsapi/location.bnd | 1 + javascript/jsapi/window.bnd | 10 ++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/javascript/jsapi.h b/javascript/jsapi.h index 718dd2021..6b0f1124d 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -74,9 +74,9 @@ /* native proprty definition */ #define JSAPI_PROP_GETTER(name, cx, obj, vp) \ - jsapi_property_##name##_get(cx, obj, jsval id, vp) + jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp) #define JSAPI_PROP_SETTER(name, cx, obj, vp) \ - jsapi_property_##name##_set(cx, obj, jsval id, vp) + jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp) /* native property return value */ #define JSAPI_PROP_RVAL(cx, vp) (vp) @@ -84,6 +84,9 @@ /* native property getter return value */ #define JSAPI_PROP_SET_RVAL(cx, vp, v) (*(vp) = (v)) +/* native property ID value as a jsval */ +#define JSAPI_PROP_IDVAL(cx, vp) (*(vp) = jsapi_id) + /* native property specifier */ #define JSAPI_PS(name, fnname, tinyid, flags) \ { name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set } @@ -183,11 +186,14 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, /* The object instance in a native call */ #define JSAPI_THIS_OBJECT(cx,vp) jsapi_this + + + /* proprty native calls */ #define JSAPI_PROP_GETTER(name, cx, obj, vp) \ - jsapi_property_##name##_get(cx, obj, jsval id, vp) + jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp) #define JSAPI_PROP_SETTER(name, cx, obj, vp) \ - jsapi_property_##name##_set(cx, obj, jsval id, vp) + jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp) /* native property return value */ #define JSAPI_PROP_RVAL JS_RVAL @@ -195,6 +201,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, /* native property return value setter */ #define JSAPI_PROP_SET_RVAL JS_SET_RVAL +/* native property ID value as a jsval */ +#define JSAPI_PROP_IDVAL(cx, vp) (*(vp) = jsapi_id) + /* property specifier */ #define JSAPI_PS(name, fnname, tinyid, flags) \ { name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set } @@ -204,6 +213,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, #define JSAPI_PS_END { NULL, 0, 0, NULL, NULL } + + + static inline JSObject * JS_NewCompartmentAndGlobalObject(JSContext *cx, JSClass *jsclass, @@ -288,9 +300,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, /* proprty native calls */ #define JSAPI_PROP_GETTER(name, cx, obj, vp) \ - jsapi_property_##name##_get(cx, obj, jsid id, vp) + jsapi_property_##name##_get(cx, obj, jsid jsapi_id, vp) #define JSAPI_PROP_SETTER(name, cx, obj, vp) \ - jsapi_property_##name##_set(cx, obj, jsid id, JSBool strict, vp) + jsapi_property_##name##_set(cx, obj, jsid jsapi_id, JSBool strict, vp) /* native property return value */ #define JSAPI_PROP_RVAL JS_RVAL @@ -298,6 +310,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, /* native property getter return value */ #define JSAPI_PROP_SET_RVAL JS_SET_RVAL +/* native property ID value as a jsval */ +#define JSAPI_PROP_IDVAL(cx, vp) JS_IdToValue(cx, jsapi_id, vp) + /* property specifier */ #define JSAPI_PS(name, fnname, tinyid, flags) { \ name, \ diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd index a381db111..32e38da93 100644 --- a/javascript/jsapi/location.bnd +++ b/javascript/jsapi/location.bnd @@ -34,6 +34,7 @@ binding location { private "struct browser_window *" bw; private "nsurl *" url; + } operation reload %{ diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index dbc38a796..e439980b9 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -30,6 +30,8 @@ binding window { internal "JSObject *" navigator; internal "JSObject *" console; internal "JSObject *" location; + + property unshared type EventHandler; } api mark %{ @@ -197,3 +199,11 @@ getter window %{ getter self %{ jsret = obj; %} + +getter EventHandler %{ + JSLOG("propname:%s %s", propname, JS_GetTypeName(cx, JS_TypeOfValue(cx, propname_jsval))); +%} + +setter EventHandler %{ + JSLOG("propname:%s %s", propname, JS_GetTypeName(cx, JS_TypeOfValue(cx, propname_jsval))); +%} -- cgit v1.2.3