diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2014-10-04 17:36:48 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2014-10-04 20:38:32 +0100 |
commit | 441735a225e7826615669a754b6bccf2b7d46ef4 (patch) | |
tree | 8234049cf11043b3218506df69a605ed52f329d1 /src/select/properties | |
parent | 55d72b3ce74fba72710076fb0cef53aa06b2cf65 (diff) | |
download | libcss-441735a225e7826615669a754b6bccf2b7d46ef4.tar.gz libcss-441735a225e7826615669a754b6bccf2b7d46ef4.tar.bz2 |
Cascade and compose column-count property into computed style.
Diffstat (limited to 'src/select/properties')
-rw-r--r-- | src/select/properties/column_count.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c index 5fe7465..ecee5f3 100644 --- a/src/select/properties/column_count.c +++ b/src/select/properties/column_count.c @@ -17,23 +17,25 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style, css_select_state *state) { + uint16_t value = CSS_COLUMN_COUNT_INHERIT; css_fixed count = 0; if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_COUNT_SET: + value = CSS_COLUMN_COUNT_SET; count = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(count)); break; case COLUMN_COUNT_AUTO: - /** \todo convert to public values */ + value = CSS_COLUMN_COUNT_AUTO; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { - /** \todo set computed elevation */ + return set_column_count(state->computed, value, count); } return CSS_OK; @@ -42,26 +44,31 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style, css_error css__set_column_count_from_hint(const css_hint *hint, css_computed_style *style) { - UNUSED(hint); - UNUSED(style); - - return CSS_OK; + return set_column_count(style, hint->status, hint->data.integer); } css_error css__initial_column_count(css_select_state *state) { - UNUSED(state); - - return CSS_OK; + return set_column_count(state->computed, CSS_COLUMN_COUNT_AUTO, 0); } css_error css__compose_column_count(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { - UNUSED(parent); - UNUSED(child); - UNUSED(result); + int32_t count = 0; + uint8_t type = get_column_count(child, &count); + + if ((child->uncommon == NULL && parent->uncommon != NULL) || + type == CSS_COLUMN_COUNT_INHERIT || + (child->uncommon != NULL && result != child)) { + if ((child->uncommon == NULL && parent->uncommon != NULL) || + type == CSS_OUTLINE_COLOR_INHERIT) { + type = get_column_count(parent, &count); + } + + return set_column_count(result, type, count); + } return CSS_OK; } |