From 2118e313c125ef2e88675e33de12b6473118b3db Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 5 Mar 2009 01:08:45 +0000 Subject: Compose {min,max}{width,height} svn path=/trunk/libcss/; revision=6701 --- src/select/properties.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'src') diff --git a/src/select/properties.c b/src/select/properties.c index 6b557bf..b2f6ad1 100644 --- a/src/select/properties.c +++ b/src/select/properties.c @@ -2575,6 +2575,23 @@ css_error initial_max_height(css_computed_style *style) return set_max_height(style, CSS_MAX_HEIGHT_NONE, 0, CSS_UNIT_PX); } +css_error compose_max_height(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_max_height(child, &length, &unit) == + CSS_MAX_HEIGHT_INHERIT) { + uint8_t p = css_computed_max_height(parent, &length, &unit); + + return set_max_height(result, p, length, unit); + } + + return CSS_OK; +} + css_error cascade_max_width(uint32_t opv, css_style *style, css_select_state *state) { @@ -2586,6 +2603,23 @@ css_error initial_max_width(css_computed_style *style) return set_max_width(style, CSS_MAX_WIDTH_NONE, 0, CSS_UNIT_PX); } +css_error compose_max_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_max_width(child, &length, &unit) == + CSS_MAX_WIDTH_INHERIT) { + uint8_t p = css_computed_max_width(parent, &length, &unit); + + return set_max_width(result, p, length, unit); + } + + return CSS_OK; +} + css_error cascade_min_height(uint32_t opv, css_style *style, css_select_state *state) { @@ -2597,6 +2631,23 @@ css_error initial_min_height(css_computed_style *style) return set_min_height(style, CSS_MIN_HEIGHT_SET, 0, CSS_UNIT_PX); } +css_error compose_min_height(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_min_height(child, &length, &unit) == + CSS_MIN_HEIGHT_INHERIT) { + uint8_t p = css_computed_min_height(parent, &length, &unit); + + return set_min_height(result, p, length, unit); + } + + return CSS_OK; +} + css_error cascade_min_width(uint32_t opv, css_style *style, css_select_state *state) { @@ -2608,6 +2659,23 @@ css_error initial_min_width(css_computed_style *style) return set_min_width(style, CSS_MIN_WIDTH_SET, 0, CSS_UNIT_PX); } +css_error compose_min_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_min_width(child, &length, &unit) == + CSS_MIN_WIDTH_INHERIT) { + uint8_t p = css_computed_min_width(parent, &length, &unit); + + return set_min_width(result, p, length, unit); + } + + return CSS_OK; +} + css_error cascade_orphans(uint32_t opv, css_style *style, css_select_state *state) { -- cgit v1.2.3