From 5c20bde8b544d23fd024dad7ace9b46849336ebf Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 21 Aug 2009 09:45:13 +0000 Subject: -libcss-align svn path=/trunk/libcss/; revision=9378 --- src/select/properties.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'src/select/properties.c') 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 * ******************************************************************************/ -- cgit v1.2.3