diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2012-02-11 21:24:47 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2012-02-11 21:24:47 +0000 |
commit | 20e38ac229f4a5e03ef2855872c358a29845c184 (patch) | |
tree | c8ae0fc3762249a91e602f29a6e4878331458aed /include/dom | |
parent | 9076b20a0004f57cb0760cd0ac81199e99e4ba39 (diff) | |
download | libdom-20e38ac229f4a5e03ef2855872c358a29845c184.tar.gz libdom-20e38ac229f4a5e03ef2855872c358a29845c184.tar.bz2 |
Provide custom API to ease optimal binding to libcss
svn path=/trunk/libdom/; revision=13440
Diffstat (limited to 'include/dom')
-rw-r--r-- | include/dom/core/element.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/dom/core/element.h b/include/dom/core/element.h index c77335b..df093a4 100644 --- a/include/dom/core/element.h +++ b/include/dom/core/element.h @@ -87,6 +87,14 @@ typedef struct dom_element_vtable { dom_exception (*dom_element_set_id_attribute_node)( struct dom_element *element, struct dom_attr *id_attr, bool is_id); + + /* These two are for the benefit of bindings to libcss */ + dom_exception (*dom_element_get_classes)( + struct dom_element *element, + lwc_string ***classes, uint32_t *n_classes); + dom_exception (*dom_element_has_class)( + struct dom_element *element, + lwc_string *name, bool *match); } dom_element_vtable; static inline dom_exception dom_element_get_tag_name( @@ -323,4 +331,25 @@ static inline dom_exception dom_element_set_id_attribute_node( dom_element_set_id_attribute_node((dom_element *) (e), \ (struct dom_attr *) (a), (bool) (i)) +static inline dom_exception dom_element_get_classes( + struct dom_element *element, + lwc_string ***classes, uint32_t *n_classes) +{ + return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> + dom_element_get_classes(element, classes, n_classes); +} +#define dom_element_get_classes(e, c, n) \ + dom_element_get_classes((dom_element *) (e), \ + (lwc_string ***) (c), (uint32_t *) (n)) + +static inline dom_exception dom_element_has_class( + struct dom_element *element, lwc_string *name, bool *match) +{ + return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> + dom_element_has_class(element, name, match); +} +#define dom_element_has_class(e, n, m) \ + dom_element_has_class((dom_element *) (e), \ + (lwc_string *) (n), (bool *) (m)) + #endif |