From 166581e23cb6e1e6279f450635cd16a12f8b0ef2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 15 Aug 2022 20:15:58 +0100 Subject: Select: Make inherit flag handling aware of other default values --- src/select/properties/align_content.c | 4 +-- src/select/properties/align_items.c | 4 +-- src/select/properties/align_self.c | 4 +-- src/select/properties/azimuth.c | 4 +-- src/select/properties/background_attachment.c | 4 +-- src/select/properties/background_position.c | 4 +-- src/select/properties/background_repeat.c | 4 +-- src/select/properties/border_collapse.c | 4 +-- src/select/properties/border_spacing.c | 4 +-- src/select/properties/box_sizing.c | 4 +-- src/select/properties/break_inside.c | 4 +-- src/select/properties/caption_side.c | 4 +-- src/select/properties/clear.c | 4 +-- src/select/properties/clip.c | 4 +-- src/select/properties/color.c | 8 ++--- src/select/properties/column_count.c | 4 +-- src/select/properties/column_fill.c | 4 +-- src/select/properties/column_rule_color.c | 7 ++-- src/select/properties/column_span.c | 4 +-- src/select/properties/content.c | 4 +-- src/select/properties/cursor.c | 4 +-- src/select/properties/direction.c | 4 +-- src/select/properties/display.c | 4 +-- src/select/properties/elevation.c | 4 +-- src/select/properties/empty_cells.c | 4 +-- src/select/properties/flex_basis.c | 4 +-- src/select/properties/flex_direction.c | 4 +-- src/select/properties/flex_grow.c | 4 +-- src/select/properties/flex_shrink.c | 4 +-- src/select/properties/flex_wrap.c | 4 +-- src/select/properties/float.c | 4 +-- src/select/properties/font_family.c | 4 +-- src/select/properties/font_size.c | 4 +-- src/select/properties/font_style.c | 4 +-- src/select/properties/font_variant.c | 4 +-- src/select/properties/font_weight.c | 4 +-- src/select/properties/helpers.c | 48 +++++++++++++-------------- src/select/properties/justify_content.c | 4 +-- src/select/properties/line_height.c | 4 +-- src/select/properties/list_style_position.c | 4 +-- src/select/properties/list_style_type.c | 4 +-- src/select/properties/opacity.c | 4 +-- src/select/properties/order.c | 4 +-- src/select/properties/outline_color.c | 4 +-- src/select/properties/overflow_x.c | 4 +-- src/select/properties/overflow_y.c | 4 +-- src/select/properties/pitch.c | 4 +-- src/select/properties/play_during.c | 4 +-- src/select/properties/position.c | 4 +-- src/select/properties/quotes.c | 4 +-- src/select/properties/speak.c | 4 +-- src/select/properties/speak_header.c | 4 +-- src/select/properties/speak_numeral.c | 4 +-- src/select/properties/speak_punctuation.c | 4 +-- src/select/properties/speech_rate.c | 4 +-- src/select/properties/table_layout.c | 4 +-- src/select/properties/text_align.c | 4 +-- src/select/properties/text_decoration.c | 4 +-- src/select/properties/text_transform.c | 4 +-- src/select/properties/unicode_bidi.c | 4 +-- src/select/properties/vertical_align.c | 4 +-- src/select/properties/visibility.c | 4 +-- src/select/properties/voice_family.c | 4 +-- src/select/properties/volume.c | 4 +-- src/select/properties/white_space.c | 4 +-- src/select/properties/writing_mode.c | 6 ++-- src/select/properties/z_index.c | 4 +-- src/select/select.c | 9 ++--- src/select/select.h | 12 +++---- test/dump.h | 8 ++++- 70 files changed, 179 insertions(+), 171 deletions(-) diff --git a/src/select/properties/align_content.c b/src/select/properties/align_content.c index f43cd8e..7d791b8 100644 --- a/src/select/properties/align_content.c +++ b/src/select/properties/align_content.c @@ -21,7 +21,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case ALIGN_CONTENT_STRETCH: value = CSS_ALIGN_CONTENT_STRETCH; @@ -48,7 +48,7 @@ css_error css__cascade_align_content(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_align_content(state->computed, value); } diff --git a/src/select/properties/align_items.c b/src/select/properties/align_items.c index ad69c81..007fd70 100644 --- a/src/select/properties/align_items.c +++ b/src/select/properties/align_items.c @@ -21,7 +21,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case ALIGN_ITEMS_STRETCH: value = CSS_ALIGN_ITEMS_STRETCH; @@ -42,7 +42,7 @@ css_error css__cascade_align_items(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_align_items(state->computed, value); } diff --git a/src/select/properties/align_self.c b/src/select/properties/align_self.c index e8e469e..b8ce46d 100644 --- a/src/select/properties/align_self.c +++ b/src/select/properties/align_self.c @@ -21,7 +21,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case ALIGN_SELF_STRETCH: value = CSS_ALIGN_SELF_STRETCH; @@ -45,7 +45,7 @@ css_error css__cascade_align_self(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_align_self(state->computed, value); } diff --git a/src/select/properties/azimuth.c b/src/select/properties/azimuth.c index d52110f..1d3e1c2 100644 --- a/src/select/properties/azimuth.c +++ b/src/select/properties/azimuth.c @@ -18,7 +18,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style, css_fixed val = 0; uint32_t unit = UNIT_DEG; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv) & ~AZIMUTH_BEHIND) { case AZIMUTH_ANGLE: val = *((css_fixed *) style->bytecode); @@ -47,7 +47,7 @@ css_error css__cascade_azimuth(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo set computed azimuth */ } diff --git a/src/select/properties/background_attachment.c b/src/select/properties/background_attachment.c index 834c830..7e59557 100644 --- a/src/select/properties/background_attachment.c +++ b/src/select/properties/background_attachment.c @@ -21,7 +21,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BACKGROUND_ATTACHMENT_FIXED: value = CSS_BACKGROUND_ATTACHMENT_FIXED; @@ -33,7 +33,7 @@ css_error css__cascade_background_attachment(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_background_attachment(state->computed, value); } diff --git a/src/select/properties/background_position.c b/src/select/properties/background_position.c index d925b9c..1d959d0 100644 --- a/src/select/properties/background_position.c +++ b/src/select/properties/background_position.c @@ -23,7 +23,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style, uint32_t hunit = UNIT_PX; uint32_t vunit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_BACKGROUND_POSITION_SET; switch (getValue(opv) & 0xf0) { @@ -73,7 +73,7 @@ css_error css__cascade_background_position(uint32_t opv, css_style *style, vunit = css__to_css_unit(vunit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_background_position(state->computed, value, hlength, hunit, vlength, vunit); } diff --git a/src/select/properties/background_repeat.c b/src/select/properties/background_repeat.c index 3881573..cf1b8fc 100644 --- a/src/select/properties/background_repeat.c +++ b/src/select/properties/background_repeat.c @@ -21,7 +21,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BACKGROUND_REPEAT_NO_REPEAT: value = CSS_BACKGROUND_REPEAT_NO_REPEAT; @@ -39,7 +39,7 @@ css_error css__cascade_background_repeat(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_background_repeat(state->computed, value); } diff --git a/src/select/properties/border_collapse.c b/src/select/properties/border_collapse.c index 1363c7c..b923de6 100644 --- a/src/select/properties/border_collapse.c +++ b/src/select/properties/border_collapse.c @@ -21,7 +21,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BORDER_COLLAPSE_SEPARATE: value = CSS_BORDER_COLLAPSE_SEPARATE; @@ -33,7 +33,7 @@ css_error css__cascade_border_collapse(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_border_collapse(state->computed, value); } diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c index 0077aac..8eb01cb 100644 --- a/src/select/properties/border_spacing.c +++ b/src/select/properties/border_spacing.c @@ -23,7 +23,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style, uint32_t hunit = UNIT_PX; uint32_t vunit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_BORDER_SPACING_SET; hlength = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(hlength)); @@ -40,7 +40,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style, vunit = css__to_css_unit(vunit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_border_spacing(state->computed, value, hlength, hunit, vlength, vunit); } diff --git a/src/select/properties/box_sizing.c b/src/select/properties/box_sizing.c index 2d19c95..5bfb43e 100644 --- a/src/select/properties/box_sizing.c +++ b/src/select/properties/box_sizing.c @@ -21,7 +21,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BOX_SIZING_CONTENT_BOX: value = CSS_BOX_SIZING_CONTENT_BOX; @@ -33,7 +33,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_box_sizing(state->computed, value); } diff --git a/src/select/properties/break_inside.c b/src/select/properties/break_inside.c index fdc44c1..58ba25e 100644 --- a/src/select/properties/break_inside.c +++ b/src/select/properties/break_inside.c @@ -21,7 +21,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BREAK_INSIDE_AUTO: value = CSS_BREAK_INSIDE_AUTO; @@ -39,7 +39,7 @@ css_error css__cascade_break_inside(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_break_inside(state->computed, value); } diff --git a/src/select/properties/caption_side.c b/src/select/properties/caption_side.c index ecccc1d..e1b7930 100644 --- a/src/select/properties/caption_side.c +++ b/src/select/properties/caption_side.c @@ -21,7 +21,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case CAPTION_SIDE_TOP: value = CSS_CAPTION_SIDE_TOP; @@ -33,7 +33,7 @@ css_error css__cascade_caption_side(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_caption_side(state->computed, value); } diff --git a/src/select/properties/clear.c b/src/select/properties/clear.c index bbb2673..a753218 100644 --- a/src/select/properties/clear.c +++ b/src/select/properties/clear.c @@ -21,7 +21,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case CLEAR_NONE: value = CSS_CLEAR_NONE; @@ -39,7 +39,7 @@ css_error css__cascade_clear(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_clear(state->computed, value); } diff --git a/src/select/properties/clip.c b/src/select/properties/clip.c index 2785afb..c82c1af 100644 --- a/src/select/properties/clip.c +++ b/src/select/properties/clip.c @@ -22,7 +22,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, false, false, false, false }; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv) & CLIP_SHAPE_MASK) { case CLIP_SHAPE_RECT: if (getValue(opv) & CLIP_RECT_TOP_AUTO) { @@ -71,7 +71,7 @@ css_error css__cascade_clip(uint32_t opv, css_style *style, rect.lunit = css__to_css_unit(rect.lunit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_clip(state->computed, value, &rect); } diff --git a/src/select/properties/color.c b/src/select/properties/color.c index 806f2cc..c455fb9 100644 --- a/src/select/properties/color.c +++ b/src/select/properties/color.c @@ -17,11 +17,11 @@ css_error css__cascade_color(uint32_t opv, css_style *style, css_select_state *state) { - bool inherit = isInherit(opv); + enum flag_value flag_value = getFlagValue(opv); uint16_t value = CSS_COLOR_INHERIT; css_color color = 0; - if (inherit == false) { + if (flag_value == FLAG_VALUE__NONE) { switch (getValue(opv)) { case COLOR_TRANSPARENT: value = CSS_COLOR_COLOR; @@ -29,7 +29,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style, case COLOR_CURRENT_COLOR: /* color: currentColor always computes to inherit */ value = CSS_COLOR_INHERIT; - inherit = true; + flag_value = FLAG_VALUE_INHERIT; break; case COLOR_SET: value = CSS_COLOR_COLOR; @@ -40,7 +40,7 @@ css_error css__cascade_color(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - inherit)) { + flag_value)) { return set_color(state->computed, value, color); } diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c index efd1243..3fdd43a 100644 --- a/src/select/properties/column_count.c +++ b/src/select/properties/column_count.c @@ -20,7 +20,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style, uint16_t value = CSS_COLUMN_COUNT_INHERIT; css_fixed count = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case COLUMN_COUNT_SET: value = CSS_COLUMN_COUNT_SET; @@ -34,7 +34,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_column_count(state->computed, value, count); } diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c index 31f19f0..c4c23c3 100644 --- a/src/select/properties/column_fill.c +++ b/src/select/properties/column_fill.c @@ -21,7 +21,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case COLUMN_FILL_BALANCE: value = CSS_COLUMN_FILL_BALANCE; @@ -33,7 +33,7 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_column_fill(state->computed, value); } diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c index f54c2ab..047cef9 100644 --- a/src/select/properties/column_rule_color.c +++ b/src/select/properties/column_rule_color.c @@ -17,17 +17,18 @@ css_error css__cascade_column_rule_color(uint32_t opv, css_style *style, css_select_state *state) { - bool inherit = isInherit(opv); + enum flag_value flag_value = getFlagValue(opv); uint16_t value = CSS_COLUMN_RULE_COLOR_INHERIT; css_color color = 0; - if (isInherit(opv) == false) { + if (flag_value == FLAG_VALUE__NONE) { switch (getValue(opv)) { case COLUMN_RULE_COLOR_TRANSPARENT: value = CSS_COLUMN_RULE_COLOR_COLOR; break; case COLUMN_RULE_COLOR_CURRENT_COLOR: value = CSS_COLUMN_RULE_COLOR_CURRENT_COLOR; + flag_value = FLAG_VALUE_INHERIT; break; case COLUMN_RULE_COLOR_SET: value = CSS_COLUMN_RULE_COLOR_COLOR; @@ -38,7 +39,7 @@ css_error css__cascade_column_rule_color(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - inherit)) { + flag_value)) { return set_column_rule_color(state->computed, value, color); } diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c index 2c870d3..d17b3ed 100644 --- a/src/select/properties/column_span.c +++ b/src/select/properties/column_span.c @@ -21,7 +21,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case COLUMN_SPAN_NONE: value = CSS_COLUMN_SPAN_NONE; @@ -33,7 +33,7 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_column_span(state->computed, value); } diff --git a/src/select/properties/content.c b/src/select/properties/content.c index f75743d..df79fe1 100644 --- a/src/select/properties/content.c +++ b/src/select/properties/content.c @@ -21,7 +21,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style, css_computed_content_item *content = NULL; uint32_t n_contents = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { uint32_t v = getValue(opv); if (v == CONTENT_NORMAL) { @@ -140,7 +140,7 @@ css_error css__cascade_content(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { css_error error; error = set_content(state->computed, value, content); diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c index c5e50c6..7b1e39b 100644 --- a/src/select/properties/cursor.c +++ b/src/select/properties/cursor.c @@ -21,7 +21,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style, lwc_string **uris = NULL; uint32_t n_uris = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { uint32_t v = getValue(opv); while (v == CURSOR_URI) { @@ -124,7 +124,7 @@ css_error css__cascade_cursor(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { css_error error; error = set_cursor(state->computed, value, uris); diff --git a/src/select/properties/direction.c b/src/select/properties/direction.c index f4a5c46..6baa58b 100644 --- a/src/select/properties/direction.c +++ b/src/select/properties/direction.c @@ -21,7 +21,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case DIRECTION_LTR: value = CSS_DIRECTION_LTR; @@ -33,7 +33,7 @@ css_error css__cascade_direction(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_direction(state->computed, value); } diff --git a/src/select/properties/display.c b/src/select/properties/display.c index 510d24a..3e15d5f 100644 --- a/src/select/properties/display.c +++ b/src/select/properties/display.c @@ -21,7 +21,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case DISPLAY_INLINE: value = CSS_DISPLAY_INLINE; @@ -81,7 +81,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_display(state->computed, value); } diff --git a/src/select/properties/elevation.c b/src/select/properties/elevation.c index ee7d036..2df207a 100644 --- a/src/select/properties/elevation.c +++ b/src/select/properties/elevation.c @@ -20,7 +20,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style, css_fixed val = 0; uint32_t unit = UNIT_DEG; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case ELEVATION_ANGLE: val = *((css_fixed *) style->bytecode); @@ -42,7 +42,7 @@ css_error css__cascade_elevation(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo set computed elevation */ } diff --git a/src/select/properties/empty_cells.c b/src/select/properties/empty_cells.c index fecdbdc..cd46b3f 100644 --- a/src/select/properties/empty_cells.c +++ b/src/select/properties/empty_cells.c @@ -21,7 +21,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case EMPTY_CELLS_SHOW: value = CSS_EMPTY_CELLS_SHOW; @@ -33,7 +33,7 @@ css_error css__cascade_empty_cells(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_empty_cells(state->computed, value); } diff --git a/src/select/properties/flex_basis.c b/src/select/properties/flex_basis.c index 1a92a6b..e5acb3c 100644 --- a/src/select/properties/flex_basis.c +++ b/src/select/properties/flex_basis.c @@ -21,7 +21,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FLEX_BASIS_AUTO: value = CSS_FLEX_BASIS_AUTO; @@ -42,7 +42,7 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_flex_basis(state->computed, value, length, unit); } diff --git a/src/select/properties/flex_direction.c b/src/select/properties/flex_direction.c index 79703be..7dc46db 100644 --- a/src/select/properties/flex_direction.c +++ b/src/select/properties/flex_direction.c @@ -21,7 +21,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FLEX_DIRECTION_ROW: value = CSS_FLEX_DIRECTION_ROW; @@ -39,7 +39,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_flex_direction(state->computed, value); } diff --git a/src/select/properties/flex_grow.c b/src/select/properties/flex_grow.c index 7f37cfe..fe4fa4d 100644 --- a/src/select/properties/flex_grow.c +++ b/src/select/properties/flex_grow.c @@ -20,7 +20,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style, uint16_t value = CSS_FLEX_GROW_INHERIT; css_fixed flex_grow = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_FLEX_GROW_SET; flex_grow = *((css_fixed *) style->bytecode); @@ -28,7 +28,7 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_flex_grow(state->computed, value, flex_grow); } diff --git a/src/select/properties/flex_shrink.c b/src/select/properties/flex_shrink.c index d1acd2a..26aaa8f 100644 --- a/src/select/properties/flex_shrink.c +++ b/src/select/properties/flex_shrink.c @@ -20,7 +20,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style, uint16_t value = CSS_FLEX_SHRINK_INHERIT; css_fixed flex_shrink = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_FLEX_SHRINK_SET; flex_shrink = *((css_fixed *) style->bytecode); @@ -28,7 +28,7 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_flex_shrink(state->computed, value, flex_shrink); } diff --git a/src/select/properties/flex_wrap.c b/src/select/properties/flex_wrap.c index 688a9b6..55034d7 100644 --- a/src/select/properties/flex_wrap.c +++ b/src/select/properties/flex_wrap.c @@ -21,7 +21,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FLEX_WRAP_NOWRAP: value = CSS_FLEX_WRAP_NOWRAP; @@ -36,7 +36,7 @@ css_error css__cascade_flex_wrap(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_flex_wrap(state->computed, value); } diff --git a/src/select/properties/float.c b/src/select/properties/float.c index c3ba909..87732f6 100644 --- a/src/select/properties/float.c +++ b/src/select/properties/float.c @@ -21,7 +21,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FLOAT_LEFT: value = CSS_FLOAT_LEFT; @@ -36,7 +36,7 @@ css_error css__cascade_float(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_float(state->computed, value); } diff --git a/src/select/properties/font_family.c b/src/select/properties/font_family.c index f853fcc..30e746c 100644 --- a/src/select/properties/font_family.c +++ b/src/select/properties/font_family.c @@ -21,7 +21,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style, lwc_string **fonts = NULL; uint32_t n_fonts = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { uint32_t v = getValue(opv); while (v != FONT_FAMILY_END) { @@ -134,7 +134,7 @@ css_error css__cascade_font_family(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { css_error error; error = set_font_family(state->computed, value, fonts); diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c index a0269be..a361ee0 100644 --- a/src/select/properties/font_size.c +++ b/src/select/properties/font_size.c @@ -21,7 +21,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style, css_fixed size = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FONT_SIZE_DIMENSION: value = CSS_FONT_SIZE_DIMENSION; @@ -65,7 +65,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_font_size(state->computed, value, size, unit); } diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c index 0ba1fdd..6c240ec 100644 --- a/src/select/properties/font_style.c +++ b/src/select/properties/font_style.c @@ -21,7 +21,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FONT_STYLE_NORMAL: value = CSS_FONT_STYLE_NORMAL; @@ -36,7 +36,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_font_style(state->computed, value); } diff --git a/src/select/properties/font_variant.c b/src/select/properties/font_variant.c index a9b6e56..1666153 100644 --- a/src/select/properties/font_variant.c +++ b/src/select/properties/font_variant.c @@ -21,7 +21,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FONT_VARIANT_NORMAL: value = CSS_FONT_VARIANT_NORMAL; @@ -33,7 +33,7 @@ css_error css__cascade_font_variant(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_font_variant(state->computed, value); } diff --git a/src/select/properties/font_weight.c b/src/select/properties/font_weight.c index c0c2f2b..d9dffc9 100644 --- a/src/select/properties/font_weight.c +++ b/src/select/properties/font_weight.c @@ -21,7 +21,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FONT_WEIGHT_NORMAL: value = CSS_FONT_WEIGHT_NORMAL; @@ -66,7 +66,7 @@ css_error css__cascade_font_weight(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_font_weight(state->computed, value); } diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c index 40936dd..10ff228 100644 --- a/src/select/properties/helpers.c +++ b/src/select/properties/helpers.c @@ -33,7 +33,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style, assert(CSS_BACKGROUND_COLOR_CURRENT_COLOR == (enum css_background_color_e)CSS_BORDER_COLOR_CURRENT_COLOR); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BACKGROUND_COLOR_TRANSPARENT: value = CSS_BACKGROUND_COLOR_COLOR; @@ -50,7 +50,7 @@ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return fun(state->computed, value, color); } @@ -65,7 +65,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style, uint16_t value = CSS_BACKGROUND_IMAGE_INHERIT; lwc_string *uri = NULL; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BACKGROUND_IMAGE_NONE: value = CSS_BACKGROUND_IMAGE_NONE; @@ -80,7 +80,7 @@ css_error css__cascade_uri_none(uint32_t opv, css_style *style, /** \todo lose fun != NULL once all properties have set routines */ if (fun != NULL && css__outranks_existing(getOpcode(opv), - isImportant(opv), state, isInherit(opv))) { + isImportant(opv), state, getFlagValue(opv))) { return fun(state->computed, value, uri); } @@ -95,7 +95,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BORDER_STYLE_NONE: value = CSS_BORDER_STYLE_NONE; @@ -131,7 +131,7 @@ css_error css__cascade_border_style(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return fun(state->computed, value); } @@ -147,7 +147,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BORDER_WIDTH_SET: value = CSS_BORDER_WIDTH_WIDTH; @@ -171,7 +171,7 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return fun(state->computed, value, length, unit); } @@ -187,7 +187,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BOTTOM_SET: value = CSS_BOTTOM_SET; @@ -205,7 +205,7 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return fun(state->computed, value, length, unit); } @@ -221,7 +221,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case LETTER_SPACING_SET: value = CSS_LETTER_SPACING_SET; @@ -239,7 +239,7 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return fun(state->computed, value, length, unit); } @@ -255,7 +255,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case MAX_HEIGHT_SET: value = CSS_MAX_HEIGHT_SET; @@ -273,7 +273,7 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return fun(state->computed, value, length, unit); } @@ -289,7 +289,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_MIN_HEIGHT_SET; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); @@ -301,7 +301,7 @@ css_error css__cascade_length(uint32_t opv, css_style *style, /** \todo lose fun != NULL once all properties have set routines */ if (fun != NULL && css__outranks_existing(getOpcode(opv), - isImportant(opv), state, isInherit(opv))) { + isImportant(opv), state, getFlagValue(opv))) { return fun(state->computed, value, length, unit); } @@ -317,7 +317,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style, /** \todo values */ - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = 0; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); @@ -325,7 +325,7 @@ css_error css__cascade_number(uint32_t opv, css_style *style, /** \todo lose fun != NULL once all properties have set routines */ if (fun != NULL && css__outranks_existing(getOpcode(opv), - isImportant(opv), state, isInherit(opv))) { + isImportant(opv), state, getFlagValue(opv))) { return fun(state->computed, value, length); } @@ -340,7 +340,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case PAGE_BREAK_AFTER_AUTO: value = CSS_PAGE_BREAK_AFTER_AUTO; @@ -362,7 +362,7 @@ css_error css__cascade_page_break_after_before_inside(uint32_t opv, /** \todo lose fun != NULL */ if (fun != NULL && css__outranks_existing(getOpcode(opv), - isImportant(opv), state, isInherit(opv))) { + isImportant(opv), state, getFlagValue(opv))) { return fun(state->computed, value); } @@ -377,7 +377,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case BREAK_AFTER_AUTO: value = CSS_BREAK_AFTER_AUTO; @@ -411,7 +411,7 @@ css_error css__cascade_break_after_before_inside(uint32_t opv, /** \todo lose fun != NULL */ if (fun != NULL && css__outranks_existing(getOpcode(opv), - isImportant(opv), state, isInherit(opv))) { + isImportant(opv), state, getFlagValue(opv))) { return fun(state->computed, value); } @@ -427,7 +427,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style, css_computed_counter *counters = NULL; uint32_t n_counters = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case COUNTER_INCREMENT_NAMED: { @@ -490,7 +490,7 @@ css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { css_error error; error = fun(state->computed, value, counters); diff --git a/src/select/properties/justify_content.c b/src/select/properties/justify_content.c index 2e17ca5..03c8bb4 100644 --- a/src/select/properties/justify_content.c +++ b/src/select/properties/justify_content.c @@ -21,7 +21,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case JUSTIFY_CONTENT_FLEX_START: value = CSS_JUSTIFY_CONTENT_FLEX_START; @@ -45,7 +45,7 @@ css_error css__cascade_justify_content(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_justify_content(state->computed, value); } diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c index 091a575..b43ebdd 100644 --- a/src/select/properties/line_height.c +++ b/src/select/properties/line_height.c @@ -21,7 +21,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style, css_fixed val = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case LINE_HEIGHT_NUMBER: value = CSS_LINE_HEIGHT_NUMBER; @@ -44,7 +44,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_line_height(state->computed, value, val, unit); } diff --git a/src/select/properties/list_style_position.c b/src/select/properties/list_style_position.c index 02d7651..0231c10 100644 --- a/src/select/properties/list_style_position.c +++ b/src/select/properties/list_style_position.c @@ -21,7 +21,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case LIST_STYLE_POSITION_INSIDE: value = CSS_LIST_STYLE_POSITION_INSIDE; @@ -33,7 +33,7 @@ css_error css__cascade_list_style_position(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_list_style_position(state->computed, value); } diff --git a/src/select/properties/list_style_type.c b/src/select/properties/list_style_type.c index e32d1b1..19cde9b 100644 --- a/src/select/properties/list_style_type.c +++ b/src/select/properties/list_style_type.c @@ -21,7 +21,7 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case LIST_STYLE_TYPE_DISC: value = CSS_LIST_STYLE_TYPE_DISC; @@ -183,7 +183,7 @@ css_error css__cascade_list_style_type(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_list_style_type(state->computed, value); } diff --git a/src/select/properties/opacity.c b/src/select/properties/opacity.c index aadab0b..c202d36 100644 --- a/src/select/properties/opacity.c +++ b/src/select/properties/opacity.c @@ -20,7 +20,7 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style, uint16_t value = CSS_OPACITY_INHERIT; css_fixed opacity = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_Z_INDEX_SET; opacity = *((css_fixed *) style->bytecode); @@ -28,7 +28,7 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_opacity(state->computed, value, opacity); } diff --git a/src/select/properties/order.c b/src/select/properties/order.c index 0366537..7e447f1 100644 --- a/src/select/properties/order.c +++ b/src/select/properties/order.c @@ -20,7 +20,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style, uint16_t value = CSS_ORDER_INHERIT; css_fixed order = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_ORDER_SET; order = FIXTOINT(*((css_fixed *) style->bytecode)); @@ -28,7 +28,7 @@ css_error css__cascade_order(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_order(state->computed, value, order); } diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c index 97846ac..707dd7b 100644 --- a/src/select/properties/outline_color.c +++ b/src/select/properties/outline_color.c @@ -20,7 +20,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style, uint16_t value = CSS_OUTLINE_COLOR_INHERIT; css_color color = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case OUTLINE_COLOR_TRANSPARENT: value = CSS_OUTLINE_COLOR_COLOR; @@ -40,7 +40,7 @@ css_error css__cascade_outline_color(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_outline_color(state->computed, value, color); } diff --git a/src/select/properties/overflow_x.c b/src/select/properties/overflow_x.c index 817d1d2..29ce7f7 100644 --- a/src/select/properties/overflow_x.c +++ b/src/select/properties/overflow_x.c @@ -21,7 +21,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case OVERFLOW_VISIBLE: value = CSS_OVERFLOW_VISIBLE; @@ -39,7 +39,7 @@ css_error css__cascade_overflow_x(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_overflow_x(state->computed, value); } diff --git a/src/select/properties/overflow_y.c b/src/select/properties/overflow_y.c index b54c4c8..398225b 100644 --- a/src/select/properties/overflow_y.c +++ b/src/select/properties/overflow_y.c @@ -21,7 +21,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case OVERFLOW_VISIBLE: value = CSS_OVERFLOW_VISIBLE; @@ -39,7 +39,7 @@ css_error css__cascade_overflow_y(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_overflow_y(state->computed, value); } diff --git a/src/select/properties/pitch.c b/src/select/properties/pitch.c index c5484d9..cdff1d6 100644 --- a/src/select/properties/pitch.c +++ b/src/select/properties/pitch.c @@ -20,7 +20,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style, css_fixed freq = 0; uint32_t unit = UNIT_HZ; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case PITCH_FREQUENCY: freq = *((css_fixed *) style->bytecode); @@ -41,7 +41,7 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo pitch */ } diff --git a/src/select/properties/play_during.c b/src/select/properties/play_during.c index 413d75a..d397b82 100644 --- a/src/select/properties/play_during.c +++ b/src/select/properties/play_during.c @@ -19,7 +19,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style, { lwc_string *uri = NULL; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case PLAY_DURING_URI: css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri); @@ -35,7 +35,7 @@ css_error css__cascade_play_during(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo play-during */ } diff --git a/src/select/properties/position.c b/src/select/properties/position.c index 9f9658f..c7cc6bf 100644 --- a/src/select/properties/position.c +++ b/src/select/properties/position.c @@ -21,7 +21,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case POSITION_STATIC: value = CSS_POSITION_STATIC; @@ -39,7 +39,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_position(state->computed, value); } diff --git a/src/select/properties/quotes.c b/src/select/properties/quotes.c index 4144d8e..9152f84 100644 --- a/src/select/properties/quotes.c +++ b/src/select/properties/quotes.c @@ -21,7 +21,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style, lwc_string **quotes = NULL; uint32_t n_quotes = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { uint32_t v = getValue(opv); value = CSS_QUOTES_STRING; @@ -75,7 +75,7 @@ css_error css__cascade_quotes(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { css_error error; error = set_quotes(state->computed, value, quotes); diff --git a/src/select/properties/speak.c b/src/select/properties/speak.c index eb5528b..87e77d9 100644 --- a/src/select/properties/speak.c +++ b/src/select/properties/speak.c @@ -19,7 +19,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style, { UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case SPEAK_NORMAL: case SPEAK_NONE: @@ -30,7 +30,7 @@ css_error css__cascade_speak(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo speak */ } diff --git a/src/select/properties/speak_header.c b/src/select/properties/speak_header.c index 0935528..9d74228 100644 --- a/src/select/properties/speak_header.c +++ b/src/select/properties/speak_header.c @@ -19,7 +19,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style, { UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case SPEAK_HEADER_ONCE: case SPEAK_HEADER_ALWAYS: @@ -29,7 +29,7 @@ css_error css__cascade_speak_header(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo speak-header */ } diff --git a/src/select/properties/speak_numeral.c b/src/select/properties/speak_numeral.c index fc54caf..ae94d2e 100644 --- a/src/select/properties/speak_numeral.c +++ b/src/select/properties/speak_numeral.c @@ -19,7 +19,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style, { UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case SPEAK_NUMERAL_DIGITS: case SPEAK_NUMERAL_CONTINUOUS: @@ -29,7 +29,7 @@ css_error css__cascade_speak_numeral(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo speak-numeral */ } diff --git a/src/select/properties/speak_punctuation.c b/src/select/properties/speak_punctuation.c index 67cbdaf..e9f8575 100644 --- a/src/select/properties/speak_punctuation.c +++ b/src/select/properties/speak_punctuation.c @@ -19,7 +19,7 @@ css_error css__cascade_speak_punctuation( { UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case SPEAK_PUNCTUATION_CODE: case SPEAK_PUNCTUATION_NONE: @@ -29,7 +29,7 @@ css_error css__cascade_speak_punctuation( } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo speak-punctuation */ } diff --git a/src/select/properties/speech_rate.c b/src/select/properties/speech_rate.c index 5cec19b..ac9d300 100644 --- a/src/select/properties/speech_rate.c +++ b/src/select/properties/speech_rate.c @@ -19,7 +19,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style, { css_fixed rate = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case SPEECH_RATE_SET: rate = *((css_fixed *) style->bytecode); @@ -38,7 +38,7 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo speech-rate */ } diff --git a/src/select/properties/table_layout.c b/src/select/properties/table_layout.c index c911e10..013ae47 100644 --- a/src/select/properties/table_layout.c +++ b/src/select/properties/table_layout.c @@ -21,7 +21,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case TABLE_LAYOUT_AUTO: value = CSS_TABLE_LAYOUT_AUTO; @@ -33,7 +33,7 @@ css_error css__cascade_table_layout(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_table_layout(state->computed, value); } diff --git a/src/select/properties/text_align.c b/src/select/properties/text_align.c index 808107f..f2ba4e6 100644 --- a/src/select/properties/text_align.c +++ b/src/select/properties/text_align.c @@ -21,7 +21,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case TEXT_ALIGN_LEFT: value = CSS_TEXT_ALIGN_LEFT; @@ -48,7 +48,7 @@ css_error css__cascade_text_align(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_text_align(state->computed, value); } diff --git a/src/select/properties/text_decoration.c b/src/select/properties/text_decoration.c index 0e7544d..759009c 100644 --- a/src/select/properties/text_decoration.c +++ b/src/select/properties/text_decoration.c @@ -23,7 +23,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { if (getValue(opv) == TEXT_DECORATION_NONE) { value = CSS_TEXT_DECORATION_NONE; } else { @@ -41,7 +41,7 @@ css_error css__cascade_text_decoration(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_text_decoration(state->computed, value); } diff --git a/src/select/properties/text_transform.c b/src/select/properties/text_transform.c index 38cb427..f3fac38 100644 --- a/src/select/properties/text_transform.c +++ b/src/select/properties/text_transform.c @@ -21,7 +21,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case TEXT_TRANSFORM_CAPITALIZE: value = CSS_TEXT_TRANSFORM_CAPITALIZE; @@ -39,7 +39,7 @@ css_error css__cascade_text_transform(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_text_transform(state->computed, value); } diff --git a/src/select/properties/unicode_bidi.c b/src/select/properties/unicode_bidi.c index 5b91df1..0a4c0d1 100644 --- a/src/select/properties/unicode_bidi.c +++ b/src/select/properties/unicode_bidi.c @@ -21,7 +21,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case UNICODE_BIDI_NORMAL: value = CSS_UNICODE_BIDI_NORMAL; @@ -36,7 +36,7 @@ css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_unicode_bidi(state->computed, value); } diff --git a/src/select/properties/vertical_align.c b/src/select/properties/vertical_align.c index 9fb7143..18b8b55 100644 --- a/src/select/properties/vertical_align.c +++ b/src/select/properties/vertical_align.c @@ -21,7 +21,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case VERTICAL_ALIGN_SET: value = CSS_VERTICAL_ALIGN_SET; @@ -61,7 +61,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_vertical_align(state->computed, value, length, unit); } diff --git a/src/select/properties/visibility.c b/src/select/properties/visibility.c index ef95252..901700d 100644 --- a/src/select/properties/visibility.c +++ b/src/select/properties/visibility.c @@ -21,7 +21,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case VISIBILITY_VISIBLE: value = CSS_VISIBILITY_VISIBLE; @@ -36,7 +36,7 @@ css_error css__cascade_visibility(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_visibility(state->computed, value); } diff --git a/src/select/properties/voice_family.c b/src/select/properties/voice_family.c index b370a2b..ff0324c 100644 --- a/src/select/properties/voice_family.c +++ b/src/select/properties/voice_family.c @@ -21,7 +21,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style, lwc_string **voices = NULL; uint32_t n_voices = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { uint32_t v = getValue(opv); while (v != VOICE_FAMILY_END) { @@ -92,7 +92,7 @@ css_error css__cascade_voice_family(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo voice-family */ if (n_voices > 0) free(voices); diff --git a/src/select/properties/volume.c b/src/select/properties/volume.c index 96787fa..65bf979 100644 --- a/src/select/properties/volume.c +++ b/src/select/properties/volume.c @@ -20,7 +20,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style, css_fixed val = 0; uint32_t unit = UNIT_PCT; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case VOLUME_NUMBER: val = *((css_fixed *) style->bytecode); @@ -46,7 +46,7 @@ css_error css__cascade_volume(uint32_t opv, css_style *style, unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { /** \todo volume */ } diff --git a/src/select/properties/white_space.c b/src/select/properties/white_space.c index b8d2e02..1c22f9d 100644 --- a/src/select/properties/white_space.c +++ b/src/select/properties/white_space.c @@ -21,7 +21,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case WHITE_SPACE_NORMAL: value = CSS_WHITE_SPACE_NORMAL; @@ -42,7 +42,7 @@ css_error css__cascade_white_space(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_white_space(state->computed, value); } diff --git a/src/select/properties/writing_mode.c b/src/select/properties/writing_mode.c index bbd3753..99ebd9e 100644 --- a/src/select/properties/writing_mode.c +++ b/src/select/properties/writing_mode.c @@ -17,11 +17,11 @@ css_error css__cascade_writing_mode(uint32_t opv, css_style *style, css_select_state *state) { - bool inherit = isInherit(opv); + enum flag_value flag_value = getFlagValue(opv); uint16_t writing_mode = CSS_WRITING_MODE_INHERIT; UNUSED(style); - if (inherit == false) { + if (flag_value == FLAG_VALUE__NONE) { switch (getValue(opv)) { case WRITING_MODE_HORIZONTAL_TB: writing_mode = CSS_WRITING_MODE_HORIZONTAL_TB; @@ -36,7 +36,7 @@ css_error css__cascade_writing_mode(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - inherit)) { + flag_value)) { return set_writing_mode(state->computed, writing_mode); } diff --git a/src/select/properties/z_index.c b/src/select/properties/z_index.c index 59cf242..32a952d 100644 --- a/src/select/properties/z_index.c +++ b/src/select/properties/z_index.c @@ -20,7 +20,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style, uint16_t value = CSS_Z_INDEX_INHERIT; css_fixed index = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case Z_INDEX_SET: value = CSS_Z_INDEX_SET; @@ -35,7 +35,7 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_z_index(state->computed, value, index); } diff --git a/src/select/select.c b/src/select/select.c index 7d8195f..855a5cc 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -1294,7 +1294,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node, * value. */ if (prop->set == false || (parent == NULL && - prop->inherit == true)) { + prop->explicit_default == FLAG_VALUE_INHERIT)) { error = set_initial(&state, i, CSS_PSEUDO_ELEMENT_NONE, parent); if (error != CSS_OK) @@ -1548,7 +1548,8 @@ css_error set_hint(css_select_state *state, css_hint *hint) existing->specificity = 0; existing->origin = CSS_ORIGIN_AUTHOR; existing->important = 0; - existing->inherit = (hint->status == 0); + existing->explicit_default = (hint->status == 0) ? + FLAG_VALUE_INHERIT : FLAG_VALUE__NONE; return CSS_OK; } @@ -2600,7 +2601,7 @@ css_error cascade_style(const css_style *style, css_select_state *state) } bool css__outranks_existing(uint16_t op, bool important, css_select_state *state, - bool inherit) + enum flag_value explicit_default) { prop_state *existing = &state->props[op][state->current_pseudo]; bool outranks = false; @@ -2695,7 +2696,7 @@ bool css__outranks_existing(uint16_t op, bool important, css_select_state *state existing->specificity = state->current_specificity; existing->origin = state->current_origin; existing->important = important; - existing->inherit = inherit; + existing->explicit_default = explicit_default; } return outranks; diff --git a/src/select/select.h b/src/select/select.h index 0a16b12..f449534 100644 --- a/src/select/select.h +++ b/src/select/select.h @@ -24,11 +24,11 @@ typedef struct reject_item { } reject_item; typedef struct prop_state { - uint32_t specificity; /* Specificity of property in result */ - unsigned int set : 1, /* Whether property is set in result */ - origin : 2, /* Origin of property in result */ - important : 1, /* Importance of property in result */ - inherit : 1; /* Property is set to inherit */ + uint32_t specificity; /* Specificity of property in result */ + unsigned int set : 1, /* Whether property is set in result */ + origin : 2, /* Origin of property in result */ + important : 1; /* Importance of property in result */ + enum flag_value explicit_default : 3; /* Property is set to inherit */ } prop_state; @@ -98,7 +98,7 @@ static inline void advance_bytecode(css_style *style, uint32_t n_bytes) } bool css__outranks_existing(uint16_t op, bool important, - css_select_state *state, bool inherit); + css_select_state *state, enum flag_value explicit_default); #endif diff --git a/test/dump.h b/test/dump.h index acfd8b0..f585788 100644 --- a/test/dump.h +++ b/test/dump.h @@ -788,8 +788,14 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) *((*ptr)++) = ' '; *ptr += sprintf(*ptr, "%s: ", opcode_names[op]); - if (isInherit(opv)) { + if (getFlagValue(opv) == FLAG_VALUE_INHERIT) { *ptr += sprintf(*ptr, "inherit"); + } else if (getFlagValue(opv) == FLAG_VALUE_INITIAL) { + *ptr += sprintf(*ptr, "initial"); + } else if (getFlagValue(opv) == FLAG_VALUE_REVERT) { + *ptr += sprintf(*ptr, "revert"); + } else if (getFlagValue(opv) == FLAG_VALUE_UNSET) { + *ptr += sprintf(*ptr, "unset"); } else { value = getValue(opv); -- cgit v1.2.3