summaryrefslogtreecommitdiff
path: root/src/select/properties/position.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/position.c')
-rw-r--r--src/select/properties/position.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/select/properties/position.c b/src/select/properties/position.c
index 9f9658f..cc4b3e7 100644
--- a/src/select/properties/position.c
+++ b/src/select/properties/position.c
@@ -21,7 +21,7 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case POSITION_STATIC:
value = CSS_POSITION_STATIC;
@@ -35,11 +35,14 @@ css_error css__cascade_position(uint32_t opv, css_style *style,
case POSITION_FIXED:
value = CSS_POSITION_FIXED;
break;
+ case POSITION_STICKY:
+ value = CSS_POSITION_STICKY;
+ break;
}
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_position(state->computed, value);
}
@@ -57,16 +60,25 @@ css_error css__initial_position(css_select_state *state)
return set_position(state->computed, CSS_POSITION_STATIC);
}
+css_error css__copy_position(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_position(to, get_position(from));
+}
+
css_error css__compose_position(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_position(child);
- if (type == CSS_POSITION_INHERIT) {
- type = get_position(parent);
- }
-
- return set_position(result, type);
+ return css__copy_position(
+ type == CSS_POSITION_INHERIT ? parent : child,
+ result);
}