summaryrefslogtreecommitdiff
path: root/src/select/properties
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-12-06 16:50:00 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2014-12-06 16:50:00 +0000
commit8dfbff7765940524bbcf9a75f0cdb20f29d99842 (patch)
tree3215a1c8336d433bc77e6a1ded1109042898970f /src/select/properties
parent48ae40f07dcba76bdcbcc965717ed5fdfbf8ccb3 (diff)
parent9248aaad8d0d90bc6f9caaf8c2b797b93ba4850f (diff)
downloadlibcss-8dfbff7765940524bbcf9a75f0cdb20f29d99842.tar.gz
libcss-8dfbff7765940524bbcf9a75f0cdb20f29d99842.tar.bz2
Merge branch 'tlsa/select-column-properties'
Diffstat (limited to 'src/select/properties')
-rw-r--r--src/select/properties/column_count.c31
-rw-r--r--src/select/properties/column_fill.c27
-rw-r--r--src/select/properties/column_gap.c52
-rw-r--r--src/select/properties/column_rule_color.c42
-rw-r--r--src/select/properties/column_rule_style.c47
-rw-r--r--src/select/properties/column_rule_width.c50
-rw-r--r--src/select/properties/column_span.c29
-rw-r--r--src/select/properties/column_width.c54
8 files changed, 136 insertions, 196 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;
}
diff --git a/src/select/properties/column_fill.c b/src/select/properties/column_fill.c
index 2322c03..9b4f1e0 100644
--- a/src/select/properties/column_fill.c
+++ b/src/select/properties/column_fill.c
@@ -17,20 +17,24 @@
css_error css__cascade_column_fill(uint32_t opv, css_style *style,
css_select_state *state)
{
+ uint16_t value = CSS_COLUMN_FILL_INHERIT;
+
UNUSED(style);
if (isInherit(opv) == false) {
switch (getValue(opv)) {
case COLUMN_FILL_BALANCE:
+ value = CSS_COLUMN_FILL_BALANCE;
+ break;
case COLUMN_FILL_AUTO:
- /** \todo convert to public values */
+ value = CSS_COLUMN_FILL_AUTO;
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
isInherit(opv))) {
- /** \todo set computed elevation */
+ return set_column_fill(state->computed, value);
}
return CSS_OK;
@@ -39,27 +43,24 @@ css_error css__cascade_column_fill(uint32_t opv, css_style *style,
css_error css__set_column_fill_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_fill(style, hint->status);
}
css_error css__initial_column_fill(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_fill(state->computed, CSS_COLUMN_FILL_BALANCE);
}
css_error css__compose_column_fill(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- UNUSED(parent);
- UNUSED(child);
- UNUSED(result);
+ uint8_t type = get_column_fill(child);
- return CSS_OK;
+ if (type == CSS_COLUMN_FILL_INHERIT) {
+ type = get_column_fill(parent);
+ }
+
+ return set_column_fill(result, type);
}
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;
}
diff --git a/src/select/properties/column_rule_color.c b/src/select/properties/column_rule_color.c
index 933cb60..d4b0e77 100644
--- a/src/select/properties/column_rule_color.c
+++ b/src/select/properties/column_rule_color.c
@@ -17,24 +17,31 @@
css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
css_select_state *state)
{
+ bool inherit = isInherit(opv);
+ uint16_t value = CSS_COLUMN_RULE_COLOR_INHERIT;
css_color color = 0;
if (isInherit(opv) == false) {
switch (getValue(opv)) {
- case COLUMN_RULE_COLOR_SET:
- color = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(color));
- break;
case COLUMN_RULE_COLOR_TRANSPARENT:
+ value = CSS_COLUMN_RULE_COLOR_COLOR;
+ break;
case COLUMN_RULE_COLOR_CURRENT_COLOR:
- /** \todo convert to public values */
+ /* color: currentColor always computes to inherit */
+ value = CSS_COLUMN_RULE_COLOR_INHERIT;
+ inherit = true;
+ break;
+ case COLUMN_RULE_COLOR_SET:
+ value = CSS_COLUMN_RULE_COLOR_COLOR;
+ color = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(color));
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
- /** \todo set computed elevation */
+ inherit)) {
+ return set_column_rule_color(state->computed, value, color);
}
return CSS_OK;
@@ -43,27 +50,26 @@ css_error css__cascade_column_rule_color(uint32_t opv, css_style *style,
css_error css__set_column_rule_color_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_rule_color(style, hint->status, hint->data.color);
}
css_error css__initial_column_rule_color(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_rule_color(state->computed,
+ CSS_COLUMN_RULE_COLOR_INHERIT, 0);
}
css_error css__compose_column_rule_color(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- UNUSED(parent);
- UNUSED(child);
- UNUSED(result);
+ css_color color;
+ uint8_t type = get_column_rule_color(child, &color);
- return CSS_OK;
+ if (type == CSS_COLUMN_RULE_COLOR_INHERIT) {
+ type = get_column_rule_color(parent, &color);
+ }
+
+ return set_column_rule_color(result, type, color);
}
diff --git a/src/select/properties/column_rule_style.c b/src/select/properties/column_rule_style.c
index ba558a2..586ce5d 100644
--- a/src/select/properties/column_rule_style.c
+++ b/src/select/properties/column_rule_style.c
@@ -17,57 +17,32 @@
css_error css__cascade_column_rule_style(uint32_t opv, css_style *style,
css_select_state *state)
{
- UNUSED(style);
-
- if (isInherit(opv) == false) {
- switch (getValue(opv)) {
- case COLUMN_RULE_STYLE_NONE:
- case COLUMN_RULE_STYLE_HIDDEN:
- case COLUMN_RULE_STYLE_DOTTED:
- case COLUMN_RULE_STYLE_DASHED:
- case COLUMN_RULE_STYLE_SOLID:
- case COLUMN_RULE_STYLE_DOUBLE:
- case COLUMN_RULE_STYLE_GROOVE:
- case COLUMN_RULE_STYLE_RIDGE:
- case COLUMN_RULE_STYLE_INSET:
- case COLUMN_RULE_STYLE_OUTSET:
- /** \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_border_style(opv, style, state,
+ set_column_rule_style);
}
css_error css__set_column_rule_style_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_rule_style(style, hint->status);
}
css_error css__initial_column_rule_style(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_rule_style(state->computed,
+ CSS_COLUMN_RULE_STYLE_NONE);
}
css_error css__compose_column_rule_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- UNUSED(parent);
- UNUSED(child);
- UNUSED(result);
+ uint8_t type = get_column_rule_style(child);
+
+ if (type == CSS_COLUMN_RULE_STYLE_INHERIT) {
+ type = get_column_rule_style(parent);
+ }
- return CSS_OK;
+ return set_column_rule_style(result, type);
}
diff --git a/src/select/properties/column_rule_width.c b/src/select/properties/column_rule_width.c
index 2c0ca0d..8694a09 100644
--- a/src/select/properties/column_rule_width.c
+++ b/src/select/properties/column_rule_width.c
@@ -17,57 +17,35 @@
css_error css__cascade_column_rule_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_RULE_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_RULE_WIDTH_THIN:
- case COLUMN_RULE_WIDTH_MEDIUM:
- case COLUMN_RULE_WIDTH_THICK:
- /** \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_border_width(opv, style, state,
+ set_column_rule_width);
}
css_error css__set_column_rule_width_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_rule_width(style, hint->status,
+ hint->data.length.value, hint->data.length.unit);
}
css_error css__initial_column_rule_width(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_rule_width(state->computed,
+ CSS_COLUMN_RULE_WIDTH_MEDIUM, 0, CSS_UNIT_PX);
}
css_error css__compose_column_rule_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- UNUSED(parent);
- UNUSED(child);
- UNUSED(result);
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_column_rule_width(child, &length, &unit);
+
+ if (type == CSS_COLUMN_RULE_WIDTH_INHERIT) {
+ type = get_column_rule_width(parent, &length, &unit);
+ }
- return CSS_OK;
+ return set_column_rule_width(result, type, length, unit);
}
diff --git a/src/select/properties/column_span.c b/src/select/properties/column_span.c
index 92048a0..2c870d3 100644
--- a/src/select/properties/column_span.c
+++ b/src/select/properties/column_span.c
@@ -14,23 +14,27 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_column_span(uint32_t opv, css_style *style,
+css_error css__cascade_column_span(uint32_t opv, css_style *style,
css_select_state *state)
{
+ uint16_t value = CSS_COLUMN_SPAN_INHERIT;
+
UNUSED(style);
if (isInherit(opv) == false) {
switch (getValue(opv)) {
case COLUMN_SPAN_NONE:
+ value = CSS_COLUMN_SPAN_NONE;
+ break;
case COLUMN_SPAN_ALL:
- /** \todo convert to public values */
+ value = CSS_COLUMN_SPAN_ALL;
break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
isInherit(opv))) {
- /** \todo set computed elevation */
+ return set_column_span(state->computed, value);
}
return CSS_OK;
@@ -39,27 +43,24 @@ css_error css__cascade_column_span(uint32_t opv, css_style *style,
css_error css__set_column_span_from_hint(const css_hint *hint,
css_computed_style *style)
{
- UNUSED(hint);
- UNUSED(style);
-
- return CSS_OK;
+ return set_column_span(style, hint->status);
}
css_error css__initial_column_span(css_select_state *state)
{
- UNUSED(state);
-
- return CSS_OK;
+ return set_column_span(state->computed, CSS_COLUMN_SPAN_NONE);
}
css_error css__compose_column_span(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- UNUSED(parent);
- UNUSED(child);
- UNUSED(result);
+ uint8_t type = get_column_span(child);
- return CSS_OK;
+ if (type == CSS_COLUMN_SPAN_INHERIT) {
+ type = get_column_span(parent);
+ }
+
+ return set_column_span(result, type);
}
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;
}