diff options
Diffstat (limited to 'src/select/properties/cursor.c')
-rw-r--r-- | src/select/properties/cursor.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/src/select/properties/cursor.c b/src/select/properties/cursor.c index c5e50c6..09955c6 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); @@ -164,38 +164,40 @@ css_error css__initial_cursor(css_select_state *state) return set_cursor(state->computed, CSS_CURSOR_AUTO, NULL); } -css_error css__compose_cursor(const css_computed_style *parent, - const css_computed_style *child, - css_computed_style *result) +css_error css__copy_cursor( + const css_computed_style *from, + css_computed_style *to) { css_error error; lwc_string **copy = NULL; - lwc_string **urls = NULL; - uint8_t type = get_cursor(child, &urls); + lwc_string **cursor = NULL; + uint8_t type = get_cursor(from, &cursor); - if (type == CSS_CURSOR_INHERIT) { - type = get_cursor(parent, &urls); + if (from == to) { + return CSS_OK; } - if (urls != NULL) { - lwc_string **i; - size_t n_urls = 0; - - for (i = urls; (*i) != NULL; i++) - n_urls++; - - copy = malloc((n_urls + 1) * - sizeof(lwc_string *)); - if (copy == NULL) - return CSS_NOMEM; - - memcpy(copy, urls, (n_urls + 1) * - sizeof(lwc_string *)); + error = css__copy_lwc_string_array(false, cursor, ©); + if (error != CSS_OK) { + return CSS_NOMEM; } - error = set_cursor(result, type, copy); - if (error != CSS_OK && copy != NULL) + error = set_cursor(to, type, copy); + if (error != CSS_OK) { free(copy); + } return error; } + +css_error css__compose_cursor(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + lwc_string **cursor = NULL; + uint8_t type = get_cursor(child, &cursor); + + return css__copy_cursor( + type == CSS_CURSOR_INHERIT ? parent : child, + result); +} |