Changeset 99254 in webkit
- Timestamp:
- Nov 3, 2011 5:56:59 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r99253 r99254 1 2011-11-03 Levi Weintraub <leviw@chromium.org> 2 3 Correct usage of LayoutUnits and integers in Table rendering classes 4 https://bugs.webkit.org/show_bug.cgi?id=71500 5 6 Reviewed by Darin Adler. 7 8 Fixing the Table layout classes to operate on integers -- sub-pixel table layout breaks 9 the spec. Meanwhile correcting the Table rendering classes themselves to still use 10 LayoutUnits. 11 12 No new tests -- no change in behavior. 13 14 * rendering/AutoTableLayout.cpp: Reverting to operating on integers. 15 (WebCore::AutoTableLayout::recalcColumn): 16 (WebCore::AutoTableLayout::computePreferredLogicalWidths): 17 (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): 18 (WebCore::AutoTableLayout::layout): 19 * rendering/AutoTableLayout.h: Reverting to operating on integers. 20 * rendering/FixedTableLayout.cpp: Ditto. 21 (WebCore::FixedTableLayout::computePreferredLogicalWidths): 22 (WebCore::FixedTableLayout::layout): 23 * rendering/RenderTable.h: Switching to LayoutUnits. 24 (WebCore::RenderTable::getColumnPos): 25 (WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection): 26 * rendering/RenderTableCell.cpp: Switching to LayoutUnits. 27 (WebCore::RenderTableCell::updateLogicalWidth): 28 (WebCore::RenderTableCell::setOverrideHeightFromRowHeight): 29 (WebCore::RenderTableCell::computeRectForRepaint): 30 (WebCore::RenderTableCell::cellBaselinePosition): 31 (WebCore::RenderTableCell::scrollbarsChanged): 32 * rendering/RenderTableCell.h: Switching to LayoutUnits 33 * rendering/RenderTableSection.cpp: Ditto. 34 (WebCore::RenderTableSection::setCellLogicalWidths): 35 (WebCore::RenderTableSection::layoutRows): 36 1 37 2011-11-03 James Robinson <jamesr@chromium.org> 2 38 -
trunk/Source/WebCore/rendering/AutoTableLayout.cpp
r90955 r99254 70 70 // A cell originates in this column. Ensure we have 71 71 // a min/max width of at least 1px for this column now. 72 columnLayout.minLogicalWidth = max< LayoutUnit>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);73 columnLayout.maxLogicalWidth = max< LayoutUnit>(columnLayout.maxLogicalWidth, 1);72 columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0); 73 columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1); 74 74 if (cell->preferredLogicalWidthsDirty()) 75 75 cell->computePreferredLogicalWidths(); 76 columnLayout.minLogicalWidth = max (cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth);76 columnLayout.minLogicalWidth = max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth); 77 77 if (cell->maxPreferredLogicalWidth() > columnLayout.maxLogicalWidth) { 78 78 columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth(); … … 120 120 // This spanning cell originates in this column. Ensure we have 121 121 // a min/max width of at least 1px for this column now. 122 columnLayout.minLogicalWidth = max< LayoutUnit>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);123 columnLayout.maxLogicalWidth = max< LayoutUnit>(columnLayout.maxLogicalWidth, 1);122 columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0); 123 columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1); 124 124 insertSpanCell(cell); 125 125 } … … 224 224 fullRecalc(); 225 225 226 LayoutUnit spanMaxLogicalWidth = calcEffectiveLogicalWidth();226 int spanMaxLogicalWidth = calcEffectiveLogicalWidth(); 227 227 minWidth = 0; 228 228 maxWidth = 0; … … 252 252 if (scaleColumns) { 253 253 maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon); 254 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 255 maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 256 maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 257 } 258 259 maxWidth = max(maxWidth, spanMaxLogicalWidth); 260 261 LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection(); 254 maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 255 maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 256 } 257 258 maxWidth = max<int>(maxWidth, spanMaxLogicalWidth); 259 260 int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection(); 262 261 minWidth += bordersPaddingAndSpacing; 263 262 maxWidth += bordersPaddingAndSpacing; … … 265 264 Length tableLogicalWidth = m_table->style()->logicalWidth(); 266 265 if (tableLogicalWidth.isFixed() && tableLogicalWidth.value() > 0) { 267 minWidth = max< LayoutUnit>(minWidth, tableLogicalWidth.value());266 minWidth = max<int>(minWidth, tableLogicalWidth.value()); 268 267 maxWidth = minWidth; 269 268 } else if (!remainingPercent && maxNonPercent) { … … 306 305 float cellMaxLogicalWidth = cell->maxPreferredLogicalWidth() + spacingInRowDirection; 307 306 float totalPercent = 0; 308 LayoutUnit spanMinLogicalWidth = 0;307 int spanMinLogicalWidth = 0; 309 308 float spanMaxLogicalWidth = 0; 310 309 bool allColsArePercent = true; … … 312 311 bool haveAuto = false; 313 312 bool spanHasEmptyCellsOnly = true; 314 LayoutUnit fixedWidth = 0;313 int fixedWidth = 0; 315 314 while (lastCol < nEffCols && span > 0) { 316 315 Layout& columnLayout = m_layoutStruct[lastCol]; … … 391 390 if (allColsAreFixed) { 392 391 for (unsigned pos = effCol; fixedWidth > 0 && pos < lastCol; ++pos) { 393 LayoutUnit cellLogicalWidth = max(m_layoutStruct[pos].effectiveMinLogicalWidth, cellMinLogicalWidth * m_layoutStruct[pos].logicalWidth.value() / fixedWidth);392 int cellLogicalWidth = max(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(cellMinLogicalWidth * m_layoutStruct[pos].logicalWidth.value() / fixedWidth)); 394 393 fixedWidth -= m_layoutStruct[pos].logicalWidth.value(); 395 394 cellMinLogicalWidth -= cellLogicalWidth; … … 398 397 } else { 399 398 float remainingMaxLogicalWidth = spanMaxLogicalWidth; 400 LayoutUnit remainingMinLogicalWidth = spanMinLogicalWidth;399 int remainingMinLogicalWidth = spanMinLogicalWidth; 401 400 402 401 // Give min to variable first, to fixed second, and to others third. 403 402 for (unsigned pos = effCol; remainingMaxLogicalWidth >= 0 && pos < lastCol; ++pos) { 404 403 if (m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto && fixedWidth <= cellMinLogicalWidth) { 405 int colMinLogicalWidth = max< LayoutUnit>(m_layoutStruct[pos].effectiveMinLogicalWidth, m_layoutStruct[pos].logicalWidth.value());404 int colMinLogicalWidth = max<int>(m_layoutStruct[pos].effectiveMinLogicalWidth, m_layoutStruct[pos].logicalWidth.value()); 406 405 fixedWidth -= m_layoutStruct[pos].logicalWidth.value(); 407 406 remainingMinLogicalWidth -= m_layoutStruct[pos].effectiveMinLogicalWidth; … … 414 413 for (unsigned pos = effCol; remainingMaxLogicalWidth >= 0 && pos < lastCol && remainingMinLogicalWidth < cellMinLogicalWidth; ++pos) { 415 414 if (!(m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto && fixedWidth <= cellMinLogicalWidth)) { 416 int colMinLogicalWidth = max< LayoutUnit>(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(remainingMaxLogicalWidth ? cellMinLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / remainingMaxLogicalWidth : cellMinLogicalWidth));417 colMinLogicalWidth = min< LayoutUnit>(m_layoutStruct[pos].effectiveMinLogicalWidth + (cellMinLogicalWidth - remainingMinLogicalWidth), colMinLogicalWidth);415 int colMinLogicalWidth = max<int>(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(remainingMaxLogicalWidth ? cellMinLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / remainingMaxLogicalWidth : cellMinLogicalWidth)); 416 colMinLogicalWidth = min<int>(m_layoutStruct[pos].effectiveMinLogicalWidth + (cellMinLogicalWidth - remainingMinLogicalWidth), colMinLogicalWidth); 418 417 remainingMaxLogicalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth; 419 418 remainingMinLogicalWidth -= m_layoutStruct[pos].effectiveMinLogicalWidth; … … 427 426 if (cellMaxLogicalWidth > spanMaxLogicalWidth) { 428 427 for (unsigned pos = effCol; spanMaxLogicalWidth >= 0 && pos < lastCol; ++pos) { 429 int colMaxLogicalWidth = max <LayoutUnit>(m_layoutStruct[pos].effectiveMaxLogicalWidth, static_cast<int>(spanMaxLogicalWidth ? cellMaxLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / spanMaxLogicalWidth : cellMaxLogicalWidth));428 int colMaxLogicalWidth = max(m_layoutStruct[pos].effectiveMaxLogicalWidth, static_cast<int>(spanMaxLogicalWidth ? cellMaxLogicalWidth * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / spanMaxLogicalWidth : cellMaxLogicalWidth)); 430 429 spanMaxLogicalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth; 431 430 cellMaxLogicalWidth -= colMaxLogicalWidth; … … 478 477 { 479 478 // table layout based on the values collected in the layout structure. 480 LayoutUnit tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection();481 LayoutUnit available = tableLogicalWidth;479 int tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection(); 480 int available = tableLogicalWidth; 482 481 size_t nEffCols = m_table->numEffCols(); 483 482 … … 502 501 // fill up every cell with its minWidth 503 502 for (size_t i = 0; i < nEffCols; ++i) { 504 LayoutUnit cellLogicalWidth = m_layoutStruct[i].effectiveMinLogicalWidth;503 int cellLogicalWidth = m_layoutStruct[i].effectiveMinLogicalWidth; 505 504 m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth; 506 505 available -= cellLogicalWidth; … … 538 537 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 539 538 if (logicalWidth.isPercent()) { 540 LayoutUnit cellLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].effectiveMinLogicalWidth, logicalWidth.calcMinValue(tableLogicalWidth));539 int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, logicalWidth.calcMinValue(tableLogicalWidth)); 541 540 available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth; 542 541 m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth; … … 545 544 if (totalPercent > 100) { 546 545 // remove overallocated space from the last columns 547 LayoutUnit excess = tableLogicalWidth * (totalPercent - 100) / 100;546 int excess = tableLogicalWidth * (totalPercent - 100) / 100; 548 547 for (int i = nEffCols - 1; i >= 0; --i) { 549 548 if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) { 550 LayoutUnit cellLogicalWidth = m_layoutStruct[i].computedLogicalWidth;551 LayoutUnit reduction = min(cellLogicalWidth, excess);549 int cellLogicalWidth = m_layoutStruct[i].computedLogicalWidth; 550 int reduction = min(cellLogicalWidth, excess); 552 551 // the lines below might look inconsistent, but that's the way it's handled in mozilla 553 552 excess -= reduction; 554 LayoutUnit newLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction);553 int newLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction); 555 554 available += cellLogicalWidth - newLogicalWidth; 556 555 m_layoutStruct[i].computedLogicalWidth = newLogicalWidth; … … 577 576 if (logicalWidth.isRelative() && logicalWidth.value() != 0) { 578 577 // width=0* gets effMinWidth. 579 LayoutUnit cellLogicalWidth = logicalWidth.value() * tableLogicalWidth / totalRelative;578 int cellLogicalWidth = logicalWidth.value() * tableLogicalWidth / totalRelative; 580 579 available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth; 581 580 m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth; … … 590 589 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 591 590 if (logicalWidth.isAuto() && totalAuto && !m_layoutStruct[i].emptyCellsOnly) { 592 LayoutUnit cellLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].computedLogicalWidth, static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto));591 int cellLogicalWidth = max<int>(m_layoutStruct[i].computedLogicalWidth, static_cast<int>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto)); 593 592 available -= cellLogicalWidth; 594 593 totalAuto -= m_layoutStruct[i].effectiveMaxLogicalWidth; … … 603 602 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 604 603 if (logicalWidth.isFixed()) { 605 LayoutUnit cellLogicalWidth = static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalFixed);604 int cellLogicalWidth = static_cast<int>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalFixed); 606 605 available -= cellLogicalWidth; 607 606 totalFixed -= m_layoutStruct[i].effectiveMaxLogicalWidth; … … 616 615 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 617 616 if (logicalWidth.isPercent()) { 618 LayoutUnit cellLogicalWidth = available * logicalWidth.percent() / totalPercent;617 int cellLogicalWidth = available * logicalWidth.percent() / totalPercent; 619 618 available -= cellLogicalWidth; 620 619 totalPercent -= logicalWidth.percent(); … … 634 633 if (m_layoutStruct[i].effectiveLogicalWidth.isAuto() && m_layoutStruct[i].emptyCellsOnly) 635 634 continue; 636 LayoutUnit cellLogicalWidth = available / total;635 int cellLogicalWidth = available / total; 637 636 available -= cellLogicalWidth; 638 637 total--; … … 651 650 // This is basically the reverse of how we grew the cells. 652 651 if (available < 0) { 653 LayoutUnit logicalWidthBeyondMin = 0;652 int logicalWidthBeyondMin = 0; 654 653 for (int i = nEffCols - 1; i >= 0; --i) { 655 654 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; … … 661 660 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 662 661 if (logicalWidth.isAuto()) { 663 LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;664 LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;662 int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth; 663 int reduce = available * minMaxDiff / logicalWidthBeyondMin; 665 664 m_layoutStruct[i].computedLogicalWidth += reduce; 666 665 available -= reduce; … … 673 672 674 673 if (available < 0) { 675 LayoutUnit logicalWidthBeyondMin = 0;674 int logicalWidthBeyondMin = 0; 676 675 for (int i = nEffCols - 1; i >= 0; --i) { 677 676 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; … … 683 682 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 684 683 if (logicalWidth.isRelative()) { 685 LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;686 LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;684 int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth; 685 int reduce = available * minMaxDiff / logicalWidthBeyondMin; 687 686 m_layoutStruct[i].computedLogicalWidth += reduce; 688 687 available -= reduce; … … 695 694 696 695 if (available < 0) { 697 LayoutUnit logicalWidthBeyondMin = 0;696 int logicalWidthBeyondMin = 0; 698 697 for (int i = nEffCols - 1; i >= 0; --i) { 699 698 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; … … 705 704 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 706 705 if (logicalWidth.isFixed()) { 707 LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;708 LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;706 int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth; 707 int reduce = available * minMaxDiff / logicalWidthBeyondMin; 709 708 m_layoutStruct[i].computedLogicalWidth += reduce; 710 709 available -= reduce; … … 717 716 718 717 if (available < 0) { 719 LayoutUnit logicalWidthBeyondMin = 0;718 int logicalWidthBeyondMin = 0; 720 719 for (int i = nEffCols - 1; i >= 0; --i) { 721 720 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; … … 727 726 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 728 727 if (logicalWidth.isPercent()) { 729 LayoutUnit minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth;730 LayoutUnit reduce = available * minMaxDiff / logicalWidthBeyondMin;728 int minMaxDiff = m_layoutStruct[i].computedLogicalWidth - m_layoutStruct[i].effectiveMinLogicalWidth; 729 int reduce = available * minMaxDiff / logicalWidthBeyondMin; 731 730 m_layoutStruct[i].computedLogicalWidth += reduce; 732 731 available -= reduce; … … 739 738 } 740 739 741 LayoutUnit pos = 0;740 int pos = 0; 742 741 for (size_t i = 0; i < nEffCols; ++i) { 743 742 m_table->columnPositions()[i] = pos; -
trunk/Source/WebCore/rendering/AutoTableLayout.h
r90955 r99254 61 61 Length logicalWidth; 62 62 Length effectiveLogicalWidth; 63 LayoutUnit minLogicalWidth;64 LayoutUnit maxLogicalWidth;65 LayoutUnit effectiveMinLogicalWidth;66 LayoutUnit effectiveMaxLogicalWidth;67 LayoutUnit computedLogicalWidth;63 int minLogicalWidth; 64 int maxLogicalWidth; 65 int effectiveMinLogicalWidth; 66 int effectiveMaxLogicalWidth; 67 int computedLogicalWidth; 68 68 bool emptyCellsOnly; 69 69 }; -
trunk/Source/WebCore/rendering/FixedTableLayout.cpp
r94776 r99254 195 195 // 196 196 // The maximum width is max(minWidth, tableWidth). 197 LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();198 199 LayoutUnit tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0;200 LayoutUnit mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing;197 int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection(); 198 199 int tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0; 200 int mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing; 201 201 202 202 minWidth = max(mw, tableLogicalWidth); … … 223 223 void FixedTableLayout::layout() 224 224 { 225 LayoutUnit tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection();225 int tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection(); 226 226 int nEffCols = m_table->numEffCols(); 227 227 Vector<int> calcWidth(nEffCols, 0); 228 228 229 229 int numAuto = 0; 230 LayoutUnit autoSpan = 0;231 LayoutUnit totalFixedWidth = 0;232 LayoutUnit totalPercentWidth = 0;230 int autoSpan = 0; 231 int totalFixedWidth = 0; 232 int totalPercentWidth = 0; 233 233 float totalPercent = 0; 234 234 … … 251 251 } 252 252 253 LayoutUnit hspacing = m_table->hBorderSpacing();254 LayoutUnit totalWidth = totalFixedWidth + totalPercentWidth;253 int hspacing = m_table->hBorderSpacing(); 254 int totalWidth = totalFixedWidth + totalPercentWidth; 255 255 if (!numAuto || totalWidth > tableLogicalWidth) { 256 256 // If there are no auto columns, or if the total is too wide, take … … 280 280 } else { 281 281 // Divide the remaining width among the auto columns. 282 LayoutUnit remainingWidth = tableLogicalWidth - totalFixedWidth - totalPercentWidth - hspacing * (autoSpan - numAuto);282 int remainingWidth = tableLogicalWidth - totalFixedWidth - totalPercentWidth - hspacing * (autoSpan - numAuto); 283 283 int lastAuto = 0; 284 284 for (int i = 0; i < nEffCols; i++) { 285 285 if (m_width[i].isAuto()) { 286 LayoutUnit span = m_table->spanOfEffCol(i);287 LayoutUnit w = remainingWidth * span / autoSpan;286 int span = m_table->spanOfEffCol(i); 287 int w = remainingWidth * span / autoSpan; 288 288 calcWidth[i] = w + hspacing * (span - 1); 289 289 remainingWidth -= w; … … 303 303 if (totalWidth < tableLogicalWidth) { 304 304 // Spread extra space over columns. 305 LayoutUnit remainingWidth = tableLogicalWidth - totalWidth;305 int remainingWidth = tableLogicalWidth - totalWidth; 306 306 int total = nEffCols; 307 307 while (total) { 308 LayoutUnit w = remainingWidth / total;308 int w = remainingWidth / total; 309 309 remainingWidth -= w; 310 310 calcWidth[--total] += w; … … 314 314 } 315 315 316 LayoutUnit pos = 0;316 int pos = 0; 317 317 for (int i = 0; i < nEffCols; i++) { 318 318 m_table->columnPositions()[i] = pos; 319 319 pos += calcWidth[i] + hspacing; 320 320 } 321 LayoutUnit colPositionsSize = m_table->columnPositions().size();321 int colPositionsSize = m_table->columnPositions().size(); 322 322 if (colPositionsSize > 0) 323 323 m_table->columnPositions()[colPositionsSize - 1] = pos; -
trunk/Source/WebCore/rendering/RenderTable.h
r98676 r99254 45 45 virtual ~RenderTable(); 46 46 47 int getColumnPos(int col) const { return m_columnPos[col]; }47 LayoutUnit getColumnPos(int col) const { return m_columnPos[col]; } 48 48 49 49 int hBorderSpacing() const { return m_hSpacing; } … … 169 169 } 170 170 171 int bordersPaddingAndSpacingInRowDirection() const171 LayoutUnit bordersPaddingAndSpacingInRowDirection() const 172 172 { 173 173 return borderStart() + borderEnd() + -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r99212 r99254 156 156 } 157 157 158 void RenderTableCell::updateLogicalWidth( int w)158 void RenderTableCell::updateLogicalWidth(LayoutUnit w) 159 159 { 160 160 if (w == logicalWidth()) … … 220 220 } 221 221 222 void RenderTableCell::setOverrideHeightFromRowHeight( int rowHeight)222 void RenderTableCell::setOverrideHeightFromRowHeight(LayoutUnit rowHeight) 223 223 { 224 224 clearIntrinsicPadding(); … … 289 289 } 290 290 291 void RenderTableCell::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& r, bool fixed) const291 void RenderTableCell::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& r, bool fixed) const 292 292 { 293 293 if (repaintContainer == this) … … 300 300 } 301 301 302 int RenderTableCell::cellBaselinePosition() const302 LayoutUnit RenderTableCell::cellBaselinePosition() const 303 303 { 304 304 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of 305 305 // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there 306 306 // is no such line box or table-row, the baseline is the bottom of content edge of the cell box. 307 int firstLineBaseline = firstLineBoxBaseline();307 LayoutUnit firstLineBaseline = firstLineBoxBaseline(); 308 308 if (firstLineBaseline != -1) 309 309 return firstLineBaseline; … … 1037 1037 void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollbarChanged) 1038 1038 { 1039 int scrollbarHeight = scrollbarLogicalHeight();1039 LayoutUnit scrollbarHeight = scrollbarLogicalHeight(); 1040 1040 if (!scrollbarHeight) 1041 1041 return; // Not sure if we should be doing something when a scrollbar goes away or not. -
trunk/Source/WebCore/rendering/RenderTableCell.h
r99212 r99254 85 85 virtual void computePreferredLogicalWidths(); 86 86 87 void updateLogicalWidth( int);87 void updateLogicalWidth(LayoutUnit); 88 88 89 89 virtual LayoutUnit borderLeft() const; … … 125 125 void paintBackgroundsBehindCell(PaintInfo&, const LayoutPoint&, RenderObject* backgroundObject); 126 126 127 int cellBaselinePosition() const;127 LayoutUnit cellBaselinePosition() const; 128 128 129 129 void setIntrinsicPaddingBefore(int p) { m_intrinsicPaddingBefore = p; } … … 146 146 virtual LayoutUnit paddingAfter(bool includeIntrinsicPadding = true) const; 147 147 148 void setOverrideHeightFromRowHeight( int);148 void setOverrideHeightFromRowHeight(LayoutUnit); 149 149 150 150 virtual void scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollbarChanged); … … 170 170 virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; 171 171 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; 172 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false) const;172 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const; 173 173 174 174 void paintCollapsedBorder(GraphicsContext*, const LayoutRect&); -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r99212 r99254 290 290 endCol++; 291 291 } 292 int w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing();293 int oldLogicalWidth = cell->logicalWidth();292 LayoutUnit w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing(); 293 LayoutUnit oldLogicalWidth = cell->logicalWidth(); 294 294 if (w != oldLogicalWidth) { 295 295 cell->setNeedsLayout(true); … … 298 298 // Technically, we should also push state for the row, but since 299 299 // rows don't push a coordinate transform, that's not necessary. 300 statePusher.push(this, IntSize(x(), y()));300 statePusher.push(this, LayoutSize(x(), y())); 301 301 } 302 302 cell->repaint(); … … 464 464 LayoutUnit add = 0; 465 465 totalPercent = min(totalPercent, 100); 466 int rh = m_rowPos[1] - m_rowPos[0];466 LayoutUnit rh = m_rowPos[1] - m_rowPos[0]; 467 467 for (unsigned r = 0; r < totalRows; r++) { 468 468 if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) { 469 LayoutUnit toAdd = min (dh, static_cast<LayoutUnit>((totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh));469 LayoutUnit toAdd = min<LayoutUnit>(dh, (totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh); 470 470 // If toAdd is negative, then we don't want to shrink the row (this bug 471 471 // affected Outlook Web Access).
Note: See TracChangeset
for help on using the changeset viewer.