diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-11-01 15:45:57 +0000 |
---|---|---|
committer | Michael Drake <mdrake.unique@gmail.com> | 2022-12-14 22:53:35 +0000 |
commit | fbb39f0d49f2606400dcf6bb2fb1d5c56903ddf9 (patch) | |
tree | 09bfbf0f00733b59797388beb954df395018ab35 | |
parent | f30f869ea40ad7633ec34903d0f1594c860a32ae (diff) | |
download | netsurf-fbb39f0d49f2606400dcf6bb2fb1d5c56903ddf9.tar.gz netsurf-fbb39f0d49f2606400dcf6bb2fb1d5c56903ddf9.tar.bz2 |
html: layout: Helper for whether flex direction is reversed
-rw-r--r-- | content/handlers/html/layout_internal.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/content/handlers/html/layout_internal.h b/content/handlers/html/layout_internal.h index 974f49348..c6eb56d6e 100644 --- a/content/handlers/html/layout_internal.h +++ b/content/handlers/html/layout_internal.h @@ -184,6 +184,19 @@ static inline bool lh__flex_main_is_horizontal(const struct box *flex) } } +static inline bool lh__flex_direction_reversed(const struct box *flex) +{ + switch (css_computed_flex_direction(flex->style)) { + default: /* Fallthrough. */ + case CSS_FLEX_DIRECTION_ROW_REVERSE: /* Fallthrough. */ + case CSS_FLEX_DIRECTION_COLUMN_REVERSE: + return true; + case CSS_FLEX_DIRECTION_ROW: /* Fallthrough. */ + case CSS_FLEX_DIRECTION_COLUMN: + return false; + } +} + static inline int lh__non_auto_margin(const struct box *b, enum box_side side) { return (b->margin[side] == AUTO) ? 0 : b->margin[side]; |