Add some HTML Element specialisations for HR and BR

These specialisations make use of the new nsgenbind feature of
generated property accessors.
This commit is contained in:
Vincent Sanders 2015-10-08 16:20:18 +01:00
parent 6fd2c320f2
commit b9a23939b2
4 changed files with 27 additions and 47 deletions

View File

@ -1024,16 +1024,8 @@ getter HTMLFrameSetElement::rows();\n
setter HTMLFrameSetElement::rows();\n
getter HTMLHeadingElement::align();\n
setter HTMLHeadingElement::align();\n
getter HTMLHRElement::align();\n
setter HTMLHRElement::align();\n
getter HTMLHRElement::color();\n
setter HTMLHRElement::color();\n
getter HTMLHRElement::noShade();\n
setter HTMLHRElement::noShade();\n
getter HTMLHRElement::size();\n
setter HTMLHRElement::size();\n
getter HTMLHRElement::width();\n
setter HTMLHRElement::width();\n
getter HTMLHtmlElement::version();\n
setter HTMLHtmlElement::version();\n
getter HTMLIFrameElement::align();\n

View File

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

View File

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

View File

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