changeset 469:06a11189d75f

Cleaned up Html_pop_tag()
author Jorge Arellano Cid <jcid@dillo.org>
date Fri, 19 Dec 2008 20:18:35 -0300
parents 6ddee709a59a
children b01e80ee7c88
files ChangeLog src/form.cc src/html.cc src/html_common.hh
diffstat 4 files changed, 4 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Dec 19 16:44:00 2008 -0300
+++ b/ChangeLog	Fri Dec 19 20:18:35 2008 -0300
@@ -18,7 +18,8 @@
  - Fix: recover page focus when clicking-out of a widget.
  - Fixed a segfault bug in the test/ directory.
  - Set middle click to submit in a new TAB. (Helps to keep form data!)
- - Added support for the Q element.
+ - Added support for the Q element. BUG#343
+ - Cleaned up Html_pop_tag().
    Patches: place (AKA corvid)
 +- Switched SSL-enabled to configure.in (./configure --enable-ssl).
  - Standardised the installation of dpid/dpidrc with auto* tools.
--- a/src/form.cc	Fri Dec 19 16:44:00 2008 -0300
+++ b/src/form.cc	Fri Dec 19 20:18:35 2008 -0300
@@ -372,8 +372,6 @@
    html->InFlags &= ~IN_SELECT;
    html->InFlags &= ~IN_OPTION;
    html->InFlags &= ~IN_TEXTAREA;
-
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -698,7 +696,6 @@
 
       html->InFlags &= ~IN_TEXTAREA;
    }
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -787,8 +784,6 @@
       SelectionResource *res = (SelectionResource*)input->embed->getResource();
       select->addOptionsTo (res);
    }
-
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -902,7 +897,6 @@
 void Html_tag_close_button(DilloHtml *html, int TagIdx)
 {
    html->InFlags &= ~IN_BUTTON;
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
--- a/src/html.cc	Fri Dec 19 16:44:00 2008 -0300
+++ b/src/html.cc	Fri Dec 19 20:18:35 2008 -0300
@@ -493,7 +493,6 @@
    PrevWasSPC = false;
    InVisitedLink = false;
    ReqTagClose = false;
-   CloseOneTag = false;
    TagSoup = true;
    NameVal = NULL;
 
@@ -1317,12 +1316,6 @@
    int stack_idx, cmp = 1;
    int new_idx = TagIdx;
 
-   if (html->CloseOneTag) {
-      Html_real_pop_tag(html);
-      html->CloseOneTag = false;
-      return;
-   }
-
    /* Look for the candidate tag to close */
    stack_idx = html->stack->size() - 1;
    while (stack_idx &&
@@ -1348,9 +1341,9 @@
                     Tags[toptag_idx].name);
 
          /* 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);
+         Html_real_pop_tag(html);
       }
 
    } else {
@@ -1365,14 +1358,6 @@
 }
 
 /*
- * Cleanup (conditional), and Pop the tag (if it matches)
- */
-void a_Html_pop_tag(DilloHtml *html, int TagIdx)
-{
-   Html_tag_cleanup_at_close(html, TagIdx);
-}
-
-/*
  * Some parsing routines.
  */
 
@@ -1586,7 +1571,6 @@
       /* beware of pages with multiple HTML close tags... :-P */
       html->InFlags &= ~IN_HTML;
    }
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -1622,7 +1606,6 @@
    
       html->InFlags &= ~IN_HEAD;
    }
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -1648,7 +1631,6 @@
    } else {
       BUG_MSG("the TITLE element must be inside the HEAD section\n");
    }
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -1668,7 +1650,6 @@
 static void Html_tag_close_script(DilloHtml *html, int TagIdx)
 {
    /* eventually the stash will be sent to an interpreter for parsing */
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -1688,7 +1669,6 @@
 static void Html_tag_close_style(DilloHtml *html, int TagIdx)
 {
    /* eventually the stash will be sent to an interpreter for parsing */
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -1766,7 +1746,6 @@
       /* some tag soup pages use multiple BODY tags... */
       html->InFlags &= ~IN_BODY;
    }
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -1895,7 +1874,6 @@
 {
    a_Menu_pagemarks_set_text(html->bw, html->Stash->str);
    DW2TB(html->dw)->addParbreak (9, S_TOP(html)->style);
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -2251,7 +2229,6 @@
 static void Html_tag_close_map(DilloHtml *html, int TagIdx)
 {
    html->InFlags &= ~IN_MAP;
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -2528,7 +2505,6 @@
 static void Html_tag_close_a(DilloHtml *html, int TagIdx)
 {
    html->InVisitedLink = false;
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -2596,7 +2572,6 @@
    const char *U201D = "\xe2\x80\x9d";
 
    DW2TB(html->dw)->addText (U201D, S_TOP(html)->style);
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -2787,7 +2762,6 @@
    html->InFlags &= ~IN_LI;
    html->WordAfterLI = false;
    ((ListItem *)html->dw)->flush ();
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -2900,7 +2874,6 @@
 {
    html->InFlags &= ~IN_PRE;
    DW2TB(html->dw)->addParbreak (9, S_TOP(html)->style);
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -3119,15 +3092,13 @@
 static void Html_tag_close_div(DilloHtml *html, int TagIdx)
 {
    DW2TB(html->dw)->addParbreak (0, S_TOP(html)->style);
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
- * Default close for most tags - just pop the stack.
+ * Default close for most tags.
  */
 static void Html_tag_close_default(DilloHtml *html, int TagIdx)
 {
-   a_Html_pop_tag(html, TagIdx);
 }
 
 /*
@@ -3136,7 +3107,6 @@
 static void Html_tag_close_par(DilloHtml *html, int TagIdx)
 {
    DW2TB(html->dw)->addParbreak (9, S_TOP(html)->style);
-   a_Html_pop_tag(html, TagIdx);
 }
 
 
--- a/src/html_common.hh	Fri Dec 19 16:44:00 2008 -0300
+++ b/src/html_common.hh	Fri Dec 19 20:18:35 2008 -0300
@@ -187,7 +187,6 @@
    bool PrevWasSPC;       /* Flag to help handling collapsing white space */
    bool InVisitedLink;    /* used to 'contrast_visited_colors' */
    bool ReqTagClose;      /* Flag to help handling bad-formed HTML */
-   bool CloseOneTag;      /* Flag to help Html_tag_cleanup_at_close() */
    bool WordAfterLI;      /* Flag to help ignoring the 1st <P> after <LI> */
    bool TagSoup;          /* Flag to enable the parser's cleanup functions */
    char *NameVal;         /* used for validation of "NAME" and "ID" in <A> */