summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box.c28
-rw-r--r--render/box.h1
-rw-r--r--render/html.c4
3 files changed, 32 insertions, 1 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.
*/
diff --git a/render/box.h b/render/box.h
index e932b7480..bdc2fdbdc 100644
--- a/render/box.h
+++ b/render/box.h
@@ -276,6 +276,7 @@ struct box *box_at_point(struct box *box, int x, int y,
struct content **content);
struct box *box_object_at_point(struct content *c, int x, int y);
struct box *box_find_by_id(struct box *box, const char *id);
+bool *box_visible(struct box *box);
void box_dump(struct box *box, unsigned int depth);
bool box_extract_link(const char *rel, const char *base, char **result);
diff --git a/render/html.c b/render/html.c
index ddf097cb3..1e50a77fb 100644
--- a/render/html.c
+++ b/render/html.c
@@ -503,7 +503,7 @@ bool html_head(struct content *c, xmlNode *head)
for (node = head->children; node != 0; node = node->next) {
if (node->type != XML_ELEMENT_NODE)
continue;
-
+
LOG(("Node: %s", node->name));
if (!c->title && strcmp(node->name, "title") == 0) {
xmlChar *title = xmlNodeGetContent(node);
@@ -1141,6 +1141,8 @@ void html_object_callback(content_msg msg, struct content *object,
break;
case CONTENT_MSG_REDRAW:
+ if (!box_visible(box))
+ break;
box_coords(box, &x, &y);
if (object == data.redraw.object) {
data.redraw.x = data.redraw.x *