add initial binding files for nsgenbind

This commit is contained in:
Vincent Sanders 2012-10-23 18:39:34 +01:00
parent 6de9eb4d62
commit f487b77f4f
3 changed files with 53 additions and 31 deletions

View File

@ -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;

View File

@ -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));
%}

View File

@ -0,0 +1,39 @@
/* test binding to generate htmldocument */
#include "dom.bnd"
webidlfile "html.idl";
hdrcomment "Part of NetSurf Project";
preamble %{
#include <dom/dom.h>
#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 */
}