Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/31c9ffb4b51b79394f882...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/31c9ffb4b51b79394f882e5...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/31c9ffb4b51b79394f882e5ef...
The branch, master has been updated
via 31c9ffb4b51b79394f882e5efed629c2df0600d9 (commit)
from 61872ab3a493d60ede0e5ca2221b4c5c94708171 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/31c9ffb4b51b79394f8...
commit 31c9ffb4b51b79394f882e5efed629c2df0600d9
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
make boxes keep reference to the DOM node that causes them
diff --git a/render/box.c b/render/box.c
index b9d0598..5dfada0 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 a4622e3..0953d9f 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 6357587..52c8cfe 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 ||
-----------------------------------------------------------------------
Summary of changes:
render/box.c | 10 ++++++++--
render/box.h | 2 ++
render/box_construct.c | 5 ++++-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/render/box.c b/render/box.c
index b9d0598..5dfada0 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 a4622e3..0953d9f 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 6357587..52c8cfe 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 ||
--
NetSurf Browser