diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-10-08 16:20:18 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-10-08 16:20:18 +0100 |
commit | b9a23939b29d5973a04a9172248a98be4b6a8ef1 (patch) | |
tree | d7c8511faa7b4d9afa43fd3c683e6739a4305c74 /javascript | |
parent | 6fd2c320f23e267416438de9425be777c81bec5f (diff) | |
download | netsurf-b9a23939b29d5973a04a9172248a98be4b6a8ef1.tar.gz netsurf-b9a23939b29d5973a04a9172248a98be4b6a8ef1.tar.bz2 |
Add some HTML Element specialisations for HR and BR
These specialisations make use of the new nsgenbind feature of
generated property accessors.
Diffstat (limited to 'javascript')
-rw-r--r-- | javascript/duktape/HTMLBRElement.bnd | 40 | ||||
-rw-r--r-- | javascript/duktape/HTMLHRElement.bnd | 24 | ||||
-rw-r--r-- | javascript/duktape/netsurf.bnd | 2 |
3 files changed, 27 insertions, 39 deletions
diff --git a/javascript/duktape/HTMLBRElement.bnd b/javascript/duktape/HTMLBRElement.bnd index 25e5184ba..3b44b9777 100644 --- a/javascript/duktape/HTMLBRElement.bnd +++ b/javascript/duktape/HTMLBRElement.bnd @@ -10,41 +10,5 @@ init HTMLBRElement(struct dom_html_element *html_br_element::html_element); -getter HTMLBRElement::clear() -%{ - dom_exception exc; - dom_string *str; - - exc = dom_html_br_element_get_clear(((node_private_t*)priv)->node, &str); - if (exc != DOM_NO_ERR) { - return 0; - } - - duk_push_lstring(ctx, dom_string_data(str), dom_string_length(str)); - dom_string_unref(str); - - return 1; - -%} - -setter HTMLBRElement::clear() -%{ - dom_exception exc; - dom_string *content; - duk_size_t slen; - const char *s; - s = duk_safe_to_lstring(ctx, 0, &slen); - - exc = dom_string_create((const uint8_t *)s, slen, &content); - if (exc != DOM_NO_ERR) { - return 0; - } - - exc = dom_html_br_element_set_clear(((node_private_t*)priv)->node, content); - dom_string_unref(content); - if (exc != DOM_NO_ERR) { - return 0; - } - - return 0; -%} +getter HTMLBRElement::clear(); +setter HTMLBRElement::clear(); diff --git a/javascript/duktape/HTMLHRElement.bnd b/javascript/duktape/HTMLHRElement.bnd new file mode 100644 index 000000000..421ec499b --- /dev/null +++ b/javascript/duktape/HTMLHRElement.bnd @@ -0,0 +1,24 @@ +/* HTML hr element binding using duktape and libdom + * + * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org> + * + * 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 + */ + +init HTMLHRElement(struct dom_html_element *html_hr_element::html_element); + +getter HTMLHRElement::noShade(); +setter HTMLHRElement::noShade(); + +getter HTMLHRElement::align(); +setter HTMLHRElement::align(); + +getter HTMLHRElement::size(); +setter HTMLHRElement::size(); + +getter HTMLHRElement::width(); +setter HTMLHRElement::width(); + diff --git a/javascript/duktape/netsurf.bnd b/javascript/duktape/netsurf.bnd index 255c782ae..c41faa45e 100644 --- a/javascript/duktape/netsurf.bnd +++ b/javascript/duktape/netsurf.bnd @@ -62,6 +62,7 @@ struct dom_html_br_element; #include "Location.bnd" #include "Navigator.bnd" #include "HTMLBRElement.bnd" +#include "HTMLHRElement.bnd" /* specialisations of html_element */ init HTMLUnknownElement(struct dom_html_element *html_unknown_element::html_element); @@ -122,7 +123,6 @@ init HTMLUListElement(struct dom_html_element *html_u_list_element::html_element init HTMLOListElement(struct dom_html_element *html_o_list_element::html_element); init HTMLQuoteElement(struct dom_html_element *html_quote_element::html_element); init HTMLPreElement(struct dom_html_element *html_pre_element::html_element); -init HTMLHRElement(struct dom_html_element *html_hr_element::html_element); init HTMLParagraphElement(struct dom_html_element *html_paragraph_element::html_element); init HTMLHeadingElement(struct dom_html_element *html_heading_element::html_element); init HTMLBodyElement(struct dom_html_element *html_body_element::html_element); |