diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-12-15 20:52:51 +0000 |
---|---|---|
committer | Michael Drake <mdrake.unique@gmail.com> | 2022-12-15 21:57:15 +0000 |
commit | cab66fb1ac15700392a26fdef8207db87144aac0 (patch) | |
tree | 8c2cf3a4e591cc5c03f5acc3d397e15a290b3d56 | |
parent | 651deffcf73f4760f32934dc2045e314998f5338 (diff) | |
download | netsurf-cab66fb1ac15700392a26fdef8207db87144aac0.tar.gz |
html: layout: flex: Helper to get main margin end size
-rw-r--r-- | content/handlers/html/layout_flex.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/content/handlers/html/layout_flex.c b/content/handlers/html/layout_flex.c index cea7964d7..a12becf3a 100644 --- a/content/handlers/html/layout_flex.c +++ b/content/handlers/html/layout_flex.c @@ -172,6 +172,38 @@ static struct flex_ctx *layout_flex_ctx__create( } /** + * Find box side representing the start of flex container in main direction. + * + * \param[in] ctx Flex layout context. + * \return the start side. + */ +static enum box_side layout_flex__main_start_side( + const struct flex_ctx *ctx) +{ + if (ctx->horizontal) { + return (ctx->main_reversed) ? RIGHT : LEFT; + } else { + return (ctx->main_reversed) ? BOTTOM : TOP; + } +} + +/** + * Find box side representing the end of flex container in main direction. + * + * \param[in] ctx Flex layout context. + * \return the end side. + */ +static enum box_side layout_flex__main_end_side( + const struct flex_ctx *ctx) +{ + if (ctx->horizontal) { + return (ctx->main_reversed) ? LEFT : RIGHT; + } else { + return (ctx->main_reversed) ? TOP : BOTTOM; + } +} + +/** * Perform layout on a flex item * * \param[in] ctx Flex layout context @@ -738,22 +770,6 @@ static bool layout_flex__resolve_line( } /** - * Find box side representing the start of flex container in main direction. - * - * \param[in] ctx Flex layout context. - * \return the start side. - */ -static enum box_side layout_flex__main_start_side( - const struct flex_ctx *ctx) -{ - if (ctx->horizontal) { - return (ctx->main_reversed) ? RIGHT : LEFT; - } else { - return (ctx->main_reversed) ? BOTTOM : TOP; - } -} - -/** * Position items along a line * * \param[in] ctx Flex layout context |