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 2011 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_opacity(uint32_t opv, css_style *style, |
||
18 | css_select_state *state) |
||
19 | { |
||
20 | uint16_t value = CSS_OPACITY_INHERIT; |
||
21 | css_fixed opacity = 0; |
||
22 | |||
23 | if (isInherit(opv) == false) { |
||
24 | value = CSS_Z_INDEX_SET; |
||
25 | |||
26 | opacity = *((css_fixed *) style->bytecode); |
||
27 | advance_bytecode(style, sizeof(opacity)); |
||
28 | } |
||
29 | |||
30 | if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, |
||
31 | isInherit(opv))) { |
||
32 | return set_opacity(state->computed, value, opacity); |
||
33 | } |
||
34 | |||
35 | return CSS_OK; |
||
36 | } |
||
37 | |||
38 | css_error css__set_opacity_from_hint(const css_hint *hint, |
||
39 | css_computed_style *style) |
||
40 | { |
||
41 | return set_opacity(style, hint->status, hint->data.fixed); |
||
42 | } |
||
43 | |||
44 | css_error css__initial_opacity(css_select_state *state) |
||
45 | { |
||
46 | return set_opacity(state->computed, CSS_OPACITY_SET, INTTOFIX(1)); |
||
47 | } |
||
48 | |||
49 | css_error css__compose_opacity(const css_computed_style *parent, |
||
50 | const css_computed_style *child, |
||
51 | css_computed_style *result) |
||
52 | { |
||
53 | css_fixed opacity = 0; |
||
54 | uint8_t type = get_opacity(child, &opacity); |
||
55 | |||
56 | if (type == CSS_OPACITY_INHERIT) { |
||
57 | type = get_opacity(parent, &opacity); |
||
58 | } |
||
59 | |||
60 | return set_opacity(result, type, opacity); |
||
61 | } |
||
62 |