summaryrefslogtreecommitdiff
path: root/src/select/properties/box_sizing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/box_sizing.c')
-rw-r--r--src/select/properties/box_sizing.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/select/properties/box_sizing.c b/src/select/properties/box_sizing.c
index 2d19c95..471f8a7 100644
--- a/src/select/properties/box_sizing.c
+++ b/src/select/properties/box_sizing.c
@@ -21,7 +21,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case BOX_SIZING_CONTENT_BOX:
value = CSS_BOX_SIZING_CONTENT_BOX;
@@ -33,7 +33,7 @@ css_error css__cascade_box_sizing(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_box_sizing(state->computed, value);
}
@@ -51,17 +51,25 @@ css_error css__initial_box_sizing(css_select_state *state)
return set_box_sizing(state->computed, CSS_BOX_SIZING_CONTENT_BOX);
}
-css_error css__compose_box_sizing(
- const css_computed_style *parent,
+css_error css__copy_box_sizing(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_box_sizing(to, get_box_sizing(from));
+}
+
+css_error css__compose_box_sizing(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_box_sizing(child);
- if (type == CSS_BOX_SIZING_INHERIT) {
- type = get_box_sizing(parent);
- }
-
- return set_box_sizing(result, type);
+ return css__copy_box_sizing(
+ type == CSS_BOX_SIZING_INHERIT ? parent : child,
+ result);
}