Reviewed by rjw
* khtml/html/html_tableimpl.cpp:
(HTMLTableCellElementImpl::parseHTMLAttribute):
* khtml/rendering/render_table.cpp:
(RenderTableCell::RenderTableCell):
(RenderTableCell::updateFromElement):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8214
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderTable {TABLE} at (0,0) size 200x42 [border: (1px outset #808080)]
+ RenderTableSection {TFOOT} at (1,1) size 0x40
+ RenderTableRow {TR} at (0,0) size 0x0
+ RenderTableCell {TD} at (0,0) size 97x20 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderText {TEXT} at (1,1) size 41x18
+ text run at (1,1) width 41: "span 1"
+ RenderTableCell {TD} at (97,0) size 101x20 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+ RenderText {TEXT} at (1,1) size 41x18
+ text run at (1,1) width 41: "span 1"
+ RenderTableRow {TR} at (0,0) size 0x0
+ RenderTableCell {TD} at (0,20) size 198x20 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=2]
+ RenderText {TEXT} at (1,1) size 87x18
+ text run at (1,1) width 87: "should span 2"
+ RenderTableSection {TBODY} at (1,1) size 0x0
--- /dev/null
+<html>
+<head>
+ <title>Webmail links</title>
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
+
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
+
+ <script type='text/javascript'>
+ <!--
+function init_table() {
+
+ var myTable = window.document.getElementById("my_table");
+ var row;
+ var cell;
+
+ row = myTable.insertRow(0);
+
+ cell = row.insertCell(0);
+ cell.colSpan = 1;
+ cell.innerHTML = "span 1";
+
+ cell = row.insertCell(1);
+ cell.colSpan = 1;
+ cell.innerHTML = "span 1";
+
+ row = myTable.insertRow(1);
+
+ cell = row.insertCell(0);
+ cell.colSpan = 2;
+ cell.innerHTML = "should span 2";
+
+}
+
+ //-->
+ </script>
+</head>
+<body onload="init_table()">
+
+ <table id='my_table' border='1' width='200px' height='200px' cellpadding='0' cellspacing='0'>
+ <tfoot>
+ </tfoot>
+ <tbody>
+ </tbody>
+ </table>
+
+</body>
+</html>
+2004-12-14 David Hyatt <hyatt@apple.com>
+
+ Fix for 3833123, setting a cell's colspan does not update rendering like it should.
+
+ Reviewed by rjw
+
+ * khtml/html/html_tableimpl.cpp:
+ (HTMLTableCellElementImpl::parseHTMLAttribute):
+ * khtml/rendering/render_table.cpp:
+ (RenderTableCell::RenderTableCell):
+ (RenderTableCell::updateFromElement):
+
2004-12-14 Chris Blumenberg <cblu@apple.com>
Fixed: <rdar://problem/3864536> crash copying text from other apps and pasting in a sticky in dashboard
// ###
rSpan = !attr->isNull() ? attr->value().toInt() : 1;
// limit this to something not causing an overflow with short int
- if(rSpan < 1 || rSpan > 1024) rSpan = 1;
+ if (rSpan < 1 || rSpan > 1024) rSpan = 1;
+ if (renderer() && renderer()->isTableCell())
+ static_cast<RenderTableCell*>(renderer())->updateFromElement();
break;
case ATTR_COLSPAN:
// ###
cSpan = !attr->isNull() ? attr->value().toInt() : 1;
// limit this to something not causing an overflow with short int
- if(cSpan < 1 || cSpan > 1024) cSpan = 1;
+ if (cSpan < 1 || cSpan > 1024) cSpan = 1;
+ if (renderer() && renderer()->isTableCell())
+ static_cast<RenderTableCell*>(renderer())->updateFromElement();
break;
case ATTR_NOWRAP:
if (!attr->isNull())
{
_col = -1;
_row = -1;
+ cSpan = rSpan = 1;
updateFromElement();
setShouldPaintBackgroundOrBorder(true);
_topExtra = 0;
void RenderTableCell::updateFromElement()
{
- DOM::NodeImpl *node = element();
- if ( node && (node->id() == ID_TD || node->id() == ID_TH) ) {
- DOM::HTMLTableCellElementImpl *tc = static_cast<DOM::HTMLTableCellElementImpl *>(node);
- cSpan = tc->colSpan();
- rSpan = tc->rowSpan();
- } else {
- cSpan = rSpan = 1;
- }
+ int oldRSpan = rSpan;
+ int oldCSpan = cSpan;
+ DOM::NodeImpl* node = element();
+ if (node && (node->id() == ID_TD || node->id() == ID_TH)) {
+ DOM::HTMLTableCellElementImpl *tc = static_cast<DOM::HTMLTableCellElementImpl *>(node);
+ cSpan = tc->colSpan();
+ rSpan = tc->rowSpan();
+ }
+ if (parent() && oldRSpan != rSpan || oldCSpan != cSpan)
+ setNeedsLayoutAndMinMaxRecalc();
}
void RenderTableCell::calcMinMaxWidth()