From f487b77f4f605f43fce620c6975e1cd5c74b92b5 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 23 Oct 2012 18:39:34 +0100 Subject: add initial binding files for nsgenbind --- javascript/jsapi/WebIDL/html.idl | 31 ------------------------ javascript/jsapi/bindings/dom.bnd | 14 +++++++++++ javascript/jsapi/bindings/htmldocument.bnd | 39 ++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 javascript/jsapi/bindings/dom.bnd create mode 100644 javascript/jsapi/bindings/htmldocument.bnd diff --git a/javascript/jsapi/WebIDL/html.idl b/javascript/jsapi/WebIDL/html.idl index 692c93ffc..94e7c75db 100644 --- a/javascript/jsapi/WebIDL/html.idl +++ b/javascript/jsapi/WebIDL/html.idl @@ -2,20 +2,6 @@ // retrived from http://www.whatwg.org/specs/web-apps/current-work/ // 23rd October 2012 -//interface Example { - // this is an IDL definition -//}; - -// this block was from the URL parsing mandantory attribute section -// but fails to define a real interface - -// attribute DOMString protocol; -// attribute DOMString host; -// attribute DOMString hostname; -// attribute DOMString port; -// attribute DOMString pathname; -// attribute DOMString search; -// attribute DOMString hash; interface HTMLAllCollection : HTMLCollection { // inherits length and item() @@ -1316,23 +1302,6 @@ interface HTMLMeterElement : HTMLElement { readonly attribute NodeList labels; }; - void select(); - attribute unsigned long selectionStart; - attribute unsigned long selectionEnd; - attribute DOMString selectionDirection; - - void setRangeText(DOMString replacement); - void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode); - - void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction = "preserve"); - -enum SelectionMode { - "select", - "start", - "end", - "preserve", -}; - interface ValidityState { readonly attribute boolean valueMissing; readonly attribute boolean typeMismatch; diff --git a/javascript/jsapi/bindings/dom.bnd b/javascript/jsapi/bindings/dom.bnd new file mode 100644 index 000000000..f323ff2ad --- /dev/null +++ b/javascript/jsapi/bindings/dom.bnd @@ -0,0 +1,14 @@ +/* test binding for document - must be included */ + +webidlfile "dom.idl"; + +operation getElementById %{ + dom_string *elementId_dom; + dom_element *element; + + dom_string_create((unsigned char*)elementId, elementId_len, &elementId_dom); + + dom_document_get_element_by_id(private->node, elementId_dom, &element); + + jsretval = OBJECT_TO_JSVAL(jsapi_new_element(cx, JS_GetGlobalObject(cx), private->htmlc, element)); +%} diff --git a/javascript/jsapi/bindings/htmldocument.bnd b/javascript/jsapi/bindings/htmldocument.bnd new file mode 100644 index 000000000..e7955d949 --- /dev/null +++ b/javascript/jsapi/bindings/htmldocument.bnd @@ -0,0 +1,39 @@ +/* test binding to generate htmldocument */ + +#include "dom.bnd" + +webidlfile "html.idl"; + +hdrcomment "Part of NetSurf Project"; + +preamble %{ + +#include + +#include "utils/config.h" +#include "utils/log.h" + +#include "javascript/jsapi.h" + +%} + +operation write %{ + LOG(("content %p parser %p writing %s", + private->htmlc, private->htmlc->parser, text)); + + if (private->htmlc->parser != NULL) { + dom_hubbub_parser_insert_chunk(private->htmlc->parser, (uint8_t *)text, text_len); + } +%} + +binding document { + type js_libdom; /* the binding type */ + + /* parameters to constructor value stored in private + * context structure. + */ + private "dom_document *" node; + private "struct html_content *" htmlc; + + interface Document; /* Web IDL interface to generate */ +} -- cgit v1.2.3