1
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4
* This file is part of The Croco Library
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of version 2.1 of the GNU Lesser General Public
8
* License as published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20
* Author: Dodji Seketeli
21
* See COPYRIGHTS file for copyright information.
27
#include "cr-selector.h"
28
#include "cr-declaration.h"
30
#ifndef __CR_STATEMENT_H__
31
#define __CR_STATEMENT_H__
37
*Declaration of the #CRStatement class.
41
*forward declaration of CRStyleSheet which is defined in
48
*typedef struct _CRStatement CRStatement ;
49
*this is forward declared in
50
*cr-declaration.h already.
53
struct _CRAtMediaRule ;
54
typedef struct _CRAtMediaRule CRAtMediaRule ;
56
typedef struct _CRRuleSet CRRuleSet ;
59
*The abstraction of a css ruleset.
60
*A ruleset is made of a list of selectors,
61
*followed by a list of declarations.
65
/**A list of instances of #CRSimpeSel*/
66
CRSelector *sel_list ;
68
/**A list of instances of #CRDeclaration*/
69
CRDeclaration *decl_list ;
72
*The parent media rule, or NULL if
73
*no parent media rule exists.
75
CRStatement *parent_media_rule ;
79
*a forward declaration of CRStylesheet.
80
*CRStylesheet is actually declared in
83
struct _CRStyleSheet ;
84
typedef struct _CRStyleSheet CRStyleSheet;
87
/**The @import rule abstraction.*/
88
typedef struct _CRAtImportRule CRAtImportRule ;
89
struct _CRAtImportRule
91
/**the url of the import rule*/
97
*the stylesheet fetched from the url, if any.
98
*this is not "owned" by #CRAtImportRule which means
99
*it is not destroyed by the destructor of #CRAtImportRule.
101
CRStyleSheet * sheet;
105
/**abstraction of an @media rule*/
106
struct _CRAtMediaRule
109
CRStatement *rulesets ;
113
typedef struct _CRAtPageRule CRAtPageRule ;
114
/**The @page rule abstraction*/
117
/**a list of instances of #CRDeclaration*/
118
CRDeclaration *decl_list ;
120
/**page selector. Is a pseudo selector*/
125
/**The @charset rule abstraction*/
126
typedef struct _CRAtCharsetRule CRAtCharsetRule ;
127
struct _CRAtCharsetRule
132
/**The abstaction of the @font-face rule.*/
133
typedef struct _CRAtFontFaceRule CRAtFontFaceRule ;
134
struct _CRAtFontFaceRule
136
/*a list of instanaces of #CRDeclaration*/
137
CRDeclaration *decl_list ;
142
*The possible types of css2 statements.
147
*A generic css at-rule
148
*each unknown at-rule will
158
/**A css2 import rule*/
161
/**A css2 media rule*/
164
/**A css2 page rule*/
167
/**A css2 charset rule*/
168
AT_CHARSET_RULE_STMT,
170
/**A css2 font face rule*/
171
AT_FONT_FACE_RULE_STMT
176
*The abstraction of css statement as defined
177
*in the chapter 4 and appendix D.1 of the css2 spec.
178
*A statement is actually a double chained list of
179
*statements.A statement can be a ruleset, an @import
180
*rule, an @page rule etc ...
185
*The type of the statement.
187
enum CRStatementType type ;
192
CRAtImportRule *import_rule ;
193
CRAtMediaRule *media_rule ;
194
CRAtPageRule *page_rule ;
195
CRAtCharsetRule *charset_rule ;
196
CRAtFontFaceRule *font_face_rule ;
200
*the specificity of the selector
201
*that matched this statement.
202
*This is only used by the cascading
203
*order determination algorithm.
208
*the style sheet that contains
211
CRStyleSheet *parent_sheet ;
215
CRParsingLocation location ;
218
*a custom pointer useable by
219
*applications that use libcroco.
220
*libcroco itself will never modify
226
*a custom pointer used
227
*by the upper layers of libcroco.
228
*application should never use this
231
gpointer croco_data ;
237
cr_statement_does_buf_parses_against_core (const guchar *a_buf,
238
enum CREncoding a_encoding) ;
240
cr_statement_parse_from_buf (const guchar *a_buf,
241
enum CREncoding a_encoding) ;
243
cr_statement_new_ruleset (CRStyleSheet *a_sheet,
244
CRSelector *a_sel_list,
245
CRDeclaration *a_decl_list,
246
CRStatement *a_media_rule) ;
248
cr_statement_ruleset_parse_from_buf (const guchar * a_buf,
249
enum CREncoding a_enc) ;
252
cr_statement_new_at_import_rule (CRStyleSheet *a_container_sheet,
255
CRStyleSheet *a_imported_sheet) ;
258
cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
259
enum CREncoding a_encoding) ;
262
cr_statement_new_at_media_rule (CRStyleSheet *a_sheet,
263
CRStatement *a_ruleset,
266
cr_statement_at_media_rule_parse_from_buf (const guchar *a_buf,
267
enum CREncoding a_enc) ;
270
cr_statement_new_at_charset_rule (CRStyleSheet *a_sheet,
271
CRString *a_charset) ;
273
cr_statement_at_charset_rule_parse_from_buf (const guchar *a_buf,
274
enum CREncoding a_encoding);
278
cr_statement_new_at_font_face_rule (CRStyleSheet *a_sheet,
279
CRDeclaration *a_font_decls) ;
281
cr_statement_font_face_rule_parse_from_buf (const guchar *a_buf,
282
enum CREncoding a_encoding) ;
285
cr_statement_new_at_page_rule (CRStyleSheet *a_sheet,
286
CRDeclaration *a_decl_list,
288
CRString *a_pseudo) ;
290
cr_statement_at_page_rule_parse_from_buf (const guchar *a_buf,
291
enum CREncoding a_encoding) ;
294
cr_statement_set_parent_sheet (CRStatement *a_this,
295
CRStyleSheet *a_sheet) ;
298
cr_statement_get_parent_sheet (CRStatement *a_this,
299
CRStyleSheet **a_sheet) ;
302
cr_statement_append (CRStatement *a_this,
303
CRStatement *a_new) ;
306
cr_statement_prepend (CRStatement *a_this,
307
CRStatement *a_new) ;
310
cr_statement_unlink (CRStatement *a_stmt) ;
313
cr_statement_ruleset_set_sel_list (CRStatement *a_this,
314
CRSelector *a_sel_list) ;
317
cr_statement_ruleset_get_sel_list (CRStatement *a_this,
318
CRSelector **a_list) ;
321
cr_statement_ruleset_set_decl_list (CRStatement *a_this,
322
CRDeclaration *a_list) ;
325
cr_statement_ruleset_get_declarations (CRStatement *a_this,
326
CRDeclaration **a_decl_list) ;
329
cr_statement_ruleset_append_decl2 (CRStatement *a_this,
330
CRString *a_prop, CRTerm *a_value) ;
333
cr_statement_ruleset_append_decl (CRStatement *a_this,
334
CRDeclaration *a_decl) ;
337
cr_statement_at_import_rule_set_imported_sheet (CRStatement *a_this,
338
CRStyleSheet *a_sheet) ;
341
cr_statement_at_import_rule_get_imported_sheet (CRStatement *a_this,
342
CRStyleSheet **a_sheet) ;
345
cr_statement_at_import_rule_set_url (CRStatement *a_this,
349
cr_statement_at_import_rule_get_url (CRStatement *a_this,
353
cr_statement_at_media_nr_rules (CRStatement *a_this) ;
356
cr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr) ;
359
cr_statement_at_page_rule_set_sel (CRStatement *a_this,
363
cr_statement_at_page_rule_get_sel (CRStatement *a_this,
364
CRSelector **a_sel) ;
367
cr_statement_at_page_rule_set_declarations (CRStatement *a_this,
368
CRDeclaration *a_decl_list) ;
371
cr_statement_at_page_rule_get_declarations (CRStatement *a_this,
372
CRDeclaration **a_decl_list) ;
375
cr_statement_at_charset_rule_set_charset (CRStatement *a_this,
376
CRString *a_charset) ;
379
cr_statement_at_charset_rule_get_charset (CRStatement *a_this,
380
CRString **a_charset) ;
383
cr_statement_at_font_face_rule_set_decls (CRStatement *a_this,
384
CRDeclaration *a_decls) ;
387
cr_statement_at_font_face_rule_get_decls (CRStatement *a_this,
388
CRDeclaration **a_decls) ;
391
cr_statement_at_font_face_rule_add_decl (CRStatement *a_this,
396
cr_statement_to_string (CRStatement * a_this, gulong a_indent) ;
399
cr_statement_list_to_string (CRStatement *a_this, gulong a_indent) ;
402
cr_statement_dump (CRStatement *a_this, FILE *a_fp, gulong a_indent) ;
405
cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp,
409
cr_statement_dump_font_face_rule (CRStatement * a_this,
414
cr_statement_dump_page (CRStatement * a_this, FILE * a_fp,
419
cr_statement_dump_media_rule (CRStatement * a_this,
424
cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
427
cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp,
430
cr_statement_nr_rules (CRStatement *a_this) ;
433
cr_statement_get_from_list (CRStatement *a_this, int itemnr) ;
436
cr_statement_destroy (CRStatement *a_this) ;
440
#endif /*__CR_STATEMENT_H__*/