Index: Source/WebCore/rendering/FixedTableLayout.cpp |
=================================================================== |
--- Source/WebCore/rendering/FixedTableLayout.cpp (revision 119426) |
+++ Source/WebCore/rendering/FixedTableLayout.cpp (working copy) |
@@ -143,40 +143,39 @@ |
// Iterate over the first row in case some are unspecified. |
RenderTableSection* section = m_table->topNonEmptySection(); |
- if (section) { |
- unsigned cCol = 0; |
- RenderObject* firstRow = section->firstChild(); |
- RenderObject* child = firstRow->firstChild(); |
- while (child) { |
- if (child->isTableCell()) { |
- RenderTableCell* cell = toRenderTableCell(child); |
- if (cell->preferredLogicalWidthsDirty()) |
- cell->computePreferredLogicalWidths(); |
+ if (!section) |
+ return usedWidth; |
- Length w = cell->styleOrColLogicalWidth(); |
- unsigned span = cell->colSpan(); |
- int effectiveColWidth = 0; |
- if (w.isFixed() && w.isPositive()) { |
- w.setValue(w.value() + cell->borderAndPaddingLogicalWidth()); |
- effectiveColWidth = w.value(); |
- } |
- |
- unsigned usedSpan = 0; |
- unsigned i = 0; |
- while (usedSpan < span && cCol + i < nEffCols) { |
- float eSpan = m_table->spanOfEffCol(cCol + i); |
- // Only set if no col element has already set it. |
- if (m_width[cCol + i].isAuto() && w.type() != Auto) { |
- m_width[cCol + i] = w; |
- m_width[cCol + i] *= eSpan / span; |
- usedWidth += effectiveColWidth * eSpan / span; |
- } |
- usedSpan += eSpan; |
- i++; |
- } |
- cCol += i; |
+ unsigned currentColumn = 0; |
+ |
+ RenderObject* firstRow = section->firstChild(); |
+ for (RenderObject* child = firstRow->firstChild(); child; child = child->nextSibling()) { |
+ if (!child->isTableCell()) |
+ continue; |
+ |
+ RenderTableCell* cell = toRenderTableCell(child); |
+ if (cell->preferredLogicalWidthsDirty()) |
+ cell->computePreferredLogicalWidths(); |
+ |
+ Length logicalWidth = cell->styleOrColLogicalWidth(); |
+ unsigned span = cell->colSpan(); |
+ int fixedBorderBoxLogicalWidth = 0; |
+ if (logicalWidth.isFixed() && logicalWidth.isPositive()) { |
+ fixedBorderBoxLogicalWidth = cell->computeBorderBoxLogicalWidth(logicalWidth.value()); |
+ logicalWidth.setValue(fixedBorderBoxLogicalWidth); |
+ } |
+ |
+ unsigned usedSpan = 0; |
+ while (usedSpan < span && currentColumn < nEffCols) { |
+ float eSpan = m_table->spanOfEffCol(currentColumn); |
+ // Only set if no col element has already set it. |
+ if (m_width[currentColumn].isAuto() && logicalWidth.type() != Auto) { |
+ m_width[currentColumn] = logicalWidth; |
+ m_width[currentColumn] *= eSpan / span; |
+ usedWidth += fixedBorderBoxLogicalWidth * eSpan / span; |
} |
- child = child->nextSibling(); |
+ usedSpan += eSpan; |
+ ++currentColumn; |
} |
} |