summaryrefslogtreecommitdiff
path: root/src/select/computed.c
diff options
context:
space:
mode:
authorLucas Neves <lcneves@gmail.com>2017-09-28 15:39:22 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2017-10-21 15:03:51 +0100
commitd637196dce1f95d5294d9fb6fc2a8a3c785684d4 (patch)
treec9a14a961d81c7e4305e9e4d1a214dd244ad06bb /src/select/computed.c
parent54183411a97306df6e52d35dc5547ffac18a0992 (diff)
downloadlibcss-d637196dce1f95d5294d9fb6fc2a8a3c785684d4.tar.gz
libcss-d637196dce1f95d5294d9fb6fc2a8a3c785684d4.tar.bz2
Selection: Add support for the flexbox properties.
Diffstat (limited to 'src/select/computed.c')
-rw-r--r--src/select/computed.c91
1 files changed, 89 insertions, 2 deletions
diff --git a/src/select/computed.c b/src/select/computed.c
index 03e7c15..ebb2b29 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -749,13 +749,39 @@ uint8_t css_computed_font_style(const css_computed_style *style)
uint8_t css_computed_min_height(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
- return get_min_height(style, length, unit);
+ uint8_t min_height = get_min_height(style, length, unit);
+
+ if (min_height == CSS_MIN_HEIGHT_AUTO) {
+ uint8_t display = get_display(style);
+
+ if (display != CSS_DISPLAY_FLEX &&
+ display != CSS_DISPLAY_INLINE_FLEX) {
+ min_height = CSS_MIN_HEIGHT_SET;
+ *length = 0;
+ *unit = CSS_UNIT_PX;
+ }
+ }
+
+ return min_height;
}
uint8_t css_computed_min_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
- return get_min_width(style, length, unit);
+ uint8_t min_width = get_min_width(style, length, unit);
+
+ if (min_width == CSS_MIN_WIDTH_AUTO) {
+ uint8_t display = get_display(style);
+
+ if (display != CSS_DISPLAY_FLEX &&
+ display != CSS_DISPLAY_INLINE_FLEX) {
+ min_width = CSS_MIN_WIDTH_SET;
+ *length = 0;
+ *unit = CSS_UNIT_PX;
+ }
+ }
+
+ return min_width;
}
uint8_t css_computed_background_repeat(const css_computed_style *style)
@@ -927,6 +953,8 @@ uint8_t css_computed_display(const css_computed_style *style,
root /* 4. */) {
if (display == CSS_DISPLAY_INLINE_TABLE) {
return CSS_DISPLAY_TABLE;
+ } else if (display == CSS_DISPLAY_INLINE_FLEX) {
+ return CSS_DISPLAY_FLEX;
} else if (display == CSS_DISPLAY_INLINE ||
display == CSS_DISPLAY_RUN_IN ||
display == CSS_DISPLAY_TABLE_ROW_GROUP ||
@@ -1054,6 +1082,59 @@ uint8_t css_computed_widows(const css_computed_style *style,
return get_widows(style, widows);
}
+uint8_t css_computed_align_content(const css_computed_style *style)
+{
+ return get_align_content(style);
+}
+
+uint8_t css_computed_align_items(const css_computed_style *style)
+{
+ return get_align_items(style);
+}
+
+uint8_t css_computed_align_self(const css_computed_style *style)
+{
+ return get_align_self(style);
+}
+
+uint8_t css_computed_flex_basis(const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ return get_flex_basis(style, length, unit);
+}
+
+uint8_t css_computed_flex_direction(const css_computed_style *style)
+{
+ return get_flex_direction(style);
+}
+
+uint8_t css_computed_flex_grow(const css_computed_style *style,
+ css_fixed *number)
+{
+ return get_flex_grow(style, number);
+}
+
+uint8_t css_computed_flex_shrink(const css_computed_style *style,
+ css_fixed *number)
+{
+ return get_flex_shrink(style, number);
+}
+
+uint8_t css_computed_flex_wrap(const css_computed_style *style)
+{
+ return get_flex_wrap(style);
+}
+
+uint8_t css_computed_justify_content(const css_computed_style *style)
+{
+ return get_justify_content(style);
+}
+
+uint8_t css_computed_order(const css_computed_style *style,
+ int32_t *order)
+{
+ return get_order(style, order);
+}
/******************************************************************************
* Library internals *
@@ -1205,6 +1286,12 @@ css_error css__compute_absolute_values(const css_computed_style *parent,
if (error != CSS_OK)
return error;
+ /* Fix up flex-basis */
+ error = compute_absolute_length(style, &ex_size.data.length,
+ get_flex_basis, set_flex_basis);
+ if (error != CSS_OK)
+ return error;
+
/* Uncommon properties */
if (style->i.uncommon != NULL) {
/* Fix up border-spacing */