diff options
27 files changed, 2655 insertions, 115 deletions
diff --git a/docs/Bytecode b/docs/Bytecode index 0107182..0d71d2a 100644 --- a/docs/Bytecode +++ b/docs/Bytecode @@ -1115,5 +1115,128 @@ Opcodes bit 7 clear => Reserved for future expansion bits 0-6: MBZ -64-3ff - Reserved for future expansion. +64 - break-after + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + 00000000 => auto, + 00000001 => always, + 00000010 => avoid, + 00000011 => left, + 00000100 => right, + 00000101 => page, + 00000110 => column, + 00000111 => avoid-page, + 00001000 => avoid-column, + other => Reserved for future expansion. + +65 - break-before + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + 00000000 => auto, + 00000001 => always, + 00000010 => avoid, + 00000011 => left, + 00000100 => right, + 00000101 => page, + 00000110 => column, + 00000111 => avoid-page, + 00001000 => avoid-column, + other => Reserved for future expansion. + +66 - break-inside + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + 00000000 => auto, + 00000001 => avoid, + 00000010 => avoid-page, + 00000011 => avoid-column, + other => Reserved for future expansion. + +67 - column-count + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + bit 7 set => integer follows + bits 0-6: MBZ + bit 7 clear => keywords: + bits 0-6: 0000000 => auto, + other => rffe. + +68 - column-fill + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + 00000000 => balance, + 00000001 => auto, + other => Reserved for future expansion. + +69 - column-gap + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + bit 7 set => length follows + bits 0-6: MBZ + bit 7 clear => keywords: + bits 0-6: 0000000 => normal, + other => rffe. + +6a - column-rule-color + <value> (14bits) : + bits 8-13: MBZ + bit 7 set => colour follows. + bits 0-6: MBZ + bit 7 clear => Reserved for future expansion + bits 0-6: MBZ + +6b - column-rule-style + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + 00000000 => none, + 00000001 => hidden, + 00000010 => dotted, + 00000011 => dashed, + 00000100 => solid, + 00000101 => double, + 00000110 => groove, + 00000111 => ridge, + 00001000 => inset, + 00001001 => outset, + other => Reserved for future expansion. + +6c - column-rule-width + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + bit 7 set => length follows + bits 0-6: MBZ + bit 7 clear => keywords: + bits 0-6: 0000000 => thin, + 0000001 => medium, + 0000010 => thick, + other => rffe. + +6d - column-span + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + 00000000 => none, + 00000001 => all, + other => Reserved for future expansion. + +6e - column-width + <value> (14bits) : + bits 8-13: MBZ + bits 0-7 : + bit 7 set => length follows + bits 0-6: MBZ + bit 7 clear => keywords: + bits 0-6: 0000000 => auto, + other => rffe. + + +6f-3ff - Reserved for future expansion. diff --git a/include/libcss/properties.h b/include/libcss/properties.h index 6b474ce..a998a70 100644 --- a/include/libcss/properties.h +++ b/include/libcss/properties.h @@ -15,105 +15,116 @@ extern "C" enum css_properties_e { CSS_PROP_AZIMUTH = 0x000, - CSS_PROP_BACKGROUND_ATTACHMENT = 0x001, - CSS_PROP_BACKGROUND_COLOR = 0x002, - CSS_PROP_BACKGROUND_IMAGE = 0x003, - CSS_PROP_BACKGROUND_POSITION = 0x004, - CSS_PROP_BACKGROUND_REPEAT = 0x005, - CSS_PROP_BORDER_COLLAPSE = 0x006, + CSS_PROP_BACKGROUND_ATTACHMENT = 0x001, + CSS_PROP_BACKGROUND_COLOR = 0x002, + CSS_PROP_BACKGROUND_IMAGE = 0x003, + CSS_PROP_BACKGROUND_POSITION = 0x004, + CSS_PROP_BACKGROUND_REPEAT = 0x005, + CSS_PROP_BORDER_COLLAPSE = 0x006, CSS_PROP_BORDER_SPACING = 0x007, - CSS_PROP_BORDER_TOP_COLOR = 0x008, + CSS_PROP_BORDER_TOP_COLOR = 0x008, CSS_PROP_BORDER_RIGHT_COLOR = 0x009, CSS_PROP_BORDER_BOTTOM_COLOR = 0x00a, CSS_PROP_BORDER_LEFT_COLOR = 0x00b, - CSS_PROP_BORDER_TOP_STYLE = 0x00c, + CSS_PROP_BORDER_TOP_STYLE = 0x00c, CSS_PROP_BORDER_RIGHT_STYLE = 0x00d, CSS_PROP_BORDER_BOTTOM_STYLE = 0x00e, CSS_PROP_BORDER_LEFT_STYLE = 0x00f, - CSS_PROP_BORDER_TOP_WIDTH = 0x010, + CSS_PROP_BORDER_TOP_WIDTH = 0x010, CSS_PROP_BORDER_RIGHT_WIDTH = 0x011, CSS_PROP_BORDER_BOTTOM_WIDTH = 0x012, CSS_PROP_BORDER_LEFT_WIDTH = 0x013, - CSS_PROP_BOTTOM = 0x014, + CSS_PROP_BOTTOM = 0x014, CSS_PROP_CAPTION_SIDE = 0x015, - CSS_PROP_CLEAR = 0x016, - CSS_PROP_CLIP = 0x017, - CSS_PROP_COLOR = 0x018, - CSS_PROP_CONTENT = 0x019, - CSS_PROP_COUNTER_INCREMENT = 0x01a, - CSS_PROP_COUNTER_RESET = 0x01b, - CSS_PROP_CUE_AFTER = 0x01c, - CSS_PROP_CUE_BEFORE = 0x01d, - CSS_PROP_CURSOR = 0x01e, - CSS_PROP_DIRECTION = 0x01f, - CSS_PROP_DISPLAY = 0x020, - CSS_PROP_ELEVATION = 0x021, - CSS_PROP_EMPTY_CELLS = 0x022, - CSS_PROP_FLOAT = 0x023, - CSS_PROP_FONT_FAMILY = 0x024, - CSS_PROP_FONT_SIZE = 0x025, - CSS_PROP_FONT_STYLE = 0x026, - CSS_PROP_FONT_VARIANT = 0x027, - CSS_PROP_FONT_WEIGHT = 0x028, - CSS_PROP_HEIGHT = 0x029, - CSS_PROP_LEFT = 0x02a, - CSS_PROP_LETTER_SPACING = 0x02b, - CSS_PROP_LINE_HEIGHT = 0x02c, - CSS_PROP_LIST_STYLE_IMAGE = 0x02d, - CSS_PROP_LIST_STYLE_POSITION = 0x02e, - CSS_PROP_LIST_STYLE_TYPE = 0x02f, - CSS_PROP_MARGIN_TOP = 0x030, + CSS_PROP_CLEAR = 0x016, + CSS_PROP_CLIP = 0x017, + CSS_PROP_COLOR = 0x018, + CSS_PROP_CONTENT = 0x019, + CSS_PROP_COUNTER_INCREMENT = 0x01a, + CSS_PROP_COUNTER_RESET = 0x01b, + CSS_PROP_CUE_AFTER = 0x01c, + CSS_PROP_CUE_BEFORE = 0x01d, + CSS_PROP_CURSOR = 0x01e, + CSS_PROP_DIRECTION = 0x01f, + CSS_PROP_DISPLAY = 0x020, + CSS_PROP_ELEVATION = 0x021, + CSS_PROP_EMPTY_CELLS = 0x022, + CSS_PROP_FLOAT = 0x023, + CSS_PROP_FONT_FAMILY = 0x024, + CSS_PROP_FONT_SIZE = 0x025, + CSS_PROP_FONT_STYLE = 0x026, + CSS_PROP_FONT_VARIANT = 0x027, + CSS_PROP_FONT_WEIGHT = 0x028, + CSS_PROP_HEIGHT = 0x029, + CSS_PROP_LEFT = 0x02a, + CSS_PROP_LETTER_SPACING = 0x02b, + CSS_PROP_LINE_HEIGHT = 0x02c, + CSS_PROP_LIST_STYLE_IMAGE = 0x02d, + CSS_PROP_LIST_STYLE_POSITION = 0x02e, + CSS_PROP_LIST_STYLE_TYPE = 0x02f, + CSS_PROP_MARGIN_TOP = 0x030, CSS_PROP_MARGIN_RIGHT = 0x031, CSS_PROP_MARGIN_BOTTOM = 0x032, CSS_PROP_MARGIN_LEFT = 0x033, - CSS_PROP_MAX_HEIGHT = 0x034, - CSS_PROP_MAX_WIDTH = 0x035, - CSS_PROP_MIN_HEIGHT = 0x036, - CSS_PROP_MIN_WIDTH = 0x037, - CSS_PROP_ORPHANS = 0x038, - CSS_PROP_OUTLINE_COLOR = 0x039, - CSS_PROP_OUTLINE_STYLE = 0x03a, - CSS_PROP_OUTLINE_WIDTH = 0x03b, - CSS_PROP_OVERFLOW = 0x03c, - CSS_PROP_PADDING_TOP = 0x03d, + CSS_PROP_MAX_HEIGHT = 0x034, + CSS_PROP_MAX_WIDTH = 0x035, + CSS_PROP_MIN_HEIGHT = 0x036, + CSS_PROP_MIN_WIDTH = 0x037, + CSS_PROP_ORPHANS = 0x038, + CSS_PROP_OUTLINE_COLOR = 0x039, + CSS_PROP_OUTLINE_STYLE = 0x03a, + CSS_PROP_OUTLINE_WIDTH = 0x03b, + CSS_PROP_OVERFLOW = 0x03c, + CSS_PROP_PADDING_TOP = 0x03d, CSS_PROP_PADDING_RIGHT = 0x03e, CSS_PROP_PADDING_BOTTOM = 0x03f, CSS_PROP_PADDING_LEFT = 0x040, - CSS_PROP_PAGE_BREAK_AFTER = 0x041, + CSS_PROP_PAGE_BREAK_AFTER = 0x041, CSS_PROP_PAGE_BREAK_BEFORE = 0x042, - CSS_PROP_PAGE_BREAK_INSIDE = 0x043, - CSS_PROP_PAUSE_AFTER = 0x044, - CSS_PROP_PAUSE_BEFORE = 0x045, - CSS_PROP_PITCH_RANGE = 0x046, - CSS_PROP_PITCH = 0x047, - CSS_PROP_PLAY_DURING = 0x048, - CSS_PROP_POSITION = 0x049, - CSS_PROP_QUOTES = 0x04a, - CSS_PROP_RICHNESS = 0x04b, - CSS_PROP_RIGHT = 0x04c, - CSS_PROP_SPEAK_HEADER = 0x04d, - CSS_PROP_SPEAK_NUMERAL = 0x04e, - CSS_PROP_SPEAK_PUNCTUATION = 0x04f, - CSS_PROP_SPEAK = 0x050, - CSS_PROP_SPEECH_RATE = 0x051, - CSS_PROP_STRESS = 0x052, - CSS_PROP_TABLE_LAYOUT = 0x053, - CSS_PROP_TEXT_ALIGN = 0x054, - CSS_PROP_TEXT_DECORATION = 0x055, - CSS_PROP_TEXT_INDENT = 0x056, - CSS_PROP_TEXT_TRANSFORM = 0x057, - CSS_PROP_TOP = 0x058, - CSS_PROP_UNICODE_BIDI = 0x059, - CSS_PROP_VERTICAL_ALIGN = 0x05a, - CSS_PROP_VISIBILITY = 0x05b, - CSS_PROP_VOICE_FAMILY = 0x05c, - CSS_PROP_VOLUME = 0x05d, - CSS_PROP_WHITE_SPACE = 0x05e, - CSS_PROP_WIDOWS = 0x05f, - CSS_PROP_WIDTH = 0x060, - CSS_PROP_WORD_SPACING = 0x061, + CSS_PROP_PAGE_BREAK_INSIDE = 0x043, + CSS_PROP_PAUSE_AFTER = 0x044, + CSS_PROP_PAUSE_BEFORE = 0x045, + CSS_PROP_PITCH_RANGE = 0x046, + CSS_PROP_PITCH = 0x047, + CSS_PROP_PLAY_DURING = 0x048, + CSS_PROP_POSITION = 0x049, + CSS_PROP_QUOTES = 0x04a, + CSS_PROP_RICHNESS = 0x04b, + CSS_PROP_RIGHT = 0x04c, + CSS_PROP_SPEAK_HEADER = 0x04d, + CSS_PROP_SPEAK_NUMERAL = 0x04e, + CSS_PROP_SPEAK_PUNCTUATION = 0x04f, + CSS_PROP_SPEAK = 0x050, + CSS_PROP_SPEECH_RATE = 0x051, + CSS_PROP_STRESS = 0x052, + CSS_PROP_TABLE_LAYOUT = 0x053, + CSS_PROP_TEXT_ALIGN = 0x054, + CSS_PROP_TEXT_DECORATION = 0x055, + CSS_PROP_TEXT_INDENT = 0x056, + CSS_PROP_TEXT_TRANSFORM = 0x057, + CSS_PROP_TOP = 0x058, + CSS_PROP_UNICODE_BIDI = 0x059, + CSS_PROP_VERTICAL_ALIGN = 0x05a, + CSS_PROP_VISIBILITY = 0x05b, + CSS_PROP_VOICE_FAMILY = 0x05c, + CSS_PROP_VOLUME = 0x05d, + CSS_PROP_WHITE_SPACE = 0x05e, + CSS_PROP_WIDOWS = 0x05f, + CSS_PROP_WIDTH = 0x060, + CSS_PROP_WORD_SPACING = 0x061, CSS_PROP_Z_INDEX = 0x062, CSS_PROP_OPACITY = 0x063, + CSS_PROP_BREAK_AFTER = 0x064, + CSS_PROP_BREAK_BEFORE = 0x065, + CSS_PROP_BREAK_INSIDE = 0x066, + CSS_PROP_COLUMN_COUNT = 0x067, + CSS_PROP_COLUMN_FILL = 0x068, + CSS_PROP_COLUMN_GAP = 0x069, + CSS_PROP_COLUMN_RULE_COLOR = 0x06a, + CSS_PROP_COLUMN_RULE_STYLE = 0x06b, + CSS_PROP_COLUMN_RULE_WIDTH = 0x06c, + CSS_PROP_COLUMN_SPAN = 0x06d, + CSS_PROP_COLUMN_WIDTH = 0x06e, CSS_N_PROPERTIES }; @@ -196,6 +207,40 @@ enum css_bottom_e { CSS_BOTTOM_AUTO = 0x2 }; +enum css_break_after_e { + CSS_BREAK_AFTER_INHERIT = 0x0, + CSS_BREAK_AFTER_AUTO = 0x1, + CSS_BREAK_AFTER_AVOID = 0x2, + CSS_BREAK_AFTER_ALWAYS = 0x3, + CSS_BREAK_AFTER_LEFT = 0x4, + CSS_BREAK_AFTER_RIGHT = 0x5, + CSS_BREAK_AFTER_PAGE = 0x6, + CSS_BREAK_AFTER_COLUMN = 0x7, + CSS_BREAK_AFTER_AVOID_PAGE = 0x8, + CSS_BREAK_AFTER_AVOID_COLUMN = 0x9 +}; + +enum css_break_before_e { + CSS_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT, + CSS_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO, + CSS_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID, + CSS_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS, + CSS_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT, + CSS_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT, + CSS_BREAK_BEFORE_PAGE = CSS_BREAK_AFTER_PAGE, + CSS_BREAK_BEFORE_COLUMN = CSS_BREAK_AFTER_COLUMN, + CSS_BREAK_BEFORE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE, + CSS_BREAK_BEFORE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN +}; + +enum css_break_inside_e { + CSS_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT, + CSS_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO, + CSS_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID, + CSS_BREAK_INSIDE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE, + CSS_BREAK_INSIDE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN +}; + enum css_caption_side_e { CSS_CAPTION_SIDE_INHERIT = 0x0, CSS_CAPTION_SIDE_TOP = 0x1, @@ -221,6 +266,63 @@ enum css_color_e { CSS_COLOR_COLOR = 0x1 }; +enum css_column_count_e { + CSS_COLUMN_COUNT_INHERIT = 0x0, + CSS_COLUMN_COUNT_AUTO = 0x1, + CSS_COLUMN_COUNT_SET = 0x2 +}; + +enum css_column_fill_e { + CSS_COLUMN_FILL_INHERIT = 0x0, + CSS_COLUMN_FILL_BALANCE = 0x1, + CSS_COLUMN_FILL_AUTO = 0x2 +}; + +enum css_column_gap_e { + CSS_COLUMN_GAP_INHERIT = 0x0, + CSS_COLUMN_GAP_NORMAL = 0x1, + CSS_COLUMN_GAP_SET = 0x2 +}; + +enum css_column_rule_color_e { + CSS_COLUMN_RULE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT, + CSS_COLUMN_RULE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR, + CSS_COLUMN_RULE_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR, +}; + +enum css_column_rule_style_e { + CSS_COLUMN_RULE_STYLE_INHERIT = CSS_BORDER_STYLE_INHERIT, + CSS_COLUMN_RULE_STYLE_NONE = CSS_BORDER_STYLE_NONE, + CSS_COLUMN_RULE_STYLE_DOTTED = CSS_BORDER_STYLE_DOTTED, + CSS_COLUMN_RULE_STYLE_DASHED = CSS_BORDER_STYLE_DASHED, + CSS_COLUMN_RULE_STYLE_SOLID = CSS_BORDER_STYLE_SOLID, + CSS_COLUMN_RULE_STYLE_DOUBLE = CSS_BORDER_STYLE_DOUBLE, + CSS_COLUMN_RULE_STYLE_GROOVE = CSS_BORDER_STYLE_GROOVE, + CSS_COLUMN_RULE_STYLE_RIDGE = CSS_BORDER_STYLE_RIDGE, + CSS_COLUMN_RULE_STYLE_INSET = CSS_BORDER_STYLE_INSET, + CSS_COLUMN_RULE_STYLE_OUTSET = CSS_BORDER_STYLE_OUTSET +}; + +enum css_column_rule_width_e { + CSS_COLUMN_RULE_WIDTH_INHERIT = CSS_BORDER_WIDTH_INHERIT, + CSS_COLUMN_RULE_WIDTH_THIN = CSS_BORDER_WIDTH_THIN, + CSS_COLUMN_RULE_WIDTH_MEDIUM = CSS_BORDER_WIDTH_MEDIUM, + CSS_COLUMN_RULE_WIDTH_THICK = CSS_BORDER_WIDTH_THICK, + CSS_COLUMN_RULE_WIDTH_WIDTH = CSS_BORDER_WIDTH_WIDTH +}; + +enum css_column_span_e { + CSS_COLUMN_SPAN_INHERIT = 0x0, + CSS_COLUMN_SPAN_NONE = 0x1, + CSS_COLUMN_SPAN_ALL = 0x2 +}; + +enum css_column_width_e { + CSS_COLUMN_WIDTH_INHERIT = 0x0, + CSS_COLUMN_WIDTH_AUTO = 0x1, + CSS_COLUMN_WIDTH_SET = 0x2 +}; + enum css_content_e { CSS_CONTENT_INHERIT = 0x0, CSS_CONTENT_NONE = 0x1, @@ -489,27 +591,27 @@ enum css_padding_e { }; enum css_page_break_after_e { - CSS_PAGE_BREAK_AFTER_INHERIT = 0x0, - CSS_PAGE_BREAK_AFTER_AUTO = 0x1, - CSS_PAGE_BREAK_AFTER_AVOID = 0x2, - CSS_PAGE_BREAK_AFTER_ALWAYS = 0x3, - CSS_PAGE_BREAK_AFTER_LEFT = 0x4, - CSS_PAGE_BREAK_AFTER_RIGHT = 0x5 + CSS_PAGE_BREAK_AFTER_INHERIT = CSS_BREAK_AFTER_INHERIT, + CSS_PAGE_BREAK_AFTER_AUTO = CSS_BREAK_AFTER_AUTO, + CSS_PAGE_BREAK_AFTER_AVOID = CSS_BREAK_AFTER_AVOID, + CSS_PAGE_BREAK_AFTER_ALWAYS = CSS_BREAK_AFTER_ALWAYS, + CSS_PAGE_BREAK_AFTER_LEFT = CSS_BREAK_AFTER_LEFT, + CSS_PAGE_BREAK_AFTER_RIGHT = CSS_BREAK_AFTER_RIGHT }; - + enum css_page_break_before_e { - CSS_PAGE_BREAK_BEFORE_INHERIT = CSS_PAGE_BREAK_AFTER_INHERIT, - CSS_PAGE_BREAK_BEFORE_AUTO = CSS_PAGE_BREAK_AFTER_AUTO, - CSS_PAGE_BREAK_BEFORE_AVOID = CSS_PAGE_BREAK_AFTER_AVOID, - CSS_PAGE_BREAK_BEFORE_ALWAYS = CSS_PAGE_BREAK_AFTER_ALWAYS, - CSS_PAGE_BREAK_BEFORE_LEFT = CSS_PAGE_BREAK_AFTER_LEFT, - CSS_PAGE_BREAK_BEFORE_RIGHT = CSS_PAGE_BREAK_AFTER_RIGHT + CSS_PAGE_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT, + CSS_PAGE_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO, + CSS_PAGE_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID, + CSS_PAGE_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS, + CSS_PAGE_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT, + CSS_PAGE_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT }; enum css_page_break_inside_e { - CSS_PAGE_BREAK_INSIDE_INHERIT = CSS_PAGE_BREAK_AFTER_INHERIT, - CSS_PAGE_BREAK_INSIDE_AUTO = CSS_PAGE_BREAK_AFTER_AUTO, - CSS_PAGE_BREAK_INSIDE_AVOID = CSS_PAGE_BREAK_AFTER_AVOID + CSS_PAGE_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT, + CSS_PAGE_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO, + CSS_PAGE_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID }; enum css_position_e { diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h index 95ab263..a0d38d4 100644 --- a/src/bytecode/opcodes.h +++ b/src/bytecode/opcodes.h @@ -103,6 +103,37 @@ enum op_bottom { BOTTOM_AUTO = 0x0000 }; +enum op_break_after { + BREAK_AFTER_AUTO = 0x0000, + BREAK_AFTER_ALWAYS = 0x0001, + BREAK_AFTER_AVOID = 0x0002, + BREAK_AFTER_LEFT = 0x0003, + BREAK_AFTER_RIGHT = 0x0004, + BREAK_AFTER_PAGE = 0x0005, + BREAK_AFTER_COLUMN = 0x0006, + BREAK_AFTER_AVOID_PAGE = 0x0007, + BREAK_AFTER_AVOID_COLUMN = 0x0008 +}; + +enum op_break_before { + BREAK_BEFORE_AUTO = 0x0000, + BREAK_BEFORE_ALWAYS = 0x0001, + BREAK_BEFORE_AVOID = 0x0002, + BREAK_BEFORE_LEFT = 0x0003, + BREAK_BEFORE_RIGHT = 0x0004, + BREAK_BEFORE_PAGE = 0x0005, + BREAK_BEFORE_COLUMN = 0x0006, + BREAK_BEFORE_AVOID_PAGE = 0x0007, + BREAK_BEFORE_AVOID_COLUMN = 0x0008 +}; + +enum op_break_inside { + BREAK_INSIDE_AUTO = 0x0000, + BREAK_INSIDE_AVOID = 0x0001, + BREAK_INSIDE_AVOID_PAGE = 0x0002, + BREAK_INSIDE_AVOID_COLUMN = 0x0003 +}; + enum op_caption_side { CAPTION_SIDE_TOP = 0x0000, CAPTION_SIDE_BOTTOM = 0x0001 @@ -133,6 +164,58 @@ enum op_color { COLOR_SET = 0x0080 }; +enum op_column_count { + COLUMN_COUNT_AUTO = 0x0000, + COLUMN_COUNT_SET = 0x0080 +}; + +enum op_column_fill { + COLUMN_FILL_BALANCE = 0x0000, + COLUMN_FILL_AUTO = 0x0001 +}; + +enum op_column_gap { + COLUMN_GAP_NORMAL = 0x0000, + COLUMN_GAP_SET = 0x0080 +}; + +enum op_column_rule_color { + COLUMN_RULE_COLOR_TRANSPARENT = 0x0000, + COLUMN_RULE_COLOR_CURRENT_COLOR = 0x0001, + COLUMN_RULE_COLOR_INVERT = 0x0002, + COLUMN_RULE_COLOR_SET = 0x0080 +}; + +enum op_column_rule_style { + COLUMN_RULE_STYLE_NONE = BORDER_STYLE_NONE, + COLUMN_RULE_STYLE_HIDDEN = BORDER_STYLE_HIDDEN, + COLUMN_RULE_STYLE_DOTTED = BORDER_STYLE_DOTTED, + COLUMN_RULE_STYLE_DASHED = BORDER_STYLE_DASHED, + COLUMN_RULE_STYLE_SOLID = BORDER_STYLE_SOLID, + COLUMN_RULE_STYLE_DOUBLE = BORDER_STYLE_DOUBLE, + COLUMN_RULE_STYLE_GROOVE = BORDER_STYLE_GROOVE, + COLUMN_RULE_STYLE_RIDGE = BORDER_STYLE_RIDGE, + COLUMN_RULE_STYLE_INSET = BORDER_STYLE_INSET, + COLUMN_RULE_STYLE_OUTSET = BORDER_STYLE_OUTSET +}; + +enum op_column_rule_width { + COLUMN_RULE_WIDTH_SET = BORDER_WIDTH_SET, + COLUMN_RULE_WIDTH_THIN = BORDER_WIDTH_THIN, + COLUMN_RULE_WIDTH_MEDIUM = BORDER_WIDTH_MEDIUM, + COLUMN_RULE_WIDTH_THICK = BORDER_WIDTH_THICK +}; + +enum op_column_span { + COLUMN_SPAN_NONE = 0x0000, + COLUMN_SPAN_ALL = 0x0001 +}; + +enum op_column_width { + COLUMN_WIDTH_AUTO = 0x0000, + COLUMN_WIDTH_SET = 0x0080 +}; + enum op_content { CONTENT_STRING = 0x0080, CONTENT_URI = 0x0081, diff --git a/src/parse/important.c b/src/parse/important.c index 8587afd..8ed51d9 100644 --- a/src/parse/important.c +++ b/src/parse/important.c @@ -99,8 +99,11 @@ void css__make_style_important(css_style *style) case CSS_PROP_BORDER_BOTTOM_COLOR: case CSS_PROP_BORDER_LEFT_COLOR: case CSS_PROP_BACKGROUND_COLOR: + case CSS_PROP_COLUMN_RULE_COLOR: assert(BACKGROUND_COLOR_SET == BORDER_COLOR_SET); + assert(BACKGROUND_COLOR_SET == + COLUMN_RULE_COLOR_SET); if (value == BACKGROUND_COLOR_SET) offset++; /* colour */ @@ -137,7 +140,10 @@ void css__make_style_important(css_style *style) case CSS_PROP_BORDER_BOTTOM_WIDTH: case CSS_PROP_BORDER_LEFT_WIDTH: case CSS_PROP_OUTLINE_WIDTH: + case CSS_PROP_COLUMN_RULE_WIDTH: assert(BORDER_WIDTH_SET == OUTLINE_WIDTH_SET); + assert(BORDER_WIDTH_SET == + COLUMN_RULE_WIDTH_SET); if (value == BORDER_WIDTH_SET) offset += 2; /* length + units */ @@ -153,12 +159,16 @@ void css__make_style_important(css_style *style) case CSS_PROP_TOP: case CSS_PROP_HEIGHT: case CSS_PROP_WIDTH: + case CSS_PROP_COLUMN_WIDTH: + case CSS_PROP_COLUMN_GAP: assert(BOTTOM_SET == LEFT_SET); assert(BOTTOM_SET == RIGHT_SET); assert(BOTTOM_SET == TOP_SET); assert(BOTTOM_SET == HEIGHT_SET); assert(BOTTOM_SET == MARGIN_SET); assert(BOTTOM_SET == WIDTH_SET); + assert(BOTTOM_SET == COLUMN_WIDTH_SET); + assert(BOTTOM_SET == COLUMN_GAP_SET); if (value == BOTTOM_SET) offset += 2; /* length + units */ @@ -186,6 +196,11 @@ void css__make_style_important(css_style *style) offset++; /* colour */ break; + case CSS_PROP_COLUMN_COUNT: + if (value == COLUMN_COUNT_SET) + offset++; /* colour */ + break; + case CSS_PROP_CONTENT: while (value != CONTENT_NORMAL && value != CONTENT_NONE) { diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c index bc2f225..9918366 100644 --- a/src/parse/properties/properties.c +++ b/src/parse/properties/properties.c @@ -42,10 +42,21 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] = css__parse_border_top_width, css__parse_border_width, css__parse_bottom, + 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_column_count, + css__parse_column_fill, + css__parse_column_gap, + 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, diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen index 016d7a0..5a4ebe0 100644 --- a/src/parse/properties/properties.gen +++ b/src/parse/properties/properties.gen @@ -188,3 +188,27 @@ width:CSS_PROP_WIDTH IDENT:( INHERIT: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UN word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT LENGTH_UNIT:) z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:) + + +break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:) + +break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:) + +break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:) + +column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:) + +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 DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT LENGTH_UNIT:) + +column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: IDENT:) COLOR:COLUMN_RULE_COLOR_SET + +column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:) + +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 DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT LENGTH_UNIT:) + diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h index 6992f18..b3d2eb4 100644 --- a/src/parse/properties/properties.h +++ b/src/parse/properties/properties.h @@ -112,6 +112,15 @@ css_error css__parse_border_width(css_language *c, css_error css__parse_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); +css_error css__parse_break_after(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_break_before(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_break_inside(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); css_error css__parse_caption_side(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); @@ -124,6 +133,30 @@ css_error css__parse_clip(css_language *c, css_error css__parse_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); +css_error css__parse_column_count(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_column_fill(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_column_gap(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_column_rule_color(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_column_rule_style(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_column_rule_width(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_column_span(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_column_width(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); css_error css__parse_content(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c index dea8816..9ea4707 100644 --- a/src/parse/propstrings.c +++ b/src/parse/propstrings.c @@ -105,10 +105,21 @@ const stringmap_entry stringmap[LAST_KNOWN] = { { "border-top-width", SLEN("border-top-width") }, { "border-width", SLEN("border-width") }, { "bottom", SLEN("bottom") }, + { "break-after", SLEN("break-after") }, + { "break-before", SLEN("break-before") }, + { "break-inside", SLEN("break-inside") }, { "caption-side", SLEN("caption-side") }, { "clear", SLEN("clear") }, { "clip", SLEN("clip") }, { "color", SLEN("color") }, + { "column-count", SLEN("column-count") }, + { "column-fill", SLEN("column-fill") }, + { "column-gap", SLEN("column-gap") }, + { "column-rule-color", SLEN("column-rule-color") }, + { "column-rule-style", SLEN("column-rule-style") }, + { "column-rule-width", SLEN("column-rule_width") }, + { "column-span", SLEN("column-span") }, + { "column-width", SLEN("column-width") }, { "content", SLEN("content") }, { "counter-increment", SLEN("counter-increment") }, { "counter-reset", SLEN("counter-reset") }, @@ -382,6 +393,10 @@ const stringmap_entry stringmap[LAST_KNOWN] = { { "opentype", SLEN("opentype") }, { "embedded-opentype", SLEN("embedded-opentype") }, { "svg", SLEN("svg") }, + { "column", SLEN("column") }, + { "avoid-page", SLEN("avoid_page") }, + { "avoid-column", SLEN("avoid-column") }, + { "balance", SLEN("balance") }, { "aliceblue", SLEN("aliceblue") }, { "antiquewhite", SLEN("antiquewhite") }, diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h index 16affcd..ffa69ee 100644 --- a/src/parse/propstrings.h +++ b/src/parse/propstrings.h @@ -42,23 +42,25 @@ enum { BORDER_LEFT_WIDTH, BORDER_RIGHT, BORDER_RIGHT_COLOR, BORDER_RIGHT_STYLE, BORDER_RIGHT_WIDTH, BORDER_SPACING, BORDER_STYLE, BORDER_TOP, BORDER_TOP_COLOR, BORDER_TOP_STYLE, - BORDER_TOP_WIDTH, BORDER_WIDTH, BOTTOM, CAPTION_SIDE, CLEAR, - CLIP, COLOR, CONTENT, COUNTER_INCREMENT, COUNTER_RESET, CUE, CUE_AFTER, - CUE_BEFORE, CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, - LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT, - FONT_WEIGHT, HEIGHT, LEFT, LETTER_SPACING, LINE_HEIGHT, - LIST_STYLE, LIST_STYLE_IMAGE, LIST_STYLE_POSITION, LIST_STYLE_TYPE, - MARGIN, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, - MAX_HEIGHT, MAX_WIDTH, MIN_HEIGHT, MIN_WIDTH, OPACITY, ORPHANS, - OUTLINE, OUTLINE_COLOR, OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, - PADDING, PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOP, - PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, PAGE_BREAK_INSIDE, - PAUSE, PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH, PLAY_DURING, - POSITION, QUOTES, RICHNESS, RIGHT, SPEAK_HEADER, SPEAK_NUMERAL, - SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE, STRESS, TABLE_LAYOUT, - TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM, TOP, - UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME, - WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, Z_INDEX, + BORDER_TOP_WIDTH, BORDER_WIDTH, BOTTOM, BREAK_AFTER, BREAK_BEFORE, + BREAK_INSIDE, CAPTION_SIDE, CLEAR, CLIP, COLOR, COLUMN_COUNT, + COLUMN_FILL, COLUMN_GAP, COLUMN_RULE_COLOR, COLUMN_RULE_STYLE, + COLUMN_RULE_WIDTH, COLUMN_SPAN, COLUMN_WIDTH, CONTENT, + COUNTER_INCREMENT, COUNTER_RESET, CUE, CUE_AFTER, CUE_BEFORE, CURSOR, + DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, LIBCSS_FLOAT, FONT, + FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT, FONT_WEIGHT, HEIGHT, + LEFT, LETTER_SPACING, LINE_HEIGHT, LIST_STYLE, LIST_STYLE_IMAGE, + LIST_STYLE_POSITION, LIST_STYLE_TYPE, MARGIN, MARGIN_BOTTOM, + MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, MAX_HEIGHT, MAX_WIDTH, + MIN_HEIGHT, MIN_WIDTH, OPACITY, ORPHANS, OUTLINE, OUTLINE_COLOR, + OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, PADDING, PADDING_BOTTOM, + PADDING_LEFT, PADDING_RIGHT, PADDING_TOP, PAGE_BREAK_AFTER, + PAGE_BREAK_BEFORE, PAGE_BREAK_INSIDE, PAUSE, PAUSE_AFTER, PAUSE_BEFORE, + PITCH_RANGE, PITCH, PLAY_DURING, POSITION, QUOTES, RICHNESS, RIGHT, + SPEAK_HEADER, SPEAK_NUMERAL, SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE, + STRESS, TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT, + TEXT_TRANSFORM, TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, + VOICE_FAMILY, VOLUME, WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, Z_INDEX, LAST_PROP = Z_INDEX, @@ -89,7 +91,8 @@ enum { FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE, LINE_THROUGH, BLINK, RGB, RGBA, HSL, HSLA, LIBCSS_LEFT, LIBCSS_CENTER, LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL, - FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, + FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN, + AVOID_PAGE, AVOID_COLUMN, BALANCE, /* Named colours */ FIRST_COLOUR, diff --git a/src/select/dispatch.c b/src/select/dispatch.c index fe17d70..85c1289 100644 --- a/src/select/dispatch.c +++ b/src/select/dispatch.c @@ -517,5 +517,60 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = { PROPERTY_FUNCS(opacity), 0, GROUP_NORMAL + }, + { + PROPERTY_FUNCS(break_after), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(break_before), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(break_inside), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_count), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_fill), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_gap), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_rule_color), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_rule_style), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_rule_width), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_span), + 0, + GROUP_NORMAL + }, + { + PROPERTY_FUNCS(column_width), + 0, + GROUP_NORMAL } }; diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile index b26939c..f9e6580 100644 --- a/src/select/properties/Makefile +++ b/src/select/properties/Makefile @@ -21,10 +21,21 @@ border_top_color.c \ border_top_style.c \ border_top_width.c \ bottom.c \ +break_after.c \ +break_before.c \ +break_inside.c \ caption_side.c \ clear.c \ clip.c \ color.c \ +column_count.c \ +column_fill.c \ +column_gap.c \ +column_rule_color.c \ +column_rule_style.c \ +column_rule_width.c \ +column_span.c \ +column_width.c \ content.c \ counter_increment.c \ counter_reset.c \ diff --git a/src/select/properties/break_after.c b/src/select/properties/break_after.c new file mode 100644 index 0000000..8a2cffc --- /dev/null +++ b/src/select/properties/break_after.c @@ -0,0 +1,72 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_break_after(uint32_t opv, css_style *style, + css_select_state *state) +{ + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case BREAK_AFTER_AUTO: + case BREAK_AFTER_ALWAYS: + case BREAK_AFTER_AVOID: + case BREAK_AFTER_LEFT: + case BREAK_AFTER_RIGHT: + case BREAK_AFTER_PAGE: + case BREAK_AFTER_COLUMN: + case BREAK_AFTER_AVOID_PAGE: + case BREAK_AFTER_AVOID_COLUMN: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_break_after_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_break_after(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_break_after(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/break_before.c b/src/select/properties/break_before.c new file mode 100644 index 0000000..73137f4 --- /dev/null +++ b/src/select/properties/break_before.c @@ -0,0 +1,72 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_break_before(uint32_t opv, css_style *style, + css_select_state *state) +{ + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case BREAK_BEFORE_AUTO: + case BREAK_BEFORE_ALWAYS: + case BREAK_BEFORE_AVOID: + case BREAK_BEFORE_LEFT: + case BREAK_BEFORE_RIGHT: + case BREAK_BEFORE_PAGE: + case BREAK_BEFORE_COLUMN: + case BREAK_BEFORE_AVOID_PAGE: + case BREAK_BEFORE_AVOID_COLUMN: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_break_before_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_break_before(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_break_before(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/break_inside.c b/src/select/properties/break_inside.c new file mode 100644 index 0000000..82cf09c --- /dev/null +++ b/src/select/properties/break_inside.c @@ -0,0 +1,67 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_break_inside(uint32_t opv, css_style *style, + css_select_state *state) +{ + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case BREAK_INSIDE_AUTO: + case BREAK_INSIDE_AVOID: + case BREAK_INSIDE_AVOID_PAGE: + case BREAK_INSIDE_AVOID_COLUMN: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_break_inside_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_break_inside(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_break_inside(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c new file mode 100644 index 0000000..5fe7465 --- /dev/null +++ b/src/select/properties/column_count.c @@ -0,0 +1,68 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_count(uint32_t opv, css_style *style, + css_select_state *state) +{ + css_fixed count = 0; + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_COUNT_SET: + count = *((css_fixed *) style->bytecode); + advance_bytecode(style, sizeof(count)); + break; + case COLUMN_COUNT_AUTO: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_count_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_count(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_count(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c new file mode 100644 index 0000000..2322c03 --- /dev/null +++ b/src/select/properties/column_fill.c @@ -0,0 +1,65 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_fill(uint32_t opv, css_style *style, + css_select_state *state) +{ + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_FILL_BALANCE: + case COLUMN_FILL_AUTO: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_fill_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_fill(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_fill(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c new file mode 100644 index 0000000..8b7a841 --- /dev/null +++ b/src/select/properties/column_gap.c @@ -0,0 +1,71 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_gap(uint32_t opv, css_style *style, + css_select_state *state) +{ + css_fixed length = 0; + uint32_t unit = UNIT_PX; + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_GAP_SET: + length = *((css_fixed *) style->bytecode); + advance_bytecode(style, sizeof(length)); + unit = *((uint32_t *) style->bytecode); + advance_bytecode(style, sizeof(unit)); + break; + case COLUMN_GAP_NORMAL: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_gap_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_gap(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_gap(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c new file mode 100644 index 0000000..933cb60 --- /dev/null +++ b/src/select/properties/column_rule_color.c @@ -0,0 +1,69 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_rule_color(uint32_t opv, css_style *style, + css_select_state *state) +{ + css_color color = 0; + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_RULE_COLOR_SET: + color = *((css_fixed *) style->bytecode); + advance_bytecode(style, sizeof(color)); + break; + case COLUMN_RULE_COLOR_TRANSPARENT: + case COLUMN_RULE_COLOR_CURRENT_COLOR: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_rule_color_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_rule_color(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_rule_color(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_rule_style.c b/src/select/properties/column_rule_style.c new file mode 100644 index 0000000..ba558a2 --- /dev/null +++ b/src/select/properties/column_rule_style.c @@ -0,0 +1,73 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_rule_style(uint32_t opv, css_style *style, + css_select_state *state) +{ + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_RULE_STYLE_NONE: + case COLUMN_RULE_STYLE_HIDDEN: + case COLUMN_RULE_STYLE_DOTTED: + case COLUMN_RULE_STYLE_DASHED: + case COLUMN_RULE_STYLE_SOLID: + case COLUMN_RULE_STYLE_DOUBLE: + case COLUMN_RULE_STYLE_GROOVE: + case COLUMN_RULE_STYLE_RIDGE: + case COLUMN_RULE_STYLE_INSET: + case COLUMN_RULE_STYLE_OUTSET: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_rule_style_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_rule_style(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_rule_style(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_rule_width.c b/src/select/properties/column_rule_width.c new file mode 100644 index 0000000..2c0ca0d --- /dev/null +++ b/src/select/properties/column_rule_width.c @@ -0,0 +1,73 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_rule_width(uint32_t opv, css_style *style, + css_select_state *state) +{ + css_fixed length = 0; + uint32_t unit = UNIT_PX; + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_RULE_WIDTH_SET: + length = *((css_fixed *) style->bytecode); + advance_bytecode(style, sizeof(length)); + unit = *((uint32_t *) style->bytecode); + advance_bytecode(style, sizeof(unit)); + break; + case COLUMN_RULE_WIDTH_THIN: + case COLUMN_RULE_WIDTH_MEDIUM: + case COLUMN_RULE_WIDTH_THICK: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_rule_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_rule_width(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_rule_width(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c new file mode 100644 index 0000000..92048a0 --- /dev/null +++ b/src/select/properties/column_span.c @@ -0,0 +1,65 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_span(uint32_t opv, css_style *style, + css_select_state *state) +{ + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_SPAN_NONE: + case COLUMN_SPAN_ALL: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_span_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_span(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_span(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c new file mode 100644 index 0000000..fd053d9 --- /dev/null +++ b/src/select/properties/column_width.c @@ -0,0 +1,71 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_column_width(uint32_t opv, css_style *style, + css_select_state *state) +{ + css_fixed length = 0; + uint32_t unit = UNIT_PX; + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case COLUMN_WIDTH_SET: + length = *((css_fixed *) style->bytecode); + advance_bytecode(style, sizeof(length)); + unit = *((uint32_t *) style->bytecode); + advance_bytecode(style, sizeof(unit)); + break; + case COLUMN_WIDTH_AUTO: + /** \todo convert to public values */ + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + /** \todo set computed elevation */ + } + + return CSS_OK; +} + +css_error css__set_column_width_from_hint(const css_hint *hint, + css_computed_style *style) +{ + UNUSED(hint); + UNUSED(style); + + return CSS_OK; +} + +css_error css__initial_column_width(css_select_state *state) +{ + UNUSED(state); + + return CSS_OK; +} + +css_error css__compose_column_width(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + UNUSED(parent); + UNUSED(child); + UNUSED(result); + + return CSS_OK; +} + diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h index 2f3fca4..d0bb648 100644 --- a/src/select/properties/properties.h +++ b/src/select/properties/properties.h @@ -42,10 +42,21 @@ PROPERTY_FUNCS(border_right_width); PROPERTY_FUNCS(border_bottom_width); PROPERTY_FUNCS(border_left_width); PROPERTY_FUNCS(bottom); +PROPERTY_FUNCS(break_after); +PROPERTY_FUNCS(break_before); +PROPERTY_FUNCS(break_inside); PROPERTY_FUNCS(caption_side); PROPERTY_FUNCS(clear); PROPERTY_FUNCS(clip); PROPERTY_FUNCS(color); +PROPERTY_FUNCS(column_count); +PROPERTY_FUNCS(column_fill); +PROPERTY_FUNCS(column_gap); +PROPERTY_FUNCS(column_rule_color); +PROPERTY_FUNCS(column_rule_style); +PROPERTY_FUNCS(column_rule_width); +PROPERTY_FUNCS(column_span); +PROPERTY_FUNCS(column_width); PROPERTY_FUNCS(content); PROPERTY_FUNCS(counter_increment); PROPERTY_FUNCS(counter_reset); diff --git a/test/data/parse/properties.dat b/test/data/parse/properties.dat index 29b5eb6..efe06ee 100644 --- a/test/data/parse/properties.dat +++ b/test/data/parse/properties.dat @@ -3818,3 +3818,447 @@ p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " at | 0x02000062 0xfffffc00 #reset +## +## 64 - break-after +## + +#data +* { break-after: auto; } +#errors +#expected +| 1 * +| 0x00000064 +#reset + +#data +* { break-after: always; } +#errors +#expected +| 1 * +| 0x00040064 +#reset + +#data +* { break-after: avoid; } +#errors +#expected +| 1 * +| 0x00080064 +#reset + +#data +* { break-after: left; } +#errors +#expected +| 1 * +| 0x000c0064 +#reset + +#data +* { break-after: right; } +#errors +#expected +| 1 * +| 0x00100064 +#reset + +#data +* { break-after: page; } +#errors +#expected +| 1 * +| 0x00140064 +#reset + +#data +* { break-after: column; } +#errors +#expected +| 1 * +| 0x00180064 +#reset + +#data +* { break-after: avoid-page; } +#errors +#expected +| 1 * +| 0x001c0064 +#reset + +#data +* { break-after: avoid-column; } +#errors +#expected +| 1 * +| 0x00200064 +#reset + +## +## 65 - break-before +## + +#data +* { break-before: auto; } +#errors +#expected +| 1 * +| 0x00000065 +#reset + +#data +* { break-before: always; } +#errors +#expected +| 1 * +| 0x00040065 +#reset + +#data +* { break-before: avoid; } +#errors +#expected +| 1 * +| 0x00080065 +#reset + +#data +* { break-before: left; } +#errors +#expected +| 1 * +| 0x000c0065 +#reset + +#data +* { break-before: right; } +#errors +#expected +| 1 * +| 0x00100065 +#reset + +#data +* { break-before: page; } +#errors +#expected +| 1 * +| 0x00140065 +#reset + +#data +* { break-before: column; } +#errors +#expected +| 1 * +| 0x00180065 +#reset + +#data +* { break-before: avoid-page; } +#errors +#expected +| 1 * +| 0x001c0065 +#reset + +#data +* { break-before: avoid-column; } +#errors +#expected +| 1 * +| 0x00200065 +#reset + +## +## 66 - break-inside +## + +#data +* { break-inside: auto; } +#errors +#expected +| 1 * +| 0x00000066 +#reset + +#data +* { break-inside: avoid; } +#errors +#expected +| 1 * +| 0x00040066 +#reset + +#data +* { break-inside: avoid-page; } +#errors +#expected +| 1 * +| 0x00080066 +#reset + +#data +* { break-inside: avoid-column; } +#errors +#expected +| 1 * +| 0x000c0066 +#reset + +## +## 67 - column-count +## + +#data +* { column-count: auto; } +#errors +#expected +| 1 * +| 0x00000067 +#reset + +#data +* { column-count: 2; } +#errors +#expected +| 1 * +| 0x02000067 0x00000800 +#reset + +## +## 68 - column-fill +## + +#data +* { column-fill: balance; } +#errors +#expected +| 1 * +| 0x00000068 +#reset + +#data +* { column-fill: auto; } +#errors +#expected +| 1 * +| 0x00040068 +#reset + +## +## 69 - column-gap +## + +#data +* { column-gap: normal; } +#errors +#expected +| 1 * +| 0x00000069 +#reset + +#data +* { column-gap: 0.1em; } +#errors +#expected +| 1 * +| 0x02000069 0x00000066 0x00000002 +#reset + +## +## 6a - column-rule-color +## + +#data +* { column-rule-color: #BBC; } +#errors +#expected +| 1 * +| 0x0200006a 0xffbbbbcc +#reset + +#data +* { column-rule-color: currentColor } +#errors +#expected +| 1 * +| 0x0004006a +#reset + +#data +* { column-rule-color: transparent } +#errors +#expected +| 1 * +| 0x0000006a +#reset + +## +## 6b - column-rule-style +## + +#data +* { column-rule-style: none; } +#errors +#expected +| 1 * +| 0x0000006b +#reset + +#data +* { column-rule-style: hidden; } +#errors +#expected +| 1 * +| 0x0004006b +#reset + +#data +* { column-rule-style: dotted; } +#errors +#expected +| 1 * +| 0x0008006b +#reset + +#data +* { column-rule-style: dashed; } +#errors +#expected +| 1 * +| 0x000c006b +#reset + +#data +* { column-rule-style: solid; } +#errors +#expected +| 1 * +| 0x0010006b +#reset + +#data +* { column-rule-style: double; } +#errors +#expected +| 1 * +| 0x0014006b +#reset + +#data +* { column-rule-style: groove; } +#errors +#expected +| 1 * +| 0x0018006b +#reset + +#data +* { column-rule-style: ridge; } +#errors +#expected +| 1 * +| 0x001c006b +#reset + +#data +* { column-rule-style: inset; } +#errors +#expected +| 1 * +| 0x0020006b +#reset + +#data +* { column-rule-style: outset; } +#errors +#expected +| 1 * +| 0x0024006b +#reset + +## +## 6c - column-rule-width +## + +#data +* { column-rule-width: thin; } +#errors +#expected +| 1 * +| 0x0000006c +#reset + +#data +* { column-rule-width: medium; } +#errors +#expected +| 1 * +| 0x0004006c +#reset + +#data +* { column-rule-width: thick; } +#errors +#expected +| 1 * +| 0x0008006c +#reset + +#data +* { column-rule-width: 3px; } +#errors +#expected +| 1 * +| 0x0200006c 0x00000c00 0x00000000 +#reset + +#data +* { column-rule-width: 0; } +#errors +#expected +| 1 * +| 0x0200006c 0x00000000 0x00000000 +#reset + +## +## 6d - column-span +## + +#data +* { column-span: none; } +#errors +#expected +| 1 * +| 0x0000006d +#reset + +#data +* { column-span: all; } +#errors +#expected +| 1 * +| 0x0004006d +#reset + +## +## 6e - column-width +## + +#data +* { column-width: auto; } +#errors +#expected +| 1 * +| 0x0000006e +#reset + +#data +* { column-width: 0.1em; } +#errors +#expected +| 1 * +| 0x0200006e 0x00000066 0x00000002 +#reset + diff --git a/test/data/parse2/INDEX b/test/data/parse2/INDEX index e51befb..651a87e 100644 --- a/test/data/parse2/INDEX +++ b/test/data/parse2/INDEX @@ -17,4 +17,5 @@ font.dat Font property tests list.dat List property tests margin.dat Margin property tests outline.dat Outline property tests -padding.dat Padding property tests
\ No newline at end of file +padding.dat Padding property tests +multicol.dat Multi-column layout property tests
\ No newline at end of file diff --git a/test/data/parse2/multicol.dat b/test/data/parse2/multicol.dat new file mode 100644 index 0000000..d9a7650 --- /dev/null +++ b/test/data/parse2/multicol.dat @@ -0,0 +1,665 @@ +#data +* { break-after: #fff inherit; } +#errors +#expected +| * +#reset + +#data +* { break-after: 10; } +#errors +#expected +| * +#reset + +#data +* { break-after: 10em !important; } +#errors +#expected +| * +#reset + +#data +* { break-after: column; } +#errors +#expected +| * +| break-after: column +#reset + +#data +* { break-after: page !important; } +#errors +#expected +| * +| break-after: page !important +#reset + +#data +* { break-after: inherit; } +#errors +#expected +| * +| break-after: inherit +#reset + +#data +* { break-after: normal; } +#errors +#expected +| * +#reset + +#data +* { break-before: #fff inherit; } +#errors +#expected +| * +#reset + +#data +* { break-before: 10; } +#errors +#expected +| * +#reset + +#data +* { break-before: 10em !important; } +#errors +#expected +| * +#reset + +#data +* { break-before: column; } +#errors +#expected +| * +| break-before: column +#reset + +#data +* { break-before: page !important; } +#errors +#expected +| * +| break-before: page !important +#reset + +#data +* { break-before: inherit; } +#errors +#expected +| * +| break-before: inherit +#reset + +#data +* { break-before: normal; } +#errors +#expected +| * +#reset + +#data +* { break-inside: #fff inherit; } +#errors +#expected +| * +#reset + +#data +* { break-inside: 10; } +#errors +#expected +| * +#reset + +#data +* { break-inside: 10em !important; } +#errors +#expected +| * +#reset + +#data +* { break-inside: avoid-column; } +#errors +#expected +| * +| break-inside: avoid-column +#reset + +#data +* { break-inside: avoid-page !important; } +#errors +#expected +| * +| break-inside: avoid-page !important +#reset + +#data +* { break-inside: page !important; } +#errors +#expected +| * +#reset + +#data +* { break-inside: inherit; } +#errors +#expected +| * +| break-inside: inherit +#reset + +#data +* { break-inside: normal; } +#errors +#expected +| * +#reset + + + + +#data +* { column-count: normal; } +#errors +#expected +| * +#reset + +#data +* { column-count: auto; } +#errors +#expected +| * +| column-count: auto +#reset + +#data +* { column-count: 3; } +#errors +#expected +| * +| column-count: 3 +#reset + +#data +* { column-count: 3px; } +#errors +#expected +| * +#reset + +#data +* { column-count: 2 3; } +#errors +#expected +| * +#reset + +#data +* { column-fill: 2; } +#errors +#expected +| * +#reset + +#data +* { column-fill: 2em; } +#errors +#expected +| * +#reset + +#data +* { column-fill: normal; } +#errors +#expected +| * +#reset + +#data +* { column-fill: balance; } +#errors +#expected +| * +| column-fill: balance +#reset + +#data +* { column-fill: auto; } +#errors +#expected +| * +| column-fill: auto +#reset + +#data +* { column-fill: inherit; } +#errors +#expected +| * +| column-fill: inherit +#reset + +#data +* { column-fill: inherit !important; } +#errors +#expected +| * +| column-fill: inherit !important +#reset + +#data +* { column-gap: 2; } +#errors +#expected +| * +#reset + +#data +* { column-gap: ; } +#errors +#expected +| * +#reset + +#data +* { column-gap: auto; } +#errors +#expected +| * +#reset + +#data +* { column-gap: normal; } +#errors +#expected +| * +| column-gap: normal +#reset + +#data +* { column-gap: 2em; } +#errors +#expected +| * +| column-gap: 2em +#reset + +#data +* { column-gap: inherit; } +#errors +#expected +| * +| column-gap: inherit +#reset + +#data +* { column-gap: inherit !important; } +#errors +#expected +| * +| column-gap: inherit !important +#reset + +#data +* { column-gap: !important; } +#errors +#expected +| * +#reset + + + +#data +* { column-rule-color: !important; } +#errors +#expected +| * +#reset + +#data +* { column-rule-color: red green; } +#errors +#expected +| * +#reset + +#data +* { column-rule-color: normal; } +#errors +#expected +| * +#reset + +#data +* { column-rule-color: auto; } +#errors +#expected +| * +#reset + +#data +* { column-rule-color: red; } +#errors +#expected +| * +| column-rule-color: #ffff0000 +#reset + +#data +* { column-rule-color: red !important; } +#errors +#expected +| * +| column-rule-color: #ffff0000 !important +#reset + +#data +* { column-rule-color: #BBC; } +#errors +#expected +| * +| column-rule-color: #ffbbbbcc +#reset + + + +#data +* { column-rule-style: !important; } +#errors +#expected +| * +#reset + +#data +* { column-rule-style: none auto; } +#errors +#expected +| * +#reset + +#data +* { column-rule-style: normal; } +#errors +#expected +| * +#reset + +#data +* { column-rule-style: solid 10px; } +#errors +#expected +| * +#reset + +#data +* { column-rule-style: 10px; } +#errors +#expected +| * +#reset + +#data +* { column-rule-style: dashed; } +#errors +#expected +| * +| column-rule-style: dashed +#reset + +#data +* { column-rule-style: groove; } +#errors +#expected +| * +| column-rule-style: groove +#reset + +#data +* { column-rule-style: none; } +#errors +#expected +| * +| column-rule-style: none +#reset + +#data +* { column-rule-style: dotted; } +#errors +#expected +| * +| column-rule-style: dotted +#reset + +#data +* { column-rule-style: outset; } +#errors +#expected +| * +| column-rule-style: outset +#reset + +#data +* { column-rule-style: solid !important; } +#errors +#expected +| * +| column-rule-style: solid !important +#reset + +#data +* { column-rule-style: inset; } +#errors +#expected +| * +| column-rule-style: inset +#reset + +#data +* { column-rule-style: inherit; } +#errors +#expected +| * +| column-rule-style: inherit +#reset + +#data +* { column-rule-style: hidden; } +#errors +#expected +| * +| column-rule-style: hidden +#reset + + + +#data +* { column-rule-width: !important; } +#errors +#expected +| * +#reset + +#data +* { column-rule-width: red green; } +#errors +#expected +| * +#reset + +#data +* { column-rule-width: normal; } +#errors +#expected +| * +#reset + +#data +* { column-rule-width: auto; } +#errors +#expected +| * +#reset + +#data +* { column-rule-width: thin; } +#errors +#expected +| * +| column-rule-width: thin +#reset + +#data +* { column-rule-width: medium !important; } +#errors +#expected +| * +| column-rule-width: medium !important +#reset + +#data +* { column-rule-width: 3px; } +#errors +#expected +| * +| column-rule-width: 3px +#reset + +#data +* { column-rule-width: 3px !important; } +#errors +#expected +| * +| column-rule-width: 3px !important +#reset + +#data +* { column-rule-width: inherit; } +#errors +#expected +| * +| column-rule-width: inherit +#reset + + + +#data +* { column-span: !important; } +#errors +#expected +| * +#reset + +#data +* { column-span: auto; } +#errors +#expected +| * +#reset + +#data +* { column-span: 4em; } +#errors +#expected +| * +#reset + +#data +* { column-span: 3; } +#errors +#expected +| * +#reset + +#data +* { column-span: 3 !important; } +#errors +#expected +| * +#reset + +#data +* { column-span: all; } +#errors +#expected +| * +| column-span: all +#reset + +#data +* { column-span: none; } +#errors +#expected +| * +| column-span: none +#reset + +#data +* { column-span: none !important; } +#errors +#expected +| * +| column-span: none !important +#reset + + + +#data +* { column-width: !important; } +#errors +#expected +| * +#reset + +#data +* { column-width: red green; } +#errors +#expected +| * +#reset + +#data +* { column-width: normal; } +#errors +#expected +| * +#reset + +#data +* { column-width: auto; } +#errors +#expected +| * +| column-width: auto +#reset + +#data +* { column-width: 30em; } +#errors +#expected +| * +| column-width: 30em +#reset + +#data +* { column-width: 30em !important; } +#errors +#expected +| * +| column-width: 30em !important +#reset + +#data +* { column-width: inherit; } +#errors +#expected +| * +| column-width: inherit +#reset + diff --git a/test/dump.h b/test/dump.h index 8817edf..73b61ea 100644 --- a/test/dump.h +++ b/test/dump.h @@ -465,6 +465,17 @@ static const char *opcode_names[] = { "word-spacing", "z-index", "opacity", + "break-after", + "break-before", + "break-inside", + "column-count", + "column-fill", + "column-gap", + "column-rule-color", + "column-rule-style", + "column-rule-width", + "column-span", + "column-width", }; static void dump_css_fixed(css_fixed f, char **ptr) @@ -801,6 +812,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) case CSS_PROP_BORDER_BOTTOM_COLOR: case CSS_PROP_BORDER_LEFT_COLOR: case CSS_PROP_BACKGROUND_COLOR: + case CSS_PROP_COLUMN_RULE_COLOR: assert(BACKGROUND_COLOR_TRANSPARENT == (enum op_background_color) BORDER_COLOR_TRANSPARENT); @@ -965,37 +977,68 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) case CSS_PROP_BORDER_RIGHT_STYLE: case CSS_PROP_BORDER_BOTTOM_STYLE: case CSS_PROP_BORDER_LEFT_STYLE: + case CSS_PROP_COLUMN_RULE_STYLE: case CSS_PROP_OUTLINE_STYLE: assert(BORDER_STYLE_NONE == (enum op_border_style) OUTLINE_STYLE_NONE); + assert(BORDER_STYLE_NONE == + (enum op_border_style) + COLUMN_RULE_STYLE_NONE); assert(BORDER_STYLE_HIDDEN == (enum op_border_style) OUTLINE_STYLE_HIDDEN); + assert(BORDER_STYLE_HIDDEN == + (enum op_border_style) + COLUMN_RULE_STYLE_HIDDEN); assert(BORDER_STYLE_DOTTED == (enum op_border_style) OUTLINE_STYLE_DOTTED); + assert(BORDER_STYLE_DOTTED == + (enum op_border_style) + COLUMN_RULE_STYLE_DOTTED); assert(BORDER_STYLE_DASHED == (enum op_border_style) OUTLINE_STYLE_DASHED); + assert(BORDER_STYLE_DASHED == + (enum op_border_style) + COLUMN_RULE_STYLE_DASHED); assert(BORDER_STYLE_SOLID == (enum op_border_style) OUTLINE_STYLE_SOLID); + assert(BORDER_STYLE_SOLID == + (enum op_border_style) + COLUMN_RULE_STYLE_SOLID); assert(BORDER_STYLE_DOUBLE == (enum op_border_style) OUTLINE_STYLE_DOUBLE); + assert(BORDER_STYLE_DOUBLE == + (enum op_border_style) + COLUMN_RULE_STYLE_DOUBLE); assert(BORDER_STYLE_GROOVE == (enum op_border_style) OUTLINE_STYLE_GROOVE); + assert(BORDER_STYLE_GROOVE == + (enum op_border_style) + COLUMN_RULE_STYLE_GROOVE); assert(BORDER_STYLE_RIDGE == (enum op_border_style) OUTLINE_STYLE_RIDGE); + assert(BORDER_STYLE_RIDGE == + (enum op_border_style) + COLUMN_RULE_STYLE_RIDGE); assert(BORDER_STYLE_INSET == (enum op_border_style) OUTLINE_STYLE_INSET); + assert(BORDER_STYLE_INSET == + (enum op_border_style) + COLUMN_RULE_STYLE_INSET); assert(BORDER_STYLE_OUTSET == (enum op_border_style) OUTLINE_STYLE_OUTSET); + assert(BORDER_STYLE_OUTSET == + (enum op_border_style) + COLUMN_RULE_STYLE_OUTSET); switch (value) { case BORDER_STYLE_NONE: @@ -1034,6 +1077,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) case CSS_PROP_BORDER_RIGHT_WIDTH: case CSS_PROP_BORDER_BOTTOM_WIDTH: case CSS_PROP_BORDER_LEFT_WIDTH: + case CSS_PROP_COLUMN_RULE_WIDTH: case CSS_PROP_OUTLINE_WIDTH: assert(BORDER_WIDTH_SET == (enum op_border_width) @@ -1080,6 +1124,7 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) case CSS_PROP_TOP: case CSS_PROP_HEIGHT: case CSS_PROP_WIDTH: + case CSS_PROP_COLUMN_WIDTH: assert(BOTTOM_SET == (enum op_bottom) LEFT_SET); assert(BOTTOM_AUTO == @@ -1104,6 +1149,12 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) (enum op_bottom) WIDTH_SET); assert(BOTTOM_AUTO == (enum op_bottom) WIDTH_AUTO); + assert(BOTTOM_SET == + (enum op_bottom) + COLUMN_WIDTH_SET); + assert(BOTTOM_AUTO == + (enum op_bottom) + COLUMN_WIDTH_AUTO); switch (value) { case BOTTOM_SET: @@ -1121,6 +1172,82 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) break; } break; + case CSS_PROP_BREAK_AFTER: + case CSS_PROP_BREAK_BEFORE: + assert(BREAK_AFTER_AUTO == + (enum op_break_after) + BREAK_BEFORE_AUTO); + assert(BREAK_AFTER_ALWAYS == + (enum op_break_after) + BREAK_BEFORE_ALWAYS); + assert(BREAK_AFTER_AVOID == + (enum op_break_after) + BREAK_BEFORE_AVOID); + assert(BREAK_AFTER_LEFT == + (enum op_break_after) + BREAK_BEFORE_LEFT); + assert(BREAK_AFTER_RIGHT == + (enum op_break_after) + BREAK_BEFORE_RIGHT); + assert(BREAK_AFTER_PAGE == + (enum op_break_after) + BREAK_BEFORE_PAGE); + assert(BREAK_AFTER_COLUMN == + (enum op_break_after) + BREAK_BEFORE_COLUMN); + assert(BREAK_AFTER_AVOID_PAGE == + (enum op_break_after) + BREAK_BEFORE_AVOID_PAGE); + assert(BREAK_AFTER_AVOID_COLUMN == + (enum op_break_after) + BREAK_BEFORE_AVOID_COLUMN); + + switch (value) { + case BREAK_AFTER_AUTO: + *ptr += sprintf(*ptr, "auto"); + break; + case BREAK_AFTER_ALWAYS: + *ptr += sprintf(*ptr, "always"); + break; + case BREAK_AFTER_AVOID: + *ptr += sprintf(*ptr, "avoid"); + break; + case BREAK_AFTER_LEFT: + *ptr += sprintf(*ptr, "left"); + break; + case BREAK_AFTER_RIGHT: + *ptr += sprintf(*ptr, "right"); + break; + case BREAK_AFTER_PAGE: + *ptr += sprintf(*ptr, "page"); + break; + case BREAK_AFTER_COLUMN: + *ptr += sprintf(*ptr, "column"); + break; + case BREAK_AFTER_AVOID_PAGE: + *ptr += sprintf(*ptr, "avoid-page"); + break; + case BREAK_AFTER_AVOID_COLUMN: + *ptr += sprintf(*ptr, "avoid-column"); + break; + } + break; + case CSS_PROP_BREAK_INSIDE: + switch (value) { + case BREAK_INSIDE_AUTO: + *ptr += sprintf(*ptr, "auto"); + break; + case BREAK_INSIDE_AVOID: + *ptr += sprintf(*ptr, "avoid"); + break; + case BREAK_INSIDE_AVOID_PAGE: + *ptr += sprintf(*ptr, "avoid-page"); + break; + case BREAK_INSIDE_AVOID_COLUMN: + *ptr += sprintf(*ptr, "avoid-column"); + break; + } + break; case CSS_PROP_CAPTION_SIDE: switch (value) { case CAPTION_SIDE_TOP: @@ -1220,6 +1347,57 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) break; } break; + case CSS_PROP_COLUMN_COUNT: + switch (value) { + case COLUMN_COUNT_SET: + { + css_fixed val = *((css_fixed *) bytecode); + ADVANCE(sizeof(val)); + dump_number(val, ptr); + } + break; + case COLUMN_COUNT_AUTO: + *ptr += sprintf(*ptr, "auto"); + break; + } + break; + case CSS_PROP_COLUMN_FILL: + switch (value) { + case COLUMN_FILL_BALANCE: + *ptr += sprintf(*ptr, "balance"); + break; + case COLUMN_FILL_AUTO: + *ptr += sprintf(*ptr, "auto"); + break; + } + break; + case CSS_PROP_COLUMN_GAP: + switch (value) { + case COLUMN_GAP_SET: + { + uint32_t unit; + css_fixed val = *((css_fixed *) bytecode); + ADVANCE(sizeof(val)); + unit = *((uint32_t *) bytecode); + ADVANCE(sizeof(unit)); + dump_unit(val, unit, ptr); + } + break; + case COLUMN_GAP_NORMAL: + *ptr += sprintf(*ptr, "normal"); + break; + } + break; + case CSS_PROP_COLUMN_SPAN: + switch (value) { + case COLUMN_SPAN_NONE: + *ptr += sprintf(*ptr, "none"); + break; + case COLUMN_SPAN_ALL: + *ptr += sprintf(*ptr, "all"); + break; + } + break; case CSS_PROP_CONTENT: if (value == CONTENT_NORMAL) { *ptr += sprintf(*ptr, "normal"); |