summaryrefslogtreecommitdiff
path: root/src/select/properties
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-12-06 15:34:27 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2014-12-06 16:45:34 +0000
commit0cab24ffcbe59104967362219f3c831c84681f7e (patch)
tree95ea3ae0ad34f8af7aa1d0468c46a8a4c9525492 /src/select/properties
parent2bbbe9050fb449276e6230ce0c2b0353d04b587c (diff)
downloadlibcss-0cab24ffcbe59104967362219f3c831c84681f7e.tar.gz
libcss-0cab24ffcbe59104967362219f3c831c84681f7e.tar.bz2
Add column-width property to computed styles.
Diffstat (limited to 'src/select/properties')
-rw-r--r--src/select/properties/column_width.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c
index fd053d9..45eb7fc 100644
--- a/src/select/properties/column_width.c
+++ b/src/select/properties/column_width.c
@@ -14,57 +14,43 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_column_width(uint32_t opv, css_style *style,
+css_error css__cascade_column_width(uint32_t opv, css_style *style,
css_select_state *state)
{
- css_fixed length = 0;
- uint32_t unit = UNIT_PX;
-
- if (isInherit(opv) == false) {
- switch (getValue(opv)) {
- case COLUMN_WIDTH_SET:
- length = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(length));
- unit = *((uint32_t *) style->bytecode);
- advance_bytecode(style, sizeof(unit));
- break;
- case COLUMN_WIDTH_AUTO:
- /** \todo convert to public values */
- break;
- }
- }
-
- if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
- /** \todo set computed elevation */
- }
-
- return CSS_OK;
+ return css__cascade_length_normal(opv, style, state, set_column_width);
}
css_error css__set_column_width_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_width(style, hint->status,
+ hint->data.length.value, hint->data.length.unit);
}
css_error css__initial_column_width(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_width(state->computed, CSS_COLUMN_WIDTH_AUTO,
+ INTTOFIX(1), CSS_UNIT_EM);
}
css_error css__compose_column_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- UNUSED(parent);
- UNUSED(child);
- UNUSED(result);
+ css_fixed length = INTTOFIX(1);
+ css_unit unit = CSS_UNIT_EM;
+ uint8_t type = get_column_width(child, &length, &unit);
+
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_WIDTH_INHERIT ||
+ (child->uncommon != NULL && result != child)) {
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_WIDTH_INHERIT) {
+ type = get_column_width(parent, &length, &unit);
+ }
+
+ return set_column_width(result, type, length, unit);
+ }
return CSS_OK;
}