Bug 108047

Summary: [test case] border collapse doesn't work in table (regression)
Product: [Applications] konqueror Reporter: Stephan Kulow <coolo>
Component: khtml rendererAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: pavel.simerda
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: tables/bug43854-2.html

Description Stephan Kulow 2005-06-24 11:32:53 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

This is a regression we got from an unidentified webcore merge.
Our own test tables/bug43854-2.html doesn't work correctly. It should show a 1px border
between the cells, but shows at least 3px
Comment 1 Stephan Kulow 2005-06-24 11:35:07 UTC
Created attachment 11567 [details]
tables/bug43854-2.html
Comment 2 Tommi Tervo 2006-05-05 11:48:43 UTC
*** Bug 115356 has been marked as a duplicate of this bug. ***
Comment 3 Allan Sandfeld 2006-10-14 20:30:44 UTC
SVN commit 595538 by carewolf:

Table-sections do not have their own border in collapsed-border model.
BUG: 108047
CCBUG: 115356


 M  +5 -0      render_table.h  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_table.h #595537:595538
@@ -248,6 +248,11 @@
     virtual int leftmostPosition(bool includeOverflowInterior, bool includeSelf) const;
     virtual int highestPosition(bool includeOverflowInterior, bool includeSelf) const;
 
+    int borderLeft() const { return table()->collapseBorders() ? 0 : RenderBox::borderLeft(); }
+    int borderRight() const { return table()->collapseBorders() ? 0 : RenderBox::borderRight(); }
+    int borderTop() const { return table()->collapseBorders() ? 0 : RenderBox::borderTop(); }
+    int borderBottom() const { return table()->collapseBorders() ? 0 : RenderBox::borderBottom(); }
+
     virtual void paint( PaintInfo& i, int tx, int ty);
 
     int numRows() const { return grid.size(); }
Comment 4 Allan Sandfeld 2006-10-16 12:13:59 UTC
Actually my patch only fixed bug 115356 which turns out to be a different bug. 

This bug still applies and the test-case still has larger than 1px borders for some reason.
Comment 5 Allan Sandfeld 2006-10-29 18:42:10 UTC
SVN commit 600141 by carewolf:

Make sure we call determineParseType when CDATA fields like
STYLE contains unclosed comments.
BUG: 108047


 M  +22 -16    khtml_part.cpp  


--- branches/KDE/3.5/kdelibs/khtml/khtml_part.cpp #600140:600141
@@ -1878,7 +1878,7 @@
     d->m_openableSuppressedPopups = 0;
     for ( QValueListIterator<QGuardedPtr<KHTMLPart> > i = d->m_suppressedPopupOriginParts.begin();
           i != d->m_suppressedPopupOriginParts.end(); ++i ) {
-       
+
       if (KHTMLPart* part = *i) {
         KJS::Window *w = KJS::Window::retrieveWindow( part );
         if (w)
@@ -1991,26 +1991,32 @@
 
 void KHTMLPart::write( const QString &str )
 {
-  if ( str.isNull() )
-    return;
+    if ( str.isNull() )
+        return;
 
-  if(d->m_bFirstData) {
-      // determine the parse mode
-      d->m_doc->setParseMode( DocumentImpl::Strict );
-      d->m_bFirstData = false;
-  }
-  khtml::Tokenizer* t = d->m_doc->tokenizer();
-  if(t)
-    t->write( str, true );
+    if(d->m_bFirstData) {
+        // determine the parse mode
+        d->m_doc->setParseMode( DocumentImpl::Strict );
+        d->m_bFirstData = false;
+    }
+    khtml::Tokenizer* t = d->m_doc->tokenizer();
+    if(t)
+        t->write( str, true );
 }
 
 void KHTMLPart::end()
 {
-    // make sure nothing's left in there...
-    if(d->m_decoder)
-        write(d->m_decoder->flush());
-    if (d->m_doc)
+    if (d->m_doc) {
+        if (d->m_decoder) {
+            QString decoded = d->m_decoder->flush();
+            if (d->m_bFirstData) {
+                d->m_bFirstData = false;
+                d->m_doc->determineParseMode(decoded);
+            }
+            write(decoded);
+        }
         d->m_doc->finishParsing();
+    }
 }
 
 bool KHTMLPart::doOpenStream( const QString& mimeType )
@@ -4316,7 +4322,7 @@
   {
     if ( processObjectRequest(*it, KURL("about:blank"), QString("text/html") ) ) {
       KHTMLPart* p = static_cast<KHTMLPart*>(static_cast<KParts::ReadOnlyPart *>((*it)->m_part));
-      
+
       // See if we want to replace content with javascript: output..
       QVariant res = p->executeScript( DOM::Node(), KURL::decode_string( url.right( url.length() - 11) ) );
       if ( res.type() == QVariant::String ) {