Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/9e3ef18255464ccf0b7e29db23a436ccdc371959
...commit
http://git.netsurf-browser.org/netsurf.git/commit/9e3ef18255464ccf0b7e29db23a436ccdc371959
...tree
http://git.netsurf-browser.org/netsurf.git/tree/9e3ef18255464ccf0b7e29db23a436ccdc371959
The branch, master has been updated
via 9e3ef18255464ccf0b7e29db23a436ccdc371959 (commit)
from 920041a13103b0b207da56d2cb9d16c9ebcaba65 (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=9e3ef18255464ccf0b7e29db23a436ccdc371959
commit 9e3ef18255464ccf0b7e29db23a436ccdc371959
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
html: layout: Cleanup dom node tag name getting with helper.
diff --git a/content/handlers/html/layout.c b/content/handlers/html/layout.c
index 082e537..c8c0127 100644
--- a/content/handlers/html/layout.c
+++ b/content/handlers/html/layout.c
@@ -4411,20 +4411,17 @@ layout_block_context(struct box *block,
return true;
}
-
/**
- * Check a node's tag type.
+ * Get a dom node's element tag type.
*
- * Assumes node is an HTML element.
- *
- * \param[in] node Node to ckeck tag type of.
- * \param[in] type Tag type to test for.
- * \return true if if node has given type, false otherwise.
+ * \param[in] node Node to get tag type of.
+ * \param[in] type Returns element tag type on success.
+ * \return true if on success, false otherwise.
*/
-static inline bool
-layout__check_element_type(
+static bool
+layout__get_element_tag(
const dom_node *node,
- dom_html_element_type type)
+ dom_html_element_type *type)
{
dom_html_element_type element_type;
dom_node_type node_type;
@@ -4441,6 +4438,29 @@ layout__check_element_type(
return false;
}
+ *type = element_type;
+ return true;
+}
+
+
+/**
+ * Check a node's tag type.
+ *
+ * \param[in] node Node to check tag type of.
+ * \param[in] type Tag type to test for.
+ * \return true if if node has given type, false otherwise.
+ */
+static inline bool
+layout__check_element_type(
+ const dom_node *node,
+ dom_html_element_type type)
+{
+ dom_html_element_type element_type;
+
+ if (!layout__get_element_tag(node, &element_type)) {
+ return false;
+ }
+
return element_type == type;
}
@@ -4566,8 +4586,7 @@ layout__get_list_item_count(
return false;
}
- exc = dom_html_element_get_tag_type(list_owner, &tag_type);
- if (exc != DOM_NO_ERR) {
+ if (!layout__get_element_tag(list_owner, &tag_type)) {
return false;
}
@@ -4634,8 +4653,7 @@ layout__ordered_list_count(
return;
}
- exc = dom_html_element_get_tag_type(box->node, &tag_type);
- if (exc != DOM_NO_ERR) {
+ if (!layout__get_element_tag(box->node, &tag_type)) {
return;
}
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/layout.c | 46 ++++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 14 deletions(-)
diff --git a/content/handlers/html/layout.c b/content/handlers/html/layout.c
index 082e537..c8c0127 100644
--- a/content/handlers/html/layout.c
+++ b/content/handlers/html/layout.c
@@ -4411,20 +4411,17 @@ layout_block_context(struct box *block,
return true;
}
-
/**
- * Check a node's tag type.
+ * Get a dom node's element tag type.
*
- * Assumes node is an HTML element.
- *
- * \param[in] node Node to ckeck tag type of.
- * \param[in] type Tag type to test for.
- * \return true if if node has given type, false otherwise.
+ * \param[in] node Node to get tag type of.
+ * \param[in] type Returns element tag type on success.
+ * \return true if on success, false otherwise.
*/
-static inline bool
-layout__check_element_type(
+static bool
+layout__get_element_tag(
const dom_node *node,
- dom_html_element_type type)
+ dom_html_element_type *type)
{
dom_html_element_type element_type;
dom_node_type node_type;
@@ -4441,6 +4438,29 @@ layout__check_element_type(
return false;
}
+ *type = element_type;
+ return true;
+}
+
+
+/**
+ * Check a node's tag type.
+ *
+ * \param[in] node Node to check tag type of.
+ * \param[in] type Tag type to test for.
+ * \return true if if node has given type, false otherwise.
+ */
+static inline bool
+layout__check_element_type(
+ const dom_node *node,
+ dom_html_element_type type)
+{
+ dom_html_element_type element_type;
+
+ if (!layout__get_element_tag(node, &element_type)) {
+ return false;
+ }
+
return element_type == type;
}
@@ -4566,8 +4586,7 @@ layout__get_list_item_count(
return false;
}
- exc = dom_html_element_get_tag_type(list_owner, &tag_type);
- if (exc != DOM_NO_ERR) {
+ if (!layout__get_element_tag(list_owner, &tag_type)) {
return false;
}
@@ -4634,8 +4653,7 @@ layout__ordered_list_count(
return;
}
- exc = dom_html_element_get_tag_type(box->node, &tag_type);
- if (exc != DOM_NO_ERR) {
+ if (!layout__get_element_tag(box->node, &tag_type)) {
return;
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]