From 5c5e38224c349ef810b8d5acebf194d06e431970 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 31 Dec 2014 13:29:57 +0000 Subject: Fix. --- src/select/propget.h | 72 +++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/src/select/propget.h b/src/select/propget.h index 45c773f..2a263aa 100644 --- a/src/select/propget.h +++ b/src/select/propget.h @@ -36,8 +36,8 @@ static inline uint8_t get_letter_spacing( return (bits & 3); } - /* Inherited */ - return CSS_LETTER_SPACING_INHERIT; + /* Initial value */ + return CSS_LETTER_SPACING_NORMAL; } #undef LETTER_SPACING_MASK #undef LETTER_SPACING_SHIFT @@ -63,7 +63,7 @@ static inline uint8_t get_outline_color( return (bits & 3); } - /* Not inherited; initial value */ + /* Initial value */ return CSS_OUTLINE_COLOR_INVERT; } #undef OUTLINE_COLOR_MASK @@ -92,7 +92,7 @@ static inline uint8_t get_outline_width( return (bits & 7); } - /* Not inherited; initial value */ + /* Initial value */ return CSS_OUTLINE_WIDTH_MEDIUM; } #undef OUTLINE_WIDTH_MASK @@ -134,8 +134,10 @@ static inline uint8_t get_border_spacing( return bits; } - /* Inherited */ - return CSS_BORDER_SPACING_INHERIT; + /* Initial value */ + *hlength = *vlength = 0; + *hunit = *vunit = CSS_UNIT_PX; + return CSS_BORDER_SPACING_SET; } #undef BORDER_SPACING_MASK1 #undef BORDER_SPACING_SHIFT1 @@ -159,7 +161,7 @@ static inline uint8_t get_break_after( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_BREAK_AFTER_AUTO; } #undef BREAK_AFTER_MASK @@ -181,7 +183,7 @@ static inline uint8_t get_break_before( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_BREAK_BEFORE_AUTO; } #undef BREAK_BEFORE_MASK @@ -203,7 +205,7 @@ static inline uint8_t get_break_inside( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_BREAK_INSIDE_AUTO; } #undef BREAK_INSIDE_MASK @@ -232,8 +234,8 @@ static inline uint8_t get_word_spacing( return (bits & 3); } - /* Inherited */ - return CSS_WORD_SPACING_INHERIT; + /* Initial value */ + return CSS_WORD_SPACING_NORMAL; } #undef WORD_SPACING_MASK #undef WORD_SPACING_SHIFT @@ -254,8 +256,8 @@ static inline uint8_t get_writing_mode( return bits; } - /* Inherited */ - return CSS_WRITING_MODE_INHERIT; + /* Initial value */ + return CSS_WRITING_MODE_HORIZONTAL_TB; } #undef WRITING_MODE_INDEX #undef WRITING_MODE_MASK @@ -279,7 +281,7 @@ static inline uint8_t get_counter_increment( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COUNTER_INCREMENT_NONE; } #undef COUNTER_INCREMENT_MASK @@ -304,7 +306,7 @@ static inline uint8_t get_counter_reset( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COUNTER_RESET_NONE; } #undef COUNTER_RESET_MASK @@ -329,8 +331,8 @@ static inline uint8_t get_cursor( return bits; } - /* Inherited */ - return CSS_CURSOR_INHERIT; + /* Initial value */ + return CSS_CURSOR_AUTO; } #undef CURSOR_MASK #undef CURSOR_SHIFT @@ -399,7 +401,7 @@ static inline uint8_t get_clip( return (bits & 0x3); } - /* Not inherited; initial value */ + /* Initial value */ return CSS_CLIP_AUTO; } #undef CLIP_MASK2 @@ -429,7 +431,7 @@ static inline uint8_t get_column_count( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COLUMN_COUNT_AUTO; } #undef COLUMN_COUNT_MASK @@ -451,7 +453,7 @@ static inline uint8_t get_column_fill( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COLUMN_FILL_BALANCE; } #undef COLUMN_FILL_MASK @@ -479,7 +481,7 @@ static inline uint8_t get_column_gap( return (bits & 0x3); } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COLUMN_GAP_NORMAL; } #undef COLUMN_GAP_MASK @@ -504,7 +506,7 @@ static inline uint8_t get_column_rule_color( return bits; } - /* Not inherited; initial value */ + /* Initial value */ *color = 0; return CSS_COLUMN_RULE_COLOR_CURRENT_COLOR; } @@ -527,7 +529,7 @@ static inline uint8_t get_column_rule_style( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COLUMN_RULE_STYLE_NONE; } #undef COLUMN_RULE_STYLE_MASK @@ -555,7 +557,7 @@ static inline uint8_t get_column_rule_width( return (bits & 0x7); } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COLUMN_RULE_WIDTH_MEDIUM; } #undef COLUMN_RULE_WIDTH_MASK @@ -577,7 +579,7 @@ static inline uint8_t get_column_span( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COLUMN_SPAN_NONE; } #undef COLUMN_SPAN_MASK @@ -605,7 +607,7 @@ static inline uint8_t get_column_width( return (bits & 0x3); } - /* Not inherited; initial value */ + /* Initial value */ return CSS_COLUMN_WIDTH_AUTO; } #undef COLUMN_WIDTH_MASK @@ -630,7 +632,7 @@ static inline uint8_t get_content( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_CONTENT_NORMAL; } #undef CONTENT_MASK @@ -2067,7 +2069,7 @@ static inline uint8_t get_page_break_after( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_PAGE_BREAK_AFTER_AUTO; } #undef PAGE_BREAK_AFTER_MASK @@ -2089,7 +2091,7 @@ static inline uint8_t get_page_break_before( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_PAGE_BREAK_BEFORE_AUTO; } #undef PAGE_BREAK_BEFORE_MASK @@ -2111,7 +2113,7 @@ static inline uint8_t get_page_break_inside( return bits; } - /* Not inherited; initial value */ + /* Initial value */ return CSS_PAGE_BREAK_INSIDE_AUTO; } #undef PAGE_BREAK_INSIDE_MASK @@ -2136,8 +2138,9 @@ static inline uint8_t get_orphans( return bits; } - /* Inherited */ - return CSS_ORPHANS_INHERIT; + /* Initial value */ + *orphans = 2; + return CSS_ORPHANS_SET; } #undef ORPHANS_MASK #undef ORPHANS_SHIFT @@ -2161,8 +2164,9 @@ static inline uint8_t get_widows( return bits; } - /* Inherited */ - return CSS_WIDOWS_INHERIT; + /* Initial value */ + *widows = 2; + return CSS_WIDOWS_SET; } #undef WIDOWS_MASK #undef WIDOWS_SHIFT -- cgit v1.2.1 From 54fd40cb367a078ac66eb8c169087a9345597434 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 31 Dec 2014 13:30:12 +0000 Subject: Make it compose styles. --- test/select-common.c | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/test/select-common.c b/test/select-common.c index fef53ea..f1762a6 100644 --- a/test/select-common.c +++ b/test/select-common.c @@ -29,6 +29,7 @@ typedef struct node { uint32_t n_attrs; attribute *attrs; + css_select_results *sr; void *libcss_node_data; struct node *parent; @@ -756,6 +757,38 @@ static void show_differences(size_t len, const char *exp, const char *res) } } + +static void run_test_select_tree(css_select_ctx *select, + node *node, line_ctx *ctx, + char *buf, size_t *buflen) +{ + css_select_results *sr; + struct node *n = NULL; + + assert(css_select_style(select, node, ctx->media, NULL, + &select_handler, ctx, &sr) == CSS_OK); + + if (node->parent != NULL) { + assert(css_computed_style_compose( + node->parent->sr->styles[ctx->pseudo_element], + sr->styles[ctx->pseudo_element], + compute_font_size, NULL, + sr->styles[ctx->pseudo_element]) == CSS_OK); + } + + node->sr = sr; + + if (node == ctx->target) { + dump_computed_style(sr->styles[ctx->pseudo_element], + buf, buflen); + } + + for (n = node->children; n != NULL; n = n->next) { + run_test_select_tree(select, n, ctx, buf, buflen); + } +} + + void run_test(line_ctx *ctx, const char *exp, size_t explen) { css_select_ctx *select; @@ -783,13 +816,11 @@ void run_test(line_ctx *ctx, const char *exp, size_t explen) testnum++; - assert(css_select_style(select, ctx->target, ctx->media, NULL, - &select_handler, ctx, &results) == CSS_OK); + run_test_select_tree(select, ctx->tree, ctx, buf, &buflen); + results = ctx->target->sr; assert(results->styles[ctx->pseudo_element] != NULL); - 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", @@ -802,9 +833,7 @@ void run_test(line_ctx *ctx, const char *exp, size_t explen) } /* Clean up */ - css_select_results_destroy(results); css_select_ctx_destroy(select); - destroy_tree(ctx->tree); for (i = 0; i < ctx->n_sheets; i++) { @@ -834,6 +863,8 @@ void destroy_tree(node *root) destroy_tree(n); } + + css_select_results_destroy(root->sr); for (i = 0; i < root->n_attrs; ++i) { lwc_string_unref(root->attrs[i].name); -- cgit v1.2.1