summaryrefslogtreecommitdiff
path: root/src/select/properties/column_gap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/column_gap.c')
-rw-r--r--src/select/properties/column_gap.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c
index 8b7a841..641f529 100644
--- a/src/select/properties/column_gap.c
+++ b/src/select/properties/column_gap.c
@@ -17,54 +17,40 @@
css_error css__cascade_column_gap(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_GAP_SET:
- length = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(length));
- unit = *((uint32_t *) style->bytecode);
- advance_bytecode(style, sizeof(unit));
- break;
- case COLUMN_GAP_NORMAL:
- /** \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_gap);
}
css_error css__set_column_gap_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_gap(style, hint->status,
+ hint->data.length.value, hint->data.length.unit);
}
css_error css__initial_column_gap(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_gap(state->computed, CSS_COLUMN_GAP_NORMAL,
+ INTTOFIX(1), CSS_UNIT_EM);
}
css_error css__compose_column_gap(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_gap(child, &length, &unit);
+
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_GAP_INHERIT ||
+ (child->uncommon != NULL && result != child)) {
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ type == CSS_COLUMN_GAP_INHERIT) {
+ type = get_column_gap(parent, &length, &unit);
+ }
+
+ return set_column_gap(result, type, length, unit);
+ }
return CSS_OK;
}