lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH 2.8.4dev.19] table robustness again


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.4dev.19] table robustness again
Date: Mon, 19 Mar 2001 03:13:38 -0500
User-agent: Mutt/1.2.5i

This is yet another way to make tables more robust w.r.t. bad HTML.  A
also took an opportunity to macroize a couple of places which I missed
in my unobfuscation-of-faking <td></td> (let me recall that this
faking happens when line break happens in a non-first column of a
table).

Enjoy,
Ilya

P.S.  BTW, here is the example of such bad HTML.

 <TR>
   <TD>
       <FORM ACTION="FrameWork.class" METHOD="post">
       y
   </TD>
   <TD>
      <DIV>
           x
      </DIV></FORM>
   </TD>
 </TR>

(note FORM which spans cells.  -trace'ing it gives very unintuitive
results: it skips </TD> inside FORM, but not <TD>.  Then it supplied
</TD> when the FORM ends.

--- ./src/TRSTable.c-fragile    Sun Mar 18 16:31:02 2001
+++ ./src/TRSTable.c    Mon Mar 19 00:43:44 2001
@@ -1531,7 +1531,7 @@ PUBLIC int Stbl_addCellToTable ARGS7(
                                /* ##850_fail_if_fail?? */
     if (me->rows[me->nrows - 1].ended)
        Stbl_addRowToTable(me, alignment, lineno);
-    Stbl_finishCellInTable(me, YES, lineno, pos);
+    Stbl_finishCellInTable(me, TRST_ENDCELL_ENDTD, lineno, pos);
     lastrow = me->rows + (me->nrows - 1);
 
 #ifdef EXP_NESTED_TABLES
@@ -1666,10 +1666,9 @@ PUBLIC int Stbl_finishCellInTable ARGS4(
     icell = lastrow->ncells - 1;
     if (icell < 0)
        return icell;
-    if (s->x_td == -1) {
-       if ((end_td & TRST_ENDCELL_MASK) == TRST_ENDCELL_ENDTD)
-           return -1;
-       lastrow->ended = ROW_ended_by_splitline;
+    if (s->x_td == -1) {       /* Stray </TD> or safety-call */
+       if ((end_td & TRST_ENDCELL_MASK) == TRST_ENDCELL_LINEBREAK)
+           lastrow->ended = ROW_ended_by_splitline;
        return 0;
     }
 
@@ -2043,7 +2042,7 @@ PUBLIC void Stbl_update_enclosing ARGS3(
            max_width, me->startline, last_lineno));
     for (l = me->startline; l <= last_lineno; l++) {
        /* Fake <BR> in appropriate positions */
-       if (Stbl_finishCellInTable(me->enclosing, 0, l, max_width) < 0) {
+       if (Stbl_finishCellInTable(me->enclosing, TRST_ENDCELL_LINEBREAK, l, 
max_width) < 0) {
            /* It is not handy to let the caller delete me->enclosing,
               and it does not buy us anything.  Do it directly. */
            STable_info *stbl = me->enclosing;

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]