Changeset 112752 in webkit
- Timestamp:
- Mar 30, 2012 5:13:20 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r112749 r112752 1 2012-03-30 Emil A Eklund <eae@chromium.org> 2 3 Fix usage of LayoutUnits in table code. 4 https://bugs.webkit.org/show_bug.cgi?id=82765 5 6 Reviewed by Eric Seidel. 7 8 Clean up usage of ints and LayoutUnits in table code in preparation for 9 turning on subpixel layout. 10 11 No new tests, no change in functionality. 12 13 * rendering/AutoTableLayout.cpp: 14 (WebCore::AutoTableLayout::computePreferredLogicalWidths): 15 Cast maxWidth to int as all table layout is done on int bounds. 16 17 * rendering/RenderTable.cpp: 18 (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth): 19 Change borders to LayoutUnit as paddings can have subpixel precision. 20 21 * rendering/RenderTable.h: 22 (WebCore::RenderTable::getColumnPos): 23 (WebCore::RenderTable::columnPositions): 24 Change getColumnPos and columnPositions to ints as the values are always 25 on pixel bounds. 26 27 (WebCore::RenderTable::bordersPaddingAndSpacingInRowDirection): 28 * rendering/RenderTableCell.cpp: 29 (WebCore::RenderTableCell::styleOrColLogicalWidth): 30 Remove unnecessary cast. 31 32 (WebCore::RenderTableCell::clippedOverflowRectForRepaint): 33 Use LayoutPoint instead of left/top. 34 35 * rendering/RenderTableSection.cpp: 36 (WebCore::RenderTableSection::calcRowLogicalHeight): 37 (WebCore::RenderTableSection::layoutRows): 38 * rendering/RenderTableSection.h: 39 Change baseline and baselineDescent to int to avoid unnecessary type 40 conversion. 41 1 42 2012-03-30 Joe Thomas <joethomas@motorola.com> 2 43 -
trunk/Source/WebCore/rendering/AutoTableLayout.cpp
r112198 r112752 252 252 if (scaleColumns) { 253 253 maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon); 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)));254 maxWidth = max<int>(maxWidth, static_cast<int>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 255 maxWidth = max<int>(maxWidth, static_cast<int>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 256 256 } 257 257 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r112425 r112752 272 272 { 273 273 // HTML tables' width styles already include borders and paddings, but CSS tables' width styles do not. 274 int borders = 0;274 LayoutUnit borders = 0; 275 275 bool isCSSTable = !node() || !node()->hasTagName(tableTag); 276 276 if (isCSSTable && styleLogicalWidth.isFixed() && styleLogicalWidth.isPositive()) { 277 277 recalcBordersInRowDirection(); 278 borders = borderStart() + borderEnd() + (collapseBorders() ? 0: paddingStart() + paddingEnd());278 borders = borderStart() + borderEnd() + (collapseBorders() ? zeroLayoutUnit : paddingStart() + paddingEnd()); 279 279 } 280 280 return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + borders; -
trunk/Source/WebCore/rendering/RenderTable.h
r111353 r112752 46 46 virtual ~RenderTable(); 47 47 48 LayoutUnit getColumnPos(unsigned col) const { return m_columnPos[col]; }48 int getColumnPos(unsigned col) const { return m_columnPos[col]; } 49 49 50 50 int hBorderSpacing() const { return m_hSpacing; } … … 137 137 138 138 Vector<ColumnStruct>& columns() { return m_columns; } 139 Vector< LayoutUnit>& columnPositions() { return m_columnPos; }139 Vector<int>& columnPositions() { return m_columnPos; } 140 140 RenderTableSection* header() const { return m_head; } 141 141 RenderTableSection* footer() const { return m_foot; } … … 173 173 { 174 174 return borderStart() + borderEnd() + 175 (collapseBorders() ? zeroLayoutUnit : (paddingStart() + paddingEnd() + (numEffCols() + 1) * hBorderSpacing()));175 (collapseBorders() ? zeroLayoutUnit : (paddingStart() + paddingEnd() + static_cast<LayoutUnit>(numEffCols() + 1) * hBorderSpacing())); 176 176 } 177 177 … … 255 255 void distributeExtraLogicalHeight(int extraLogicalHeight); 256 256 257 mutable Vector< LayoutUnit> m_columnPos;257 mutable Vector<int> m_columnPos; 258 258 mutable Vector<ColumnStruct> m_columns; 259 259 mutable Vector<RenderTableCaption*> m_captions; -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r112301 r112752 144 144 // See Bugzilla bug 8126 for details. 145 145 if (colWidthSum.isFixed() && colWidthSum.value() > 0) 146 colWidthSum = Length(max <LayoutUnit>(0, colWidthSum.value() - borderAndPaddingLogicalWidth()), Fixed);146 colWidthSum = Length(max(0, colWidthSum.value() - borderAndPaddingLogicalWidth()), Fixed); 147 147 return colWidthSum; 148 148 } … … 297 297 } 298 298 } 299 left = max(left, -minXVisualOverflow()); 300 top = max(top, -minYVisualOverflow()); 301 LayoutRect r(-left, - top, left + max(width() + right, maxXVisualOverflow()), top + max(height() + bottom, maxYVisualOverflow())); 299 LayoutPoint location(max<LayoutUnit>(left, -minXVisualOverflow()), max<LayoutUnit>(top, -minYVisualOverflow())); 300 LayoutRect r(-location.x(), -location.y(), location.x() + max(width() + right, maxXVisualOverflow()), location.y() + max(height() + bottom, maxYVisualOverflow())); 302 301 303 302 if (RenderView* v = view()) { -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r112425 r112752 337 337 for (unsigned r = 0; r < m_grid.size(); r++) { 338 338 m_grid[r].baseline = 0; 339 LayoutUnit baselineDescent = 0;339 int baselineDescent = 0; 340 340 341 341 // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells). … … 621 621 EVerticalAlign va = cell->style()->verticalAlign(); 622 622 if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) { 623 LayoutUnit baseline = cell->cellBaselinePosition();623 int baseline = cell->cellBaselinePosition(); 624 624 if (baseline > cell->borderBefore() + cell->paddingBefore()) 625 625 m_grid[r].baseline = max(m_grid[r].baseline, baseline); -
trunk/Source/WebCore/rendering/RenderTableSection.h
r111435 r112752 111 111 Row row; 112 112 RenderTableRow* rowRenderer; 113 LayoutUnit baseline;113 int baseline; 114 114 Length logicalHeight; 115 115 };
Note: See TracChangeset
for help on using the changeset viewer.