summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--include/libcss/computed.h283
-rw-r--r--include/libcss/properties.h21
-rw-r--r--src/bytecode/opcodes.h7
-rw-r--r--src/select/computed.c45
-rw-r--r--src/select/computed.h38
-rw-r--r--src/select/dispatch.c16
-rw-r--r--src/select/properties/column_count.c31
-rw-r--r--src/select/properties/column_fill.c27
-rw-r--r--src/select/properties/column_gap.c52
-rw-r--r--src/select/properties/column_rule_color.c42
-rw-r--r--src/select/properties/column_rule_style.c47
-rw-r--r--src/select/properties/column_rule_width.c50
-rw-r--r--src/select/properties/column_span.c29
-rw-r--r--src/select/properties/column_width.c54
-rw-r--r--src/select/propget.h312
-rw-r--r--src/select/propset.h352
-rw-r--r--test/data/select/tests1.dat444
-rw-r--r--test/dump_computed.h210
-rw-r--r--test/select-common.c38
20 files changed, 1605 insertions, 495 deletions
diff --git a/.gitignore b/.gitignore
index d5c7a48..ed1b138 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
build-*
Makefile.config.override
-
+*~
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index 8e327d2..b384cba 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -19,7 +19,7 @@ extern "C"
#include <libcss/functypes.h>
#include <libcss/properties.h>
#include <libcss/types.h>
-
+
struct css_hint;
struct css_select_handler;
@@ -75,7 +75,7 @@ typedef struct css_computed_content_item {
} counters;
} data;
} css_computed_content_item;
-
+
css_error css_computed_style_create(css_computed_style **result);
css_error css_computed_style_destroy(css_computed_style *style);
@@ -85,7 +85,7 @@ css_error css_computed_style_initialise(css_computed_style *style,
css_error css_computed_style_compose(const css_computed_style *parent,
const css_computed_style *child,
css_error (*compute_font_size)(void *pw,
- const struct css_hint *parent,
+ const struct css_hint *parent,
struct css_hint *size),
void *pw,
css_computed_style *result);
@@ -93,215 +93,215 @@ css_error css_computed_style_compose(const css_computed_style *parent,
/******************************************************************************
* Property accessors below here *
******************************************************************************/
-
+
uint8_t css_computed_letter_spacing(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
uint8_t css_computed_outline_color(
const css_computed_style *style, css_color *color);
-
+
uint8_t css_computed_outline_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_border_spacing(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *hlength, css_unit *hunit,
css_fixed *vlength, css_unit *vunit);
-
+
uint8_t css_computed_word_spacing(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_counter_increment(
- const css_computed_style *style,
+ const css_computed_style *style,
const css_computed_counter **counters);
-
+
uint8_t css_computed_counter_reset(
- const css_computed_style *style,
+ const css_computed_style *style,
const css_computed_counter **counters);
-
+
uint8_t css_computed_cursor(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string ***urls);
uint8_t css_computed_clip(
- const css_computed_style *style,
+ const css_computed_style *style,
css_computed_clip_rect *rect);
-
+
uint8_t css_computed_content(
- const css_computed_style *style,
+ const css_computed_style *style,
const css_computed_content_item **content);
-
+
uint8_t css_computed_vertical_align(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_font_size(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_border_top_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_border_right_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_border_bottom_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_border_left_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_background_image(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string **url);
-
+
uint8_t css_computed_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color);
-
+
uint8_t css_computed_list_style_image(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string **url);
-
+
uint8_t css_computed_quotes(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string ***quotes);
-
+
uint8_t css_computed_top(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_right(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_bottom(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_left(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_border_top_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color);
-
+
uint8_t css_computed_border_right_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color);
-
+
uint8_t css_computed_border_bottom_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color);
-
+
uint8_t css_computed_border_left_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color);
-
+
uint8_t css_computed_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_line_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_background_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color);
-
+
uint8_t css_computed_z_index(
- const css_computed_style *style,
+ const css_computed_style *style,
int32_t *z_index);
-
+
uint8_t css_computed_margin_top(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_margin_right(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_margin_bottom(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_margin_left(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_background_attachment(
const css_computed_style *style);
-
+
uint8_t css_computed_border_collapse(
const css_computed_style *style);
-
+
uint8_t css_computed_caption_side(
const css_computed_style *style);
-
+
uint8_t css_computed_direction(
const css_computed_style *style);
-
+
uint8_t css_computed_max_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_max_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_empty_cells(
const css_computed_style *style);
-
+
uint8_t css_computed_float(
const css_computed_style *style);
-
+
uint8_t css_computed_writing_mode(
const css_computed_style *style);
uint8_t css_computed_font_style(
const css_computed_style *style);
-
+
uint8_t css_computed_min_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_min_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_background_repeat(
const css_computed_style *style);
-
+
uint8_t css_computed_clear(
const css_computed_style *style);
-
+
uint8_t css_computed_padding_top(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_padding_right(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_padding_bottom(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_padding_left(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
uint8_t css_computed_overflow_x(
@@ -312,75 +312,104 @@ uint8_t css_computed_overflow_y(
uint8_t css_computed_position(
const css_computed_style *style);
-
+
uint8_t css_computed_opacity(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *opacity);
-
+
uint8_t css_computed_text_transform(
const css_computed_style *style);
-
+
uint8_t css_computed_text_indent(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
+
uint8_t css_computed_white_space(
const css_computed_style *style);
-
+
uint8_t css_computed_background_position(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *hlength, css_unit *hunit,
css_fixed *vlength, css_unit *vunit);
-
+
+uint8_t css_computed_column_count(
+ const css_computed_style *style,
+ int32_t *column_count);
+
+uint8_t css_computed_column_fill(
+ const css_computed_style *style);
+
+uint8_t css_computed_column_gap(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit);
+
+uint8_t css_computed_column_rule_color(
+ const css_computed_style *style,
+ css_color *color);
+
+uint8_t css_computed_column_rule_style(
+ const css_computed_style *style);
+
+uint8_t css_computed_column_rule_width(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit);
+
+uint8_t css_computed_column_span(
+ const css_computed_style *style);
+
+uint8_t css_computed_column_width(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit);
+
uint8_t css_computed_display(
const css_computed_style *style, bool root);
-
+
uint8_t css_computed_display_static(
const css_computed_style *style);
-
+
uint8_t css_computed_font_variant(
const css_computed_style *style);
-
+
uint8_t css_computed_text_decoration(
const css_computed_style *style);
-
+
uint8_t css_computed_font_family(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string ***names);
-
+
uint8_t css_computed_border_top_style(
const css_computed_style *style);
-
+
uint8_t css_computed_border_right_style(
const css_computed_style *style);
-
+
uint8_t css_computed_border_bottom_style(
const css_computed_style *style);
-
+
uint8_t css_computed_border_left_style(
const css_computed_style *style);
-
+
uint8_t css_computed_font_weight(
const css_computed_style *style);
-
+
uint8_t css_computed_list_style_type(
const css_computed_style *style);
-
+
uint8_t css_computed_outline_style(
const css_computed_style *style);
-
+
uint8_t css_computed_table_layout(
const css_computed_style *style);
-
+
uint8_t css_computed_unicode_bidi(
const css_computed_style *style);
-
+
uint8_t css_computed_visibility(
const css_computed_style *style);
-
+
uint8_t css_computed_list_style_position(
const css_computed_style *style);
-
+
uint8_t css_computed_text_align(
const css_computed_style *style);
@@ -394,11 +423,11 @@ uint8_t css_computed_page_break_inside(
const css_computed_style *style);
uint8_t css_computed_orphans(
- const css_computed_style *style,
+ const css_computed_style *style,
int32_t *orphans);
uint8_t css_computed_widows(
- const css_computed_style *style,
+ const css_computed_style *style,
int32_t *widows);
#ifdef __cplusplus
diff --git a/include/libcss/properties.h b/include/libcss/properties.h
index dbcd75a..899a552 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -282,8 +282,8 @@ enum css_column_fill_e {
enum css_column_gap_e {
CSS_COLUMN_GAP_INHERIT = 0x0,
- CSS_COLUMN_GAP_NORMAL = 0x1,
- CSS_COLUMN_GAP_SET = 0x2
+ CSS_COLUMN_GAP_SET = 0x1,
+ CSS_COLUMN_GAP_NORMAL = 0x2
};
enum css_column_rule_color_e {
@@ -295,6 +295,7 @@ enum css_column_rule_color_e {
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_HIDDEN = CSS_BORDER_STYLE_HIDDEN,
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,
@@ -321,8 +322,8 @@ enum css_column_span_e {
enum css_column_width_e {
CSS_COLUMN_WIDTH_INHERIT = 0x0,
- CSS_COLUMN_WIDTH_AUTO = 0x1,
- CSS_COLUMN_WIDTH_SET = 0x2
+ CSS_COLUMN_WIDTH_SET = 0x1,
+ CSS_COLUMN_WIDTH_AUTO = 0x2
};
enum css_content_e {
@@ -474,9 +475,9 @@ enum css_left_e {
};
enum css_letter_spacing_e {
- CSS_LETTER_SPACING_INHERIT = 0x0,
- CSS_LETTER_SPACING_SET = 0x1,
- CSS_LETTER_SPACING_NORMAL = 0x2
+ CSS_LETTER_SPACING_INHERIT = CSS_COLUMN_GAP_INHERIT,
+ CSS_LETTER_SPACING_SET = CSS_COLUMN_GAP_SET,
+ CSS_LETTER_SPACING_NORMAL = CSS_COLUMN_GAP_NORMAL
};
enum css_line_height_e {
@@ -737,9 +738,9 @@ enum css_width_e {
};
enum css_word_spacing_e {
- CSS_WORD_SPACING_INHERIT = 0x0,
- CSS_WORD_SPACING_SET = 0x1,
- CSS_WORD_SPACING_NORMAL = 0x2
+ CSS_WORD_SPACING_INHERIT = CSS_COLUMN_GAP_INHERIT,
+ CSS_WORD_SPACING_SET = CSS_COLUMN_GAP_SET,
+ CSS_WORD_SPACING_NORMAL = CSS_COLUMN_GAP_NORMAL
};
enum css_writing_mode_e {
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index 544687a..4f80142 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -180,10 +180,9 @@ enum op_column_gap {
};
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
+ COLUMN_RULE_COLOR_TRANSPARENT = COLOR_TRANSPARENT,
+ COLUMN_RULE_COLOR_CURRENT_COLOR = COLOR_CURRENT_COLOR,
+ COLUMN_RULE_COLOR_SET = COLOR_SET
};
enum op_column_rule_style {
diff --git a/src/select/computed.c b/src/select/computed.c
index 9b59dc4..8054b02 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -787,6 +787,51 @@ uint8_t css_computed_background_position(const css_computed_style *style,
return get_background_position(style, hlength, hunit, vlength, vunit);
}
+uint8_t css_computed_column_count(const css_computed_style *style,
+ int32_t *column_count)
+{
+ return get_column_count(style, column_count);
+}
+
+uint8_t css_computed_column_fill(const css_computed_style *style)
+{
+ return get_column_fill(style);
+}
+
+uint8_t css_computed_column_gap(const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ return get_column_gap(style, length, unit);
+}
+
+uint8_t css_computed_column_rule_color(const css_computed_style *style,
+ css_color *color)
+{
+ return get_column_rule_color(style, color);
+}
+
+uint8_t css_computed_column_rule_style(const css_computed_style *style)
+{
+ return get_column_rule_style(style);
+}
+
+uint8_t css_computed_column_rule_width(const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ return get_column_rule_width(style, length, unit);
+}
+
+uint8_t css_computed_column_span(const css_computed_style *style)
+{
+ return get_column_span(style);
+}
+
+uint8_t css_computed_column_width(const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ return get_column_width(style, length, unit);
+}
+
uint8_t css_computed_display(const css_computed_style *style,
bool root)
{
diff --git a/src/select/computed.h b/src/select/computed.h
index e7f3742..574d36b 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -17,12 +17,20 @@ typedef struct css_computed_uncommon {
/*
* border_spacing 1 + 2(4) 2(4)
* clip 2 + 4(4) + 4 4(4)
+ * column_count 2 4
+ * column_fill 2 0
+ * column_gap 2 + 4 4
+ * column_rule_color 2 4
+ * column_rule_style 4 0
+ * column_rule_width 3 + 4 4
+ * column_span 2 0
+ * column_width 2 + 4 4
* letter_spacing 2 + 4 4
* outline_color 2 4
* outline_width 3 + 4 4
* word_spacing 2 + 4 4
* --- ---
- * 52 bits 40 bytes
+ * 83 bits 60 bytes
*
* Encode counter_increment and _reset as an array of name, value pairs,
* terminated with a blank entry.
@@ -46,25 +54,29 @@ typedef struct css_computed_uncommon {
* 2 bits sizeof(ptr)
*
* ___ ___
- * 61 bits 40 + 4sizeof(ptr) bytes
+ * 96 bits 62 + 4sizeof(ptr) bytes
*
- * 8 bytes 40 + 4sizeof(ptr) bytes
+ * 12 bytes 62 + 4sizeof(ptr) bytes
* ===================
- * 48 + 4sizeof(ptr) bytes
+ * 72 + 4sizeof(ptr) bytes
*
* Bit allocations:
*
* 76543210
- * 1 llllllcc letter-spacing | outline-color
- * 2 ooooooob outline-width | border-spacing
+ * 1 llllllcc letter-spacing | outline-color
+ * 2 ooooooob outline-width | border-spacing
* 3 bbbbbbbb border-spacing
- * 4 wwwwwwir word-spacing | counter-increment | counter-reset
- * 5 uuuuumm. cursor | writing-mode | <unused>
+ * 4 wwwwwwir word-spacing | counter-increment | counter-reset
+ * 5 uuuuumm. cursor | writing-mode | <unused>
* 6 cccccccc clip
* 7 cccccccc clip
- * 8 ccccccoo clip | content
+ * 8 ccccccoo clip | content
+ * 9 ccffssss column_count | column-fill | column-rule-style
+ * 10 ggggggcc column-gap | column-rule-color
+ * 11 wwwwwww. column-rule-width | <unused>
+ * 12 sswwwwww column-span | column_width
*/
- uint8_t bits[8];
+ uint8_t bits[12];
css_fixed border_spacing[2];
@@ -77,6 +89,12 @@ typedef struct css_computed_uncommon {
css_fixed word_spacing;
+ int32_t column_count;
+ css_fixed column_gap;
+ css_color column_rule_color;
+ css_fixed column_rule_width;
+ css_fixed column_width;
+
css_computed_counter *counter_increment;
css_computed_counter *counter_reset;
diff --git a/src/select/dispatch.c b/src/select/dispatch.c
index b03e468..2c72e86 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -536,42 +536,42 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
{
PROPERTY_FUNCS(column_count),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(column_fill),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(column_gap),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(column_rule_color),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(column_rule_style),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(column_rule_width),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(column_span),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(column_width),
0,
- GROUP_NORMAL
+ GROUP_UNCOMMON
},
{
PROPERTY_FUNCS(writing_mode),
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c
index 5fe7465..ecee5f3 100644
--- a/src/select/properties/column_count.c
+++ b/src/select/properties/column_count.c
@@ -17,23 +17,25 @@
css_error css__cascade_column_count(uint32_t opv, css_style *style,
css_select_state *state)
{
+ uint16_t value = CSS_COLUMN_COUNT_INHERIT;
css_fixed count = 0;
if (isInherit(opv) == false) {
switch (getValue(opv)) {
case COLUMN_COUNT_SET:
+ value = CSS_COLUMN_COUNT_SET;
count = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(count));
break;
case COLUMN_COUNT_AUTO:
- /** \todo convert to public values */
+ value = CSS_COLUMN_COUNT_AUTO;
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
isInherit(opv))) {
- /** \todo set computed elevation */
+ return set_column_count(state->computed, value, count);
}
return CSS_OK;
@@ -42,26 +44,31 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
css_error css__set_column_count_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_count(style, hint->status, hint->data.integer);
}
css_error css__initial_column_count(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_count(state->computed, CSS_COLUMN_COUNT_AUTO, 0);
}
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);
+ int32_t count = 0;
+ uint8_t type = get_column_count(child, &count);
+
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_COUNT_INHERIT ||
+ (child->uncommon != NULL && result != child)) {
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_OUTLINE_COLOR_INHERIT) {
+ type = get_column_count(parent, &count);
+ }
+
+ return set_column_count(result, type, count);
+ }
return CSS_OK;
}
diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c
index 2322c03..9b4f1e0 100644
--- a/src/select/properties/column_fill.c
+++ b/src/select/properties/column_fill.c
@@ -17,20 +17,24 @@
css_error css__cascade_column_fill(uint32_t opv, css_style *style,
css_select_state *state)
{
+ uint16_t value = CSS_COLUMN_FILL_INHERIT;
+
UNUSED(style);
if (isInherit(opv) == false) {
switch (getValue(opv)) {
case COLUMN_FILL_BALANCE:
+ value = CSS_COLUMN_FILL_BALANCE;
+ break;
case COLUMN_FILL_AUTO:
- /** \todo convert to public values */
+ value = CSS_COLUMN_FILL_AUTO;
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
isInherit(opv))) {
- /** \todo set computed elevation */
+ return set_column_fill(state->computed, value);
}
return CSS_OK;
@@ -39,27 +43,24 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
css_error css__set_column_fill_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_fill(style, hint->status);
}
css_error css__initial_column_fill(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_fill(state->computed, CSS_COLUMN_FILL_BALANCE);
}
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);
+ uint8_t type = get_column_fill(child);
- return CSS_OK;
+ if (type == CSS_COLUMN_FILL_INHERIT) {
+ type = get_column_fill(parent);
+ }
+
+ return set_column_fill(result, type);
}
diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c
index 8b7a841..641f529 100644
--- a/src/select/properties/column_gap.c
+++ b/src/select/properties/column_gap.c
@@ -17,54 +17,40 @@
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;
+ return css__cascade_length_normal(opv, style, state, set_column_gap);
}
css_error css__set_column_gap_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_gap(style, hint->status,
+ hint->data.length.value, hint->data.length.unit);
}
css_error css__initial_column_gap(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_gap(state->computed, CSS_COLUMN_GAP_NORMAL,
+ INTTOFIX(1), CSS_UNIT_EM);
}
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);
+ css_fixed length = INTTOFIX(1);
+ css_unit unit = CSS_UNIT_EM;
+ uint8_t type = get_column_gap(child, &length, &unit);
+
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_GAP_INHERIT ||
+ (child->uncommon != NULL && result != child)) {
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_GAP_INHERIT) {
+ type = get_column_gap(parent, &length, &unit);
+ }
+
+ return set_column_gap(result, type, length, unit);
+ }
return CSS_OK;
}
diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c
index 933cb60..d4b0e77 100644
--- a/src/select/properties/column_rule_color.c
+++ b/src/select/properties/column_rule_color.c
@@ -17,24 +17,31 @@
css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
css_select_state *state)
{
+ bool inherit = isInherit(opv);
+ uint16_t value = CSS_COLUMN_RULE_COLOR_INHERIT;
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:
+ value = CSS_COLUMN_RULE_COLOR_COLOR;
+ break;
case COLUMN_RULE_COLOR_CURRENT_COLOR:
- /** \todo convert to public values */
+ /* color: currentColor always computes to inherit */
+ value = CSS_COLUMN_RULE_COLOR_INHERIT;
+ inherit = true;
+ break;
+ case COLUMN_RULE_COLOR_SET:
+ value = CSS_COLUMN_RULE_COLOR_COLOR;
+ color = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(color));
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
- /** \todo set computed elevation */
+ inherit)) {
+ return set_column_rule_color(state->computed, value, color);
}
return CSS_OK;
@@ -43,27 +50,26 @@ css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
css_error css__set_column_rule_color_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_rule_color(style, hint->status, hint->data.color);
}
css_error css__initial_column_rule_color(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_rule_color(state->computed,
+ CSS_COLUMN_RULE_COLOR_INHERIT, 0);
}
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);
+ css_color color;
+ uint8_t type = get_column_rule_color(child, &color);
- return CSS_OK;
+ if (type == CSS_COLUMN_RULE_COLOR_INHERIT) {
+ type = get_column_rule_color(parent, &color);
+ }
+
+ return set_column_rule_color(result, type, color);
}
diff --git a/src/select/properties/column_rule_style.c b/src/select/properties/column_rule_style.c
index ba558a2..586ce5d 100644
--- a/src/select/properties/column_rule_style.c
+++ b/src/select/properties/column_rule_style.c
@@ -17,57 +17,32 @@
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;
+ return css__cascade_border_style(opv, style, state,
+ set_column_rule_style);
}
css_error css__set_column_rule_style_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_rule_style(style, hint->status);
}
css_error css__initial_column_rule_style(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_rule_style(state->computed,
+ CSS_COLUMN_RULE_STYLE_NONE);
}
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);
+ uint8_t type = get_column_rule_style(child);
+
+ if (type == CSS_COLUMN_RULE_STYLE_INHERIT) {
+ type = get_column_rule_style(parent);
+ }
- return CSS_OK;
+ return set_column_rule_style(result, type);
}
diff --git a/src/select/properties/column_rule_width.c b/src/select/properties/column_rule_width.c
index 2c0ca0d..8694a09 100644
--- a/src/select/properties/column_rule_width.c
+++ b/src/select/properties/column_rule_width.c
@@ -17,57 +17,35 @@
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;
+ return css__cascade_border_width(opv, style, state,
+ set_column_rule_width);
}
css_error css__set_column_rule_width_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_rule_width(style, hint->status,
+ hint->data.length.value, hint->data.length.unit);
}
css_error css__initial_column_rule_width(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_rule_width(state->computed,
+ CSS_COLUMN_RULE_WIDTH_MEDIUM, 0, CSS_UNIT_PX);
}
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);
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_rule_width(child, &length, &unit);
+
+ if (type == CSS_COLUMN_RULE_WIDTH_INHERIT) {
+ type = get_column_rule_width(parent, &length, &unit);
+ }
- return CSS_OK;
+ return set_column_rule_width(result, type, length, unit);
}
diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c
index 92048a0..2c870d3 100644
--- a/src/select/properties/column_span.c
+++ b/src/select/properties/column_span.c
@@ -14,23 +14,27 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_column_span(uint32_t opv, css_style *style,
+css_error css__cascade_column_span(uint32_t opv, css_style *style,
css_select_state *state)
{
+ uint16_t value = CSS_COLUMN_SPAN_INHERIT;
+
UNUSED(style);
if (isInherit(opv) == false) {
switch (getValue(opv)) {
case COLUMN_SPAN_NONE:
+ value = CSS_COLUMN_SPAN_NONE;
+ break;
case COLUMN_SPAN_ALL:
- /** \todo convert to public values */
+ value = CSS_COLUMN_SPAN_ALL;
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
isInherit(opv))) {
- /** \todo set computed elevation */
+ return set_column_span(state->computed, value);
}
return CSS_OK;
@@ -39,27 +43,24 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
css_error css__set_column_span_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_span(style, hint->status);
}
css_error css__initial_column_span(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_span(state->computed, CSS_COLUMN_SPAN_NONE);
}
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);
+ uint8_t type = get_column_span(child);
- return CSS_OK;
+ if (type == CSS_COLUMN_SPAN_INHERIT) {
+ type = get_column_span(parent);
+ }
+
+ return set_column_span(result, type);
}
diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c
index fd053d9..45eb7fc 100644
--- a/src/select/properties/column_width.c
+++ b/src/select/properties/column_width.c
@@ -14,57 +14,43 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_column_width(uint32_t opv, css_style *style,
+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;
+ return css__cascade_length_normal(opv, style, state, set_column_width);
}
css_error css__set_column_width_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_width(style, hint->status,
+ hint->data.length.value, hint->data.length.unit);
}
css_error css__initial_column_width(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_width(state->computed, CSS_COLUMN_WIDTH_AUTO,
+ INTTOFIX(1), CSS_UNIT_EM);
}
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);
+ css_fixed length = INTTOFIX(1);
+ css_unit unit = CSS_UNIT_EM;
+ uint8_t type = get_column_width(child, &length, &unit);
+
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_WIDTH_INHERIT ||
+ (child->uncommon != NULL && result != child)) {
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_WIDTH_INHERIT) {
+ type = get_column_width(parent, &length, &unit);
+ }
+
+ return set_column_width(result, type, length, unit);
+ }
return CSS_OK;
}
diff --git a/src/select/propget.h b/src/select/propget.h
index b124cfe..08ed0f4 100644
--- a/src/select/propget.h
+++ b/src/select/propget.h
@@ -18,7 +18,7 @@
#define LETTER_SPACING_SHIFT 2
#define LETTER_SPACING_MASK 0xfc
static inline uint8_t get_letter_spacing(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
if (style->uncommon != NULL) {
@@ -72,7 +72,7 @@ static inline uint8_t get_outline_color(
#define OUTLINE_WIDTH_SHIFT 1
#define OUTLINE_WIDTH_MASK 0xfe
static inline uint8_t get_outline_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
if (style->uncommon != NULL) {
@@ -106,7 +106,7 @@ static inline uint8_t get_outline_width(
#define BORDER_SPACING_SHIFT1 0
#define BORDER_SPACING_MASK1 0xff
static inline uint8_t get_border_spacing(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *hlength, css_unit *hunit,
css_fixed *vlength, css_unit *vunit)
{
@@ -117,7 +117,7 @@ static inline uint8_t get_border_spacing(
/* 1 bit: type */
if (bits == CSS_BORDER_SPACING_SET) {
- uint8_t bits1 =
+ uint8_t bits1 =
style->uncommon->bits[BORDER_SPACING_INDEX1];
bits1 &= BORDER_SPACING_MASK1;
bits1 >>= BORDER_SPACING_SHIFT1;
@@ -150,7 +150,7 @@ static inline uint8_t get_border_spacing(
#define WORD_SPACING_SHIFT 2
#define WORD_SPACING_MASK 0xfc
static inline uint8_t get_word_spacing(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
if (style->uncommon != NULL) {
@@ -199,7 +199,7 @@ static inline uint8_t get_writing_mode(
#define COUNTER_INCREMENT_SHIFT 1
#define COUNTER_INCREMENT_MASK 0x2
static inline uint8_t get_counter_increment(
- const css_computed_style *style,
+ const css_computed_style *style,
const css_computed_counter **counters)
{
if (style->uncommon != NULL) {
@@ -223,7 +223,7 @@ static inline uint8_t get_counter_increment(
#define COUNTER_RESET_SHIFT 0
#define COUNTER_RESET_MASK 0x1
static inline uint8_t get_counter_reset(
- const css_computed_style *style,
+ const css_computed_style *style,
const css_computed_counter **counters)
{
if (style->uncommon != NULL) {
@@ -247,7 +247,7 @@ static inline uint8_t get_counter_reset(
#define CURSOR_SHIFT 3
#define CURSOR_MASK 0xf8
static inline uint8_t get_cursor(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string ***urls)
{
if (style->uncommon != NULL) {
@@ -277,7 +277,7 @@ static inline uint8_t get_cursor(
#define CLIP_SHIFT2 0
#define CLIP_MASK2 0xff
static inline uint8_t get_clip(
- const css_computed_style *style,
+ const css_computed_style *style,
css_computed_clip_rect *rect)
{
if (style->uncommon != NULL) {
@@ -287,7 +287,7 @@ static inline uint8_t get_clip(
/* 6bits: trblyy : top | right | bottom | left | type */
if ((bits & 0x3) == CSS_CLIP_RECT) {
- uint8_t bits1;
+ uint8_t bits1;
rect->left_auto = (bits & 0x4);
rect->bottom_auto = (bits & 0x8);
@@ -342,11 +342,203 @@ static inline uint8_t get_clip(
#undef CLIP_SHIFT
#undef CLIP_INDEX
+#define COLUMN_COUNT_INDEX 8
+#define COLUMN_COUNT_SHIFT 6
+#define COLUMN_COUNT_MASK 0xc0
+static inline uint8_t get_column_count(
+ const css_computed_style *style, int32_t *count)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_COUNT_INDEX];
+ bits &= COLUMN_COUNT_MASK;
+ bits >>= COLUMN_COUNT_SHIFT;
+
+ /* 2bits: tt : type */
+ *count = style->uncommon->column_count;
+
+ return bits;
+ }
+
+ return CSS_COLUMN_COUNT_AUTO;
+}
+#undef COLUMN_COUNT_MASK
+#undef COLUMN_COUNT_SHIFT
+#undef COLUMN_COUNT_INDEX
+
+#define COLUMN_FILL_INDEX 8
+#define COLUMN_FILL_SHIFT 4
+#define COLUMN_FILL_MASK 0x30
+static inline uint8_t get_column_fill(
+ const css_computed_style *style)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_FILL_INDEX];
+ bits &= COLUMN_FILL_MASK;
+ bits >>= COLUMN_FILL_SHIFT;
+
+ /* 2bits: type */
+ return bits;
+ }
+
+ return CSS_COLUMN_FILL_BALANCE;
+}
+#undef COLUMN_FILL_MASK
+#undef COLUMN_FILL_SHIFT
+#undef COLUMN_FILL_INDEX
+
+#define COLUMN_GAP_INDEX 9
+#define COLUMN_GAP_SHIFT 2
+#define COLUMN_GAP_MASK 0xfc
+static inline uint8_t get_column_gap(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_GAP_INDEX];
+ bits &= COLUMN_GAP_MASK;
+ bits >>= COLUMN_GAP_SHIFT;
+
+ /* 6bits: uuuutt : units | type */
+ if ((bits & 0x3) == CSS_COLUMN_GAP_SET) {
+ *length = style->uncommon->column_gap;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
+ }
+
+ return CSS_COLUMN_GAP_NORMAL;
+}
+#undef COLUMN_GAP_MASK
+#undef COLUMN_GAP_SHIFT
+#undef COLUMN_GAP_INDEX
+
+#define COLUMN_RULE_COLOR_INDEX 9
+#define COLUMN_RULE_COLOR_SHIFT 0
+#define COLUMN_RULE_COLOR_MASK 0x3
+static inline uint8_t get_column_rule_color(
+ const css_computed_style *style,
+ css_color *color)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_RULE_COLOR_INDEX];
+ bits &= COLUMN_RULE_COLOR_MASK;
+ bits >>= COLUMN_RULE_COLOR_SHIFT;
+
+ /* 2bits: type */
+ *color = style->uncommon->column_rule_color;
+
+ return bits;
+ }
+
+ *color = 0;
+ return CSS_COLUMN_RULE_COLOR_CURRENT_COLOR;
+}
+#undef COLUMN_RULE_COLOR_MASK
+#undef COLUMN_RULE_COLOR_SHIFT
+#undef COLUMN_RULE_COLOR_INDEX
+
+#define COLUMN_RULE_STYLE_INDEX 8
+#define COLUMN_RULE_STYLE_SHIFT 0
+#define COLUMN_RULE_STYLE_MASK 0xf
+static inline uint8_t get_column_rule_style(
+ const css_computed_style *style)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_RULE_STYLE_INDEX];
+ bits &= COLUMN_RULE_STYLE_MASK;
+ bits >>= COLUMN_RULE_STYLE_SHIFT;
+
+ /* 4bits: type */
+ return bits;
+ }
+
+ return CSS_COLUMN_RULE_STYLE_NONE;
+}
+#undef COLUMN_RULE_STYLE_MASK
+#undef COLUMN_RULE_STYLE_SHIFT
+#undef COLUMN_RULE_STYLE_INDEX
+
+#define COLUMN_RULE_WIDTH_INDEX 10
+#define COLUMN_RULE_WIDTH_SHIFT 1
+#define COLUMN_RULE_WIDTH_MASK 0xfe
+static inline uint8_t get_column_rule_width(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_RULE_WIDTH_INDEX];
+ bits &= COLUMN_RULE_WIDTH_MASK;
+ bits >>= COLUMN_RULE_WIDTH_SHIFT;
+
+ /* 7bits: uuuuttt : units | type */
+ if ((bits & 0x7) == CSS_COLUMN_RULE_WIDTH_WIDTH) {
+ *length = style->uncommon->column_rule_width;
+ *unit = bits >> 3;
+ }
+
+ return (bits & 0x7);
+ }
+
+ return CSS_COLUMN_RULE_WIDTH_MEDIUM;
+}
+#undef COLUMN_RULE_WIDTH_MASK
+#undef COLUMN_RULE_WIDTH_SHIFT
+#undef COLUMN_RULE_WIDTH_INDEX
+
+#define COLUMN_SPAN_INDEX 11
+#define COLUMN_SPAN_SHIFT 6
+#define COLUMN_SPAN_MASK 0xc0
+static inline uint8_t get_column_span(
+ const css_computed_style *style)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_SPAN_INDEX];
+ bits &= COLUMN_SPAN_MASK;
+ bits >>= COLUMN_SPAN_SHIFT;
+
+ /* 2bits: type */
+ return bits;
+ }
+
+ return CSS_COLUMN_SPAN_NONE;
+}
+#undef COLUMN_SPAN_MASK
+#undef COLUMN_SPAN_SHIFT
+#undef COLUMN_SPAN_INDEX
+
+#define COLUMN_WIDTH_INDEX 11
+#define COLUMN_WIDTH_SHIFT 0
+#define COLUMN_WIDTH_MASK 0x3f
+static inline uint8_t get_column_width(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ if (style->uncommon != NULL) {
+ uint8_t bits = style->uncommon->bits[COLUMN_WIDTH_INDEX];
+ bits &= COLUMN_WIDTH_MASK;
+ bits >>= COLUMN_WIDTH_SHIFT;
+
+ /* 6bits: uuuutt : units | type */
+ if ((bits & 0x3) == CSS_COLUMN_WIDTH_SET) {
+ *length = style->uncommon->column_width;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
+ }
+
+ return CSS_COLUMN_WIDTH_AUTO;
+}
+#undef COLUMN_WIDTH_MASK
+#undef COLUMN_WIDTH_SHIFT
+#undef COLUMN_WIDTH_INDEX
+
#define CONTENT_INDEX 7
#define CONTENT_SHIFT 0
#define CONTENT_MASK 0x3
static inline uint8_t get_content(
- const css_computed_style *style,
+ const css_computed_style *style,
const css_computed_content_item **content)
{
if (style->uncommon != NULL) {
@@ -370,7 +562,7 @@ static inline uint8_t get_content(
#define VERTICAL_ALIGN_SHIFT 0
#define VERTICAL_ALIGN_MASK 0xff
static inline uint8_t get_vertical_align(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[VERTICAL_ALIGN_INDEX];
@@ -393,7 +585,7 @@ static inline uint8_t get_vertical_align(
#define FONT_SIZE_SHIFT 0
#define FONT_SIZE_MASK 0xff
static inline uint8_t get_font_size(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[FONT_SIZE_INDEX];
@@ -416,7 +608,7 @@ static inline uint8_t get_font_size(
#define BORDER_TOP_WIDTH_SHIFT 1
#define BORDER_TOP_WIDTH_MASK 0xfe
static inline uint8_t get_border_top_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[BORDER_TOP_WIDTH_INDEX];
@@ -439,7 +631,7 @@ static inline uint8_t get_border_top_width(
#define BORDER_RIGHT_WIDTH_SHIFT 1
#define BORDER_RIGHT_WIDTH_MASK 0xfe
static inline uint8_t get_border_right_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[BORDER_RIGHT_WIDTH_INDEX];
@@ -462,7 +654,7 @@ static inline uint8_t get_border_right_width(
#define BORDER_BOTTOM_WIDTH_SHIFT 1
#define BORDER_BOTTOM_WIDTH_MASK 0xfe
static inline uint8_t get_border_bottom_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[BORDER_BOTTOM_WIDTH_INDEX];
@@ -485,7 +677,7 @@ static inline uint8_t get_border_bottom_width(
#define BORDER_LEFT_WIDTH_SHIFT 1
#define BORDER_LEFT_WIDTH_MASK 0xfe
static inline uint8_t get_border_left_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[BORDER_LEFT_WIDTH_INDEX];
@@ -508,7 +700,7 @@ static inline uint8_t get_border_left_width(
#define BACKGROUND_IMAGE_SHIFT 0
#define BACKGROUND_IMAGE_MASK 0x1
static inline uint8_t get_background_image(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string **url)
{
uint8_t bits = style->bits[BACKGROUND_IMAGE_INDEX];
@@ -528,7 +720,7 @@ static inline uint8_t get_background_image(
#define COLOR_SHIFT 0
#define COLOR_MASK 0x1
static inline uint8_t get_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color)
{
uint8_t bits = style->bits[COLOR_INDEX];
@@ -548,7 +740,7 @@ static inline uint8_t get_color(
#define LIST_STYLE_IMAGE_SHIFT 0
#define LIST_STYLE_IMAGE_MASK 0x1
static inline uint8_t get_list_style_image(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string **url)
{
uint8_t bits = style->bits[LIST_STYLE_IMAGE_INDEX];
@@ -568,7 +760,7 @@ static inline uint8_t get_list_style_image(
#define QUOTES_SHIFT 0
#define QUOTES_MASK 0x1
static inline uint8_t get_quotes(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string ***quotes)
{
uint8_t bits = style->bits[QUOTES_INDEX];
@@ -588,7 +780,7 @@ static inline uint8_t get_quotes(
#define TOP_SHIFT 2
#define TOP_MASK 0xfc
static inline uint8_t get_top(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[TOP_INDEX];
@@ -621,7 +813,7 @@ static inline uint8_t get_top_bits(
#define RIGHT_SHIFT 2
#define RIGHT_MASK 0xfc
static inline uint8_t get_right(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[RIGHT_INDEX];
@@ -654,7 +846,7 @@ static inline uint8_t get_right_bits(
#define BOTTOM_SHIFT 2
#define BOTTOM_MASK 0xfc
static inline uint8_t get_bottom(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[BOTTOM_INDEX];
@@ -687,7 +879,7 @@ static inline uint8_t get_bottom_bits(
#define LEFT_SHIFT 2
#define LEFT_MASK 0xfc
static inline uint8_t get_left(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[LEFT_INDEX];
@@ -720,7 +912,7 @@ static inline uint8_t get_left_bits(
#define BORDER_TOP_COLOR_SHIFT 0
#define BORDER_TOP_COLOR_MASK 0x3
static inline uint8_t get_border_top_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color)
{
uint8_t bits = style->bits[BORDER_TOP_COLOR_INDEX];
@@ -740,7 +932,7 @@ static inline uint8_t get_border_top_color(
#define BORDER_RIGHT_COLOR_SHIFT 0
#define BORDER_RIGHT_COLOR_MASK 0x3
static inline uint8_t get_border_right_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color)
{
uint8_t bits = style->bits[BORDER_RIGHT_COLOR_INDEX];
@@ -760,7 +952,7 @@ static inline uint8_t get_border_right_color(
#define BORDER_BOTTOM_COLOR_SHIFT 0
#define BORDER_BOTTOM_COLOR_MASK 0x3
static inline uint8_t get_border_bottom_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color)
{
uint8_t bits = style->bits[BORDER_BOTTOM_COLOR_INDEX];
@@ -780,7 +972,7 @@ static inline uint8_t get_border_bottom_color(
#define BORDER_LEFT_COLOR_SHIFT 0
#define BORDER_LEFT_COLOR_MASK 0x3
static inline uint8_t get_border_left_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color)
{
uint8_t bits = style->bits[BORDER_LEFT_COLOR_INDEX];
@@ -800,7 +992,7 @@ static inline uint8_t get_border_left_color(
#define HEIGHT_SHIFT 2
#define HEIGHT_MASK 0xfc
static inline uint8_t get_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[HEIGHT_INDEX];
@@ -823,7 +1015,7 @@ static inline uint8_t get_height(
#define LINE_HEIGHT_SHIFT 2
#define LINE_HEIGHT_MASK 0xfc
static inline uint8_t get_line_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[LINE_HEIGHT_INDEX];
@@ -831,7 +1023,7 @@ static inline uint8_t get_line_height(
bits >>= LINE_HEIGHT_SHIFT;
/* 6bits: uuuutt : units | type */
- if ((bits & 0x3) == CSS_LINE_HEIGHT_NUMBER ||
+ if ((bits & 0x3) == CSS_LINE_HEIGHT_NUMBER ||
(bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
*length = style->line_height;
}
@@ -850,7 +1042,7 @@ static inline uint8_t get_line_height(
#define BACKGROUND_COLOR_SHIFT 0
#define BACKGROUND_COLOR_MASK 0x3
static inline uint8_t get_background_color(
- const css_computed_style *style,
+ const css_computed_style *style,
css_color *color)
{
uint8_t bits = style->bits[BACKGROUND_COLOR_INDEX];
@@ -870,7 +1062,7 @@ static inline uint8_t get_background_color(
#define Z_INDEX_SHIFT 0
#define Z_INDEX_MASK 0x3
static inline uint8_t get_z_index(
- const css_computed_style *style,
+ const css_computed_style *style,
int32_t *z_index)
{
uint8_t bits = style->bits[Z_INDEX_INDEX];
@@ -890,7 +1082,7 @@ static inline uint8_t get_z_index(
#define MARGIN_TOP_SHIFT 2
#define MARGIN_TOP_MASK 0xfc
static inline uint8_t get_margin_top(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MARGIN_TOP_INDEX];
@@ -913,7 +1105,7 @@ static inline uint8_t get_margin_top(
#define MARGIN_RIGHT_SHIFT 2
#define MARGIN_RIGHT_MASK 0xfc
static inline uint8_t get_margin_right(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MARGIN_RIGHT_INDEX];
@@ -936,7 +1128,7 @@ static inline uint8_t get_margin_right(
#define MARGIN_BOTTOM_SHIFT 2
#define MARGIN_BOTTOM_MASK 0xfc
static inline uint8_t get_margin_bottom(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MARGIN_BOTTOM_INDEX];
@@ -959,7 +1151,7 @@ static inline uint8_t get_margin_bottom(
#define MARGIN_LEFT_SHIFT 2
#define MARGIN_LEFT_MASK 0xfc
static inline uint8_t get_margin_left(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MARGIN_LEFT_INDEX];
@@ -1050,7 +1242,7 @@ static inline uint8_t get_direction(
#define MAX_HEIGHT_SHIFT 2
#define MAX_HEIGHT_MASK 0xfc
static inline uint8_t get_max_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MAX_HEIGHT_INDEX];
@@ -1073,7 +1265,7 @@ static inline uint8_t get_max_height(
#define MAX_WIDTH_SHIFT 2
#define MAX_WIDTH_MASK 0xfc
static inline uint8_t get_max_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MAX_WIDTH_INDEX];
@@ -1096,7 +1288,7 @@ static inline uint8_t get_max_width(
#define WIDTH_SHIFT 2
#define WIDTH_MASK 0xfc
static inline uint8_t get_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[WIDTH_INDEX];
@@ -1170,7 +1362,7 @@ static inline uint8_t get_font_style(
#define MIN_HEIGHT_SHIFT 3
#define MIN_HEIGHT_MASK 0xf8
static inline uint8_t get_min_height(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MIN_HEIGHT_INDEX];
@@ -1193,7 +1385,7 @@ static inline uint8_t get_min_height(
#define MIN_WIDTH_SHIFT 3
#define MIN_WIDTH_MASK 0xf8
static inline uint8_t get_min_width(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[MIN_WIDTH_INDEX];
@@ -1250,7 +1442,7 @@ static inline uint8_t get_clear(
#define PADDING_TOP_SHIFT 3
#define PADDING_TOP_MASK 0xf8
static inline uint8_t get_padding_top(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[PADDING_TOP_INDEX];
@@ -1273,7 +1465,7 @@ static inline uint8_t get_padding_top(
#define PADDING_RIGHT_SHIFT 3
#define PADDING_RIGHT_MASK 0xf8
static inline uint8_t get_padding_right(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[PADDING_RIGHT_INDEX];
@@ -1296,7 +1488,7 @@ static inline uint8_t get_padding_right(
#define PADDING_BOTTOM_SHIFT 3
#define PADDING_BOTTOM_MASK 0xf8
static inline uint8_t get_padding_bottom(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[PADDING_BOTTOM_INDEX];
@@ -1319,7 +1511,7 @@ static inline uint8_t get_padding_bottom(
#define PADDING_LEFT_SHIFT 3
#define PADDING_LEFT_MASK 0xf8
static inline uint8_t get_padding_left(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[PADDING_LEFT_INDEX];
@@ -1393,7 +1585,7 @@ static inline uint8_t get_position(
#define OPACITY_SHIFT 2
#define OPACITY_MASK 0x04
static inline uint8_t get_opacity(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *opacity)
{
uint8_t bits = style->bits[OPACITY_INDEX];
@@ -1432,7 +1624,7 @@ static inline uint8_t get_text_transform(
#define TEXT_INDENT_SHIFT 3
#define TEXT_INDENT_MASK 0xf8
static inline uint8_t get_text_indent(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
uint8_t bits = style->bits[TEXT_INDENT_INDEX];
@@ -1475,7 +1667,7 @@ static inline uint8_t get_white_space(
#define BACKGROUND_POSITION_SHIFT1 0
#define BACKGROUND_POSITION_MASK1 0xff
static inline uint8_t get_background_position(
- const css_computed_style *style,
+ const css_computed_style *style,
css_fixed *hlength, css_unit *hunit,
css_fixed *vlength, css_unit *vunit)
{
@@ -1561,7 +1753,7 @@ static inline uint8_t get_text_decoration(
#define FONT_FAMILY_SHIFT 0
#define FONT_FAMILY_MASK 0x7
static inline uint8_t get_font_family(
- const css_computed_style *style,
+ const css_computed_style *style,
lwc_string ***names)
{
uint8_t bits = style->bits[FONT_FAMILY_INDEX];
@@ -1801,7 +1993,7 @@ static inline uint8_t get_page_break_after(
#undef PAGE_BREAK_AFTER_MASK
#undef PAGE_BREAK_AFTER_SHIFT
#undef PAGE_BREAK_AFTER_INDEX
-
+
#define PAGE_BREAK_BEFORE_INDEX 0
#define PAGE_BREAK_BEFORE_SHIFT 3
#define PAGE_BREAK_BEFORE_MASK 0x38
@@ -1816,13 +2008,13 @@ static inline uint8_t get_page_break_before(
/* 3bits: type */
return bits;
}
-
+
return CSS_PAGE_BREAK_BEFORE_AUTO;
}
#undef PAGE_BREAK_BEFORE_MASK
#undef PAGE_BREAK_BEFORE_SHIFT
#undef PAGE_BREAK_BEFORE_INDEX
-
+
#define PAGE_BREAK_INSIDE_INDEX 0
#define PAGE_BREAK_INSIDE_SHIFT 6
#define PAGE_BREAK_INSIDE_MASK 0xc0
@@ -1855,13 +2047,13 @@ static inline uint8_t get_orphans(
uint8_t bits = style->page->bits[ORPHANS_INDEX];
bits &= ORPHANS_MASK;
bits >>= ORPHANS_SHIFT;
-
+
*orphans = style->page->orphans;
-
+
/* 1bit: type */
return bits;
}
-
+
*orphans = 2;
return CSS_ORPHANS_SET;
}
@@ -1880,13 +2072,13 @@ static inline uint8_t get_widows(
uint8_t bits = style->page->bits[WIDOWS_INDEX];
bits &= WIDOWS_MASK;
bits >>= WIDOWS_SHIFT;
-
+
*widows = style->page->widows;
-
+
/* 1bit: type */
return bits;
}
-
+
*widows = 2;
return CSS_WIDOWS_SET;
}
diff --git a/src/select/propset.h b/src/select/propset.h
index b7da5a6..769d3b3 100644
--- a/src/select/propset.h
+++ b/src/select/propset.h
@@ -20,12 +20,17 @@ static const css_computed_uncommon default_uncommon = {
{ (CSS_LETTER_SPACING_INHERIT << 2) | CSS_OUTLINE_COLOR_INVERT,
(CSS_OUTLINE_WIDTH_MEDIUM << 1) | CSS_BORDER_SPACING_INHERIT,
0,
- (CSS_WORD_SPACING_INHERIT << 2) |
+ (CSS_WORD_SPACING_INHERIT << 2) |
(CSS_COUNTER_INCREMENT_NONE << 1) | CSS_COUNTER_RESET_NONE,
(CSS_CURSOR_INHERIT << 3) | (CSS_WRITING_MODE_INHERIT << 1) | 0,
0,
0,
- (CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL
+ (CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL,
+ (CSS_COLUMN_COUNT_AUTO << 6) | (CSS_COLUMN_FILL_BALANCE << 4) |
+ (CSS_COLUMN_RULE_STYLE_NONE << 0),
+ (CSS_COLUMN_GAP_NORMAL << 2) | (CSS_COLUMN_RULE_COLOR_CURRENT_COLOR),
+ (CSS_COLUMN_RULE_WIDTH_MEDIUM << 1),
+ (CSS_COLUMN_SPAN_NONE << 6) | CSS_COLUMN_WIDTH_AUTO
},
{ 0, 0 },
{ 0, 0, 0, 0 },
@@ -33,6 +38,11 @@ static const css_computed_uncommon default_uncommon = {
0,
0,
0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
NULL,
NULL,
NULL,
@@ -51,14 +61,14 @@ static const css_computed_uncommon default_uncommon = {
} while(0)
static const css_computed_page default_page = {
- {
- (CSS_PAGE_BREAK_INSIDE_AUTO << 6) |
+ {
+ (CSS_PAGE_BREAK_INSIDE_AUTO << 6) |
(CSS_PAGE_BREAK_BEFORE_AUTO << 3) |
CSS_PAGE_BREAK_AFTER_AUTO,
- (CSS_WIDOWS_SET << 1) |
+ (CSS_WIDOWS_SET << 1) |
CSS_ORPHANS_SET
},
- 2 << CSS_RADIX_POINT,
+ 2 << CSS_RADIX_POINT,
2 << CSS_RADIX_POINT
};
@@ -77,7 +87,7 @@ static const css_computed_page default_page = {
#define LETTER_SPACING_SHIFT 2
#define LETTER_SPACING_MASK 0xfc
static inline css_error set_letter_spacing(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits;
@@ -87,7 +97,7 @@ static inline css_error set_letter_spacing(
bits = &style->uncommon->bits[LETTER_SPACING_INDEX];
/* 6bits: uuuutt : unit | type */
- *bits = (*bits & ~LETTER_SPACING_MASK) |
+ *bits = (*bits & ~LETTER_SPACING_MASK) |
(((type & 0x3) | unit << 2) << LETTER_SPACING_SHIFT);
style->uncommon->letter_spacing = length;
@@ -126,7 +136,7 @@ static inline css_error set_outline_color(
#define OUTLINE_WIDTH_SHIFT 1
#define OUTLINE_WIDTH_MASK 0xfe
static inline css_error set_outline_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits;
@@ -153,7 +163,7 @@ static inline css_error set_outline_width(
#define BORDER_SPACING_INDEX1 2
#define BORDER_SPACING_SHIFT1 0
static inline css_error set_border_spacing(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed hlength, css_unit hunit,
css_fixed vlength, css_unit vunit)
{
@@ -164,7 +174,7 @@ static inline css_error set_border_spacing(
bits = &style->uncommon->bits[BORDER_SPACING_INDEX];
/* 1 bit: type */
- *bits = (*bits & ~BORDER_SPACING_MASK) |
+ *bits = (*bits & ~BORDER_SPACING_MASK) |
((type & 0x1) << BORDER_SPACING_SHIFT);
bits = &style->uncommon->bits[BORDER_SPACING_INDEX1];
@@ -188,7 +198,7 @@ static inline css_error set_border_spacing(
#define WORD_SPACING_SHIFT 2
#define WORD_SPACING_MASK 0xfc
static inline css_error set_word_spacing(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits;
@@ -200,7 +210,7 @@ static inline css_error set_word_spacing(
/* 6bits: uuuutt : unit | type */
*bits = (*bits & ~WORD_SPACING_MASK) |
(((type & 0x3) | (unit << 2)) << WORD_SPACING_SHIFT);
-
+
style->uncommon->word_spacing = length;
return CSS_OK;
@@ -235,7 +245,7 @@ static inline css_error set_writing_mode(
#define COUNTER_INCREMENT_SHIFT 1
#define COUNTER_INCREMENT_MASK 0x2
static inline css_error set_counter_increment(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_computed_counter *counters)
{
uint8_t *bits;
@@ -275,7 +285,7 @@ static inline css_error set_counter_increment(
#define COUNTER_RESET_SHIFT 0
#define COUNTER_RESET_MASK 0x1
static inline css_error set_counter_reset(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_computed_counter *counters)
{
uint8_t *bits;
@@ -315,7 +325,7 @@ static inline css_error set_counter_reset(
#define CURSOR_SHIFT 3
#define CURSOR_MASK 0xf8
static inline css_error set_cursor(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
lwc_string **urls)
{
uint8_t *bits;
@@ -359,7 +369,7 @@ static inline css_error set_cursor(
#define CLIP_INDEX2 6
#define CLIP_SHIFT2 0
static inline css_error set_clip(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_computed_clip_rect *rect)
{
uint8_t *bits;
@@ -369,7 +379,7 @@ static inline css_error set_clip(
bits = &style->uncommon->bits[CLIP_INDEX];
/* 6bits: trblyy : top | right | bottom | left | type */
- *bits = (*bits & ~CLIP_MASK) |
+ *bits = (*bits & ~CLIP_MASK) |
((type & 0x3) << CLIP_SHIFT);
if (type == CSS_CLIP_RECT) {
@@ -404,6 +414,196 @@ static inline css_error set_clip(
#undef CLIP_SHIFT
#undef CLIP_INDEX
+#define COLUMN_COUNT_INDEX 8
+#define COLUMN_COUNT_SHIFT 6
+#define COLUMN_COUNT_MASK 0xc0
+static inline css_error set_column_count(
+ css_computed_style *style, uint8_t type, int32_t count)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_COUNT_INDEX];
+
+ /* 2bits: tt : type */
+ *bits = (*bits & ~COLUMN_COUNT_MASK) |
+ ((type & 0x3) << COLUMN_COUNT_SHIFT);
+
+ style->uncommon->column_count = count;
+
+ return CSS_OK;
+}
+#undef COLUMN_COUNT_MASK
+#undef COLUMN_COUNT_SHIFT
+#undef COLUMN_COUNT_INDEX
+
+#define COLUMN_FILL_INDEX 8
+#define COLUMN_FILL_SHIFT 4
+#define COLUMN_FILL_MASK 0x30
+static inline css_error set_column_fill(
+ css_computed_style *style, uint8_t type)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_FILL_INDEX];
+
+ /* 2bits: tt : type */
+ *bits = (*bits & ~COLUMN_FILL_MASK) |
+ ((type & 0x3) << COLUMN_FILL_SHIFT);
+
+ return CSS_OK;
+}
+#undef COLUMN_FILL_MASK
+#undef COLUMN_FILL_SHIFT
+#undef COLUMN_FILL_INDEX
+
+#define COLUMN_GAP_INDEX 9
+#define COLUMN_GAP_SHIFT 2
+#define COLUMN_GAP_MASK 0xfc
+static inline css_error set_column_gap(
+ css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_GAP_INDEX];
+
+ /* 6bits: uuuutt : units | type */
+ *bits = (*bits & ~COLUMN_GAP_MASK) |
+ (((type & 0x3) | (unit << 2)) << COLUMN_GAP_SHIFT);
+
+ style->uncommon->column_gap = length;
+
+ return CSS_OK;
+}
+#undef COLUMN_GAP_MASK
+#undef COLUMN_GAP_SHIFT
+#undef COLUMN_GAP_INDEX
+
+#define COLUMN_RULE_COLOR_INDEX 9
+#define COLUMN_RULE_COLOR_SHIFT 0
+#define COLUMN_RULE_COLOR_MASK 0x3
+static inline css_error set_column_rule_color(
+ css_computed_style *style, uint8_t type,
+ css_color color)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_RULE_COLOR_INDEX];
+
+ /* 2bits: type */
+ *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) |
+ ((type & 0x3) << COLUMN_RULE_COLOR_SHIFT);
+
+ style->uncommon->column_rule_color = color;
+
+ return CSS_OK;
+}
+#undef COLUMN_RULE_COLOR_MASK
+#undef COLUMN_RULE_COLOR_SHIFT
+#undef COLUMN_RULE_COLOR_INDEX
+
+#define COLUMN_RULE_STYLE_INDEX 8
+#define COLUMN_RULE_STYLE_SHIFT 0
+#define COLUMN_RULE_STYLE_MASK 0xf
+static inline css_error set_column_rule_style(
+ css_computed_style *style, uint8_t type)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_RULE_STYLE_INDEX];
+
+ /* 4bits: type */
+ *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) |
+ ((type & 0xf) << COLUMN_RULE_STYLE_SHIFT);
+
+ return CSS_OK;
+}
+#undef COLUMN_RULE_STYLE_MASK
+#undef COLUMN_RULE_STYLE_SHIFT
+#undef COLUMN_RULE_STYLE_INDEX
+
+#define COLUMN_RULE_WIDTH_INDEX 10
+#define COLUMN_RULE_WIDTH_SHIFT 1
+#define COLUMN_RULE_WIDTH_MASK 0xfe
+static inline css_error set_column_rule_width(
+ css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_RULE_WIDTH_INDEX];
+
+ /* 7bits: uuuuttt : units | type */
+ *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) |
+ (((type & 0x7) | (unit << 3)) << COLUMN_RULE_WIDTH_SHIFT);
+
+ style->uncommon->column_rule_width = length;
+
+ return CSS_OK;
+}
+#undef COLUMN_RULE_WIDTH_MASK
+#undef COLUMN_RULE_WIDTH_SHIFT
+#undef COLUMN_RULE_WIDTH_INDEX
+
+#define COLUMN_SPAN_INDEX 11
+#define COLUMN_SPAN_SHIFT 6
+#define COLUMN_SPAN_MASK 0xc0
+static inline css_error set_column_span(
+ css_computed_style *style, uint8_t type)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_SPAN_INDEX];
+
+ /* 2bits: tt : type */
+ *bits = (*bits & ~COLUMN_SPAN_MASK) |
+ ((type & 0x3) << COLUMN_SPAN_SHIFT);
+
+ return CSS_OK;
+}
+#undef COLUMN_SPAN_MASK
+#undef COLUMN_SPAN_SHIFT
+#undef COLUMN_SPAN_INDEX
+
+#define COLUMN_WIDTH_INDEX 11
+#define COLUMN_WIDTH_SHIFT 0
+#define COLUMN_WIDTH_MASK 0x3f
+static inline css_error set_column_width(
+ css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint8_t *bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->uncommon->bits[COLUMN_WIDTH_INDEX];
+
+ /* 6bits: uuuutt : units | type */
+ *bits = (*bits & ~COLUMN_WIDTH_MASK) |
+ (((type & 0x3) | (unit << 2)) << COLUMN_WIDTH_SHIFT);
+
+ style->uncommon->column_width = length;
+
+ return CSS_OK;
+}
+#undef COLUMN_WIDTH_MASK
+#undef COLUMN_WIDTH_SHIFT
+#undef COLUMN_WIDTH_INDEX
+
#define CONTENT_INDEX 7
#define CONTENT_SHIFT 0
#define CONTENT_MASK 0x3
@@ -424,7 +624,7 @@ static inline css_error set_content(
*bits = (*bits & ~CONTENT_MASK) |
((type & 0x3) << CONTENT_SHIFT);
- for (c = content; c != NULL &&
+ for (c = content; c != NULL &&
c->type != CSS_COMPUTED_CONTENT_NONE; c++) {
switch (c->type) {
case CSS_COMPUTED_CONTENT_STRING:
@@ -441,9 +641,9 @@ static inline css_error set_content(
lwc_string_ref(c->data.counter.name);
break;
case CSS_COMPUTED_CONTENT_COUNTERS:
- c->data.counters.name =
+ c->data.counters.name =
lwc_string_ref(c->data.counters.name);
- c->data.counters.sep =
+ c->data.counters.sep =
lwc_string_ref(c->data.counters.sep);
break;
default:
@@ -455,7 +655,7 @@ static inline css_error set_content(
/* Free existing array */
if (oldcontent != NULL) {
- for (c = oldcontent;
+ for (c = oldcontent;
c->type != CSS_COMPUTED_CONTENT_NONE; c++) {
switch (c->type) {
case CSS_COMPUTED_CONTENT_STRING:
@@ -493,7 +693,7 @@ static inline css_error set_content(
#define VERTICAL_ALIGN_INDEX 0
#define VERTICAL_ALIGN_SHIFT 0
static inline css_error set_vertical_align(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[VERTICAL_ALIGN_INDEX];
@@ -511,7 +711,7 @@ static inline css_error set_vertical_align(
#define FONT_SIZE_INDEX 1
#define FONT_SIZE_SHIFT 0
static inline css_error set_font_size(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[FONT_SIZE_INDEX];
@@ -530,7 +730,7 @@ static inline css_error set_font_size(
#define BORDER_TOP_WIDTH_SHIFT 1
#define BORDER_TOP_WIDTH_MASK 0xfe
static inline css_error set_border_top_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[BORDER_TOP_WIDTH_INDEX];
@@ -551,7 +751,7 @@ static inline css_error set_border_top_width(
#define BORDER_RIGHT_WIDTH_SHIFT 1
#define BORDER_RIGHT_WIDTH_MASK 0xfe
static inline css_error set_border_right_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[BORDER_RIGHT_WIDTH_INDEX];
@@ -572,7 +772,7 @@ static inline css_error set_border_right_width(
#define BORDER_BOTTOM_WIDTH_SHIFT 1
#define BORDER_BOTTOM_WIDTH_MASK 0xfe
static inline css_error set_border_bottom_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[BORDER_BOTTOM_WIDTH_INDEX];
@@ -593,7 +793,7 @@ static inline css_error set_border_bottom_width(
#define BORDER_LEFT_WIDTH_SHIFT 1
#define BORDER_LEFT_WIDTH_MASK 0xfe
static inline css_error set_border_left_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[BORDER_LEFT_WIDTH_INDEX];
@@ -614,7 +814,7 @@ static inline css_error set_border_left_width(
#define BACKGROUND_IMAGE_SHIFT 0
#define BACKGROUND_IMAGE_MASK 0x1
static inline css_error set_background_image(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
lwc_string *url)
{
uint8_t *bits = &style->bits[BACKGROUND_IMAGE_INDEX];
@@ -643,7 +843,7 @@ static inline css_error set_background_image(
#define COLOR_SHIFT 0
#define COLOR_MASK 0x1
static inline css_error set_color(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_color color)
{
uint8_t *bits = &style->bits[COLOR_INDEX];
@@ -664,7 +864,7 @@ static inline css_error set_color(
#define LIST_STYLE_IMAGE_SHIFT 0
#define LIST_STYLE_IMAGE_MASK 0x1
static inline css_error set_list_style_image(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
lwc_string *url)
{
uint8_t *bits = &style->bits[LIST_STYLE_IMAGE_INDEX];
@@ -693,7 +893,7 @@ static inline css_error set_list_style_image(
#define QUOTES_SHIFT 0
#define QUOTES_MASK 0x1
static inline css_error set_quotes(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
lwc_string **quotes)
{
uint8_t *bits = &style->bits[QUOTES_INDEX];
@@ -728,7 +928,7 @@ static inline css_error set_quotes(
#define TOP_SHIFT 2
#define TOP_MASK 0xfc
static inline css_error set_top(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[TOP_INDEX];
@@ -749,7 +949,7 @@ static inline css_error set_top(
#define RIGHT_SHIFT 2
#define RIGHT_MASK 0xfc
static inline css_error set_right(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[RIGHT_INDEX];
@@ -770,7 +970,7 @@ static inline css_error set_right(
#define BOTTOM_SHIFT 2
#define BOTTOM_MASK 0xfc
static inline css_error set_bottom(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[BOTTOM_INDEX];
@@ -791,7 +991,7 @@ static inline css_error set_bottom(
#define LEFT_SHIFT 2
#define LEFT_MASK 0xfc
static inline css_error set_left(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[LEFT_INDEX];
@@ -812,7 +1012,7 @@ static inline css_error set_left(
#define BORDER_TOP_COLOR_SHIFT 0
#define BORDER_TOP_COLOR_MASK 0x3
static inline css_error set_border_top_color(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_color color)
{
uint8_t *bits = &style->bits[BORDER_TOP_COLOR_INDEX];
@@ -833,7 +1033,7 @@ static inline css_error set_border_top_color(
#define BORDER_RIGHT_COLOR_SHIFT 0
#define BORDER_RIGHT_COLOR_MASK 0x3
static inline css_error set_border_right_color(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_color color)
{
uint8_t *bits = &style->bits[BORDER_RIGHT_COLOR_INDEX];
@@ -854,7 +1054,7 @@ static inline css_error set_border_right_color(
#define BORDER_BOTTOM_COLOR_SHIFT 0
#define BORDER_BOTTOM_COLOR_MASK 0x3
static inline css_error set_border_bottom_color(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_color color)
{
uint8_t *bits = &style->bits[BORDER_BOTTOM_COLOR_INDEX];
@@ -875,7 +1075,7 @@ static inline css_error set_border_bottom_color(
#define BORDER_LEFT_COLOR_SHIFT 0
#define BORDER_LEFT_COLOR_MASK 0x3
static inline css_error set_border_left_color(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_color color)
{
uint8_t *bits = &style->bits[BORDER_LEFT_COLOR_INDEX];
@@ -896,7 +1096,7 @@ static inline css_error set_border_left_color(
#define HEIGHT_SHIFT 2
#define HEIGHT_MASK 0xfc
static inline css_error set_height(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[HEIGHT_INDEX];
@@ -917,7 +1117,7 @@ static inline css_error set_height(
#define LINE_HEIGHT_SHIFT 2
#define LINE_HEIGHT_MASK 0xfc
static inline css_error set_line_height(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[LINE_HEIGHT_INDEX];
@@ -938,7 +1138,7 @@ static inline css_error set_line_height(
#define BACKGROUND_COLOR_SHIFT 0
#define BACKGROUND_COLOR_MASK 0x3
static inline css_error set_background_color(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_color color)
{
uint8_t *bits = &style->bits[BACKGROUND_COLOR_INDEX];
@@ -959,7 +1159,7 @@ static inline css_error set_background_color(
#define Z_INDEX_SHIFT 0
#define Z_INDEX_MASK 0x3
static inline css_error set_z_index(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
int32_t z_index)
{
uint8_t *bits = &style->bits[Z_INDEX_INDEX];
@@ -980,7 +1180,7 @@ static inline css_error set_z_index(
#define MARGIN_TOP_SHIFT 2
#define MARGIN_TOP_MASK 0xfc
static inline css_error set_margin_top(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MARGIN_TOP_INDEX];
@@ -1001,7 +1201,7 @@ static inline css_error set_margin_top(
#define MARGIN_RIGHT_SHIFT 2
#define MARGIN_RIGHT_MASK 0xfc
static inline css_error set_margin_right(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MARGIN_RIGHT_INDEX];
@@ -1022,7 +1222,7 @@ static inline css_error set_margin_right(
#define MARGIN_BOTTOM_SHIFT 2
#define MARGIN_BOTTOM_MASK 0xfc
static inline css_error set_margin_bottom(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MARGIN_BOTTOM_INDEX];
@@ -1043,7 +1243,7 @@ static inline css_error set_margin_bottom(
#define MARGIN_LEFT_SHIFT 2
#define MARGIN_LEFT_MASK 0xfc
static inline css_error set_margin_left(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MARGIN_LEFT_INDEX];
@@ -1136,7 +1336,7 @@ static inline css_error set_direction(
#define MAX_HEIGHT_SHIFT 2
#define MAX_HEIGHT_MASK 0xfc
static inline css_error set_max_height(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MAX_HEIGHT_INDEX];
@@ -1157,7 +1357,7 @@ static inline css_error set_max_height(
#define MAX_WIDTH_SHIFT 2
#define MAX_WIDTH_MASK 0xfc
static inline css_error set_max_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MAX_WIDTH_INDEX];
@@ -1178,7 +1378,7 @@ static inline css_error set_max_width(
#define WIDTH_SHIFT 2
#define WIDTH_MASK 0xfc
static inline css_error set_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[WIDTH_INDEX];
@@ -1253,7 +1453,7 @@ static inline css_error set_font_style(
#define MIN_HEIGHT_SHIFT 3
#define MIN_HEIGHT_MASK 0xf8
static inline css_error set_min_height(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MIN_HEIGHT_INDEX];
@@ -1274,7 +1474,7 @@ static inline css_error set_min_height(
#define MIN_WIDTH_SHIFT 3
#define MIN_WIDTH_MASK 0xf8
static inline css_error set_min_width(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[MIN_WIDTH_INDEX];
@@ -1331,7 +1531,7 @@ static inline css_error set_clear(
#define PADDING_TOP_SHIFT 3
#define PADDING_TOP_MASK 0xf8
static inline css_error set_padding_top(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[PADDING_TOP_INDEX];
@@ -1352,7 +1552,7 @@ static inline css_error set_padding_top(
#define PADDING_RIGHT_SHIFT 3
#define PADDING_RIGHT_MASK 0xf8
static inline css_error set_padding_right(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[PADDING_RIGHT_INDEX];
@@ -1373,7 +1573,7 @@ static inline css_error set_padding_right(
#define PADDING_BOTTOM_SHIFT 3
#define PADDING_BOTTOM_MASK 0xf8
static inline css_error set_padding_bottom(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[PADDING_BOTTOM_INDEX];
@@ -1394,7 +1594,7 @@ static inline css_error set_padding_bottom(
#define PADDING_LEFT_SHIFT 3
#define PADDING_LEFT_MASK 0xf8
static inline css_error set_padding_left(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[PADDING_LEFT_INDEX];
@@ -1469,7 +1669,7 @@ static inline css_error set_position(
#define OPACITY_SHIFT 2
#define OPACITY_MASK 0x04
static inline css_error set_opacity(
- css_computed_style *style,
+ css_computed_style *style,
uint8_t type, css_fixed opacity)
{
uint8_t *bits = &style->bits[OPACITY_INDEX];
@@ -1508,7 +1708,7 @@ static inline css_error set_text_transform(
#define TEXT_INDENT_SHIFT 3
#define TEXT_INDENT_MASK 0xf8
static inline css_error set_text_indent(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
uint8_t *bits = &style->bits[TEXT_INDENT_INDEX];
@@ -1549,7 +1749,7 @@ static inline css_error set_white_space(
#define BACKGROUND_POSITION_INDEX1 26
#define BACKGROUND_POSITION_SHIFT1 0
static inline css_error set_background_position(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
css_fixed hlength, css_unit hunit,
css_fixed vlength, css_unit vunit)
{
@@ -1558,7 +1758,7 @@ static inline css_error set_background_position(
bits = &style->bits[BACKGROUND_POSITION_INDEX];
/* 1 bit: type */
- *bits = (*bits & ~BACKGROUND_POSITION_MASK) |
+ *bits = (*bits & ~BACKGROUND_POSITION_MASK) |
((type & 0x1) << BACKGROUND_POSITION_SHIFT);
bits = &style->bits[BACKGROUND_POSITION_INDEX1];
@@ -1635,7 +1835,7 @@ static inline css_error set_text_decoration(
#define FONT_FAMILY_SHIFT 0
#define FONT_FAMILY_MASK 0x7
static inline css_error set_font_family(
- css_computed_style *style, uint8_t type,
+ css_computed_style *style, uint8_t type,
lwc_string **names)
{
uint8_t *bits = &style->bits[FONT_FAMILY_INDEX];
@@ -1923,9 +2123,9 @@ static inline css_error set_page_break_before(
return CSS_OK;
}
}
-
+
ENSURE_PAGE;
-
+
bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX];
/* 3bits: type */
@@ -1951,7 +2151,7 @@ static inline css_error set_page_break_inside(
return CSS_OK;
}
}
-
+
ENSURE_PAGE;
bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX];
@@ -1973,7 +2173,7 @@ static inline css_error set_orphans(
css_computed_style *style, uint8_t type, int32_t count)
{
uint8_t *bits;
-
+
if (style->page == NULL) {
if (type == CSS_ORPHANS_SET && count == 2) {
return CSS_OK;
@@ -1981,14 +2181,14 @@ static inline css_error set_orphans(
}
ENSURE_PAGE;
-
+
bits = &style->page->bits[ORPHANS_INDEX];
-
+
/* 1bit: type */
*bits = (*bits & ~ORPHANS_MASK) | ((type & 0x1) << ORPHANS_SHIFT);
-
+
style->page->orphans = count;
-
+
return CSS_OK;
}
#undef ORPHANS_INDEX
@@ -2002,22 +2202,22 @@ static inline css_error set_widows(
css_computed_style *style, uint8_t type, int32_t count)
{
uint8_t *bits;
-
+
if (style->page == NULL) {
if (type == CSS_WIDOWS_SET && count == 2) {
return CSS_OK;
}
}
-
+
ENSURE_PAGE;
-
+
bits = &style->page->bits[WIDOWS_INDEX];
-
+
/* 1bit: type */
*bits = (*bits & ~WIDOWS_MASK) | ((type & 0x1) << WIDOWS_SHIFT);
-
+
style->page->widows = count;
-
+
return CSS_OK;
}
#undef WIDOWS_INDEX
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 96e57bf..c04f063 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -37,6 +37,14 @@ caption-side: inherit
clear: none
clip: auto
color: #ffff0000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -134,6 +142,14 @@ caption-side: inherit
clear: none
clip: auto
color: #ffff0000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -231,6 +247,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -328,6 +352,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -417,6 +449,14 @@ caption-side: top
clear: none
clip: auto
color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -504,6 +544,14 @@ caption-side: top
clear: none
clip: auto
color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -592,6 +640,14 @@ caption-side: top
clear: none
clip: auto
color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -680,6 +736,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -767,6 +831,14 @@ caption-side: top
clear: none
clip: auto
color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -859,6 +931,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -951,6 +1031,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1044,6 +1132,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1140,6 +1236,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1235,6 +1339,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1336,6 +1448,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1437,6 +1557,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1538,6 +1666,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1643,6 +1779,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1747,6 +1891,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1849,6 +2001,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -1950,6 +2110,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2051,6 +2219,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2152,6 +2328,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2253,6 +2437,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2354,6 +2546,14 @@ caption-side: inherit
clear: inherit
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2455,6 +2655,14 @@ caption-side: inherit
clear: left
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2556,6 +2764,14 @@ caption-side: inherit
clear: both
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2657,6 +2873,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2758,6 +2982,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2859,6 +3091,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -2960,6 +3200,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3061,6 +3309,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3162,6 +3418,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3263,6 +3527,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3364,6 +3636,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3465,6 +3745,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3566,6 +3854,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3667,6 +3963,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3768,6 +4072,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3869,6 +4181,14 @@ caption-side: inherit
clear: right
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -3963,6 +4283,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: currentColor
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -4057,6 +4385,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -4151,6 +4487,14 @@ caption-side: inherit
clear: none
clip: auto
color: inherit
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: inherit
+column-rule-style: none
+column-rule-width: medium
+column-span: none
+column-width: auto
content: normal
counter-increment: none
counter-reset: none
@@ -4207,3 +4551,103 @@ word-spacing: inherit
writing-mode: vertical-lr
z-index: auto
#reset
+
+#tree
+| div
+| p*
+#ua
+p{display: block;}
+#user
+#author
+p{column-count: 2; column-rule-color: #bbc; column-rule-style: solid; column-rule-width: 2px; column-span: all; column-width: 6em;}
+#errors
+#expected
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: inherit
+border-spacing: inherit
+border-top-color: currentColor
+border-right-color: currentColor
+border-bottom-color: currentColor
+border-left-color: currentColor
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: medium
+border-right-width: medium
+border-bottom-width: medium
+border-left-width: medium
+bottom: auto
+caption-side: inherit
+clear: none
+clip: auto
+color: inherit
+column-count: 2048
+column-fill: balance
+column-gap: normal
+column-rule-color: #ffbbbbcc
+column-rule-style: solid
+column-rule-width: 2px
+column-span: all
+column-width: 6em
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: inherit
+direction: inherit
+display: block
+empty-cells: inherit
+float: none
+font-family: inherit
+font-size: inherit
+font-style: inherit
+font-variant: inherit
+font-weight: inherit
+height: auto
+left: auto
+letter-spacing: inherit
+line-height: inherit
+list-style-image: inherit
+list-style-position: inherit
+list-style-type: inherit
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+outline-color: invert
+outline-style: none
+outline-width: medium
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: inherit
+right: auto
+table-layout: auto
+text-align: inherit
+text-decoration: none
+text-indent: inherit
+text-transform: inherit
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: inherit
+white-space: inherit
+width: auto
+word-spacing: inherit
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
diff --git a/test/dump_computed.h b/test/dump_computed.h
index 5f83767..a4c0b89 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -151,7 +151,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
const css_computed_content_item *content = NULL;
const css_computed_counter *counter = NULL;
lwc_string **string_list = NULL;
- int32_t zindex = 0;
+ int32_t integer = 0;
/* background-attachment */
val = css_computed_background_attachment(style);
@@ -824,6 +824,210 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
ptr += wrote;
*len -= wrote;
+ /* column-count */
+ val = css_computed_column_count(style, &integer);
+ switch (val) {
+ case CSS_COLUMN_COUNT_INHERIT:
+ wrote = snprintf(ptr, *len, "column-count: inherit\n");
+ break;
+ case CSS_COLUMN_COUNT_AUTO:
+ wrote = snprintf(ptr, *len, "column-count: auto\n");
+ break;
+ case CSS_COLUMN_COUNT_SET:
+ wrote = snprintf(ptr, *len, "column-count: %d\n", integer);
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* column-fill */
+ val = css_computed_column_fill(style);
+ switch (val) {
+ case CSS_COLUMN_FILL_INHERIT:
+ wrote = snprintf(ptr, *len, "column-fill: inherit\n");
+ break;
+ case CSS_COLUMN_FILL_AUTO:
+ wrote = snprintf(ptr, *len, "column-fill: auto\n");
+ break;
+ case CSS_COLUMN_FILL_BALANCE:
+ wrote = snprintf(ptr, *len, "column-fill: balance\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* column-gap */
+ val = css_computed_column_gap(style, &len1, &unit1);
+ switch (val) {
+ case CSS_COLUMN_GAP_INHERIT:
+ wrote = snprintf(ptr, *len, "column-gap: inherit\n");
+ break;
+ case CSS_COLUMN_GAP_NORMAL:
+ wrote = snprintf(ptr, *len, "column-gap: normal\n");
+ break;
+ case CSS_COLUMN_GAP_SET:
+ wrote = snprintf(ptr, *len, "column-gap: ");
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = dump_css_unit(len1, unit1, ptr, *len);
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = snprintf(ptr, *len, "\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* column-rule-color */
+ val = css_computed_column_rule_color(style, &color);
+ switch (val) {
+ case CSS_COLUMN_RULE_COLOR_INHERIT:
+ wrote = snprintf(ptr, *len, "column-rule-color: inherit\n");
+ break;
+ case CSS_COLUMN_RULE_COLOR_CURRENT_COLOR:
+ wrote = snprintf(ptr, *len, "column-rule-color: currentColor\n");
+ break;
+ case CSS_COLUMN_RULE_COLOR_COLOR:
+ wrote = snprintf(ptr, *len, "column-rule-color: #%08x\n",
+ color);
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* column-rule-style */
+ val = css_computed_column_rule_style(style);
+ switch (val) {
+ case CSS_COLUMN_RULE_STYLE_INHERIT:
+ wrote = snprintf(ptr, *len, "column-rule-style: inherit\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_NONE:
+ wrote = snprintf(ptr, *len, "column-rule-style: none\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_HIDDEN:
+ wrote = snprintf(ptr, *len, "column-rule-style: hidden\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_DOTTED:
+ wrote = snprintf(ptr, *len, "column-rule-style: dotted\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_DASHED:
+ wrote = snprintf(ptr, *len, "column-rule-style: dashed\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_SOLID:
+ wrote = snprintf(ptr, *len, "column-rule-style: solid\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_DOUBLE:
+ wrote = snprintf(ptr, *len, "column-rule-style: double\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_GROOVE:
+ wrote = snprintf(ptr, *len, "column-rule-style: groove\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_RIDGE:
+ wrote = snprintf(ptr, *len, "column-rule-style: ridge\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_INSET:
+ wrote = snprintf(ptr, *len, "column-rule-style: inset\n");
+ break;
+ case CSS_COLUMN_RULE_STYLE_OUTSET:
+ wrote = snprintf(ptr, *len, "column-rule-style: outset\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* column-rule-width */
+ val = css_computed_column_rule_width(style, &len1, &unit1);
+ switch (val) {
+ case CSS_COLUMN_RULE_WIDTH_INHERIT:
+ wrote = snprintf(ptr, *len, "column-rule-width: inherit\n");
+ break;
+ case CSS_COLUMN_RULE_WIDTH_THIN:
+ wrote = snprintf(ptr, *len, "column-rule-width: thin\n");
+ break;
+ case CSS_COLUMN_RULE_WIDTH_MEDIUM:
+ wrote = snprintf(ptr, *len, "column-rule-width: medium\n");
+ break;
+ case CSS_COLUMN_RULE_WIDTH_THICK:
+ wrote = snprintf(ptr, *len, "column-rule-width: thick\n");
+ break;
+ case CSS_COLUMN_RULE_WIDTH_WIDTH:
+ wrote = snprintf(ptr, *len, "column-rule-width: ");
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = dump_css_unit(len1, unit1, ptr, *len);
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = snprintf(ptr, *len, "\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* column-span */
+ val = css_computed_column_span(style);
+ switch (val) {
+ case CSS_COLUMN_SPAN_INHERIT:
+ wrote = snprintf(ptr, *len, "column-span: inherit\n");
+ break;
+ case CSS_COLUMN_SPAN_NONE:
+ wrote = snprintf(ptr, *len, "column-span: none\n");
+ break;
+ case CSS_COLUMN_SPAN_ALL:
+ wrote = snprintf(ptr, *len, "column-span: all\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* column-width */
+ val = css_computed_column_width(style, &len1, &unit1);
+ switch (val) {
+ case CSS_COLUMN_WIDTH_INHERIT:
+ wrote = snprintf(ptr, *len, "column-width: inherit\n");
+ break;
+ case CSS_COLUMN_WIDTH_AUTO:
+ wrote = snprintf(ptr, *len, "column-width: auto\n");
+ break;
+ case CSS_COLUMN_WIDTH_SET:
+ wrote = snprintf(ptr, *len, "column-width: ");
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = dump_css_unit(len1, unit1, ptr, *len);
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = snprintf(ptr, *len, "\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
/* content */
val = css_computed_content(style, &content);
switch (val) {
@@ -2520,7 +2724,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
*len -= wrote;
/* z-index */
- val = css_computed_z_index(style, &zindex);
+ val = css_computed_z_index(style, &integer);
switch (val) {
case CSS_Z_INDEX_INHERIT:
wrote = snprintf(ptr, *len, "z-index: inherit\n");
@@ -2529,7 +2733,7 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
wrote = snprintf(ptr, *len, "z-index: auto\n");
break;
case CSS_Z_INDEX_SET:
- wrote = snprintf(ptr, *len, "z-index: %d\n", zindex);
+ wrote = snprintf(ptr, *len, "z-index: %d\n", integer);
break;
default:
wrote = 0;
diff --git a/test/select-common.c b/test/select-common.c
index 783790a..fef53ea 100644
--- a/test/select-common.c
+++ b/test/select-common.c
@@ -721,6 +721,41 @@ void css__parse_expected(line_ctx *ctx, const char *data, size_t len)
ctx->expused += len;
}
+static void show_differences(size_t len, const char *exp, const char *res)
+{
+ const char *pos_exp, *opos_exp;
+ const char *pos_res, *opos_res;
+
+ opos_exp = pos_exp = exp;
+ opos_res = pos_res = res;
+
+ printf("Line differences:\n");
+ while (pos_exp < exp + len && pos_res < res + len) {
+ if (*pos_exp == '\n' && *pos_res == '\n') {
+ if (pos_exp - opos_exp != pos_res - opos_res ||
+ memcmp(opos_exp, opos_res,
+ pos_exp - opos_exp) != 0) {
+ printf("Expected:\t%.*s\n",
+ (int)(pos_exp - opos_exp),
+ opos_exp);
+ printf(" Result:\t%.*s\n",
+ (int)(pos_res - opos_res),
+ opos_res);
+ printf("\n");
+ }
+ opos_exp = ++pos_exp;
+ opos_res = ++pos_res;
+ } else if (*pos_exp == '\n') {
+ pos_res++;
+ } else if (*pos_res == '\n') {
+ pos_exp++;
+ } else {
+ pos_exp++;
+ pos_res++;
+ }
+ }
+}
+
void run_test(line_ctx *ctx, const char *exp, size_t explen)
{
css_select_ctx *select;
@@ -756,10 +791,13 @@ void run_test(line_ctx *ctx, const char *exp, size_t explen)
dump_computed_style(results->styles[ctx->pseudo_element], buf, &buflen);
if (8192 - buflen != explen || memcmp(buf, exp, explen) != 0) {
+ size_t len = 8192 - buflen < explen ? 8192 - buflen : explen;
printf("Expected (%u):\n%.*s\n",
(int) explen, (int) explen, exp);
printf("Result (%u):\n%.*s\n", (int) (8192 - buflen),
(int) (8192 - buflen), buf);
+
+ show_differences(len, exp, buf);
assert(0 && "Result doesn't match expected");
}