From 3caf569a9db0c852d7f149cf796d77ce3858cf32 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 10 Feb 2009 15:49:51 +0000 Subject: Much API cleanup. Dispatch property handling through a table. Implement cascade_style. All property handlers are stubs at present. svn path=/trunk/libcss/; revision=6409 --- src/select/properties.c | 1519 +++++++++++++++++++++++++++++++++++++++++++++++ src/select/select.c | 164 ++++- 2 files changed, 1660 insertions(+), 23 deletions(-) create mode 100644 src/select/properties.c diff --git a/src/select/properties.c b/src/select/properties.c new file mode 100644 index 0000000..658f668 --- /dev/null +++ b/src/select/properties.c @@ -0,0 +1,1519 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 John-Mark Bell + */ + +static css_error cascade_azimuth(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_azimuth(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_background_attachment(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_background_attachment(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_background_color(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_background_color(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_background_image(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_background_image(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_background_position(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_background_position(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_background_repeat(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_background_repeat(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_border_collapse(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_border_collapse(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_border_spacing(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_border_spacing(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_border_color(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_border_color(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_border_style(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_border_style(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_border_width(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_border_width(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_bottom(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_bottom(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_caption_side(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_caption_side(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_clear(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_clear(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_clip(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_clip(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_color(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_color(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_content(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_content(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_counter_increment(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_counter_increment(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_counter_reset(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_counter_reset(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_cue_after(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_cue_after(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_cue_before(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_cue_before(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_cursor(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_cursor(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_direction(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_direction(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_display(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_display(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_elevation(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_elevation(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_empty_cells(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_empty_cells(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_float(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_float(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_font_family(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_font_family(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_font_size(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_font_size(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_font_style(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_font_style(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_font_variant(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_font_variant(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_font_weight(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_font_weight(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_height(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_height(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_left(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_left(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_letter_spacing(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_letter_spacing(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_line_height(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_line_height(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_list_style_image(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_list_style_image(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_list_style_position(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_list_style_position(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_list_style_type(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_list_style_type(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_margin(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_margin(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_max_height(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_max_height(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_max_width(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_max_width(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_min_height(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_min_height(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_min_width(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_min_width(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_orphans(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_orphans(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_outline_color(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_outline_color(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_outline_style(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_outline_style(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_outline_width(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_outline_width(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_overflow(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_overflow(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_padding(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_padding(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_page_break_after(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_page_break_after(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_page_break_before(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_page_break_before(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_page_break_inside(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_page_break_inside(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_pause_after(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_pause_after(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_pause_before(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_pause_before(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_pitch_range(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_pitch_range(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_pitch(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_pitch(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_play_during(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_play_during(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_position(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_position(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_quotes(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_quotes(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_richness(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_richness(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_right(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_right(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_speak_header(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_speak_header(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_speak_numeral(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_speak_numeral(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_speak_punctuation(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_speak_punctuation(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_speak(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_speak(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_speech_rate(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_speech_rate(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_stress(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_stress(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_table_layout(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_table_layout(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_text_align(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_text_align(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_text_decoration(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_text_decoration(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_text_indent(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_text_indent(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_text_transform(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_text_transform(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_top(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_top(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_unicode_bidi(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_unicode_bidi(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_vertical_align(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_vertical_align(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_visibility(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_visibility(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_voice_family(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_voice_family(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_volume(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_volume(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_white_space(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_white_space(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_widows(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_widows(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_width(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_width(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_word_spacing(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_word_spacing(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + +static css_error cascade_z_index(css_select_ctx *ctx, + uint32_t opv, css_style *style, css_select_state *state) +{ + UNUSED(ctx); + UNUSED(opv); + UNUSED(style); + UNUSED(state); + + return CSS_OK; +} + +static css_error initial_z_index(css_computed_style *style) +{ + UNUSED(style); + + return CSS_OK; +} + diff --git a/src/select/select.c b/src/select/select.c index 8e620ea..21f3770 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -12,6 +12,8 @@ #include #include +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" #include "stylesheet.h" #include "select/hash.h" #include "select/propset.h" @@ -31,7 +33,7 @@ struct css_select_ctx { }; /** - * State for each property during selection + * Selection state */ typedef struct css_select_state { void *node; /* Node we're selecting for */ @@ -44,6 +46,9 @@ typedef struct css_select_state { void *pw; /* Client data for handlers */ uint32_t current_sheet; /* Identity of current sheet */ + css_origin current_origin; /* Origin of current sheet */ + uint32_t current_rule_index; /* Index of current rule */ + uint32_t current_specificity; /* Specificity of current rule */ /** \todo We need a better way of knowing the number of properties * Bytecode opcodes cover 84 properties, then there's a @@ -69,8 +74,7 @@ static css_error select_from_sheet(css_select_ctx *ctx, static css_error match_selectors_in_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_select_state *state); static css_error match_selector_chain(css_select_ctx *ctx, - const css_selector *selector, css_origin origin, - css_select_state *state, + const css_selector *selector, css_select_state *state, const parserutils_hash_entry *universal); static css_error match_named_combinator(css_select_ctx *ctx, css_combinator type, const parserutils_hash_entry *name, @@ -84,9 +88,108 @@ static css_error match_details(css_select_ctx *ctx, void *node, static css_error match_detail(css_select_ctx *ctx, void *node, const css_selector_detail *detail, css_select_state *state, bool *match); -static css_error cascade_style(css_select_ctx *ctx, css_style *style, - uint32_t specificity, css_origin origin, uint32_t rule_index, +static css_error cascade_style(css_select_ctx *ctx, const css_style *style, css_select_state *state); +static inline void advance_bytecode(css_style *style, uint32_t n_bytes); + +/* Property handlers */ +#include "select/properties.c" + +/** + * Dispatch table for properties, indexed by opcode + */ +static struct prop_table { + css_error (*cascade)(css_select_ctx *ctx, uint32_t opv, + css_style *style, css_select_state *state); + css_error (*initial)(css_computed_style *style); + + uint32_t inherited : 1; +} properties[] = { + { cascade_azimuth, initial_azimuth, 1 }, + { cascade_background_attachment, initial_background_attachment, 0 }, + { cascade_background_color, initial_background_color, 0 }, + { cascade_background_image, initial_background_image, 0 }, + { cascade_background_position, initial_background_position, 0 }, + { cascade_background_repeat, initial_background_repeat, 0 }, + { cascade_border_collapse, initial_border_collapse, 1 }, + { cascade_border_spacing, initial_border_spacing, 1 }, + { cascade_border_color, initial_border_color, 0 }, + { cascade_border_style, initial_border_style, 0 }, + { cascade_border_width, initial_border_width, 0 }, + { cascade_bottom, initial_bottom, 0 }, + { cascade_caption_side, initial_caption_side, 1 }, + { cascade_clear, initial_clear, 0 }, + { cascade_clip, initial_clip, 0 }, + { cascade_color, initial_color, 1 }, + { cascade_content, initial_content, 0 }, + { cascade_counter_increment, initial_counter_increment, 0 }, + { cascade_counter_reset, initial_counter_reset, 0 }, + { cascade_cue_after, initial_cue_after, 0 }, + { cascade_cue_before, initial_cue_before, 0 }, + { cascade_cursor, initial_cursor, 1 }, + { cascade_direction, initial_direction, 1 }, + { cascade_display, initial_display, 0 }, + { cascade_elevation, initial_elevation, 1 }, + { cascade_empty_cells, initial_empty_cells, 1 }, + { cascade_float, initial_float, 0 }, + { cascade_font_family, initial_font_family, 1 }, + { cascade_font_size, initial_font_size, 1 }, + { cascade_font_style, initial_font_style, 1 }, + { cascade_font_variant, initial_font_variant, 1 }, + { cascade_font_weight, initial_font_weight, 1 }, + { cascade_height, initial_height, 0 }, + { cascade_left, initial_left, 0 }, + { cascade_letter_spacing, initial_letter_spacing, 1 }, + { cascade_line_height, initial_line_height, 1 }, + { cascade_list_style_image, initial_list_style_image, 1 }, + { cascade_list_style_position, initial_list_style_position, 1 }, + { cascade_list_style_type, initial_list_style_type, 1 }, + { cascade_margin, initial_margin, 0 }, + { cascade_max_height, initial_max_height, 0 }, + { cascade_max_width, initial_max_width, 0 }, + { cascade_min_height, initial_min_height, 0 }, + { cascade_min_width, initial_min_width, 0 }, + { cascade_orphans, initial_orphans, 1 }, + { cascade_outline_color, initial_outline_color, 0 }, + { cascade_outline_style, initial_outline_style, 0 }, + { cascade_outline_width, initial_outline_width, 0 }, + { cascade_overflow, initial_overflow, 0 }, + { cascade_padding, initial_padding, 0 }, + { cascade_page_break_after, initial_page_break_after, 0 }, + { cascade_page_break_before, initial_page_break_before, 0 }, + { cascade_page_break_inside, initial_page_break_inside, 1 }, + { cascade_pause_after, initial_pause_after, 0 }, + { cascade_pause_before, initial_pause_before, 0 }, + { cascade_pitch_range, initial_pitch_range, 1 }, + { cascade_pitch, initial_pitch, 1 }, + { cascade_play_during, initial_play_during, 0 }, + { cascade_position, initial_position, 0 }, + { cascade_quotes, initial_quotes, 1 }, + { cascade_richness, initial_richness, 1 }, + { cascade_right, initial_right, 0 }, + { cascade_speak_header, initial_speak_header, 1 }, + { cascade_speak_numeral, initial_speak_numeral, 1 }, + { cascade_speak_punctuation, initial_speak_punctuation, 1 }, + { cascade_speak, initial_speak, 1 }, + { cascade_speech_rate, initial_speech_rate, 1 }, + { cascade_stress, initial_stress, 1 }, + { cascade_table_layout, initial_table_layout, 0 }, + { cascade_text_align, initial_text_align, 1 }, + { cascade_text_decoration, initial_text_decoration, 0 }, + { cascade_text_indent, initial_text_indent, 1 }, + { cascade_text_transform, initial_text_transform, 1 }, + { cascade_top, initial_top, 0 }, + { cascade_unicode_bidi, initial_unicode_bidi, 0 }, + { cascade_vertical_align, initial_vertical_align, 0 }, + { cascade_visibility, initial_visibility, 1 }, + { cascade_voice_family, initial_voice_family, 1 }, + { cascade_volume, initial_volume, 1 }, + { cascade_white_space, initial_white_space, 1 }, + { cascade_widows, initial_widows, 1 }, + { cascade_width, initial_width, 0 }, + { cascade_word_spacing, initial_word_spacing, 1 }, + { cascade_z_index, initial_z_index, 0 } +}; /** * Create a selection context @@ -321,7 +424,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node, } /* Finally, fix up any remaining unset properties. - * Those properties which are inherited, need to be set as inherit. + * Those properties which are inherited need to be set as inherit. * Those which are not inherited need to be set to their default value. */ /** \todo fixup unset properties */ @@ -332,6 +435,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node, /****************************************************************************** * Selection engine internals below here * ******************************************************************************/ + css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_select_state *state) { @@ -368,6 +472,7 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, /* Process this sheet */ state->current_sheet++; + state->current_origin = s->origin; error = match_selectors_in_sheet(ctx, s, state); if (error != CSS_OK) @@ -421,8 +526,7 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx, /* Process any matching selectors */ while (*selectors != NULL) { - error = match_selector_chain(ctx, *selectors, - sheet->origin, state, universal); + error = match_selector_chain(ctx, *selectors, state, universal); if (error != CSS_OK) return error; @@ -439,8 +543,7 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx, /* Process any matching selectors */ while (*selectors != NULL) { - error = match_selector_chain(ctx, *selectors, - sheet->origin, state, universal); + error = match_selector_chain(ctx, *selectors, state, universal); if (error != CSS_OK) return error; @@ -454,8 +557,7 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx, } css_error match_selector_chain(css_select_ctx *ctx, - const css_selector *selector, css_origin origin, - css_select_state *state, + const css_selector *selector, css_select_state *state, const parserutils_hash_entry *universal) { const css_selector *s = selector; @@ -509,9 +611,11 @@ css_error match_selector_chain(css_select_ctx *ctx, } while (s != NULL); /* If we got here, then the entire selector chain matched, so cascade */ + state->current_rule_index = selector->rule->index; + state->current_specificity = selector->specificity; + return cascade_style(ctx, ((css_rule_selector *) selector->rule)->style, - selector->specificity, origin, selector->rule->index, state); } @@ -606,7 +710,7 @@ css_error match_details(css_select_ctx *ctx, void *node, * actually requires looking at data rather than simply comparing * pointers). Should we consider sorting the detail list such that the * simpler details come first (and thus the expensive match routines - * can be avoided unless absolutely necessary). */ + * can be avoided unless absolutely necessary)? */ while (detail->next != 0) { /* Don't bother with the first detail, as it's the @@ -625,7 +729,6 @@ css_error match_details(css_select_ctx *ctx, void *node, return CSS_OK; } - css_error match_detail(css_select_ctx *ctx, void *node, const css_selector_detail *detail, css_select_state *state, bool *match) @@ -679,17 +782,32 @@ css_error match_detail(css_select_ctx *ctx, void *node, return error; } -css_error cascade_style(css_select_ctx *ctx, css_style *style, - uint32_t specificity, css_origin origin, uint32_t rule_index, +css_error cascade_style(css_select_ctx *ctx, const css_style *style, css_select_state *state) { - UNUSED(ctx); - UNUSED(style); - UNUSED(specificity); - UNUSED(origin); - UNUSED(rule_index); - UNUSED(state); + css_style s = *style; + + while (s.length > 0) { + opcode op; + css_error error; + uint32_t opv = *((uint32_t *) s.bytecode); + + advance_bytecode(&s, sizeof(opv)); + + op = getOpcode(opv); + + error = properties[op].cascade(ctx, opv, &s, state); + if (error != CSS_OK) + return error; + } return CSS_OK; } +void advance_bytecode(css_style *style, uint32_t n_bytes) +{ + style->length -= n_bytes; + style->bytecode = ((uint8_t *) style->bytecode) + n_bytes; +} + + -- cgit v1.2.3