diff options
author | Vincent Sanders <vince@kyllikki.org> | 2013-01-02 22:43:29 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2013-01-02 23:14:31 +0000 |
commit | bb10e7131f615b9266d7a1996f561637286e2839 (patch) | |
tree | 734ba083b57047fd047fe20074db4de5d0f27b73 /javascript/jsapi/window.bnd | |
parent | 1b8f9daa51c901119d4dc27f82fb993fc8378bd0 (diff) | |
download | netsurf-bb10e7131f615b9266d7a1996f561637286e2839.tar.gz netsurf-bb10e7131f615b9266d7a1996f561637286e2839.tar.bz2 |
use a prologue section in the node binding to abstract out javascrip dom node to libdom node conversion
Diffstat (limited to 'javascript/jsapi/window.bnd')
-rw-r--r-- | javascript/jsapi/window.bnd | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index 937c150db..bba1eb7db 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -10,6 +10,7 @@ webidlfile "html.idl"; +webidlfile "dom.idl"; hdrcomment "Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>"; hdrcomment "This file is part of NetSurf, http://www.netsurf-browser.org/"; @@ -19,7 +20,7 @@ hdrcomment " http://www.opensource.org/licenses/mit-license"; preamble %{ #include <dom/dom.h> - + #include "utils/config.h" #include "utils/log.h" #include "utils/corestrings.h" @@ -41,8 +42,6 @@ preamble %{ %} -#include "dom.bnd" - binding window { type js_libdom; /* the binding type */ @@ -109,7 +108,7 @@ api init %{ return NULL; /* Initialises all the user javascript classes to make their - * prototypes available. + * prototypes available. */ /** @todo should we be managing these prototype objects ourselves */ user_proto = jsapi_InitClass_Document(cx, prototype); @@ -173,16 +172,16 @@ api new %{ /* @todo sort out windows that are not globals */ assert(parent == NULL); - /* the window object is the global so its prototype *is* the instance */ - newobject = prototype; + /* the window object is the global so its prototype *is* the instance */ + newobject = prototype; /* instantiate the subclasses off the window global */ private->document = jsapi_new_Document(cx, - NULL, - newobject, - (dom_document *)dom_node_ref(htmlc->document), - htmlc); - if (private->document == NULL) { + NULL, + newobject, + (dom_document *)dom_node_ref(htmlc->document), + htmlc); + if (private->document == NULL) { free(private); return NULL; } @@ -219,7 +218,7 @@ operation prompt %{ /* boolean dispatchEvent(Event event); */ operation dispatchEvent %{ /* this implementation is unique to the window object as it is - * not a "real" dom node. + * not a "real" dom node. */ /* caution, this must match the struct generated from event.bnd */ @@ -249,7 +248,7 @@ operation dispatchEvent %{ jsret = JS_CallFunctionValue(cx, NULL, eventval, 1, event_argv, &event_rval); } } - } + } %} getter location %{ @@ -268,18 +267,18 @@ getter self %{ getter EventHandler %{ /* this implementation is unique to the window object as it is - * not a dom node. + * not a dom node. */ - JSLOG("propname[%d]=\"%s\"", + JSLOG("propname[%d]=\"%s\"", tinyid, jsclass_properties[tinyid].name); %} setter EventHandler %{ /* this implementation is unique to the window object as it is - * not a dom node. + * not a dom node. */ - JSLOG("propname[%d]=\"%s\"", - tinyid, + JSLOG("propname[%d]=\"%s\"", + tinyid, jsclass_properties[tinyid].name); %} |