aboutsummaryrefslogtreecommitdiff
path: root/src/html.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-02-06 21:20:34 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-02-06 21:20:34 +0100
commit17c9dc7f581ca55e931ce2987cb34bc505bf75d3 (patch)
tree7ce6844ff84cb9e3d65a73dfa14f34a34a5e5ee3 /src/html.cc
parentb65e704d76928e1a3f3984e8206840d87ea19a64 (diff)
parentfd6ff6812d018df008ca4ec8a2b3992cc962d3dd (diff)
merge with main
Diffstat (limited to 'src/html.cc')
-rw-r--r--src/html.cc39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/html.cc b/src/html.cc
index d59afe97..b2b8cd92 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -456,7 +456,6 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url,
InVisitedLink = false;
ReqTagClose = false;
TagSoup = true;
- NameVal = NULL;
Num_HTML = Num_HEAD = Num_BODY = Num_TITLE = 0;
@@ -2392,11 +2391,24 @@ static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize)
html->styleEngine->inheritBackgroundColor ();
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "name"))) {
+ char *nameVal;
+ const char *id = html->styleEngine->getId ();
+
if (prefs.show_extra_warnings)
Html_check_name_val(html, attrbuf, "name");
- /* html->NameVal is freed in Html_process_tag */
- html->NameVal = a_Url_decode_hex_str(attrbuf);
- Html_add_anchor(html, html->NameVal);
+
+ nameVal = a_Url_decode_hex_str(attrbuf);
+
+ if (nameVal) {
+ /* We compare the "id" value with the url-decoded "name" value */
+ if (!id || strcmp(nameVal, id)) {
+ if (id)
+ BUG_MSG("'id' and 'name' attribute of <a> tag differ\n");
+ Html_add_anchor(html, nameVal);
+ }
+
+ dFree(nameVal);
+ }
}
}
@@ -3325,24 +3337,13 @@ static void Html_parse_common_attrs(DilloHtml *html, char *tag, int tagsize)
* spec states in Sec. 7.5.2 that anchor ids are case-sensitive.
* So we don't do it and hope for better specs in the future ...
*/
- if (attrbuf)
- html->styleEngine->setId (attrbuf);
-
Html_check_name_val(html, attrbuf, "id");
- /* We compare the "id" value with the url-decoded "name" value */
- if (!html->NameVal || strcmp(html->NameVal, attrbuf)) {
- if (html->NameVal)
- BUG_MSG("'id' and 'name' attribute of <a> tag differ\n");
- Html_add_anchor(html, attrbuf);
- }
- }
- /* Reset NameVal */
- if (html->NameVal) {
- dFree(html->NameVal);
- html->NameVal = NULL;
+
+ html->styleEngine->setId(attrbuf);
+ Html_add_anchor(html, attrbuf);
}
- if (tagsize >= 10) { /* length of "<t class=i>" */
+ if (tagsize >= 11) { /* length of "<t class=i>" */
attrbuf = Html_get_attr2(html, tag, tagsize, "class",
HTML_LeftTrim | HTML_RightTrim);
if (attrbuf)