summaryrefslogtreecommitdiff
path: root/src/select/properties/color.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/color.c')
-rw-r--r--src/select/properties/color.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/select/properties/color.c b/src/select/properties/color.c
index 3cd1e3d..dad2b9d 100644
--- a/src/select/properties/color.c
+++ b/src/select/properties/color.c
@@ -17,17 +17,30 @@
css_error css__cascade_color(uint32_t opv, css_style *style,
css_select_state *state)
{
+ bool inherit = isInherit(opv);
uint16_t value = CSS_COLOR_INHERIT;
css_color color = 0;
- if (isInherit(opv) == false) {
- value = CSS_COLOR_COLOR;
- color = *((css_color *) style->bytecode);
- advance_bytecode(style, sizeof(color));
+ if (inherit == false) {
+ switch (getValue(opv)) {
+ case COLOR_TRANSPARENT:
+ value = CSS_COLOR_COLOR;
+ break;
+ case COLOR_CURRENT_COLOR:
+ /* color: currentColor always computes to inherit */
+ value = CSS_COLOR_INHERIT;
+ inherit = true;
+ break;
+ case COLOR_SET:
+ value = CSS_COLOR_COLOR;
+ color = *((css_color *) style->bytecode);
+ advance_bytecode(style, sizeof(color));
+ break;
+ }
}
- if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
+ inherit)) {
return set_color(state->computed, value, color);
}