summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/AutoTableLayout.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-23 10:25:11 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-23 10:25:11 +0200
commit5ea819f80c6840c492386bfafbffb059c7e2091f (patch)
tree42ad0b1d82eff090d14278a088ea0f4840a0f938 /Source/WebCore/rendering/AutoTableLayout.cpp
parent43a42f108af6bcbd91f2672731c3047c26213af1 (diff)
downloadqtwebkit-5ea819f80c6840c492386bfafbffb059c7e2091f.tar.gz
Imported WebKit commit 20434eb8eb95065803473139d8794e98a7672f75 (http://svn.webkit.org/repository/webkit/trunk@132191)
New snapshot that should fix build with latest qtbase and the QPlastiqueStyle removal
Diffstat (limited to 'Source/WebCore/rendering/AutoTableLayout.cpp')
-rw-r--r--Source/WebCore/rendering/AutoTableLayout.cpp132
1 files changed, 64 insertions, 68 deletions
diff --git a/Source/WebCore/rendering/AutoTableLayout.cpp b/Source/WebCore/rendering/AutoTableLayout.cpp
index 08ecff90e..fb436ca55 100644
--- a/Source/WebCore/rendering/AutoTableLayout.cpp
+++ b/Source/WebCore/rendering/AutoTableLayout.cpp
@@ -49,81 +49,77 @@ void AutoTableLayout::recalcColumn(unsigned effCol)
RenderTableCell* fixedContributor = 0;
RenderTableCell* maxContributor = 0;
- for (RenderObject* child = m_table->children()->firstChild(); child; child = child->nextSibling()) {
- if (child->isRenderTableCol())
- toRenderTableCol(child)->computePreferredLogicalWidths();
- else if (child->isTableSection()) {
- RenderTableSection* section = toRenderTableSection(child);
- unsigned numRows = section->numRows();
- for (unsigned i = 0; i < numRows; i++) {
- RenderTableSection::CellStruct current = section->cellAt(i, effCol);
- RenderTableCell* cell = current.primaryCell();
-
- if (current.inColSpan || !cell)
- continue;
-
- bool cellHasContent = cell->children()->firstChild() || cell->style()->hasBorder() || cell->style()->hasPadding();
- if (cellHasContent)
- columnLayout.emptyCellsOnly = false;
-
- // A cell originates in this column. Ensure we have
- // a min/max width of at least 1px for this column now.
- columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);
- columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1);
-
- if (cell->colSpan() == 1) {
- if (cell->preferredLogicalWidthsDirty())
- cell->computePreferredLogicalWidths();
- columnLayout.minLogicalWidth = max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth);
- if (cell->maxPreferredLogicalWidth() > columnLayout.maxLogicalWidth) {
- columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth();
- maxContributor = cell;
- }
+ for (RenderTableSection* section = m_table->topNonEmptySection(); section; section = m_table->sectionBelow(section, SkipEmptySections)) {
+ unsigned numRows = section->numRows();
+ ASSERT(numRows);
+ for (unsigned i = 0; i < numRows; i++) {
+ RenderTableSection::CellStruct current = section->cellAt(i, effCol);
+ RenderTableCell* cell = current.primaryCell();
+
+ if (current.inColSpan || !cell)
+ continue;
- // All browsers implement a size limit on the cell's max width.
- // Our limit is based on KHTML's representation that used 16 bits widths.
- // FIXME: Other browsers have a lower limit for the cell's max width.
- const int cCellMaxWidth = 32760;
- Length cellLogicalWidth = cell->styleOrColLogicalWidth();
- if (cellLogicalWidth.value() > cCellMaxWidth)
- cellLogicalWidth.setValue(cCellMaxWidth);
- if (cellLogicalWidth.isNegative())
- cellLogicalWidth.setValue(0);
- switch (cellLogicalWidth.type()) {
- case Fixed:
- // ignore width=0
- if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercent()) {
- LayoutUnit logicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(cellLogicalWidth.value());
- if (columnLayout.logicalWidth.isFixed()) {
- // Nav/IE weirdness
- if ((logicalWidth > columnLayout.logicalWidth.value())
- || ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) {
- columnLayout.logicalWidth.setValue(Fixed, logicalWidth);
- fixedContributor = cell;
- }
- } else {
+ bool cellHasContent = cell->children()->firstChild() || cell->style()->hasBorder() || cell->style()->hasPadding();
+ if (cellHasContent)
+ columnLayout.emptyCellsOnly = false;
+
+ // A cell originates in this column. Ensure we have
+ // a min/max width of at least 1px for this column now.
+ columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);
+ columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1);
+
+ if (cell->colSpan() == 1) {
+ if (cell->preferredLogicalWidthsDirty())
+ cell->computePreferredLogicalWidths();
+ columnLayout.minLogicalWidth = max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth);
+ if (cell->maxPreferredLogicalWidth() > columnLayout.maxLogicalWidth) {
+ columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth();
+ maxContributor = cell;
+ }
+
+ // All browsers implement a size limit on the cell's max width.
+ // Our limit is based on KHTML's representation that used 16 bits widths.
+ // FIXME: Other browsers have a lower limit for the cell's max width.
+ const int cCellMaxWidth = 32760;
+ Length cellLogicalWidth = cell->styleOrColLogicalWidth();
+ if (cellLogicalWidth.value() > cCellMaxWidth)
+ cellLogicalWidth.setValue(cCellMaxWidth);
+ if (cellLogicalWidth.isNegative())
+ cellLogicalWidth.setValue(0);
+ switch (cellLogicalWidth.type()) {
+ case Fixed:
+ // ignore width=0
+ if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercent()) {
+ LayoutUnit logicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(cellLogicalWidth.value());
+ if (columnLayout.logicalWidth.isFixed()) {
+ // Nav/IE weirdness
+ if ((logicalWidth > columnLayout.logicalWidth.value())
+ || ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) {
columnLayout.logicalWidth.setValue(Fixed, logicalWidth);
fixedContributor = cell;
}
+ } else {
+ columnLayout.logicalWidth.setValue(Fixed, logicalWidth);
+ fixedContributor = cell;
}
- break;
- case Percent:
- m_hasPercent = true;
- if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value()))
- columnLayout.logicalWidth = cellLogicalWidth;
- break;
- case Relative:
- // FIXME: Need to understand this case and whether it makes sense to compare values
- // which are not necessarily of the same type.
- if (cellLogicalWidth.value() > columnLayout.logicalWidth.value())
- columnLayout.logicalWidth = cellLogicalWidth;
- default:
- break;
}
- } else if (!effCol || section->primaryCellAt(i, effCol - 1) != cell) {
- // This spanning cell originates in this column. Insert the cell into spanning cells list.
- insertSpanCell(cell);
+ break;
+ case Percent:
+ m_hasPercent = true;
+ if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value()))
+ columnLayout.logicalWidth = cellLogicalWidth;
+ break;
+ case Relative:
+ // FIXME: Need to understand this case and whether it makes sense to compare values
+ // which are not necessarily of the same type.
+ if (cellLogicalWidth.value() > columnLayout.logicalWidth.value())
+ columnLayout.logicalWidth = cellLogicalWidth;
+ default:
+ break;
}
+ } else if (!effCol || section->primaryCellAt(i, effCol - 1) != cell) {
+ // This spanning cell originates in this column. Insert the cell into spanning cells list.
+ insertSpanCell(cell);
}
}
}