From 2caf5a7505210eadd95cd35ad34600275aafcd65 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 5 Mar 2009 01:52:49 +0000 Subject: z-index is a signed int, not a css_fixed value. Compose width, word-spacing and z-index. svn path=/trunk/libcss/; revision=6709 --- src/select/properties.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src') diff --git a/src/select/properties.c b/src/select/properties.c index da432b7..91567c4 100644 --- a/src/select/properties.c +++ b/src/select/properties.c @@ -4347,6 +4347,22 @@ css_error initial_width(css_computed_style *style) return set_width(style, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX); } +css_error compose_width(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + css_fixed length = 0; + css_unit unit = CSS_UNIT_PX; + + if (css_computed_width(child, &length, &unit) == CSS_WIDTH_INHERIT) { + uint8_t p = css_computed_width(parent, &length, &unit); + + return set_width(result, p, length, unit); + } + + return CSS_OK; +} + css_error cascade_word_spacing(uint32_t opv, css_style *style, css_select_state *state) { @@ -4358,6 +4374,24 @@ css_error initial_word_spacing(css_computed_style *style) return set_word_spacing(style, CSS_WORD_SPACING_NORMAL, 0, CSS_UNIT_PX); } +css_error compose_word_spacing(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + css_fixed length = 0; + css_unit unit = CSS_UNIT_PX; + + if ((child->uncommon == NULL && parent->uncommon != NULL) || + css_computed_word_spacing(child, &length, &unit) == + CSS_WORD_SPACING_INHERIT) { + uint8_t p = css_computed_word_spacing(parent, &length, &unit); + + return set_word_spacing(result, p, length, unit); + } + + return CSS_OK; +} + css_error cascade_z_index(uint32_t opv, css_style *style, css_select_state *state) { @@ -4390,6 +4424,21 @@ css_error initial_z_index(css_computed_style *style) return set_z_index(style, CSS_Z_INDEX_AUTO, 0); } +css_error compose_z_index(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + int32_t index = 0; + + if (css_computed_z_index(child, &index) == CSS_Z_INDEX_INHERIT) { + uint8_t p = css_computed_z_index(parent, &index); + + return set_z_index(result, p, index); + } + + return CSS_OK; +} + /****************************************************************************** * Utilities below here * ******************************************************************************/ -- cgit v1.2.3