Bug 122884

Summary: <table><form><div> elements are not rendered
Product: [Applications] konqueror Reporter: Jani-Matti Hätinen <jani-matti.hatinen>
Component: khtml parsingAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: maillists, v13
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: A test case from Sampo bank internet service
A more complete test case

Description Jani-Matti Hätinen 2006-03-01 07:32:48 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Gentoo Packages
OS:                Linux

HTML elements inside <table><form><div> tags don't get rendered with the KHTML shipped in the KDE-3.5 series. This is a regression from 3.4 and earlier.

IOW:
<table>
   <form>
      <div>
         This doesn't get rendered
      </div>
   </form>
</table>

<form>
   <table>
      <div>
         But this does
      </div>
   </table>
</form>
Comment 1 Jani-Matti Hätinen 2006-03-01 07:35:14 UTC
Created attachment 14915 [details]
A test case from Sampo bank internet service
Comment 2 Jani-Matti Hätinen 2006-05-25 20:43:35 UTC
Created attachment 16274 [details]
A more complete test case
Comment 3 Allan Sandfeld 2006-05-25 20:49:53 UTC
No ofcause it can't. FORM is not allowed inside TABLE, but we sort of handle it because it is common, but DIV is certainly not allowed inside a table, and is not handled at all.
Comment 4 Jani-Matti Hätinen 2006-05-25 20:54:00 UTC
The latter test case shows that the problem is the <table><form> combination. Content within all other combinations of <div>, <table> and <form> is displayed.

What's really strange (as illustrated by the test case) is that if there's a <p> or <br> element between the <table> and <form> elements, everything works just fine. Only a <table><form> combination without any line break elements between them results in undisplayed contents.
Comment 5 Allan Sandfeld 2006-05-25 21:04:04 UTC
I will try and figure out how firefox handles it, and see if we can come close and still make sense.
Comment 6 Jani-Matti Hätinen 2006-05-25 21:23:28 UTC
Thanks for your efforts.

I've filed a bug report about this issue with the bank and it seems like they might actually do something about it. So there's a chance that for me this'll be fixed right where it should be.
Comment 7 Allan Sandfeld 2006-06-15 22:00:29 UTC
SVN commit 551858 by carewolf:

Don't put content under already malformed FORMs in malformed TABLEs
BUG:122884


 M  +5 -0      htmlparser.cpp  


--- branches/KDE/3.5/kdelibs/khtml/html/htmlparser.cpp #551857:551858
@@ -329,6 +329,10 @@
 #ifdef PARSER_DEBUG
         kdDebug( 6035 ) << "added " << n->nodeName().string() << " to " << tmp->nodeName().string() << ", new current=" << newNode->nodeName().string() << endl;
 #endif
+        // We allow TABLE > FORM in dtd.cpp, but do not allow form have children in this case
+        if (current->id() == ID_TABLE && id == ID_FORM) {
+            flat = true;
+        }
 
 	// don't push elements without end tag on the stack
         if(tagPriority[id] != 0 && !flat) {
@@ -353,6 +357,7 @@
 	    if(n->isInline()) m_inline = true;
         }
 
+
 #if SPEED_DEBUG < 1
         if(tagPriority[id] == 0 && n->renderer())
             n->renderer()->calcMinMaxWidth();
Comment 8 Allan Sandfeld 2006-06-16 18:56:47 UTC
*** Bug 117850 has been marked as a duplicate of this bug. ***
Comment 9 Allan Sandfeld 2006-06-16 19:13:06 UTC
*** Bug 123242 has been marked as a duplicate of this bug. ***
Comment 10 Jani-Matti Hätinen 2006-06-17 09:45:15 UTC
I tested the patch on kdelibs-3.5.3 and it fixes my problem.
Thank you so much. Now I can finally give Opera the boot.