Commit 08f5bba3 authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Darin Adler.

        - fix <rdar://problem/6032139> Table cell widths calculated
          incorrectly on table that uses table-layout:fixed, colspans, and a mix
          of percentage and pixel widths

        Test: fast/table/fixed-granular-cols.html

        The incorrect widths resulted from incorrect handling of the case where
        the <col> elements are more granular than the table cells.

        * rendering/FixedTableLayout.cpp:
        (WebCore::FixedTableLayout::calcWidthArray): When processing <col>
        elements, append effective columns or split existing effective columns
        as needed.

LayoutTests:

        Reviewed by Darin Adler.

        - test for <rdar://problem/6032139> Table cell widths calculated
          incorrectly on table that uses table-layout:fixed, colspans, and a mix
          of percentage and pixel widths

        * fast/table/fixed-granular-cols.html: Added.
        * platform/mac/fast/table/fixed-granular-cols-expected.checksum: Added.
        * platform/mac/fast/table/fixed-granular-cols-expected.png: Added.
        * platform/mac/fast/table/fixed-granular-cols-expected.txt: Added.



git-svn-id: svn://svn.chromium.org/blink/trunk@42577 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6a41fea6
2009-04-16 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- test for <rdar://problem/6032139> Table cell widths calculated
incorrectly on table that uses table-layout:fixed, colspans, and a mix
of percentage and pixel widths
* fast/table/fixed-granular-cols.html: Added.
* platform/mac/fast/table/fixed-granular-cols-expected.checksum: Added.
* platform/mac/fast/table/fixed-granular-cols-expected.png: Added.
* platform/mac/fast/table/fixed-granular-cols-expected.txt: Added.
2009-04-15 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough.
......
<table style="table-layout: fixed; width: 200px; border-collapse: collapse;">
<col style="width: 10px;">
<col style="width: 10px;">
<col style="width: 10px;">
<col style="width: 80px;">
<col style="width: 90px;">
<tbody>
<tr>
<td></td>
<td colspan="3" style="height: 50px; background-color: green;"></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<table style="table-layout: fixed; width: 200px; border-collapse: collapse;">
<col span = "2" style="width: 10px;">
<col style="width: 80px;">
<col style="width: 10px;">
<tbody>
<tr>
<td></td>
<td colspan="3" style="height: 50px; background-color: green;"></td>
<td></td>
</tr>
</tbody>
</table>
layer at (0,0) size 800x600
RenderView 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 200x50
RenderTableCol {COL} at (0,0) size 0x0
RenderTableCol {COL} at (0,0) size 0x0
RenderTableCol {COL} at (0,0) size 0x0
RenderTableCol {COL} at (0,0) size 0x0
RenderTableCol {COL} at (0,0) size 0x0
RenderTableSection {TBODY} at (0,0) size 200x50
RenderTableRow {TR} at (0,0) size 200x50
RenderTableCell {TD} at (0,24) size 10x2 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (10,24) size 100x2 [bgcolor=#008000] [r=0 c=1 rs=1 cs=3]
RenderTableCell {TD} at (110,24) size 90x2 [r=0 c=4 rs=1 cs=1]
RenderTableCell {TD} at (200,24) size 0x2 [r=0 c=5 rs=1 cs=1]
RenderTable {TABLE} at (0,50) size 200x50
RenderTableCol {COL} at (0,0) size 0x0
RenderTableCol {COL} at (0,0) size 0x0
RenderTableCol {COL} at (0,0) size 0x0
RenderTableSection {TBODY} at (0,0) size 200x50
RenderTableRow {TR} at (0,0) size 200x50
RenderTableCell {TD} at (0,24) size 10x2 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (10,24) size 100x2 [bgcolor=#008000] [r=0 c=1 rs=1 cs=3]
RenderTableCell {TD} at (110,24) size 90x2 [r=0 c=4 rs=1 cs=1]
2009-04-16 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix <rdar://problem/6032139> Table cell widths calculated
incorrectly on table that uses table-layout:fixed, colspans, and a mix
of percentage and pixel widths
Test: fast/table/fixed-granular-cols.html
The incorrect widths resulted from incorrect handling of the case where
the <col> elements are more granular than the table cells.
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray): When processing <col>
elements, append effective columns or split existing effective columns
as needed.
2009-04-16 Alexey Proskuryakov <ap@webkit.org>
<rdar://problem/6795285> Infinite recursion in ResourceHandle::receivedRequestToContinueWithoutCredential
......@@ -85,16 +85,15 @@ int FixedTableLayout::calcWidthArray(int)
// iterate over all <col> elements
RenderObject* child = m_table->firstChild();
int cCol = 0;
int nEffCols = m_table->numEffCols();
m_width.resize(nEffCols);
m_width.fill(Length(Auto));
int currentEffectiveColumn = 0;
Length grpWidth;
while (child) {
if (child->isTableCol()) {
RenderTableCol *col = static_cast<RenderTableCol *>(child);
int span = col->span();
RenderTableCol* col = static_cast<RenderTableCol*>(child);
if (col->firstChild())
grpWidth = col->style()->width();
else {
......@@ -104,30 +103,35 @@ int FixedTableLayout::calcWidthArray(int)
int effWidth = 0;
if (w.isFixed() && w.value() > 0)
effWidth = w.value();
int usedSpan = 0;
int i = 0;
while (usedSpan < span) {
if(cCol + i >= nEffCols) {
m_table->appendColumn(span - usedSpan);
int span = col->span();
while (span) {
int spanInCurrentEffectiveColumn;
if (currentEffectiveColumn >= nEffCols) {
m_table->appendColumn(span);
nEffCols++;
m_width.resize(nEffCols);
m_width[nEffCols-1] = Length();
m_width.append(Length());
spanInCurrentEffectiveColumn = span;
} else {
if (span < m_table->spanOfEffCol(currentEffectiveColumn)) {
m_table->splitColumn(currentEffectiveColumn, span);
nEffCols++;
m_width.append(Length());
}
spanInCurrentEffectiveColumn = m_table->spanOfEffCol(currentEffectiveColumn);
}
int eSpan = m_table->spanOfEffCol(cCol+i);
if ((w.isFixed() || w.isPercent()) && w.isPositive()) {
m_width[cCol + i].setRawValue(w.type(), w.rawValue() * eSpan);
usedWidth += effWidth * eSpan;
m_width[currentEffectiveColumn].setRawValue(w.type(), w.rawValue() * spanInCurrentEffectiveColumn);
usedWidth += effWidth * spanInCurrentEffectiveColumn;
}
usedSpan += eSpan;
i++;
span -= spanInCurrentEffectiveColumn;
currentEffectiveColumn++;
}
cCol += i;
}
} else
break;
RenderObject *next = child->firstChild();
RenderObject* next = child->firstChild();
if (!next)
next = child->nextSibling();
if (!next && child->parent()->isTableCol()) {
......@@ -146,7 +150,7 @@ int FixedTableLayout::calcWidthArray(int)
if (section && !section->numRows())
section = m_table->sectionBelow(section, true);
if (section) {
cCol = 0;
int cCol = 0;
RenderObject* firstRow = section->firstChild();
child = firstRow->firstChild();
while (child) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment