From 049695fa070c23580291949053b6d1faf8ffd749 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 29 Jun 2018 15:03:10 +0100 Subject: Box: Add helper to check if box is first child. --- content/handlers/html/box.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'content/handlers') diff --git a/content/handlers/html/box.h b/content/handlers/html/box.h index f096b6714..0952b841b 100644 --- a/content/handlers/html/box.h +++ b/content/handlers/html/box.h @@ -366,4 +366,15 @@ bool box_normalise_block( const struct box *root, struct html_content *c); +/** + * Check if layout box is a first child. + * + * \param[in] b Box to check. + * \return true iff box is first child. + */ +static inline bool box_is_first_child(struct box *b) +{ + return (b->parent == NULL || b == b->parent->children); +} + #endif -- cgit v1.2.3