1 /*
2  * This file is part of LibCSS
3  * Licensed under the MIT License,
4  *		  http://www.opensource.org/licenses/mit-license.php
5  * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
6  */
7 
8 #include "bytecode/bytecode.h"
9 #include "bytecode/opcodes.h"
10 #include "select/propset.h"
11 #include "select/propget.h"
12 #include "utils/utils.h"
13 
14 #include "select/properties/properties.h"
15 #include "select/properties/helpers.h"
16 
css__cascade_background_color(uint32_t opv,css_style * style,css_select_state * state)17 css_error css__cascade_background_color(uint32_t opv, css_style *style,
18 		css_select_state *state)
19 {
20 	return css__cascade_bg_border_color(opv, style, state, set_background_color);
21 }
22 
css__set_background_color_from_hint(const css_hint * hint,css_computed_style * style)23 css_error css__set_background_color_from_hint(const css_hint *hint,
24 		css_computed_style *style)
25 {
26 	return set_background_color(style, hint->status, hint->data.color);
27 }
28 
css__initial_background_color(css_select_state * state)29 css_error css__initial_background_color(css_select_state *state)
30 {
31 	return set_background_color(state->computed,
32 			CSS_BACKGROUND_COLOR_COLOR, 0);
33 }
34 
css__compose_background_color(const css_computed_style * parent,const css_computed_style * child,css_computed_style * result)35 css_error css__compose_background_color(const css_computed_style *parent,
36 		const css_computed_style *child,
37 		css_computed_style *result)
38 {
39 	css_color color;
40 	uint8_t type = get_background_color(child, &color);
41 
42 	if (type == CSS_BACKGROUND_COLOR_INHERIT) {
43 		type = get_background_color(parent, &color);
44 	}
45 
46 	return set_background_color(result, type, color);
47 }
48 
49