aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2016-05-27 12:22:12 -0400
committerJorge Arellano Cid <jcid@dillo.org>2016-05-27 12:22:12 -0400
commitcdd88cd498b429db054060238560f5a57b98780d (patch)
treef64d70f4e25168836b0aa8fab4fb498ec99a7f37
parente4efad9e3e1a93ab676cbe0e2adb19fede0ee921 (diff)
parentc88af610b854350c5bee17bff5d3e7b6dd672b25 (diff)
merge
-rw-r--r--src/html.cc14
-rw-r--r--src/html_common.hh3
2 files changed, 11 insertions, 6 deletions
diff --git a/src/html.cc b/src/html.cc
index a3004dba..e9449cbd 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -1363,7 +1363,7 @@ static void Html_tag_cleanup_to_idx(DilloHtml *html, int idx)
int toptag_idx = S_TOP(html)->tag_idx;
TagInfo toptag = Tags[toptag_idx];
if (s_sz > idx + 1 && toptag.EndTag != 'O')
- BUG_MSG(" - forcing close of open tag: <%s>.", toptag.name);
+ BUG_MSG("Bad nesting - forcing close of open tag: <%s>.",toptag.name);
_MSG("Close: %s sz=%d idx=%d\n", toptag.name, s_sz, idx);
if (toptag_idx == i_BODY &&
!((html->InFlags & IN_EOF) || html->ReqTagClose)) {
@@ -1393,7 +1393,8 @@ static void Html_tag_cleanup_to_idx(DilloHtml *html, int idx)
*/
static void Html_tag_cleanup_at_close(DilloHtml *html, int new_idx)
{
- static int i_BUTTON = a_Html_tag_index("button"),
+ static int i_A = a_Html_tag_index("a"),
+ i_BUTTON = a_Html_tag_index("button"),
i_SELECT = a_Html_tag_index("select"),
i_TEXTAREA = a_Html_tag_index("textarea");
int w3c_mode = !prefs.w3c_plus_heuristics;
@@ -1411,10 +1412,11 @@ static void Html_tag_cleanup_at_close(DilloHtml *html, int new_idx)
} else if (Tags[tag_idx].EndTag == 'O') {
/* skip an optional tag */
continue;
- } else if ((new_idx == i_BUTTON && html->InFlags & IN_BUTTON) ||
+ } else if ((new_idx == i_A && html->InFlags & IN_A) ||
+ (new_idx == i_BUTTON && html->InFlags & IN_BUTTON) ||
(new_idx == i_SELECT && html->InFlags & IN_SELECT) ||
(new_idx == i_TEXTAREA && html->InFlags & IN_TEXTAREA)) {
- /* let these elements close tags inside them */
+ /* Let these elements close anything left open inside them */
continue;
} else if (w3c_mode || Tags[tag_idx].TagLevel >= new_tag.TagLevel) {
/* this is the tag that should have been closed */
@@ -2783,6 +2785,7 @@ static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize)
const char *attrbuf;
/* TODO: add support for MAP with A HREF */
+ html->InFlags |= IN_A;
if (html->InFlags & IN_MAP)
Html_tag_content_area(html, tag, tagsize);
@@ -2848,6 +2851,7 @@ static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize)
*/
static void Html_tag_close_a(DilloHtml *html)
{
+ html->InFlags &= ~IN_A;
html->InVisitedLink = false;
}
@@ -3593,7 +3597,7 @@ const TagInfo Tags[] = {
NULL},
{"html", B8(001110),'O',1, Html_tag_open_html, NULL, Html_tag_close_html},
{"i", B8(010101),'R',2, Html_tag_open_default, NULL, NULL},
- {"iframe", B8(011110),'R',2, Html_tag_open_frame, Html_tag_content_frame,
+ {"iframe", B8(011101),'R',2, Html_tag_open_frame, Html_tag_content_frame,
NULL},
{"img", B8(010001),'F',0, Html_tag_open_img, Html_tag_content_img,
NULL},
diff --git a/src/html_common.hh b/src/html_common.hh
index 6d0d8c62..6f086f5f 100644
--- a/src/html_common.hh
+++ b/src/html_common.hh
@@ -89,7 +89,8 @@ typedef enum {
IN_LI = 1 << 11,
IN_MEDIA = 1 << 12,
IN_META_HACK = 1 << 13,
- IN_EOF = 1 << 14,
+ IN_A = 1 << 14,
+ IN_EOF = 1 << 15,
} DilloHtmlProcessingState;
/*