diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2017-04-27 11:57:37 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2017-04-27 11:57:37 +0100 |
commit | 8d583fbe94b801353faec8e3a5a6729e3fe767a5 (patch) | |
tree | 76f7e72bbf31a9adf3271f0d95672e41eec2802a /src/select/properties/box_sizing.c | |
parent | 24f23765517bd02445835dd543a07b1a883ca316 (diff) | |
download | libcss-8d583fbe94b801353faec8e3a5a6729e3fe767a5.tar.gz libcss-8d583fbe94b801353faec8e3a5a6729e3fe767a5.tar.bz2 |
Selection: Add support for the CSS3 box-sizing property.
Diffstat (limited to 'src/select/properties/box_sizing.c')
-rw-r--r-- | src/select/properties/box_sizing.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/select/properties/box_sizing.c b/src/select/properties/box_sizing.c index 357dd3c..91c475d 100644 --- a/src/select/properties/box_sizing.c +++ b/src/select/properties/box_sizing.c @@ -17,20 +17,24 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style, css_select_state *state) { + uint16_t value = CSS_BOX_SIZING_INHERIT; + UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BOX_SIZING_CONTENT_BOX: + value = CSS_BOX_SIZING_CONTENT_BOX; + break; case BOX_SIZING_BORDER_BOX: - /** \todo convert to public values */ + value = CSS_BOX_SIZING_BORDER_BOX; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { - /** \todo set computed value */ + return set_box_sizing(state->computed, value); } return CSS_OK; @@ -39,17 +43,12 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style, css_error css__set_box_sizing_from_hint(const css_hint *hint, css_computed_style *style) { - UNUSED(hint); - UNUSED(style); - - return CSS_OK; + return set_box_sizing(style, hint->status); } css_error css__initial_box_sizing(css_select_state *state) { - UNUSED(state); - - return CSS_OK; + return set_box_sizing(state->computed, CSS_BOX_SIZING_CONTENT_BOX); } css_error css__compose_box_sizing( @@ -57,10 +56,12 @@ css_error css__compose_box_sizing( const css_computed_style *child, css_computed_style *result) { - UNUSED(parent); - UNUSED(child); - UNUSED(result); + uint8_t type = get_box_sizing(child); - return CSS_OK; + if (type == CSS_BOX_SIZING_INHERIT) { + type = get_box_sizing(parent); + } + + return set_box_sizing(result, type); } |