From: hyatt Date: Wed, 15 Dec 2004 02:09:19 +0000 (+0000) Subject: Fix for 3833123, setting a cell's colspan does not update rendering like it should. X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=be91af49964447339d319aca9e2b9079ca15ceac 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): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8214 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/LayoutTests/fast/dynamic/013-expected.txt b/LayoutTests/fast/dynamic/013-expected.txt new file mode 100644 index 000000000000..843aaf91554f --- /dev/null +++ b/LayoutTests/fast/dynamic/013-expected.txt @@ -0,0 +1,19 @@ +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 diff --git a/LayoutTests/fast/dynamic/013.html b/LayoutTests/fast/dynamic/013.html new file mode 100644 index 000000000000..a0c8449207dd --- /dev/null +++ b/LayoutTests/fast/dynamic/013.html @@ -0,0 +1,47 @@ + + + Webmail links + + + + + + + + + + + + + +
+ + + diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index c40db4f2c993..3e8451da9c98 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,15 @@ +2004-12-14 David Hyatt + + 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 Fixed: crash copying text from other apps and pasting in a sticky in dashboard diff --git a/WebCore/khtml/html/html_tableimpl.cpp b/WebCore/khtml/html/html_tableimpl.cpp index e205366953fd..b5e3de8e3415 100644 --- a/WebCore/khtml/html/html_tableimpl.cpp +++ b/WebCore/khtml/html/html_tableimpl.cpp @@ -938,13 +938,17 @@ void HTMLTableCellElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr) // ### 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(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(renderer())->updateFromElement(); break; case ATTR_NOWRAP: if (!attr->isNull()) diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp index 67546f4a5d46..df4a048552e3 100644 --- a/WebCore/khtml/rendering/render_table.cpp +++ b/WebCore/khtml/rendering/render_table.cpp @@ -1578,6 +1578,7 @@ RenderTableCell::RenderTableCell(DOM::NodeImpl* _node) { _col = -1; _row = -1; + cSpan = rSpan = 1; updateFromElement(); setShouldPaintBackgroundOrBorder(true); _topExtra = 0; @@ -1595,14 +1596,16 @@ void RenderTableCell::detach() void RenderTableCell::updateFromElement() { - DOM::NodeImpl *node = element(); - if ( node && (node->id() == ID_TD || node->id() == ID_TH) ) { - DOM::HTMLTableCellElementImpl *tc = static_cast(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(node); + cSpan = tc->colSpan(); + rSpan = tc->rowSpan(); + } + if (parent() && oldRSpan != rSpan || oldCSpan != cSpan) + setNeedsLayoutAndMinMaxRecalc(); } void RenderTableCell::calcMinMaxWidth()