File Coverage

third_party/modest/source/modest/render/binding.c
Criterion Covered Total %
statement 0 38 0.0
branch 0 22 0.0
condition n/a
subroutine n/a
pod n/a
total 0 60 0.0


line stmt bran cond sub pod time code
1             /*
2             Copyright (C) 2016-2017 Alexander Borisov
3            
4             This library is free software; you can redistribute it and/or
5             modify it under the terms of the GNU Lesser General Public
6             License as published by the Free Software Foundation; either
7             version 2.1 of the License, or (at your option) any later version.
8            
9             This library is distributed in the hope that it will be useful,
10             but WITHOUT ANY WARRANTY; without even the implied warranty of
11             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12             Lesser General Public License for more details.
13            
14             You should have received a copy of the GNU Lesser General Public
15             License along with this library; if not, write to the Free Software
16             Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17            
18             Author: lex.borisov@gmail.com (Alexander Borisov)
19             */
20              
21             #include "modest/render/binding.h"
22              
23 0           modest_render_tree_node_t * modest_render_binding_create_viewport(modest_t* modest, modest_render_tree_t* render_tree)
24             {
25 0           modest_render_tree_node_t* render_node = modest_render_tree_node_create_and_init(render_tree);
26 0           render_node->type = MODEST_RENDER_TREE_NODE_TYPE_VIEWPORT;
27            
28 0           return render_node;
29             }
30              
31 0           modest_render_tree_node_t * modest_render_binding(modest_t* modest, modest_render_tree_t* render_tree, myhtml_tree_t* html_tree)
32             {
33 0           myhtml_tree_node_t* html_node = html_tree->node_html;
34 0           myhtml_tree_node_t* html_scope = html_node;
35            
36 0           modest_render_tree_node_t *render_root = modest_render_binding_create_viewport(modest, render_tree);
37 0           modest_render_tree_node_t *render_node = render_root;
38            
39 0 0         while(html_node) {
40 0           render_node = modest_layer_binding_node(modest, render_tree, render_node, html_node);
41            
42 0 0         if(render_node == NULL && html_node->next) {
    0          
43 0           modest_node_t *m_node = html_node->parent->data;
44 0           render_node = m_node->render_node;
45            
46 0           html_node = html_node->next;
47             }
48 0 0         else if(render_node && html_node->child)
    0          
49 0           html_node = html_node->child;
50             else {
51 0 0         while(html_node != html_scope && html_node->next == NULL) {
    0          
52 0           html_node = html_node->parent;
53             }
54            
55 0 0         if(html_node == html_scope)
56 0           break;
57            
58 0           modest_node_t *m_node = html_node->parent->data;
59 0           render_node = m_node->render_node;
60            
61 0           html_node = html_node->next;
62             }
63             }
64            
65 0           return render_root;
66             }
67              
68 0           modest_render_tree_node_t * modest_layer_binding_node(modest_t* modest, modest_render_tree_t* render_tree,
69             modest_render_tree_node_t* render_root, myhtml_tree_node_t* html_node)
70             {
71 0 0         if(html_node->data == NULL)
72 0           return NULL;
73            
74 0           mycss_declaration_entry_t *display = modest_declaration_by_type(modest, html_node, MyCSS_PROPERTY_TYPE_DISPLAY);
75            
76 0 0         if(display->value_type == MyCSS_PROPERTY_DISPLAY_NONE)
77 0           return NULL;
78            
79 0           modest_node_t *m_node = html_node->data;
80            
81 0 0         if(m_node->render_node == NULL) {
82 0           m_node->render_node = modest_render_tree_node_create_and_init(render_tree);
83             }
84            
85 0           modest_render_tree_node_t* render_node = m_node->render_node;
86 0           modest_render_tree_node_append(render_root, render_node);
87            
88 0           render_node->html_node = html_node;
89            
90 0           return render_node;
91             }
92              
93