summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/rendering/FixedTableLayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/FixedTableLayout.cpp')
-rw-r--r--Source/WebCore/rendering/FixedTableLayout.cpp65
1 files changed, 32 insertions, 33 deletions
diff --git a/Source/WebCore/rendering/FixedTableLayout.cpp b/Source/WebCore/rendering/FixedTableLayout.cpp
index 4a495384c..54272b117 100644
--- a/Source/WebCore/rendering/FixedTableLayout.cpp
+++ b/Source/WebCore/rendering/FixedTableLayout.cpp
@@ -127,40 +127,39 @@ int FixedTableLayout::calcWidthArray(int)
// 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();
-
- 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;
+ if (!section)
+ return usedWidth;
+
+ 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;
}
}