diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2015-08-01 17:40:24 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2015-08-03 22:30:20 +0100 |
commit | ba2cea6270dc014bf2751f373404fa915d2c38b6 (patch) | |
tree | 1a7d6a91c3362a0acda23715e8fba918a885a500 /src/layout.c | |
parent | cefb64e2eb6e67d523ed9367fea54ec7d30a1414 (diff) | |
download | libnslayout-ba2cea6270dc014bf2751f373404fa915d2c38b6.tar.gz libnslayout-ba2cea6270dc014bf2751f373404fa915d2c38b6.tar.bz2 |
Add DOM event handler.
Currently just prints the events it gets.
Diffstat (limited to 'src/layout.c')
-rw-r--r-- | src/layout.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/layout.c b/src/layout.c index b5d74c2..f1a1490 100644 --- a/src/layout.c +++ b/src/layout.c @@ -10,8 +10,25 @@ #include <assert.h> #include <stdlib.h> +#include <stdio.h> #include "layout.h" +#include "dom/event.h" +#include "util/dom-str.h" + + +/* Publically exported function, documented in include/libnslayout/nslayout.h */ +nslayout_error nslayout_init(void) +{ + return nsl_dom_str_init(); +} + + +/* Publically exported function, documented in include/libnslayout/nslayout.h */ +nslayout_error nslayout_fini(void) +{ + return nsl_dom_str_fini(); +} /* Publically exported function, documented in include/libnslayout/nslayout.h */ @@ -23,13 +40,15 @@ nslayout_error nslayout_layout_create( void *pw, nslayout_layout **layout) { - nslayout_layout *l; + nslayout_layout *l = NULL; assert(doc != NULL); assert(css_ctx != NULL); assert(media != NULL); assert(cb != NULL); + printf("Called layout_create\n"); + l = calloc(1, sizeof(nslayout_layout)); if (l == NULL) { return NSLAYOUT_NO_MEM; @@ -42,6 +61,9 @@ nslayout_error nslayout_layout_create( l->cb = cb; l->pw = pw; + /* TODO: error handling */ + nsl_dom_event_layout_init(l); + *layout = l; return NSLAYOUT_OK; } @@ -51,9 +73,12 @@ nslayout_error nslayout_layout_create( nslayout_error nslayout_layout_destroy( nslayout_layout *layout) { - /* TODO: free/unref the stuff we own in the layout */ assert(layout != NULL); + /* TODO: free/unref the stuff we own in the layout */ + /* TODO: error handling */ + nsl_dom_event_layout_fini(layout); + free(layout); return NSLAYOUT_OK; } |