select.h 3.14 KB
Newer Older
XueShuming's avatar
XueShuming committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/////////////////////////////////////////////////////////////////////////////// //
//                          IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/**
 \verbatim

XueShuming's avatar
XueShuming committed
15
16
17
    This file is part of HiDOMLayout. hiDOMLayout is a library to
    maintain a DOM tree, lay out and stylize the DOM nodes by
    using CSS (Cascaded Style Sheets).
XueShuming's avatar
XueShuming committed
18

XueShuming's avatar
XueShuming committed
19
    Copyright (C) 2021 Beijing FMSoft Technologies Co., Ltd.
XueShuming's avatar
XueShuming committed
20
21

    This program is free software: you can redistribute it and/or modify
XueShuming's avatar
XueShuming committed
22
    it under the terms of the GNU Lesser General License as published by
XueShuming's avatar
XueShuming committed
23
24
25
26
27
28
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
XueShuming's avatar
XueShuming committed
29
    GNU Lesser General License for more details.
XueShuming's avatar
XueShuming committed
30

XueShuming's avatar
XueShuming committed
31
    You should have received a copy of the GNU Lesser General License
XueShuming's avatar
XueShuming committed
32
33
34
35
36
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    Or,

    As this program is a library, any link to this program must follow
XueShuming's avatar
XueShuming committed
37
38
    GNU Lesser General License version 3 (LGPLv3). If you cannot accept
    LGPLv3, you need to be licensed from FMSoft.
XueShuming's avatar
XueShuming committed
39
40
41
42
43
44
45
46
47
48
49

    If you have got a commercial license of this program, please use it
    under the terms and conditions of the commercial license.

    For more information about the commercial license, please refer to
    <http://www.minigui.com/blog/minigui-licensing-policy/>.

 \endverbatim
 */


XueShuming's avatar
XueShuming committed
50
51
#ifndef _HL_SELECT_H_
#define _HL_SELECT_H_
XueShuming's avatar
XueShuming committed
52

XueShuming's avatar
XueShuming committed
53
54
#include <libcss/libcss.h>

XueShuming's avatar
XueShuming committed
55
#include "hidomlayout.h"
XueShuming's avatar
XueShuming committed
56

57
58
#include "node.h"

XueShuming's avatar
XueShuming committed
59
60
typedef struct HLCSS_ {
    css_stylesheet* sheet;
61
    css_stylesheet* ua_sheet;
XueShuming's avatar
XueShuming committed
62
63
64
    int done;
} HLCSS;

XueShuming's avatar
XueShuming committed
65
66
67
68
#ifdef __cplusplus
extern "C" {
#endif

XueShuming's avatar
XueShuming committed
69
70
css_stylesheet* _hilayout_css_stylesheet_create(const char *charset, const char *url, bool allow_quirks, bool inline_style);
css_stylesheet* _hilayout_css_stylesheet_inline_style_create(const uint8_t *data, size_t len);
71
css_stylesheet* _hilayout_css_stylesheet_create_ua_css();
XueShuming's avatar
XueShuming committed
72
73
74
int _hilayout_css_stylesheet_append_data(css_stylesheet* sheet, const uint8_t *data, size_t len);
int _hilayout_css_stylesheet_data_done(css_stylesheet* sheet);
int _hilayout_css_stylesheet_destroy(css_stylesheet* sheet);
75

XueShuming's avatar
XueShuming committed
76

77
78
79
css_select_ctx* _hilayout_css_select_ctx_create(HLCSS* css);
int _hilayout_css_select_ctx_destroy(css_select_ctx* ctx);

XueShuming's avatar
XueShuming committed
80
int _hilayout_select_node_style(const css_media* media, css_select_ctx* select_ctx, HLDomElementNode* node);
XueShuming's avatar
XueShuming committed
81
82
css_select_results* _hilayout_get_node_style(const css_media* media, css_select_ctx* select_ctx, HLDomElementNode* node);

XueShuming's avatar
XueShuming committed
83
css_select_results* _hilayout_css_select_style(const HLCSS* css, void *node,
XueShuming's avatar
XueShuming committed
84
		const css_media *media, const css_stylesheet *inline_style, css_select_handler *handler);
85

XueShuming's avatar
XueShuming committed
86
int _hilayout_css_select_result_destroy(css_select_results *result);
XueShuming's avatar
XueShuming committed
87

XueShuming's avatar
XueShuming committed
88
89
90
#ifdef __cplusplus
}
#endif
XueShuming's avatar
XueShuming committed
91

XueShuming's avatar
XueShuming committed
92
#endif // _HL_SELECT_H_