<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>50235</bug_id>
          
          <creation_ts>2002-11-05 15:29:26 +0000</creation_ts>
          <short_desc>padding attribute for style definitions in tables ignored</short_desc>
          <delta_ts>2005-03-08 12:23:18 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml renderer</component>
          <version>4.0</version>
          <rep_platform>unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Melchior Franz">mfranz</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>103921</commentid>
    <comment_count>0</comment_count>
    <who name="Melchior Franz">mfranz</who>
    <bug_when>2002-11-05 15:29:26 +0000</bug_when>
    <thetext>Version:           4.0 (using KDE 3.0.9)
Compiler:          gcc version 3.2
OS:          Linux (i686) release 2.4.19

Since a while khtml ignores the padding style given to a whole table.

The same example code also exposes another problem: khtml wrongly(?)
interprets the newline after the &lt;td&gt;-contents as space.

mozilla renders the example file &quot;correctly&quot; (i.e. like I think
it *should* be rendered  ;-)

m.




&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt;
        &lt;title&gt;Test&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;table style=&quot;background-color: red; padding: 20px&quot;&gt;
            &lt;tr&gt;
                &lt;td&gt;
                    padding 20px
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
        &lt;br&gt;
        &lt;table style=&quot;background-color: green; padding: 0px&quot;&gt;
            &lt;tr&gt;
                &lt;td&gt;
                    padding 0px
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>146657</commentid>
    <comment_count>1</comment_count>
    <who name="Marc Mutz">mutz</who>
    <bug_when>2003-07-20 00:31:18 +0000</bug_when>
    <thetext>I can confirm this. padding work on other elements, though, most notably &lt;div&gt;. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>170159</commentid>
    <comment_count>2</comment_count>
    <who name="Stephan Kulow">coolo</who>
    <bug_when>2003-10-29 12:54:48 +0000</bug_when>
    <thetext>the test case is rendered exactly as in IE6, mozilla adds indeed padding pixels. I&apos;m not
sure what&apos;s supposed to happen ;(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>170160</commentid>
    <comment_count>3</comment_count>
    <who name="Stephan Kulow">coolo</who>
    <bug_when>2003-10-29 13:00:03 +0000</bug_when>
    <thetext>JFYI: this is the way it works:

&lt;table style=&quot;background-color: red&quot;&gt;
 &lt;tr&gt;
 &lt;td style=&quot;padding: 20px&quot;&gt;
 padding 20px
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>318346</commentid>
    <comment_count>4</comment_count>
    <who name="Daniel Arnold">arnomane</who>
    <bug_when>2005-02-25 17:26:34 +0000</bug_when>
    <thetext>I can reproduce this bug with Konqueror from KDE 3.3.2a. So it is still there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>318498</commentid>
    <comment_count>5</comment_count>
    <who name="Thiago Macieira">thiago</who>
    <bug_when>2005-02-26 02:33:44 +0000</bug_when>
    <thetext>3.3.2 isn&apos;t the newest version anymore. But it&apos;s still present in HEAD 20050213.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>322105</commentid>
    <comment_count>6</comment_count>
    <who name="Allan Sandfeld">kde</who>
    <bug_when>2005-03-08 12:23:16 +0000</bug_when>
    <thetext>CVS commit by carewolf: 

Respect padding in tables. Merged from WebCore
BUG: 50235, 90711


  M +9 -1      ChangeLog   1.397
  M +6 -11     html/html_tableimpl.cpp   1.190
  M +11 -9     rendering/render_table.cpp   1.277
  M +6 -5      rendering/render_table.h   1.113
  M +4 -4      rendering/table_layout.cpp   1.41


--- kdelibs/khtml/html/html_tableimpl.cpp  #1.189:1.190
@@ -455,17 +455,12 @@ void HTMLTableElementImpl::parseAttribut
         break;
     case ATTR_CELLPADDING:
-        if (!attr-&gt;value().isEmpty()) {
-            addCSSLength(CSS_PROP_PADDING_TOP, attr-&gt;value(), true);
-            addCSSLength(CSS_PROP_PADDING_LEFT, attr-&gt;value(), true);
-            addCSSLength(CSS_PROP_PADDING_BOTTOM, attr-&gt;value(), true);
-            addCSSLength(CSS_PROP_PADDING_RIGHT, attr-&gt;value(), true);
+        if (!attr-&gt;value().isEmpty())
             padding = kMax( 0, attr-&gt;value().toInt() );
-        }
-        else {
-            removeCSSProperty(CSS_PROP_PADDING_TOP);
-            removeCSSProperty(CSS_PROP_PADDING_LEFT);
-            removeCSSProperty(CSS_PROP_PADDING_BOTTOM);
-            removeCSSProperty(CSS_PROP_PADDING_RIGHT);
+        else
             padding = 1;
+        if (m_render &amp;&amp; m_render-&gt;isTable()) {
+            static_cast&lt;RenderTable *&gt;(m_render)-&gt;setCellPadding(padding);
+            if (!m_render-&gt;needsLayout())
+                m_render-&gt;setNeedsLayout(true);
         }
         break;

--- kdelibs/khtml/ChangeLog  #1.396:1.397
@@ -1,2 +1,10 @@
+2005-03-04  Allan Sandfeld Jensen &lt;kde@carewolf.com&gt;
+
+        Merge table padding from WebCore
+
+        * html/html_tableimpl.cpp: CELLPADDING should not set normal padding
+        * rendering/render_table.cpp: Respect padding
+        * rendering/render_table.h: bordersAndSpacing() -&gt; bordersPaddingAndSpacing()
+
 2005-03-04  Germain Garand  &lt;germain@ebooksfrance.org&gt;
 
@@ -15,5 +23,5 @@
         * ecma/kjs_dom.cpp (getValueProperty/putValueProperty):
         Mozilla/IE strict compatibility: document.documentElement.scroll{Top,Left}
-        concern the canvas, not the root block. 
+        concern the canvas, not the root block.
         Cf. http://www.quirksmode.org/viewport/compatibility.html
 

--- kdelibs/khtml/rendering/render_table.cpp  #1.276:1.277
@@ -296,6 +296,6 @@ void RenderTable::layout()
     }
 
-    int bpTop = borderTop();
-    int bpBottom = borderBottom();
+    int bpTop = borderTop() + (collapseBorders() ? 0 : paddingTop());
+    int bpBottom = borderBottom() + (collapseBorders() ? 0 : paddingBottom());
 
     m_height += bpTop;
@@ -327,4 +327,6 @@ void RenderTable::layout()
     }
     int bl = borderLeft();
