1 /*
2  * Copyright (C) 2018 Alexander Borisov
3  *
4  * Author: Alexander Borisov <borisov@lexbor.com>
5  */
6 
7 #include "lexbor/html/interfaces/window.h"
8 #include "lexbor/html/interfaces/document.h"
9 
10 
11 lxb_html_window_t *
lxb_html_window_create(lxb_html_document_t * document)12 lxb_html_window_create(lxb_html_document_t *document)
13 {
14     lxb_html_window_t *element;
15 
16     element = lexbor_mraw_calloc(document->dom_document.mraw,
17                                  sizeof(lxb_html_window_t));
18     if (element == NULL) {
19         return NULL;
20     }
21 
22     lxb_dom_node_t *node = lxb_dom_interface_node(element);
23 
24     node->owner_document = lxb_html_document_original_ref(document);
25     node->type = LXB_DOM_NODE_TYPE_ELEMENT;
26 
27     return element;
28 }
29 
30 lxb_html_window_t *
lxb_html_window_destroy(lxb_html_window_t * window)31 lxb_html_window_destroy(lxb_html_window_t *window)
32 {
33     return lexbor_mraw_free(
34         lxb_dom_interface_node(window)->owner_document->mraw,
35         window);
36 }
37