Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3584 sourcerer 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 
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
 
17
css_error css__cascade_width(uint32_t opv, css_style *style,
18
		css_select_state *state)
19
{
20
	return css__cascade_length_auto(opv, style, state, set_width);
21
}
22
 
23
css_error css__set_width_from_hint(const css_hint *hint,
24
		css_computed_style *style)
25
{
26
	return set_width(style, hint->status,
27
			hint->data.length.value, hint->data.length.unit);
28
}
29
 
30
css_error css__initial_width(css_select_state *state)
31
{
32
	return set_width(state->computed, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX);
33
}
34
 
35
css_error css__compose_width(const css_computed_style *parent,
36
		const css_computed_style *child,
37
		css_computed_style *result)
38
{
39
	css_fixed length = 0;
40
	css_unit unit = CSS_UNIT_PX;
41
	uint8_t type = get_width(child, &length, &unit);
42
 
43
	if (type == CSS_WIDTH_INHERIT) {
44
		type = get_width(parent, &length, &unit);
45
	}
46
 
47
	return set_width(result, type, length, unit);
48
}
49