diff options
Diffstat (limited to 'render/box.c')
-rw-r--r-- | render/box.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/render/box.c b/render/box.c index fe70c61f8..6f5b3f158 100644 --- a/render/box.c +++ b/render/box.c @@ -459,6 +459,34 @@ struct box *box_find_by_id(struct box *box, const char *id) /** + * Determine if a box is visible when the tree is rendered. + * + * \param box box to check + * \return true iff the box is rendered + */ + +bool *box_visible(struct box *box) +{ + struct box *fallback; + + /* visibility: hidden */ + if (box->style && box->style->visibility == CSS_VISIBILITY_HIDDEN) + return false; + + /* check if a fallback */ + while (box->parent) { + for (fallback = box->parent->fallback; fallback; + fallback = fallback->next) + if (fallback == box) + return false; + box = box->parent; + } + + return true; +} + + +/** * Print a box tree to stderr. */ |