1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
2
3 /* libcroco - Library for parsing and applying CSS
4 * Copyright (C) 2006-2019 Free Software Foundation, Inc.
5 *
6 * This file is not part of the GNU gettext program, but is used with
7 * GNU gettext.
8 *
9 * The original copyright notice is as follows:
10 */
11
12 /*
13 * This file is part of The Croco Library
14 *
15 * Copyright (C) 2003-2004 Dodji Seketeli. All Rights Reserved.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of version 2.1 of the GNU Lesser General Public
19 * License as published by the Free Software Foundation.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29 * USA
30 *
31 * Author: Dodji Seketeli
32 */
33
34 #ifndef __CR_SEL_ENG_H__
35 #define __CR_SEL_ENG_H__
36
37 #include "cr-utils.h"
38 #include "cr-stylesheet.h"
39 #include "cr-cascade.h"
40 #include "cr-style.h"
41 #include "cr-prop-list.h"
42
43 #include <libxml/tree.h>
44
45 /**
46 *@file:
47 *The declaration of the #CRSelEng class.
48 *The #CRSelEng is actually the "Selection Engine"
49 *class.
50 */
51
52 G_BEGIN_DECLS
53
54 typedef struct _CRSelEng CRSelEng ;
55 typedef struct _CRSelEngPriv CRSelEngPriv ;
56
57 /**
58 *The Selection engine class.
59 *The main service provided by this class, is
60 *the ability to interpret a libcroco implementation
61 *of css2 selectors, and given an xml node, say if
62 *the selector matches the node or not.
63 */
64 struct _CRSelEng
65 {
66 CRSelEngPriv *priv ;
67 } ;
68
69
70 typedef gboolean (*CRPseudoClassSelectorHandler) (CRSelEng* a_this,
71 CRAdditionalSel *a_add_sel,
72 xmlNode *a_node) ;
73 CRSelEng * cr_sel_eng_new (void) ;
74
75 enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng *a_this,
76 guchar *a_pseudo_class_sel_name,
77 enum CRPseudoType a_pseudo_class_type,
78 CRPseudoClassSelectorHandler a_handler) ;
79
80 enum CRStatus cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng *a_this,
81 guchar *a_pseudo_class_sel_name,
82 enum CRPseudoType a_pseudo_class_type) ;
83
84 enum CRStatus cr_sel_eng_unregister_all_pseudo_class_sel_handlers (CRSelEng *a_this) ;
85
86 enum CRStatus cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng *a_this,
87 guchar *a_pseudo_class_sel_name,
88 enum CRPseudoType a_pseudo_class_type,
89 CRPseudoClassSelectorHandler *a_handler) ;
90
91 enum CRStatus cr_sel_eng_matches_node (CRSelEng *a_this,
92 CRSimpleSel *a_sel,
93 xmlNode *a_node,
94 gboolean *a_result) ;
95
96 enum CRStatus cr_sel_eng_get_matched_rulesets (CRSelEng *a_this,
97 CRStyleSheet *a_sheet,
98 xmlNode *a_node,
99 CRStatement ***a_rulesets,
100 gulong *a_len) ;
101
102 enum CRStatus
103 cr_sel_eng_get_matched_properties_from_cascade (CRSelEng *a_this,
104 CRCascade *a_cascade,
105 xmlNode *a_node,
106 CRPropList **a_props) ;
107
108 enum CRStatus cr_sel_eng_get_matched_style (CRSelEng *a_this,
109 CRCascade *a_cascade,
110 xmlNode *a_node,
111 CRStyle *a_parent_style,
112 CRStyle **a_style,
113 gboolean a_set_props_to_initial_values) ;
114
115 void cr_sel_eng_destroy (CRSelEng *a_this) ;
116
117 G_END_DECLS
118
119
120 #endif/*__CR_SEL_ENG_H__*/