+    if (!collapseBorders())
+        bl += paddingLeft();
 
     // position the table sections

--- kdelibs/khtml/rendering/render_table.h  #1.112:1.113
@@ -161,6 +161,7 @@ public:
     }
 
-    int bordersAndSpacing() const {
-        return borderLeft() + borderRight() + (numEffCols()+1) * borderHSpacing();
+    int bordersPaddingAndSpacing() const {
+        return borderLeft() + borderRight() +
+               (collapseBorders() ? 0 : (paddingLeft() + paddingRight() + (numEffCols()+1) * borderHSpacing()));
     }
 

--- kdelibs/khtml/rendering/table_layout.cpp  #1.40:1.41
@@ -233,5 +233,5 @@ void FixedTableLayout::calcMinMaxWidth()
     // unlimited.
 
-    int bs = table-&gt;bordersAndSpacing();
+    int bs = table-&gt;bordersPaddingAndSpacing();
     int tableWidth = table-&gt;style()-&gt;width().isFixed() ? table-&gt;style()-&gt;width().value() - bs : 0;
 
@@ -258,5 +258,5 @@ void FixedTableLayout::calcMinMaxWidth()
 void FixedTableLayout::layout()
 {
-    int tableWidth = table-&gt;width() - table-&gt;bordersAndSpacing();
+    int tableWidth = table-&gt;width() - table-&gt;bordersPaddingAndSpacing();
     int available = tableWidth;
     int nEffCols = table-&gt;numEffCols();
@@ -597,5 +597,5 @@ void AutoTableLayout::calcMinMaxWidth()
     maxWidth = kMax( maxWidth, spanMaxWidth );
 
-    int bs = table-&gt;bordersAndSpacing();
+    int bs = table-&gt;bordersPaddingAndSpacing();
     minWidth += bs;
     maxWidth += bs;
@@ -850,5 +850,5 @@ void AutoTableLayout::layout()
 {
     // table layout based on the values collected in the layout structure.
-    int tableWidth = table-&gt;width() - table-&gt;bordersAndSpacing();
+    int tableWidth = table-&gt;width() - table-&gt;bordersPaddingAndSpacing();
     int available = tableWidth;
     int nEffCols = table-&gt;numEffCols();


</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>