Fix for bug 8126, column widths apply to the border boxes of cells.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2006 04:52:50 +0000 (04:52 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2006 04:52:50 +0000 (04:52 +0000)
        Reviewed by aroben

        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::styleOrColWidth):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16315 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/rendering/RenderTableCell.cpp

index 24e33b9fa344fbf36c527a18c83ed99e94e3e563..de060d6e6a0531187b453d1da97576882ad2fde4 100644 (file)
@@ -1,3 +1,12 @@
+2006-09-11  David Hyatt  <hyatt@apple.com>
+
+        Fix for bug 8126, column widths apply to the border boxes of cells.
+
+        Reviewed by aroben
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::styleOrColWidth):
+
 2006-09-11  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Adele.
index 882981885137cc413d6623421854dbe6a98ed557..b8784e1511f3983dc93614d29b4617c1f55e4209 100644 (file)
@@ -80,8 +80,15 @@ Length RenderTableCell::styleOrColWidth()
     if (colSpan() > 1 || !w.isAuto())
         return w;
     RenderTableCol* col = table()->colElement(_col);
-    if (col)
+    if (col) {
         w = col->style()->width();
+        
+        // Column widths specified on <col> apply to the border box of the cell.
+        // Percentages don't need to be handled since they're always treated this way (even when specified on the cells).
+        // See Bugzilla bug 8126 for details.
+        if (w.isFixed() && w.value() > 0)
+            w = Length(max(0, w.value() - borderLeft() - borderRight() - paddingLeft() - paddingRight()), Fixed);
+    }
     return w;
 }