mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-22 17:34:19 +03:00
make boxes keep reference to the DOM node that causes them
This commit is contained in:
parent
61872ab3a4
commit
31c9ffb4b5
10
render/box.c
10
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;
|
||||
}
|
||||
|
@ -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. */
|
||||
|
@ -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 ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user