summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Drake <Michael Drake tlsa@netsurf-browser.org>2020-11-15 15:34:44 +0000
committerMichael Drake <Michael Drake tlsa@netsurf-browser.org>2020-11-15 15:34:44 +0000
commite2b4077eed0ad778847cd7b17406e8bf8b61a4ae (patch)
treecd44e465d51834374990cbab95f4c1310373ba6a /src
parentd7c1541ac2d21577e58f2839879e71a2cebed229 (diff)
downloadlibcss-master.tar.gz
libcss-master.tar.bz2
parse: properties: Add property-specific unit class masks.HEADmaster
There's a table we can index into for calc(): const uint32_t property_unit_mask[CSS_N_PROPERTIES] And there are #defines for where the code is already property-specific, avoiding the lookup.
Diffstat (limited to 'src')
-rw-r--r--src/parse/properties/css_property_parser_gen.c7
-rw-r--r--src/parse/properties/properties.c128
-rw-r--r--src/parse/properties/properties.gen44
-rw-r--r--src/parse/properties/properties.h113
4 files changed, 270 insertions, 22 deletions
diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c
index 0e6ce72..24cc536 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -326,6 +326,13 @@ void output_length_unit(FILE *outputf, struct keyval *parseid, struct keyval_lis
"\t\t\treturn CSS_INVALID;\n"
"\t\t}\n\n",
ulkv->val);
+ } else if (strcmp(ulkv->key, "MASK") == 0) {
+ fprintf(outputf,
+ "\t\tif ((unit & %s ) == 0) {\n"
+ "\t\t\t*ctx = orig_ctx;\n"
+ "\t\t\treturn CSS_INVALID;\n"
+ "\t\t}\n\n",
+ ulkv->val);
} else if (strcmp(ulkv->key, "RANGE") == 0) {
fprintf(outputf,
"\t\tif (length %s) {\n"
diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c
index 3f374fa..06524da 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -158,3 +158,131 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
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,
+};
diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen
index db3a531..e729285 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -22,35 +22,35 @@ empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: SHOW:0,EMPTY_CELLS_SHOW HIDE:0
float:CSS_PROP_FLOAT IDENT:( INHERIT: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
-font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
-height:CSS_PROP_HEIGHT IDENT:( INHERIT: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+height:CSS_PROP_HEIGHT IDENT:( INHERIT: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
-letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET ALLOW:unit&UNIT_LENGTH LENGTH_UNIT:)
+letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
-line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side
border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side
border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side
border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side
-max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
-max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
-min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
-min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
color:CSS_PROP_COLOR IDENT:INHERIT COLOR:COLOR_SET
#generic for padding_{top, bottom, left, right}.c
-padding_side:op GENERIC: IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:PADDING_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+padding_side:op GENERIC: IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side
padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side
@@ -59,7 +59,7 @@ padding_right:CSS_PROP_PADDING_RIGHT WRAP:css__parse_padding_side
#generic for margin_{top, bottom, left, right}.c
-margin_side:op GENERIC IDENT:( INHERIT: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
+margin_side:op GENERIC IDENT:( INHERIT: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side
margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side
@@ -76,7 +76,7 @@ right:CSS_PROP_RIGHT WRAP:css__parse_side
#generic for border_{top, bottom, left, right}_width.c
-border_side_width:op GENERIC: IDENT:( INHERIT: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET ALLOW:unit&UNIT_LENGTH RANGE:<0 LENGTH_UNIT:)
+border_side_width:op GENERIC: IDENT:( INHERIT: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width
border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH WRAP:css__parse_border_side_width
@@ -140,11 +140,11 @@ page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_
page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
-pause_after:CSS_PROP_PAUSE_AFTER IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET ALLOW:unit&(UNIT_TIME|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+pause_after:CSS_PROP_PAUSE_AFTER IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
-pause_before:CSS_PROP_PAUSE_BEFORE IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET ALLOW:unit&(UNIT_TIME|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+pause_before:CSS_PROP_PAUSE_BEFORE IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
-pitch:CSS_PROP_PITCH IDENT:( INHERIT: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW:unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:)
+pitch:CSS_PROP_PITCH IDENT:( INHERIT: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
pitch_range:CSS_PROP_PITCH_RANGE IDENT:INHERIT NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
@@ -168,26 +168,26 @@ table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: AUTO:0,TABLE_LAYOUT_AUTO FIX
text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
-text_indent:CSS_PROP_TEXT_INDENT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
+text_indent:CSS_PROP_TEXT_INDENT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
-vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
+vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
-volume:CSS_PROP_VOLUME IDENT:( INHERIT: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION ALLOW:unit&UNIT_PCT RANGE:<0 LENGTH_UNIT:)
+volume:CSS_PROP_VOLUME IDENT:( INHERIT: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
widows:CSS_PROP_WIDOWS IDENT:INHERIT NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
-width:CSS_PROP_WIDTH IDENT:( INHERIT: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+width:CSS_PROP_WIDTH IDENT:( INHERIT: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
-word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET ALLOW:unit&UNIT_LENGTH LENGTH_UNIT:)
+word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
@@ -202,7 +202,7 @@ column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: AUTO:0,COLUMN_COUNT_AUTO IDE
column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
-column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 ALLOW:unit&UNIT_LENGTH LENGTH_UNIT:)
+column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
@@ -212,7 +212,7 @@ column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH WRAP:css__parse_border_side_width
column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
-column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET ALLOW:unit&UNIT_LENGTH LENGTH_UNIT:)
+column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
@@ -224,7 +224,7 @@ align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: STRETCH:0,ALIGN_ITEMS_STRETCH
align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
-flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) RANGE:<0 LENGTH_UNIT:)
+flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h
index 1e085c5..1e7f821 100644
--- a/src/parse/properties/properties.h
+++ b/src/parse/properties/properties.h
@@ -458,4 +458,117 @@ css_error css__parse_z_index(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
+/** Mapping from property bytecode index to bytecode unit class mask. */
+extern const uint32_t property_unit_mask[CSS_N_PROPERTIES];
+
+#define UNIT_MASK_AZIMUTH (UNIT_ANGLE)
+#define UNIT_MASK_BACKGROUND_ATTACHMENT (0)
+#define UNIT_MASK_BACKGROUND_COLOR (0)
+#define UNIT_MASK_BACKGROUND_IMAGE (0)
+#define UNIT_MASK_BACKGROUND_POSITION (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_BACKGROUND_REPEAT (0)
+#define UNIT_MASK_BORDER_COLLAPSE (0)
+#define UNIT_MASK_BORDER_SPACING (UNIT_LENGTH)
+#define UNIT_MASK_BORDER_SIDE_COLOR (0)
+#define UNIT_MASK_BORDER_SIDE_STYLE (0)
+#define UNIT_MASK_BORDER_SIDE_WIDTH (UNIT_LENGTH)
+#define UNIT_MASK_BOTTOM (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_CAPTION_SIDE (0)
+#define UNIT_MASK_CLEAR (0)
+#define UNIT_MASK_CLIP (UNIT_LENGTH)
+#define UNIT_MASK_COLOR (0)
+#define UNIT_MASK_CONTENT (0)
+#define UNIT_MASK_COUNTER_INCREMENT (0)
+#define UNIT_MASK_COUNTER_RESET (0)
+#define UNIT_MASK_CUE_AFTER (0)
+#define UNIT_MASK_CUE_BEFORE (0)
+#define UNIT_MASK_CURSOR (0)
+#define UNIT_MASK_DIRECTION (0)
+#define UNIT_MASK_DISPLAY (0)
+#define UNIT_MASK_ELEVATION (UNIT_ANGLE)
+#define UNIT_MASK_EMPTY_CELLS (0)
+#define UNIT_MASK_FLOAT (0)
+#define UNIT_MASK_FONT_FAMILY (0)
+#define UNIT_MASK_FONT_SIZE (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_FONT_STYLE (0)
+#define UNIT_MASK_FONT_VARIANT (0)
+#define UNIT_MASK_FONT_WEIGHT (0)
+#define UNIT_MASK_HEIGHT (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_LEFT (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_LETTER_SPACING (UNIT_LENGTH)
+#define UNIT_MASK_LINE_HEIGHT (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_LIST_STYLE_IMAGE (0)
+#define UNIT_MASK_LIST_STYLE_POSITION (0)
+#define UNIT_MASK_LIST_STYLE_TYPE (0)
+#define UNIT_MASK_MARGIN_SIDE (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_MAX_HEIGHT (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_MAX_WIDTH (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_MIN_HEIGHT (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_MIN_WIDTH (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_ORPHANS (0)
+#define UNIT_MASK_OUTLINE_COLOR (0)
+#define UNIT_MASK_OUTLINE_STYLE (0)
+#define UNIT_MASK_OUTLINE_WIDTH (UNIT_LENGTH)
+#define UNIT_MASK_OVERFLOW_X (0)
+#define UNIT_MASK_PADDING_SIDE (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_PAGE_BREAK_AFTER (0)
+#define UNIT_MASK_PAGE_BREAK_BEFORE (0)
+#define UNIT_MASK_PAGE_BREAK_INSIDE (0)
+#define UNIT_MASK_PAUSE_AFTER (UNIT_TIME | UNIT_PCT)
+#define UNIT_MASK_PAUSE_BEFORE (UNIT_TIME | UNIT_PCT)
+#define UNIT_MASK_PITCH_RANGE (0)
+#define UNIT_MASK_PITCH (UNIT_FREQ)
+#define UNIT_MASK_PLAY_DURING (0)
+#define UNIT_MASK_POSITION (0)
+#define UNIT_MASK_QUOTES (0)
+#define UNIT_MASK_RICHNESS (0)
+#define UNIT_MASK_RIGHT (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_SPEAK_HEADER (0)
+#define UNIT_MASK_SPEAK_NUMERAL (0)
+#define UNIT_MASK_SPEAK_PUNCTUATION (0)
+#define UNIT_MASK_SPEAK (0)
+#define UNIT_MASK_SPEECH_RATE (0)
+#define UNIT_MASK_STRESS (0)
+#define UNIT_MASK_TABLE_LAYOUT (0)
+#define UNIT_MASK_TEXT_ALIGN (0)
+#define UNIT_MASK_TEXT_DECORATION (0)
+#define UNIT_MASK_TEXT_INDENT (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_TEXT_TRANSFORM (0)
+#define UNIT_MASK_TOP (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_UNICODE_BIDI (0)
+#define UNIT_MASK_VERTICAL_ALIGN (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_VISIBILITY (0)
+#define UNIT_MASK_VOICE_FAMILY (0)
+#define UNIT_MASK_VOLUME (UNIT_PCT)
+#define UNIT_MASK_WHITE_SPACE (0)
+#define UNIT_MASK_WIDOWS (0)
+#define UNIT_MASK_WIDTH (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_WORD_SPACING (UNIT_LENGTH)
+#define UNIT_MASK_Z_INDEX (0)
+#define UNIT_MASK_OPACITY (0)
+#define UNIT_MASK_BREAK_AFTER (0)
+#define UNIT_MASK_BREAK_BEFORE (0)
+#define UNIT_MASK_BREAK_INSIDE (0)
+#define UNIT_MASK_COLUMN_COUNT (0)
+#define UNIT_MASK_COLUMN_FILL (0)
+#define UNIT_MASK_COLUMN_GAP (UNIT_LENGTH)
+#define UNIT_MASK_COLUMN_RULE_COLOR (0)
+#define UNIT_MASK_COLUMN_RULE_STYLE (0)
+#define UNIT_MASK_COLUMN_RULE_WIDTH (UNIT_LENGTH)
+#define UNIT_MASK_COLUMN_SPAN (0)
+#define UNIT_MASK_COLUMN_WIDTH (UNIT_LENGTH)
+#define UNIT_MASK_WRITING_MODE (0)
+#define UNIT_MASK_OVERFLOW_Y (0)
+#define UNIT_MASK_BOX_SIZING (0)
+#define UNIT_MASK_ALIGN_CONTENT (0)
+#define UNIT_MASK_ALIGN_ITEMS (0)
+#define UNIT_MASK_ALIGN_SELF (0)
+#define UNIT_MASK_FLEX_BASIS (UNIT_LENGTH | UNIT_PCT)
+#define UNIT_MASK_FLEX_DIRECTION (0)
+#define UNIT_MASK_FLEX_GROW (0)
+#define UNIT_MASK_FLEX_SHRINK (0)
+#define UNIT_MASK_FLEX_WRAP (0)
+#define UNIT_MASK_JUSTIFY_CONTENT (0)
+#define UNIT_MASK_ORDER (0)
+
#endif