Summary: | padding attribute for style definitions in tables ignored | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Melchior Franz <mfranz> |
Component: | khtml renderer | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 4.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Melchior Franz
2002-11-05 15:29:26 UTC
I can confirm this. padding work on other elements, though, most notably <div>. the test case is rendered exactly as in IE6, mozilla adds indeed padding pixels. I'm not sure what's supposed to happen ;( JFYI: this is the way it works: <table style="background-color: red"> <tr> <td style="padding: 20px"> padding 20px </td> </tr> </table> I can reproduce this bug with Konqueror from KDE 3.3.2a. So it is still there. 3.3.2 isn't the newest version anymore. But it's still present in HEAD 20050213. 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->value().isEmpty()) { - addCSSLength(CSS_PROP_PADDING_TOP, attr->value(), true); - addCSSLength(CSS_PROP_PADDING_LEFT, attr->value(), true); - addCSSLength(CSS_PROP_PADDING_BOTTOM, attr->value(), true); - addCSSLength(CSS_PROP_PADDING_RIGHT, attr->value(), true); + if (!attr->value().isEmpty()) padding = kMax( 0, attr->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 && m_render->isTable()) { + static_cast<RenderTable *>(m_render)->setCellPadding(padding); + if (!m_render->needsLayout()) + m_render->setNeedsLayout(true); } break; --- kdelibs/khtml/ChangeLog #1.396:1.397 @@ -1,2 +1,10 @@ +2005-03-04 Allan Sandfeld Jensen <kde@carewolf.com> + + 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() -> bordersPaddingAndSpacing() + 2005-03-04 Germain Garand <germain@ebooksfrance.org> @@ -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->bordersAndSpacing(); + int bs = table->bordersPaddingAndSpacing(); int tableWidth = table->style()->width().isFixed() ? table->style()->width().value() - bs : 0; @@ -258,5 +258,5 @@ void FixedTableLayout::calcMinMaxWidth() void FixedTableLayout::layout() { - int tableWidth = table->width() - table->bordersAndSpacing(); + int tableWidth = table->width() - table->bordersPaddingAndSpacing(); int available = tableWidth; int nEffCols = table->numEffCols(); @@ -597,5 +597,5 @@ void AutoTableLayout::calcMinMaxWidth() maxWidth = kMax( maxWidth, spanMaxWidth ); - int bs = table->bordersAndSpacing(); + int bs = table->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->width() - table->bordersAndSpacing(); + int tableWidth = table->width() - table->bordersPaddingAndSpacing(); int available = tableWidth; int nEffCols = table->numEffCols(); |