summaryrefslogtreecommitdiff
path: root/src/parse/properties/properties.c
blob: 06524da9bd513bd13b4f0ed1565c6beafa790b3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/*
 * This file is part of LibCSS.
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 * Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
 */

#include "parse/properties/properties.h"

/**
 * Dispatch table of property handlers, indexed by property enum
 */
const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
{
	css__parse_align_content,
	css__parse_align_items,
	css__parse_align_self,
	css__parse_azimuth,
	css__parse_background,
	css__parse_background_attachment,
	css__parse_background_color,
	css__parse_background_image,
	css__parse_background_position,
	css__parse_background_repeat,
	css__parse_border,
	css__parse_border_bottom,
	css__parse_border_bottom_color,
	css__parse_border_bottom_style,
	css__parse_border_bottom_width,
	css__parse_border_collapse,
	css__parse_border_color,
	css__parse_border_left,
	css__parse_border_left_color,
	css__parse_border_left_style,
	css__parse_border_left_width,
	css__parse_border_right,
	css__parse_border_right_color,
	css__parse_border_right_style,
	css__parse_border_right_width,
	css__parse_border_spacing,
	css__parse_border_style,
	css__parse_border_top,
	css__parse_border_top_color,
	css__parse_border_top_style,
	css__parse_border_top_width,
	css__parse_border_width,
	css__parse_bottom,
	css__parse_box_sizing,
	css__parse_break_after,
	css__parse_break_before,
	css__parse_break_inside,
	css__parse_caption_side,
	css__parse_clear,
	css__parse_clip,
	css__parse_color,
	css__parse_columns,
	css__parse_column_count,
	css__parse_column_fill,
	css__parse_column_gap,
	css__parse_column_rule,
	css__parse_column_rule_color,
	css__parse_column_rule_style,
	css__parse_column_rule_width,
	css__parse_column_span,
	css__parse_column_width,
	css__parse_content,
	css__parse_counter_increment,
	css__parse_counter_reset,
	css__parse_cue,
	css__parse_cue_after,
	css__parse_cue_before,
	css__parse_cursor,
	css__parse_direction,
	css__parse_display,
	css__parse_elevation,
	css__parse_empty_cells,
	css__parse_flex,
	css__parse_flex_basis,
	css__parse_flex_direction,
	css__parse_flex_flow,
	css__parse_flex_grow,
	css__parse_flex_shrink,
	css__parse_flex_wrap,
	css__parse_float,
	css__parse_font,
	css__parse_font_family,
	css__parse_font_size,
	css__parse_font_style,
	css__parse_font_variant,
	css__parse_font_weight,
	css__parse_height,
	css__parse_justify_content,
	css__parse_left,
	css__parse_letter_spacing,
	css__parse_line_height,
	css__parse_list_style,
	css__parse_list_style_image,
	css__parse_list_style_position,
	css__parse_list_style_type,
	css__parse_margin,
	css__parse_margin_bottom,
	css__parse_margin_left,
	css__parse_margin_right,
	css__parse_margin_top,
	css__parse_max_height,
	css__parse_max_width,
	css__parse_min_height,
	css__parse_min_width,
	css__parse_opacity,
	css__parse_order,
	css__parse_orphans,
	css__parse_outline,
	css__parse_outline_color,
	css__parse_outline_style,
	css__parse_outline_width,
	css__parse_overflow,
	css__parse_overflow_x,
	css__parse_overflow_y,
	css__parse_padding,
	css__parse_padding_bottom,
	css__parse_padding_left,
	css__parse_padding_right,
	css__parse_padding_top,
	css__parse_page_break_after,
	css__parse_page_break_before,
	css__parse_page_break_inside,
	css__parse_pause,
	css__parse_pause_after,
	css__parse_pause_before,
	css__parse_pitch_range,
	css__parse_pitch,
	css__parse_play_during,
	css__parse_position,
	css__parse_quotes,
	css__parse_richness,
	css__parse_right,
	css__parse_speak_header,
	css__parse_speak_numeral,
	css__parse_speak_punctuation,
	css__parse_speak,
	css__parse_speech_rate,
	css__parse_stress,
	css__parse_table_layout,
	css__parse_text_align,
	css__parse_text_decoration,
	css__parse_text_indent,
	css__parse_text_transform,
	css__parse_top,
	css__parse_unicode_bidi,
	css__parse_vertical_align,
	css__parse_visibility,
	css__parse_voice_family,
	css__parse_volume,
	css__parse_white_space,
	css__parse_widows,
	css__parse_width,
	css__parse_word_spacing,
	css__parse_writing_mode,
	css__parse_z_index
};

