summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/box.c10
-rw-r--r--render/box.h2
-rw-r--r--render/box_construct.c5
3 files changed, 14 insertions, 3 deletions
diff --git a/render/box.c b/render/box.c
index b9d059858..5dfada0c0 100644
--- a/render/box.c
+++ b/render/box.c
@@ -92,9 +92,14 @@ static int box_talloc_destructor(struct box *b)
if (b->href != NULL)
nsurl_unref(b->href);
- if (b->id != NULL)
+ if (b->id != NULL) {
lwc_string_unref(b->id);
-
+ }
+
+ if (b->node != NULL) {
+ dom_node_unref(b->node);
+ }
+
return 0;
}
@@ -172,6 +177,7 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
box->object = NULL;
box->object_params = NULL;
box->iframe = NULL;
+ box->node = NULL;
return box;
}
diff --git a/render/box.h b/render/box.h
index a4622e374..0953d9f88 100644
--- a/render/box.h
+++ b/render/box.h
@@ -265,6 +265,8 @@ struct box {
/** Iframe's browser_window, or NULL if none */
struct browser_window *iframe;
+
+ struct dom_node *node; /**< DOM node that generated this box or NULL */
};
/** Table column data. */
diff --git a/render/box_construct.c b/render/box_construct.c
index 63575876e..52c8cfee5 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -994,12 +994,15 @@ bool box_construct_element(struct box_construct_ctx *ctx,
return true;
}
- /* Attach box to DOM node */
+ /* Attach DOM node to box */
err = dom_node_set_user_data(ctx->n, kstr_box_key, box, NULL,
(void *) &old_box);
if (err != DOM_NO_ERR)
return false;
+ /* Attach box to DOM node */
+ box->node = dom_node_ref(ctx->n);
+
if (props.inline_container == NULL &&
(box->type == BOX_INLINE ||
box->type == BOX_BR ||