summaryrefslogtreecommitdiff
path: root/src/select/properties.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties.c')
-rw-r--r--src/select/properties.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/select/properties.c b/src/select/properties.c
index 4b7b8a7..b83a29d 100644
--- a/src/select/properties.c
+++ b/src/select/properties.c
@@ -5452,6 +5452,62 @@ css_error compose_z_index(const css_computed_style *parent,
return set_z_index(result, type, index);
}
+css_error cascade_libcss_align(uint32_t opv, css_style *style,
+ css_select_state *state)
+{
+ uint16_t value = CSS_LIBCSS_ALIGN_INHERIT;
+
+ UNUSED(style);
+
+ if (isInherit(opv) == false) {
+ switch (getValue(opv)) {
+ case LIBCSS_ALIGN_LEFT:
+ value = CSS_LIBCSS_ALIGN_LEFT;
+ break;
+ case LIBCSS_ALIGN_RIGHT:
+ value = CSS_LIBCSS_ALIGN_RIGHT;
+ break;
+ case LIBCSS_ALIGN_CENTER:
+ value = CSS_LIBCSS_ALIGN_CENTER;
+ break;
+ case LIBCSS_ALIGN_JUSTIFY:
+ value = CSS_LIBCSS_ALIGN_JUSTIFY;
+ break;
+ }
+ }
+
+ if (outranks_existing(getOpcode(opv), isImportant(opv), state,
+ isInherit(opv))) {
+ return set_libcss_align(state->result, value);
+ }
+
+ return CSS_OK;
+}
+
+css_error set_libcss_align_from_hint(const css_hint *hint,
+ css_computed_style *style)
+{
+ return set_libcss_align(style, hint->status);
+}
+
+css_error initial_libcss_align(css_select_state *state)
+{
+ return set_libcss_align(state->result, CSS_LIBCSS_ALIGN_DEFAULT);
+}
+
+css_error compose_libcss_align(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ uint8_t type = get_libcss_align(child);
+
+ if (type == CSS_LIBCSS_ALIGN_INHERIT) {
+ type = get_libcss_align(parent);
+ }
+
+ return set_libcss_align(result, type);
+}
+
/******************************************************************************
* Utilities below here *
******************************************************************************/