diff options
Diffstat (limited to 'src/select/properties/helpers.c')
-rw-r--r-- | src/select/properties/helpers.c | 74 |
1 files changed, 24 insertions, 50 deletions
diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c index 36c3cba..10ff228 100644 --- a/src/select/properties/helpers.c +++ b/src/select/properties/helpers.c @@ -16,32 +16,6 @@ #include "select/properties/helpers.h" -/* Useful helpers */ - -css_unit css__to_css_unit(uint32_t u) -{ - switch (u) { - case UNIT_PX: return CSS_UNIT_PX; - case UNIT_EX: return CSS_UNIT_EX; - case UNIT_EM: return CSS_UNIT_EM; - case UNIT_IN: return CSS_UNIT_IN; - case UNIT_CM: return CSS_UNIT_CM; - case UNIT_MM: return CSS_UNIT_MM; - case UNIT_PT: return CSS_UNIT_PT; - case UNIT_PC: return CSS_UNIT_PC; - case UNIT_PCT: return CSS_UNIT_PCT; - case UNIT_DEG: return CSS_UNIT_DEG; - case UNIT_GRAD: return CSS_UNIT_GRAD; - case UNIT_RAD: return CSS_UNIT_RAD; - case UNIT_MS: return CSS_UNIT_MS; - case UNIT_S: return CSS_UNIT_S; - case UNIT_HZ: return CSS_UNIT_HZ; - case UNIT_KHZ: return CSS_UNIT_KHZ; - } - - return 0; -} - /****************************************************************************** * Utilities below here * ******************************************************************************/ @@ -59,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; @@ -76,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); } @@ -91,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; @@ -106,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); } @@ -121,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; @@ -157,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); } @@ -173,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; @@ -197,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); } @@ -213,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; @@ -231,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); } @@ -247,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; @@ -265,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); } @@ -281,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; @@ -299,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); } @@ -315,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)); @@ -327,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); } @@ -343,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)); @@ -351,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); } @@ -366,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; @@ -388,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); } @@ -403,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; @@ -437,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); } @@ -453,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: { @@ -516,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); |