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/node/node.h" |
22
|
|
|
|
|
|
|
#include "modest/style/sheet.h" |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
modest_node_t * modest_node_create(modest_t* modest) |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
|
|
|
modest_node_t* mnode = (modest_node_t*)mcobject_async_malloc(modest->mnode_obj, modest->mnode_node_id, NULL); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if(mnode == NULL) |
29
|
0
|
|
|
|
|
|
return NULL; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
memset(mnode, 0, sizeof(modest_node_t)); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return mnode; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
mystatus_t modest_node_init(modest_t* modest, modest_node_t *mnode) |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
|
|
|
mnode->stylesheet = modest_style_sheet_create(modest); |
39
|
0
|
0
|
|
|
|
|
if(mnode->stylesheet == NULL) |
40
|
0
|
|
|
|
|
|
return MODEST_STATUS_ERROR_MEMORY_ALLOCATION; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
mystatus_t status = modest_style_sheet_init(modest, mnode->stylesheet); |
43
|
0
|
0
|
|
|
|
|
if(status) |
44
|
0
|
|
|
|
|
|
return MODEST_STATUS_ERROR; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return MODEST_STATUS_OK; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#ifdef MODEST_NODE_FULL_RAW |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
mycss_declaration_entry_t * modest_node_declaration_by_type(modest_t* modest, modest_node_t *mnode, mycss_property_type_t type) |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
if(mnode->raw_declaration[ type ]) |
54
|
|
|
|
|
|
|
return mnode->raw_declaration[ type ]->declaration; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return NULL; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
modest_style_raw_declaration_t * modest_node_raw_declaration_by_type(modest_t* modest, modest_node_t *mnode, mycss_property_type_t type) |
60
|
|
|
|
|
|
|
{ |
61
|
|
|
|
|
|
|
return mnode->raw_declaration[ type ]; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
void modest_node_raw_declaration_set_by_type(modest_t* modest, modest_node_t *mnode, mycss_property_type_t type, modest_style_raw_declaration_t *raw_declr) |
65
|
|
|
|
|
|
|
{ |
66
|
|
|
|
|
|
|
mnode->raw_declaration[ type ] = raw_declr; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#else |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
mycss_declaration_entry_t * modest_node_declaration_by_type(modest_t* modest, modest_node_t *mnode, mycss_property_type_t type) |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
|
|
|
mycore_utils_avl_tree_node_t *find_node = mycore_utils_avl_tree_search_by_type(modest->style_avl_tree, mnode->avl_tree_node, type); |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
if(find_node) |
76
|
0
|
|
|
|
|
|
return ((modest_style_raw_declaration_t*)find_node->value)->declaration; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return NULL; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
modest_style_raw_declaration_t * modest_node_raw_declaration_by_type(modest_t* modest, modest_node_t *mnode, mycss_property_type_t type) |
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
|
|
|
mycore_utils_avl_tree_node_t *find_node = mycore_utils_avl_tree_search_by_type(modest->style_avl_tree, mnode->avl_tree_node, type); |
84
|
0
|
0
|
|
|
|
|
return (find_node ? find_node->value : NULL); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
void modest_node_raw_declaration_set_by_type(modest_t* modest, modest_node_t *mnode, mycss_property_type_t type, modest_style_raw_declaration_t *raw_declr) |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
|
|
|
mycore_utils_avl_tree_add(modest->style_avl_tree, &mnode->avl_tree_node, type, raw_declr); |
90
|
0
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#endif /* MODEST_NODE_FULL_RAW */ |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|