summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2018-06-29 15:03:10 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2018-06-29 15:03:10 +0100
commit049695fa070c23580291949053b6d1faf8ffd749 (patch)
tree79e20e50faf28ba20409ecb1bc0a64f51f3a5acc
parent948207472ac1d405e6e6552eb51c6ed1a67ee32e (diff)
downloadnetsurf-049695fa070c23580291949053b6d1faf8ffd749.tar.gz
netsurf-049695fa070c23580291949053b6d1faf8ffd749.tar.bz2
Box: Add helper to check if box is first child.
-rw-r--r--content/handlers/html/box.h11
1 files changed, 11 insertions, 0 deletions
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