From ca24b238ed2c12f39e699ae16d15f00b0b064795 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 7 Nov 2012 18:52:30 +0000 Subject: add Text interface --- Makefile.sources.javascript | 1 + javascript/jsapi/dom.bnd | 7 +++++++ javascript/jsapi/text.bnd | 44 ++++++++++++++++++++++++++++++++++++++++++++ javascript/jsapi/window.bnd | 5 +++++ 4 files changed, 57 insertions(+) create mode 100644 javascript/jsapi/text.bnd diff --git a/Makefile.sources.javascript b/Makefile.sources.javascript index da7c2101e..88412ec57 100644 --- a/Makefile.sources.javascript +++ b/Makefile.sources.javascript @@ -19,6 +19,7 @@ JSAPI_BINDING_console := javascript/jsapi/console.bnd JSAPI_BINDING_location := javascript/jsapi/location.bnd JSAPI_BINDING_htmlcollection := javascript/jsapi/htmlcollection.bnd JSAPI_BINDING_nodelist := javascript/jsapi/nodelist.bnd +JSAPI_BINDING_text := javascript/jsapi/text.bnd # 1: input file # 2: output file diff --git a/javascript/jsapi/dom.bnd b/javascript/jsapi/dom.bnd index cd252fc27..c2f9e787e 100644 --- a/javascript/jsapi/dom.bnd +++ b/javascript/jsapi/dom.bnd @@ -2,6 +2,8 @@ webidlfile "dom.idl"; +/* interface Node members */ + getter textContent %{ dom_exception exc; @@ -21,3 +23,8 @@ getter textContent %{ +operation appendChild %{ +%} + +operation createTextNode %{ +%} diff --git a/javascript/jsapi/text.bnd b/javascript/jsapi/text.bnd new file mode 100644 index 000000000..d440e4a9e --- /dev/null +++ b/javascript/jsapi/text.bnd @@ -0,0 +1,44 @@ +/* Binding to generate Text interface + * + * Copyright 2012 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * Released under the terms of the MIT License, + * http://www.opensource.org/licenses/mit-license + */ + +#include "dom.bnd" + +webidlfile "html.idl"; + +hdrcomment "Copyright 2012 Vincent Sanders "; +hdrcomment "This file is part of NetSurf, http://www.netsurf-browser.org/"; +hdrcomment "Released under the terms of the MIT License,"; +hdrcomment " http://www.opensource.org/licenses/mit-license"; + +preamble %{ + +#include + +#include "utils/config.h" +#include "utils/log.h" + +#include "javascript/jsapi.h" +#include "javascript/jsapi/binding.h" + +%} + +binding text { + type js_libdom; /* the binding type */ + + interface Text; /* Web IDL interface to generate */ + + private "dom_node *" node; +} + +api finalise %{ + if (private != NULL) { + dom_node_unref(private->node); + } +%} diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index 865cbf3d4..5a7de530f 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -130,6 +130,11 @@ api init %{ return NULL; } + user_proto = jsapi_InitClass_Text(cx, prototype); + if (user_proto == NULL) { + return NULL; + } + %} api new %{ -- cgit v1.2.3