diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-08-21 09:45:13 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-08-21 09:45:13 +0000 |
commit | 5c20bde8b544d23fd024dad7ace9b46849336ebf (patch) | |
tree | 07dc508d51d281b7553e471a42ba3684018fe512 /src/select/properties.c | |
parent | 5bd907c74151d0bbe1859c37cb2bde898ab72e2f (diff) | |
download | libcss-5c20bde8b544d23fd024dad7ace9b46849336ebf.tar.gz libcss-5c20bde8b544d23fd024dad7ace9b46849336ebf.tar.bz2 |
-libcss-align
svn path=/trunk/libcss/; revision=9378
Diffstat (limited to 'src/select/properties.c')
-rw-r--r-- | src/select/properties.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/select/properties.c b/src/select/properties.c index 4b7b8a7..b83a29d 100644 --- a/src/select/properties.c +++ b/src/select/properties.c @@ -5452,6 +5452,62 @@ css_error compose_z_index(const css_computed_style *parent, return set_z_index(result, type, index); } +css_error cascade_libcss_align(uint32_t opv, css_style *style, + css_select_state *state) +{ + uint16_t value = CSS_LIBCSS_ALIGN_INHERIT; + + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case LIBCSS_ALIGN_LEFT: + value = CSS_LIBCSS_ALIGN_LEFT; + break; + case LIBCSS_ALIGN_RIGHT: + value = CSS_LIBCSS_ALIGN_RIGHT; + break; + case LIBCSS_ALIGN_CENTER: + value = CSS_LIBCSS_ALIGN_CENTER; + break; + case LIBCSS_ALIGN_JUSTIFY: + value = CSS_LIBCSS_ALIGN_JUSTIFY; + break; + } + } + + if (outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + return set_libcss_align(state->result, value); + } + + return CSS_OK; +} + +css_error set_libcss_align_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_libcss_align(style, hint->status); +} + +css_error initial_libcss_align(css_select_state *state) +{ + return set_libcss_align(state->result, CSS_LIBCSS_ALIGN_DEFAULT); +} + +css_error compose_libcss_align(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + uint8_t type = get_libcss_align(child); + + if (type == CSS_LIBCSS_ALIGN_INHERIT) { + type = get_libcss_align(parent); + } + + return set_libcss_align(result, type); +} + /****************************************************************************** * Utilities below here * ******************************************************************************/ |