changeset 461:49ed70ecc779

Fixed the parser not to call Html_tag_close_* functions twice.
author Jorge Arellano Cid <jcid@dillo.org>
date Sun, 07 Dec 2008 22:49:40 -0300
parents 049ecedd288c
children a82583f71897 76b081fc0a71
files ChangeLog src/html.cc
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Dec 07 16:22:19 2008 -0300
+++ b/ChangeLog	Sun Dec 07 22:49:40 2008 -0300
@@ -38,6 +38,7 @@
 +- Set the File menu label to hide when the File menu-button is shown.
  ? Trying a new iconv() test in configure.in.
  - Allowed the rc parser to skip whitespace around the equal sign.
+ - Fixed the parser not to call Html_tag_close_* functions twice.
    Patches: Jorge Arellano
 
 dw
--- a/src/html.cc	Sun Dec 07 16:22:19 2008 -0300
+++ b/src/html.cc	Sun Dec 07 22:49:40 2008 -0300
@@ -490,7 +490,6 @@
    pre_column = 0;
    PreFirstChar = false;
    PrevWasCR = false;
-   PrevWasOpenTag = false;
    PrevWasSPC = false;
    InVisitedLink = false;
    ReqTagClose = false;
@@ -1216,7 +1215,6 @@
       }
    }
 
-   html->PrevWasOpenTag = false;
    html->PrevWasSPC = false;
    if (html->InFlags & IN_LI)
       html->WordAfterLI = true;
@@ -1351,6 +1349,7 @@
 
          /* Close this and only this tag */
          html->CloseOneTag = true;
+         MSG("Close: %*s%s\n", html->stack->size()," ",Tags[toptag_idx].name);
          Tags[toptag_idx].close (html, toptag_idx);
       }
 
@@ -3404,6 +3403,7 @@
       if (tag_idx != new_idx || IsCloseTag) {
          /* implicit open */
          Html_force_push_tag(html, tag_idx);
+         MSG("Open : %*s%s\n", html->stack->size()," ",Tags[tag_idx].name);
          Tags[tag_idx].open (html, tag, strlen(tag));
       }
    }
@@ -3416,6 +3416,7 @@
          if (tag_idx != new_idx || IsCloseTag) {
             /* implicit open of the head element */
             Html_force_push_tag(html, tag_idx);
+            MSG("Open : %*s%s\n", html->stack->size()," ",Tags[tag_idx].name);
             Tags[tag_idx].open (html, tag, strlen(tag));
          }
       }
@@ -3425,13 +3426,14 @@
       if (html->InFlags & IN_HEAD) {
          tag = "</head>";
          tag_idx = Html_tag_index(tag + 2);
-         Tags[tag_idx].close (html, tag_idx);
+         Html_tag_cleanup_at_close(html, tag_idx);
       }
       tag = "<body>";
       tag_idx = Html_tag_index(tag + 1);
       if (tag_idx != new_idx || IsCloseTag) {
          /* implicit open */
          Html_force_push_tag(html, tag_idx);
+         MSG("Open : %*s%s\n", html->stack->size()," ",Tags[tag_idx].name);
          Tags[tag_idx].open (html, tag, strlen(tag));
       }
    }
@@ -3484,6 +3486,7 @@
       Html_push_tag(html, ni);
 
       /* Call the open function for this tag */
+      MSG("Open : %*s%s\n", html->stack->size(), " ", Tags[ni].name);
       Tags[ni].open (html, tag, tagsize);
       if (html->stop_parser)
          break;
@@ -3513,9 +3516,6 @@
          html->NameVal = NULL;
       }
 
-      /* let the parser know this was an open tag */
-      html->PrevWasOpenTag = true;
-
       /* Request inmediate close for elements with forbidden close tag. */
       /* TODO: XHTML always requires close tags. A simple implementation
        * of the commented clause below will make it work. */
@@ -3532,9 +3532,8 @@
           html->ReqTagClose ||                                  /* request */
           tag[tagsize - 2] == '/') {                            /* XML     */
    
-         Tags[ni].close (html, ni);
+         Html_tag_cleanup_at_close(html, ni);
          /* This was a close tag */
-         html->PrevWasOpenTag = false;
          html->ReqTagClose = false;
       }
    }