From fbb39f0d49f2606400dcf6bb2fb1d5c56903ddf9 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 1 Nov 2022 15:45:57 +0000 Subject: html: layout: Helper for whether flex direction is reversed --- content/handlers/html/layout_internal.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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]; -- cgit v1.2.3