netsurf: branch master updated. release/3.0-73-gabebc6a

NetSurf Browser Project (Commit Mailer) no-reply at netsurf-browser.org
Thu May 16 18:18:43 BST 2013


Gitweb links:

...log http://git.netsurf-browser.org/netsurf.git/shortlog/abebc6ae2b3fb5e40b581d9afdc32d954bcb51b9
...commit http://git.netsurf-browser.org/netsurf.git/commit/abebc6ae2b3fb5e40b581d9afdc32d954bcb51b9
...tree http://git.netsurf-browser.org/netsurf.git/tree/abebc6ae2b3fb5e40b581d9afdc32d954bcb51b9

The branch, master has been updated
       via  abebc6ae2b3fb5e40b581d9afdc32d954bcb51b9 (commit)
      from  023c014ac439b03de4e45dd4cf567fe3a393bbf7 (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/commit/?id=abebc6ae2b3fb5e40b581d9afdc32d954bcb51b9
commit abebc6ae2b3fb5e40b581d9afdc32d954bcb51b9
Author: Michael Drake <tlsa at netsurf-browser.org>
Commit: Michael Drake <tlsa at netsurf-browser.org>

    Fix visited support for libdom.  (Still disabled.)

diff --git a/css/select.c b/css/select.c
index a98ab06..0d3be38 100644
--- a/css/select.c
+++ b/css/select.c
@@ -1552,38 +1552,59 @@ css_error node_is_visited(void *pw, void *node, bool *match)
 	*match = false;
 
 	/** \todo Implement visted check in a more performant way */
-
 #ifdef SUPPORT_VISITED
+
 	nscss_select_ctx *ctx = pw;
-	xmlNode *n = node;
+	nsurl *url;
+	nserror error;
+	const struct url_data *data;
 
-	if (strcasecmp((const char *) n->name, "a") == 0) {
-		nsurl *url;
-		nserror error;
-		const struct url_data *data;
-		xmlChar *href = xmlGetProp(n, (const xmlChar *) "href");
+	dom_exception exc;
+	dom_node *n = node;
+	dom_string *s = NULL;
 
-		if (href == NULL)
-			return CSS_OK;
+	exc = dom_node_get_node_name(n, &s);
+	if ((exc != DOM_NO_ERR) || (s == NULL)) {
+		return CSS_NOMEM;
+	}
 
-		/* Make href absolute */
-		/* TODO: this duplicates what we do for box->href */
-		error = nsurl_join(ctx->base_url, (const char *)href, &url);
+	if (!dom_string_caseless_lwc_isequal(s, corestring_lwc_a)) {
+		/* Can't be visited; not ancher element */
+		dom_string_unref(s);
+		return CSS_OK;
+	}
 
-		xmlFree(href);
-		if (error != NSERROR_OK) {
-			return CSS_NOMEM;
-		}
+	/* Finished with node name string */
+	dom_string_unref(s);
+	s = NULL;
+
+	exc = dom_element_get_attribute(n, corestring_dom_href, &s);
+	if ((exc != DOM_NO_ERR) || (s == NULL)) {
+		/* Can't be visited; not got a URL */
+		return CSS_OK;
+	}
 
-		data = urldb_get_url_data(nsurl_access(url));
+	/* Make href absolute */
+	/* TODO: this duplicates what we do for box->href
+	 *       should we put the absolute URL on the dom node? */
+	error = nsurl_join(ctx->base_url, dom_string_data(s), &url);
 
-		/* Visited if in the db and has
-		 * non-zero visit count */
-		if (data != NULL && data->visits > 0)
-			*match = true;
+	/* Finished with href string */
+	dom_string_unref(s);
 
-		nsurl_unref(url);
+	if (error != NSERROR_OK) {
+		/* Couldn't make nsurl object */
+		return CSS_NOMEM;
 	}
+
+	data = urldb_get_url_data(url);
+
+	/* Visited if in the db and has
+	 * non-zero visit count */
+	if (data != NULL && data->visits > 0)
+		*match = true;
+
+	nsurl_unref(url);
 #endif
 
 	return CSS_OK;


-----------------------------------------------------------------------

Summary of changes:
 css/select.c |   65 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 43 insertions(+), 22 deletions(-)

diff --git a/css/select.c b/css/select.c
index a98ab06..0d3be38 100644
--- a/css/select.c
+++ b/css/select.c
@@ -1552,38 +1552,59 @@ css_error node_is_visited(void *pw, void *node, bool *match)
 	*match = false;
 
 	/** \todo Implement visted check in a more performant way */
-
 #ifdef SUPPORT_VISITED
+
 	nscss_select_ctx *ctx = pw;
-	xmlNode *n = node;
+	nsurl *url;
+	nserror error;
+	const struct url_data *data;
 
-	if (strcasecmp((const char *) n->name, "a") == 0) {
-		nsurl *url;
-		nserror error;
-		const struct url_data *data;
-		xmlChar *href = xmlGetProp(n, (const xmlChar *) "href");
+	dom_exception exc;
+	dom_node *n = node;
+	dom_string *s = NULL;
 
-		if (href == NULL)
-			return CSS_OK;
+	exc = dom_node_get_node_name(n, &s);
+	if ((exc != DOM_NO_ERR) || (s == NULL)) {
+		return CSS_NOMEM;
+	}
 
-		/* Make href absolute */
-		/* TODO: this duplicates what we do for box->href */
-		error = nsurl_join(ctx->base_url, (const char *)href, &url);
+	if (!dom_string_caseless_lwc_isequal(s, corestring_lwc_a)) {
+		/* Can't be visited; not ancher element */
+		dom_string_unref(s);
+		return CSS_OK;
+	}
 
-		xmlFree(href);
-		if (error != NSERROR_OK) {
-			return CSS_NOMEM;
-		}
+	/* Finished with node name string */
+	dom_string_unref(s);
+	s = NULL;
+
+	exc = dom_element_get_attribute(n, corestring_dom_href, &s);
+	if ((exc != DOM_NO_ERR) || (s == NULL)) {
+		/* Can't be visited; not got a URL */
+		return CSS_OK;
+	}
 
-		data = urldb_get_url_data(nsurl_access(url));
+	/* Make href absolute */
+	/* TODO: this duplicates what we do for box->href
+	 *       should we put the absolute URL on the dom node? */
+	error = nsurl_join(ctx->base_url, dom_string_data(s), &url);
 
-		/* Visited if in the db and has
-		 * non-zero visit count */
-		if (data != NULL && data->visits > 0)
-			*match = true;
+	/* Finished with href string */
+	dom_string_unref(s);
 
-		nsurl_unref(url);
+	if (error != NSERROR_OK) {
+		/* Couldn't make nsurl object */
+		return CSS_NOMEM;
 	}
+
+	data = urldb_get_url_data(url);
+
+	/* Visited if in the db and has
+	 * non-zero visit count */
+	if (data != NULL && data->visits > 0)
+		*match = true;
+
+	nsurl_unref(url);
 #endif
 
 	return CSS_OK;


-- 
NetSurf Browser



More information about the netsurf-commits mailing list