/** Mapping from property bytecode index to bytecode unit class mask. */
const uint32_t property_unit_mask[CSS_N_PROPERTIES] = {
	[CSS_PROP_AZIMUTH]               = UNIT_MASK_AZIMUTH,
	[CSS_PROP_BACKGROUND_ATTACHMENT] = UNIT_MASK_BACKGROUND_ATTACHMENT,
	[CSS_PROP_BACKGROUND_COLOR]      = UNIT_MASK_BACKGROUND_COLOR,
	[CSS_PROP_BACKGROUND_IMAGE]      = UNIT_MASK_BACKGROUND_IMAGE,
	[CSS_PROP_BACKGROUND_POSITION]   = UNIT_MASK_BACKGROUND_POSITION,
	[CSS_PROP_BACKGROUND_REPEAT]     = UNIT_MASK_BACKGROUND_REPEAT,
	[CSS_PROP_BORDER_COLLAPSE]       = UNIT_MASK_BORDER_COLLAPSE,
	[CSS_PROP_BORDER_SPACING]        = UNIT_MASK_BORDER_SPACING,
	[CSS_PROP_BORDER_TOP_COLOR]      = UNIT_MASK_BORDER_SIDE_COLOR,
	[CSS_PROP_BORDER_RIGHT_COLOR]    = UNIT_MASK_BORDER_SIDE_COLOR,
	[CSS_PROP_BORDER_BOTTOM_COLOR]   = UNIT_MASK_BORDER_SIDE_COLOR,
	[CSS_PROP_BORDER_LEFT_COLOR]     = UNIT_MASK_BORDER_SIDE_COLOR,
	[CSS_PROP_BORDER_TOP_STYLE]      = UNIT_MASK_BORDER_SIDE_STYLE,
	[CSS_PROP_BORDER_RIGHT_STYLE]    = UNIT_MASK_BORDER_SIDE_STYLE,
	[CSS_PROP_BORDER_BOTTOM_STYLE]   = UNIT_MASK_BORDER_SIDE_STYLE,
	[CSS_PROP_BORDER_LEFT_STYLE]     = UNIT_MASK_BORDER_SIDE_STYLE,
	[CSS_PROP_BORDER_TOP_WIDTH]      = UNIT_MASK_BORDER_SIDE_WIDTH,
	[CSS_PROP_BORDER_RIGHT_WIDTH]    = UNIT_MASK_BORDER_SIDE_WIDTH,
	[CSS_PROP_BORDER_BOTTOM_WIDTH]   = UNIT_MASK_BORDER_SIDE_WIDTH,
	[CSS_PROP_BORDER_LEFT_WIDTH]     = UNIT_MASK_BORDER_SIDE_WIDTH,
	[CSS_PROP_BOTTOM]                = UNIT_MASK_BOTTOM,
	[CSS_PROP_CAPTION_SIDE]          = UNIT_MASK_CAPTION_SIDE,
	[CSS_PROP_CLEAR]                 = UNIT_MASK_CLEAR,
	[CSS_PROP_CLIP]                  = UNIT_MASK_CLIP,
	[CSS_PROP_COLOR]                 = UNIT_MASK_COLOR,
	[CSS_PROP_CONTENT]               = UNIT_MASK_CONTENT,
	[CSS_PROP_COUNTER_INCREMENT]     = UNIT_MASK_COUNTER_INCREMENT,
	[CSS_PROP_COUNTER_RESET]         = UNIT_MASK_COUNTER_RESET,
	[CSS_PROP_CUE_AFTER]             = UNIT_MASK_CUE_AFTER,
	[CSS_PROP_CUE_BEFORE]            = UNIT_MASK_CUE_BEFORE,
	[CSS_PROP_CURSOR]                = UNIT_MASK_CURSOR,
	[CSS_PROP_DIRECTION]             = UNIT_MASK_DIRECTION,
	[CSS_PROP_DISPLAY]               = UNIT_MASK_DISPLAY,
	[CSS_PROP_ELEVATION]             = UNIT_MASK_ELEVATION,
	[CSS_PROP_EMPTY_CELLS]           = UNIT_MASK_EMPTY_CELLS,
	[CSS_PROP_FLOAT]                 = UNIT_MASK_FLOAT,
	[CSS_PROP_FONT_FAMILY]           = UNIT_MASK_FONT_FAMILY,
	[CSS_PROP_FONT_SIZE]             = UNIT_MASK_FONT_SIZE,
	[CSS_PROP_FONT_STYLE]            = UNIT_MASK_FONT_STYLE,
	[CSS_PROP_FONT_VARIANT]          = UNIT_MASK_FONT_VARIANT,
	[CSS_PROP_FONT_WEIGHT]           = UNIT_MASK_FONT_WEIGHT,
	[CSS_PROP_HEIGHT]                = UNIT_MASK_HEIGHT,
	[CSS_PROP_LEFT]                  = UNIT_MASK_LEFT,
	[CSS_PROP_LETTER_SPACING]        = UNIT_MASK_LETTER_SPACING,
	[CSS_PROP_LINE_HEIGHT]           = UNIT_MASK_LINE_HEIGHT,
	[CSS_PROP_LIST_STYLE_IMAGE]      = UNIT_MASK_LIST_STYLE_IMAGE,
	[CSS_PROP_LIST_STYLE_POSITION]   = UNIT_MASK_LIST_STYLE_POSITION,
	[CSS_PROP_LIST_STYLE_TYPE]       = UNIT_MASK_LIST_STYLE_TYPE,
	[CSS_PROP_MARGIN_TOP]            = UNIT_MASK_MARGIN_SIDE,
	[CSS_PROP_MARGIN_RIGHT]          = UNIT_MASK_MARGIN_SIDE,
	[CSS_PROP_MARGIN_BOTTOM]         = UNIT_MASK_MARGIN_SIDE,
	[CSS_PROP_MARGIN_LEFT]           = UNIT_MASK_MARGIN_SIDE,
	[CSS_PROP_MAX_HEIGHT]            = UNIT_MASK_MAX_HEIGHT,
	[CSS_PROP_MAX_WIDTH]             = UNIT_MASK_MAX_WIDTH,
	[CSS_PROP_MIN_HEIGHT]            = UNIT_MASK_MIN_HEIGHT,
	[CSS_PROP_MIN_WIDTH]             = UNIT_MASK_MIN_WIDTH,
	[CSS_PROP_ORPHANS]               = UNIT_MASK_ORPHANS,
	[CSS_PROP_OUTLINE_COLOR]         = UNIT_MASK_OUTLINE_COLOR,
	[CSS_PROP_OUTLINE_STYLE]         = UNIT_MASK_OUTLINE_STYLE,
	[CSS_PROP_OUTLINE_WIDTH]         = UNIT_MASK_OUTLINE_WIDTH,
	[CSS_PROP_OVERFLOW_X]            = UNIT_MASK_OVERFLOW_X,
	[CSS_PROP_PADDING_TOP]           = UNIT_MASK_PADDING_SIDE,
	[CSS_PROP_PADDING_RIGHT]         = UNIT_MASK_PADDING_SIDE,
	[CSS_PROP_PADDING_BOTTOM]        = UNIT_MASK_PADDING_SIDE,
	[CSS_PROP_PADDING_LEFT]          = UNIT_MASK_PADDING_SIDE,
	[CSS_PROP_PAGE_BREAK_AFTER]      = UNIT_MASK_PAGE_BREAK_AFTER,
	[CSS_PROP_PAGE_BREAK_BEFORE]     = UNIT_MASK_PAGE_BREAK_BEFORE,
	[CSS_PROP_PAGE_BREAK_INSIDE]     = UNIT_MASK_PAGE_BREAK_INSIDE,
	[CSS_PROP_PAUSE_AFTER]           = UNIT_MASK_PAUSE_AFTER,
	[CSS_PROP_PAUSE_BEFORE]          = UNIT_MASK_PAUSE_BEFORE,
	[CSS_PROP_PITCH_RANGE]           = UNIT_MASK_PITCH_RANGE,
	[CSS_PROP_PITCH]                 = UNIT_MASK_PITCH,
	[CSS_PROP_PLAY_DURING]           = UNIT_MASK_PLAY_DURING,
	[CSS_PROP_POSITION]              = UNIT_MASK_POSITION,
	[CSS_PROP_QUOTES]                = UNIT_MASK_QUOTES,
	[CSS_PROP_RICHNESS]              = UNIT_MASK_RICHNESS,
	[CSS_PROP_RIGHT]                 = UNIT_MASK_RIGHT,
	[CSS_PROP_SPEAK_HEADER]          = UNIT_MASK_SPEAK_HEADER,
	[CSS_PROP_SPEAK_NUMERAL]         = UNIT_MASK_SPEAK_NUMERAL,
	[CSS_PROP_SPEAK_PUNCTUATION]     = UNIT_MASK_SPEAK_PUNCTUATION,
	[CSS_PROP_SPEAK]                 = UNIT_MASK_SPEAK,
	[CSS_PROP_SPEECH_RATE]           = UNIT_MASK_SPEECH_RATE,
	[CSS_PROP_STRESS]                = UNIT_MASK_STRESS,
	[CSS_PROP_TABLE_LAYOUT]          = UNIT_MASK_TABLE_LAYOUT,
	[CSS_PROP_TEXT_ALIGN]            = UNIT_MASK_TEXT_ALIGN,
	[CSS_PROP_TEXT_DECORATION]       = UNIT_MASK_TEXT_DECORATION,
	[CSS_PROP_TEXT_INDENT]           = UNIT_MASK_TEXT_INDENT,
	[CSS_PROP_TEXT_TRANSFORM]        = UNIT_MASK_TEXT_TRANSFORM,
	[CSS_PROP_TOP]                   = UNIT_MASK_TOP,
	[CSS_PROP_UNICODE_BIDI]          = UNIT_MASK_UNICODE_BIDI,
	[CSS_PROP_VERTICAL_ALIGN]        = UNIT_MASK_VERTICAL_ALIGN,
	[CSS_PROP_VISIBILITY]            = UNIT_MASK_VISIBILITY,
	[CSS_PROP_VOICE_FAMILY]          = UNIT_MASK_VOICE_FAMILY,
	[CSS_PROP_VOLUME]                = UNIT_MASK_VOLUME,
	[CSS_PROP_WHITE_SPACE]           = UNIT_MASK_WHITE_SPACE,
	[CSS_PROP_WIDOWS]                = UNIT_MASK_WIDOWS,
	[CSS_PROP_WIDTH]                 = UNIT_MASK_WIDTH,
	[CSS_PROP_WORD_SPACING]          = UNIT_MASK_WORD_SPACING,
	[CSS_PROP_Z_INDEX]               = UNIT_MASK_Z_INDEX,
	[CSS_PROP_OPACITY]               = UNIT_MASK_OPACITY,
	[CSS_PROP_BREAK_AFTER]           = UNIT_MASK_BREAK_AFTER,
	[CSS_PROP_BREAK_BEFORE]          = UNIT_MASK_BREAK_BEFORE,
	[CSS_PROP_BREAK_INSIDE]          = UNIT_MASK_BREAK_INSIDE,
	[CSS_PROP_COLUMN_COUNT]          = UNIT_MASK_COLUMN_COUNT,
	[CSS_PROP_COLUMN_FILL]           = UNIT_MASK_COLUMN_FILL,
	[CSS_PROP_COLUMN_GAP]            = UNIT_MASK_COLUMN_GAP,
	[CSS_PROP_COLUMN_RULE_COLOR]     = UNIT_MASK_COLUMN_RULE_COLOR,
	[CSS_PROP_COLUMN_RULE_STYLE]     = UNIT_MASK_COLUMN_RULE_STYLE,
	[CSS_PROP_COLUMN_RULE_WIDTH]     = UNIT_MASK_COLUMN_RULE_WIDTH,
	[CSS_PROP_COLUMN_SPAN]           = UNIT_MASK_COLUMN_SPAN,
	[CSS_PROP_COLUMN_WIDTH]          = UNIT_MASK_COLUMN_WIDTH,
	[CSS_PROP_WRITING_MODE]          = UNIT_MASK_WRITING_MODE,
	[CSS_PROP_OVERFLOW_Y]            = UNIT_MASK_OVERFLOW_Y,
	[CSS_PROP_BOX_SIZING]            = UNIT_MASK_BOX_SIZING,
	[CSS_PROP_ALIGN_CONTENT]         = UNIT_MASK_ALIGN_CONTENT,
	[CSS_PROP_ALIGN_ITEMS]           = UNIT_MASK_ALIGN_ITEMS,
	[CSS_PROP_ALIGN_SELF]            = UNIT_MASK_ALIGN_SELF,
	[CSS_PROP_FLEX_BASIS]            = UNIT_MASK_FLEX_BASIS,
	[CSS_PROP_FLEX_DIRECTION]        = UNIT_MASK_FLEX_DIRECTION,
	[CSS_PROP_FLEX_GROW]             = UNIT_MASK_FLEX_GROW,
	[CSS_PROP_FLEX_SHRINK]           = UNIT_MASK_FLEX_SHRINK,
	[CSS_PROP_FLEX_WRAP]             = UNIT_MASK_FLEX_WRAP,
	[CSS_PROP_JUSTIFY_CONTENT]       = UNIT_MASK_JUSTIFY_CONTENT,
	[CSS_PROP_ORDER]                 = UNIT_MASK_ORDER,
};