summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2019-12-08 16:57:15 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2019-12-22 11:28:01 +0000
commit2fd7c49e85a0cc00d083f7d9b8b8c7a79947dd4b (patch)
tree9d3abfecc979381ad953f6483baed876a280294f
parent26f3055e7582ec87f431807907fe3b190ae083b0 (diff)
downloadnetsurf-2fd7c49e85a0cc00d083f7d9b8b8c7a79947dd4b.tar.gz
netsurf-2fd7c49e85a0cc00d083f7d9b8b8c7a79947dd4b.tar.bz2
layout: Add helper for checking if a style has a border on a side.
-rw-r--r--content/handlers/html/layout.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/content/handlers/html/layout.c b/content/handlers/html/layout.c
index c37429716..28a8465a0 100644
--- a/content/handlers/html/layout.c
+++ b/content/handlers/html/layout.c
@@ -111,6 +111,14 @@ static const css_border_style_func border_style_funcs[4] = {
[LEFT] = css_computed_border_left_style,
};
+/** Layout helper: Check for CSS border on given side. */
+static inline bool lh__have_border(
+ enum box_side side,
+ const css_computed_style *style)
+{
+ return border_style_funcs[side](style) != CSS_BORDER_STYLE_NONE;
+}
+
/** Array of per-side access functions for computed style border colors. */
static const css_border_color_func border_color_funcs[4] = {
[TOP] = css_computed_border_top_color,
@@ -302,8 +310,7 @@ calculate_mbp_width(const nscss_len_ctx *len_ctx,
/* border */
if (border) {
- if (border_style_funcs[side](style) !=
- CSS_BORDER_STYLE_NONE) {
+ if (lh__have_border(side, style)) {
border_width_funcs[side](style, &value, &unit);
*fixed += FIXTOINT(nscss_len2px(len_ctx,