Diff
Modified: trunk/Source/WebCore/ChangeLog (99253 => 99254)
--- trunk/Source/WebCore/ChangeLog 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/ChangeLog 2011-11-04 00:56:59 UTC (rev 99254)
@@ -1,3 +1,39 @@
+2011-11-03 Levi Weintraub <[email protected]>
+
+ Correct usage of LayoutUnits and integers in Table rendering classes
+ https://bugs.webkit.org/show_bug.cgi?id=71500
+
+ Reviewed by Darin Adler.
+
+ Fixing the Table layout classes to operate on integers -- sub-pixel table layout breaks
+ the spec. Meanwhile correcting the Table rendering classes themselves to still use
+ LayoutUnits.
+
+ No new tests -- no change in behavior.
+
+ * rendering/AutoTableLayout.cpp: Reverting to operating on integers.
+ (WebCore::AutoTableLayout::recalcColumn):
+ (WebCore::AutoTableLayout::computePreferredLogicalWidths):
+ (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
+ (WebCore::AutoTableLayout::layout):
+ * rendering/AutoTableLayout.h: Reverting to operating on integers.
+ * rendering/FixedTableLayout.cpp: Ditto.
+ (WebCore::FixedTableLayout::computePreferredLogicalWidths):
+ (WebCore::FixedTableLayout::layout):
+ * rendering/RenderTable.h: Switching to LayoutUnits.
+ (WebCore::RenderTable::getColumnPos):
+ (WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection):
+ * rendering/RenderTableCell.cpp: Switching to LayoutUnits.
+ (WebCore::RenderTableCell::updateLogicalWidth):
+ (WebCore::RenderTableCell::setOverrideHeightFromRowHeight):
+ (WebCore::RenderTableCell::computeRectForRepaint):
+ (WebCore::RenderTableCell::cellBaselinePosition):
+ (WebCore::RenderTableCell::scrollbarsChanged):
+ * rendering/RenderTableCell.h: Switching to LayoutUnits
+ * rendering/RenderTableSection.cpp: Ditto.
+ (WebCore::RenderTableSection::setCellLogicalWidths):
+ (WebCore::RenderTableSection::layoutRows):
+
2011-11-03 James Robinson <[email protected]>
[chromium] Notify scheduler on SwapBuffers in threaded compositor mode
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (99253 => 99254)
--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2011-11-04 00:56:59 UTC (rev 99254)
@@ -69,11 +69,11 @@
if (cell->colSpan() == 1) {
// A cell originates in this column. Ensure we have
// a min/max width of at least 1px for this column now.
- columnLayout.minLogicalWidth = max<LayoutUnit>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);
- columnLayout.maxLogicalWidth = max<LayoutUnit>(columnLayout.maxLogicalWidth, 1);
+ columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);
+ columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1);
if (cell->preferredLogicalWidthsDirty())
cell->computePreferredLogicalWidths();
- columnLayout.minLogicalWidth = max(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth);
+ columnLayout.minLogicalWidth = max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth);
if (cell->maxPreferredLogicalWidth() > columnLayout.maxLogicalWidth) {
columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth();
maxContributor = cell;
@@ -119,8 +119,8 @@
} else if (!effCol || section->primaryCellAt(i, effCol - 1) != cell) {
// This spanning cell originates in this column. Ensure we have
// a min/max width of at least 1px for this column now.
- columnLayout.minLogicalWidth = max<LayoutUnit>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);
- columnLayout.maxLogicalWidth = max<LayoutUnit>(columnLayout.maxLogicalWidth, 1);
+ columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);
+ columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1);
insertSpanCell(cell);
}
}
@@ -223,7 +223,7 @@
{
fullRecalc();
- LayoutUnit spanMaxLogicalWidth = calcEffectiveLogicalWidth();
+ int spanMaxLogicalWidth = calcEffectiveLogicalWidth();
minWidth = 0;
maxWidth = 0;
float maxPercent = 0;
@@ -251,20 +251,19 @@
if (scaleColumns) {
maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon);
- // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
- maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
- maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
+ maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
+ maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
}
- maxWidth = max(maxWidth, spanMaxLogicalWidth);
+ maxWidth = max<int>(maxWidth, spanMaxLogicalWidth);
- LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
+ int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
minWidth += bordersPaddingAndSpacing;
maxWidth += bordersPaddingAndSpacing;
Length tableLogicalWidth = m_table->style()->logicalWidth();
if (tableLogicalWidth.isFixed() && tableLogicalWidth.value() > 0) {
- minWidth = max<LayoutUnit>(minWidth, tableLogicalWidth.value());
+ minWidth = max<int>(minWidth, tableLogicalWidth.value());
maxWidth = minWidth;
} else if (!remainingPercent && maxNonPercent) {
// if there was no remaining percent, maxWidth is invalid.
@@ -305,13 +304,13 @@
int cellMinLogicalWidth = cell->minPreferredLogicalWidth() + spacingInRowDirection;
float cellMaxLogicalWidth = cell->maxPreferredLogicalWidth() + spacingInRowDirection;
float totalPercent = 0;
- LayoutUnit spanMinLogicalWidth = 0;
+ int spanMinLogicalWidth = 0;
float spanMaxLogicalWidth = 0;
bool allColsArePercent = true;
bool allColsAreFixed = true;
bool haveAuto = false;
bool spanHasEmptyCellsOnly = true;
- LayoutUnit fixedWidth = 0;
+ int fixedWidth = 0;
while (lastCol < nEffCols && span > 0) {
Layout& columnLayout = m_layoutStruct[lastCol];
switch (columnLayout.logicalWidth.type()) {
@@ -390,19 +389,19 @@
if (cellMinLogicalWidth > spanMinLogicalWidth) {
if (allColsAreFixed) {
for (unsigned pos = effCol; fixedWidth > 0 && pos < lastCol; ++pos) {
- LayoutUnit cellLogicalWidth = max(m_layoutStruct[pos].effectiveMinLogicalWidth, cellMinLogicalWidth * m_layoutStruct[pos].logicalWidth.value() / fixedWidth);
+ int cellLogicalWidth = max(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(cellMinLogicalWidth * m_layoutStruct[pos].logicalWidth.value() / fixedWidth));
fixedWidth -= m_layoutStruct[pos].logicalWidth.value();
cellMinLogicalWidth -= cellLogicalWidth;
m_layoutStruct[pos].effectiveMinLogicalWidth = cellLogicalWidth;
}
} else {
float remainingMaxLogicalWidth = spanMaxLogicalWidth;
- LayoutUnit remainingMinLogicalWidth = spanMinLogicalWidth;
+ int remainingMinLogicalWidth = spanMinLogicalWidth;
// Give min to variable first, to fixed second, and to others third.
for (unsigned pos = effCol; remainingMaxLogicalWidth >= 0 && pos < lastCol; ++pos) {
if (m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto && fixedWidth <= cellMinLogicalWidth) {
- int colMinLogicalWidth = max<LayoutUnit>(m_layoutStruct[pos].effectiveMinLogicalWidth, m_layoutStruct[pos].logicalWidth.value());
+ int colMinLogicalWidth = max<int>(m_layoutStruct[pos].effectiveMinLogicalWidth, m_layoutStruct[pos].logicalWidth.value());
fixedWidth -= m_layoutStruct[pos].logicalWidth.value();
remainingMinLogicalWidth -= m_layoutStruct[pos].effectiveMinLogicalWidth;
remainingMaxLogicalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth;
@@ -413,8 +412,8 @@
for (unsigned pos = effCol; remainingMaxLogicalWidth >= 0 && pos < lastCol && remainingMinLogicalWidth < cellMinLogicalWidth; ++pos) {
if (!(m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto && fixedWidth <= cellMinLogicalWidth)) {
- int colMinLogicalWidth = max<LayoutUnit>(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(remainingMaxLogicalWidth ? cellMinLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / remainingMaxLogicalWidth : cellMinLogicalWidth));
- colMinLogicalWidth = min<LayoutUnit>(m_layoutStruct[pos].effectiveMinLogicalWidth + (cellMinLogicalWidth - remainingMinLogicalWidth), colMinLogicalWidth);
+ int colMinLogicalWidth = max<int>(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(remainingMaxLogicalWidth ? cellMinLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / remainingMaxLogicalWidth : cellMinLogicalWidth));
+ colMinLogicalWidth = min<int>(m_layoutStruct[pos].effectiveMinLogicalWidth + (cellMinLogicalWidth - remainingMinLogicalWidth), colMinLogicalWidth);
remainingMaxLogicalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth;
remainingMinLogicalWidth -= m_layoutStruct[pos].effectiveMinLogicalWidth;
cellMinLogicalWidth -= colMinLogicalWidth;
@@ -426,7 +425,7 @@
if (!cellLogicalWidth.isPercent()) {
if (cellMaxLogicalWidth > spanMaxLogicalWidth) {
for (unsigned pos = effCol; spanMaxLogicalWidth >= 0 && pos < lastCol; ++pos) {
- int colMaxLogicalWidth = max<LayoutUnit>(m_layoutStruct[pos].effectiveMaxLogicalWidth, static_cast<int>(spanMaxLogicalWidth ? cellMaxLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / spanMaxLogicalWidth : cellMaxLogicalWidth));
+ int colMaxLogicalWidth = max(m_layoutStruct[pos].effectiveMaxLogicalWidth, static_cast<int>(spanMaxLogicalWidth ? cellMaxLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / spanMaxLogicalWidth : cellMaxLogicalWidth));
spanMaxLogicalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth;
cellMaxLogicalWidth -= colMaxLogicalWidth;
m_layoutStruct[pos].effectiveMaxLogicalWidth = colMaxLogicalWidth;
@@ -477,8 +476,8 @@
void AutoTableLayout::layout()
{
// table layout based on the values collected in the layout structure.
- LayoutUnit tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection();
- LayoutUnit available = tableLogicalWidth;
+ int tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection();
+ int available = tableLogicalWidth;
size_t nEffCols = m_table->numEffCols();
if (nEffCols != m_layoutStruct.size()) {
@@ -501,7 +500,7 @@
// fill up every cell with its minWidth
for (size_t i = 0; i < nEffCols; ++i) {
- LayoutUnit cellLogicalWidth = m_layoutStruct[i].effectiveMinLogicalWidth;
+ int cellLogicalWidth = m_layoutStruct[i].effectiveMinLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
available -= cellLogicalWidth;
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
@@ -537,21 +536,21 @@
for (size_t i = 0; i < nEffCols; ++i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isPercent()) {
- LayoutUnit cellLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].effectiveMinLogicalWidth, logicalWidth.calcMinValue(tableLogicalWidth));
+ int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, logicalWidth.calcMinValue(tableLogicalWidth));
available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
}
}
if (totalPercent > 100) {
// remove overallocated space from the last columns
- LayoutUnit excess = tableLogicalWidth * (totalPercent - 100) / 100;
+ int excess = tableLogicalWidth * (totalPercent - 100) / 100;
for (int i = nEffCols - 1; i >= 0; --i) {
if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
- LayoutUnit cellLogicalWidth = m_layoutStruct[i].computedLogicalWidth;
- LayoutUnit reduction = min(cellLogicalWidth, excess);
+ int cellLogicalWidth = m_layoutStruct[i].computedLogicalWidth;
+ int reduction = min(cellLogicalWidth, excess);
// the lines below might look inconsistent, but that's the way it's handled in mozilla
excess -= reduction;
- LayoutUnit newLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction);
+ int newLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction);
available += cellLogicalWidth - newLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = newLogicalWidth;
}
@@ -576,7 +575,7 @@
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isRelative() && logicalWidth.value() != 0) {
// width=0* gets effMinWidth.
- LayoutUnit cellLogicalWidth = logicalWidth.value() * tableLogicalWidth / totalRelative;
+ int cellLogicalWidth = logicalWidth.value() * tableLogicalWidth / totalRelative;
available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
}
@@ -589,7 +588,7 @@
for (size_t i = 0; i < nEffCols; ++i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isAuto() && totalAuto && !m_layoutStruct[i].emptyCellsOnly) {
- LayoutUnit cellLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].computedLogicalWidth, static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto));
+ int cellLogicalWidth = max<int>(m_layoutStruct[i].computedLogicalWidth, static_cast<int>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto));
available -= cellLogicalWidth;
totalAuto -= m_layoutStruct[i].effectiveMaxLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
@@ -602,7 +601,7 @@
for (size_t i = 0; i < nEffCols; ++i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isFixed()) {
- LayoutUnit cellLogicalWidth = static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalFixed);
+ int cellLogicalWidth = static_cast<int>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalFixed);
available -= cellLogicalWidth;
totalFixed -= m_layoutStruct[i].effectiveMaxLogicalWidth;
m_layoutStruct[i].computedLogicalWidth += cellLogicalWidth;
@@ -615,7 +614,7 @@
for (size_t i = 0; i < nEffCols; ++i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isPercent()) {
- LayoutUnit cellLogicalWidth = available * logicalWidth.percent() / totalPercent;
+ int cellLogicalWidth = available * logicalWidth.percent() / totalPercent;
available -= cellLogicalWidth;
totalPercent -= logicalWidth.percent();
m_layoutStruct[i].computedLogicalWidth += cellLogicalWidth;
@@ -633,7 +632,7 @@
// variable columns with empty cells only don't get any width
if (m_layoutStruct[i].effectiveLogicalWidth.isAuto() && m_layoutStruct[i].emptyCellsOnly)
continue;
- LayoutUnit cellLogicalWidth = available / total;
+ int cellLogicalWidth = available / total;
available -= cellLogicalWidth;
total--;
m_layoutStruct[i].computedLogicalWidth += cellLogicalWidth;
@@ -650,7 +649,7 @@
// (4) Percent
// This is basically the reverse of how we grew the cells.
if (available < 0) {
- LayoutUnit logicalWidthBeyondMin = 0;
+ int logicalWidthBeyondMin = 0;
for (int i = nEffCols - 1; i >= 0; --i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isAuto())
@@ -660,8 +659,8 @@
for (int i = nEffCols - 1; i >= 0 && logicalWidthBeyondMin > 0; --i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isAuto()) {
- LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
- LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;
+ int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
+ int reduce = available * minMaxDiff / logicalWidthBeyondMin;
m_layoutStruct[i].computedLogicalWidth += reduce;
available -= reduce;
logicalWidthBeyondMin -= minMaxDiff;
@@ -672,7 +671,7 @@
}
if (available < 0) {
- LayoutUnit logicalWidthBeyondMin = 0;
+ int logicalWidthBeyondMin = 0;
for (int i = nEffCols - 1; i >= 0; --i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isRelative())
@@ -682,8 +681,8 @@
for (int i = nEffCols - 1; i >= 0 && logicalWidthBeyondMin > 0; --i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isRelative()) {
- LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
- LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;
+ int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
+ int reduce = available * minMaxDiff / logicalWidthBeyondMin;
m_layoutStruct[i].computedLogicalWidth += reduce;
available -= reduce;
logicalWidthBeyondMin -= minMaxDiff;
@@ -694,7 +693,7 @@
}
if (available < 0) {
- LayoutUnit logicalWidthBeyondMin = 0;
+ int logicalWidthBeyondMin = 0;
for (int i = nEffCols - 1; i >= 0; --i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isFixed())
@@ -704,8 +703,8 @@
for (int i = nEffCols - 1; i >= 0 && logicalWidthBeyondMin > 0; --i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isFixed()) {
- LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
- LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;
+ int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
+ int reduce = available * minMaxDiff / logicalWidthBeyondMin;
m_layoutStruct[i].computedLogicalWidth += reduce;
available -= reduce;
logicalWidthBeyondMin -= minMaxDiff;
@@ -716,7 +715,7 @@
}
if (available < 0) {
- LayoutUnit logicalWidthBeyondMin = 0;
+ int logicalWidthBeyondMin = 0;
for (int i = nEffCols - 1; i >= 0; --i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isPercent())
@@ -726,8 +725,8 @@
for (int i = nEffCols-1; i >= 0 && logicalWidthBeyondMin > 0; i--) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isPercent()) {
- LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
- LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;
+ int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;
+ int reduce = available * minMaxDiff / logicalWidthBeyondMin;
m_layoutStruct[i].computedLogicalWidth += reduce;
available -= reduce;
logicalWidthBeyondMin -= minMaxDiff;
@@ -738,7 +737,7 @@
}
}
- LayoutUnit pos = 0;
+ int pos = 0;
for (size_t i = 0; i < nEffCols; ++i) {
m_table->columnPositions()[i] = pos;
pos += m_layoutStruct[i].computedLogicalWidth + m_table->hBorderSpacing();
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.h (99253 => 99254)
--- trunk/Source/WebCore/rendering/AutoTableLayout.h 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.h 2011-11-04 00:56:59 UTC (rev 99254)
@@ -60,11 +60,11 @@
Length logicalWidth;
Length effectiveLogicalWidth;
- LayoutUnit minLogicalWidth;
- LayoutUnit maxLogicalWidth;
- LayoutUnit effectiveMinLogicalWidth;
- LayoutUnit effectiveMaxLogicalWidth;
- LayoutUnit computedLogicalWidth;
+ int minLogicalWidth;
+ int maxLogicalWidth;
+ int effectiveMinLogicalWidth;
+ int effectiveMaxLogicalWidth;
+ int computedLogicalWidth;
bool emptyCellsOnly;
};
Modified: trunk/Source/WebCore/rendering/FixedTableLayout.cpp (99253 => 99254)
--- trunk/Source/WebCore/rendering/FixedTableLayout.cpp 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/rendering/FixedTableLayout.cpp 2011-11-04 00:56:59 UTC (rev 99254)
@@ -194,10 +194,10 @@
// cols/cells with a fixed width.
//
// The maximum width is max(minWidth, tableWidth).
- LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
+ int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
- LayoutUnit tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0;
- LayoutUnit mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing;
+ int tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0;
+ int mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing;
minWidth = max(mw, tableLogicalWidth);
maxWidth = minWidth;
@@ -222,14 +222,14 @@
void FixedTableLayout::layout()
{
- LayoutUnit tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection();
+ int tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection();
int nEffCols = m_table->numEffCols();
Vector<int> calcWidth(nEffCols, 0);
int numAuto = 0;
- LayoutUnit autoSpan = 0;
- LayoutUnit totalFixedWidth = 0;
- LayoutUnit totalPercentWidth = 0;
+ int autoSpan = 0;
+ int totalFixedWidth = 0;
+ int totalPercentWidth = 0;
float totalPercent = 0;
// Compute requirements and try to satisfy fixed and percent widths.
@@ -250,8 +250,8 @@
}
}
- LayoutUnit hspacing = m_table->hBorderSpacing();
- LayoutUnit totalWidth = totalFixedWidth + totalPercentWidth;
+ int hspacing = m_table->hBorderSpacing();
+ int totalWidth = totalFixedWidth + totalPercentWidth;
if (!numAuto || totalWidth > tableLogicalWidth) {
// If there are no auto columns, or if the total is too wide, take
// what we have and scale it to fit as necessary.
@@ -279,12 +279,12 @@
}
} else {
// Divide the remaining width among the auto columns.
- LayoutUnit remainingWidth = tableLogicalWidth - totalFixedWidth - totalPercentWidth - hspacing * (autoSpan - numAuto);
+ int remainingWidth = tableLogicalWidth - totalFixedWidth - totalPercentWidth - hspacing * (autoSpan - numAuto);
int lastAuto = 0;
for (int i = 0; i < nEffCols; i++) {
if (m_width[i].isAuto()) {
- LayoutUnit span = m_table->spanOfEffCol(i);
- LayoutUnit w = remainingWidth * span / autoSpan;
+ int span = m_table->spanOfEffCol(i);
+ int w = remainingWidth * span / autoSpan;
calcWidth[i] = w + hspacing * (span - 1);
remainingWidth -= w;
if (!remainingWidth)
@@ -302,10 +302,10 @@
if (totalWidth < tableLogicalWidth) {
// Spread extra space over columns.
- LayoutUnit remainingWidth = tableLogicalWidth - totalWidth;
+ int remainingWidth = tableLogicalWidth - totalWidth;
int total = nEffCols;
while (total) {
- LayoutUnit w = remainingWidth / total;
+ int w = remainingWidth / total;
remainingWidth -= w;
calcWidth[--total] += w;
}
@@ -313,12 +313,12 @@
calcWidth[nEffCols - 1] += remainingWidth;
}
- LayoutUnit pos = 0;
+ int pos = 0;
for (int i = 0; i < nEffCols; i++) {
m_table->columnPositions()[i] = pos;
pos += calcWidth[i] + hspacing;
}
- LayoutUnit colPositionsSize = m_table->columnPositions().size();
+ int colPositionsSize = m_table->columnPositions().size();
if (colPositionsSize > 0)
m_table->columnPositions()[colPositionsSize - 1] = pos;
}
Modified: trunk/Source/WebCore/rendering/RenderTable.h (99253 => 99254)
--- trunk/Source/WebCore/rendering/RenderTable.h 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/rendering/RenderTable.h 2011-11-04 00:56:59 UTC (rev 99254)
@@ -44,7 +44,7 @@
explicit RenderTable(Node*);
virtual ~RenderTable();
- int getColumnPos(int col) const { return m_columnPos[col]; }
+ LayoutUnit getColumnPos(int col) const { return m_columnPos[col]; }
int hBorderSpacing() const { return m_hSpacing; }
int vBorderSpacing() const { return m_vSpacing; }
@@ -168,7 +168,7 @@
return c;
}
- int bordersPaddingAndSpacingInRowDirection() const
+ LayoutUnit bordersPaddingAndSpacingInRowDirection() const
{
return borderStart() + borderEnd() +
(collapseBorders() ? 0 : (paddingStart() + paddingEnd() + (numEffCols() + 1) * hBorderSpacing()));
Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (99253 => 99254)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-11-04 00:56:59 UTC (rev 99254)
@@ -155,7 +155,7 @@
{
}
-void RenderTableCell::updateLogicalWidth(int w)
+void RenderTableCell::updateLogicalWidth(LayoutUnit w)
{
if (w == logicalWidth())
return;
@@ -219,7 +219,7 @@
return result + intrinsicPaddingAfter();
}
-void RenderTableCell::setOverrideHeightFromRowHeight(int rowHeight)
+void RenderTableCell::setOverrideHeightFromRowHeight(LayoutUnit rowHeight)
{
clearIntrinsicPadding();
RenderBlock::setOverrideHeight(max<LayoutUnit>(0, rowHeight - borderBefore() - paddingBefore() - borderAfter() - paddingAfter()));
@@ -288,7 +288,7 @@
return r;
}
-void RenderTableCell::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& r, bool fixed) const
+void RenderTableCell::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& r, bool fixed) const
{
if (repaintContainer == this)
return;
@@ -299,12 +299,12 @@
RenderBlock::computeRectForRepaint(repaintContainer, r, fixed);
}
-int RenderTableCell::cellBaselinePosition() const
+LayoutUnit RenderTableCell::cellBaselinePosition() const
{
// <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of
// the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there
// is no such line box or table-row, the baseline is the bottom of content edge of the cell box.
- int firstLineBaseline = firstLineBoxBaseline();
+ LayoutUnit firstLineBaseline = firstLineBoxBaseline();
if (firstLineBaseline != -1)
return firstLineBaseline;
return paddingBefore() + borderBefore() + contentLogicalHeight();
@@ -1036,7 +1036,7 @@
void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollbarChanged)
{
- int scrollbarHeight = scrollbarLogicalHeight();
+ LayoutUnit scrollbarHeight = scrollbarLogicalHeight();
if (!scrollbarHeight)
return; // Not sure if we should be doing something when a scrollbar goes away or not.
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (99253 => 99254)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2011-11-04 00:56:59 UTC (rev 99254)
@@ -84,7 +84,7 @@
virtual void computePreferredLogicalWidths();
- void updateLogicalWidth(int);
+ void updateLogicalWidth(LayoutUnit);
virtual LayoutUnit borderLeft() const;
virtual LayoutUnit borderRight() const;
@@ -124,7 +124,7 @@
void paintBackgroundsBehindCell(PaintInfo&, const LayoutPoint&, RenderObject* backgroundObject);
- int cellBaselinePosition() const;
+ LayoutUnit cellBaselinePosition() const;
void setIntrinsicPaddingBefore(int p) { m_intrinsicPaddingBefore = p; }
void setIntrinsicPaddingAfter(int p) { m_intrinsicPaddingAfter = p; }
@@ -145,7 +145,7 @@
virtual LayoutUnit paddingBefore(bool includeIntrinsicPadding = true) const;
virtual LayoutUnit paddingAfter(bool includeIntrinsicPadding = true) const;
- void setOverrideHeightFromRowHeight(int);
+ void setOverrideHeightFromRowHeight(LayoutUnit);
virtual void scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollbarChanged);
@@ -169,7 +169,7 @@
virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
- virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false) const;
+ virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const;
void paintCollapsedBorder(GraphicsContext*, const LayoutRect&);
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (99253 => 99254)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2011-11-04 00:31:27 UTC (rev 99253)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2011-11-04 00:56:59 UTC (rev 99254)
@@ -289,15 +289,15 @@
cspan -= table()->columns()[endCol].span;
endCol++;
}
- int w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing();
- int oldLogicalWidth = cell->logicalWidth();
+ LayoutUnit w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing();
+ LayoutUnit oldLogicalWidth = cell->logicalWidth();
if (w != oldLogicalWidth) {
cell->setNeedsLayout(true);
if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout()) {
if (!statePusher.didPush()) {
// Technically, we should also push state for the row, but since
// rows don't push a coordinate transform, that's not necessary.
- statePusher.push(this, IntSize(x(), y()));
+ statePusher.push(this, LayoutSize(x(), y()));
}
cell->repaint();
}
@@ -463,10 +463,10 @@
// try to satisfy percent
LayoutUnit add = 0;
totalPercent = min(totalPercent, 100);
- int rh = m_rowPos[1] - m_rowPos[0];
+ LayoutUnit rh = m_rowPos[1] - m_rowPos[0];
for (unsigned r = 0; r < totalRows; r++) {
if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) {
- LayoutUnit toAdd = min(dh, static_cast<LayoutUnit>((totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh));
+ LayoutUnit toAdd = min<LayoutUnit>(dh, (totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh);
// If toAdd is negative, then we don't want to shrink the row (this bug
// affected Outlook Web Access).
toAdd = max<LayoutUnit>(0, toAdd);