Changeset 122282 in webkit
- Timestamp:
- Jul 10, 2012 5:41:48 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122280 r122282 1 2012-07-10 Pravin D <pravind.2k4@gmail.com> 2 3 Re-factoring recalcColumn in AutoTableLayout.cpp for readability 4 https://bugs.webkit.org/show_bug.cgi?id=89636 5 6 Reviewed by Julien Chaffraix. 7 8 No test case required. Code re-factoring. 9 10 * rendering/AutoTableLayout.cpp: 11 Added a const integer place holder for 32760. 12 13 (WebCore::AutoTableLayout::recalcColumn): 14 Changes : 15 1) Moved the continue statement above the bool cellHasContent for an early return. 16 2) Replaced the constant 32760 by a placeholder. 17 3) Initialization of columnLayout max and min logical widths is made common for both cells having col span == 1 and span > 1. 18 4) Removed redundant check for cell logical width type. 19 1 20 2012-07-10 Adam Barth <abarth@webkit.org> 2 21 -
trunk/Source/WebCore/rendering/AutoTableLayout.cpp
r121279 r122282 60 60 RenderTableCell* cell = current.primaryCell(); 61 61 62 bool cellHasContent = cell && !current.inColSpan && (cell->firstChild() || cell->style()->hasBorder() || cell->style()->hasPadding()); 62 if (current.inColSpan || !cell) 63 continue; 64 65 bool cellHasContent = cell->firstChild() || cell->style()->hasBorder() || cell->style()->hasPadding(); 63 66 if (cellHasContent) 64 67 columnLayout.emptyCellsOnly = false; 65 66 if (current.inColSpan || !cell) 67 continue; 68 69 // A cell originates in this column. Ensure we have 70 // a min/max width of at least 1px for this column now. 71 columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0); 72 columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1); 68 73 69 74 if (cell->colSpan() == 1) { 70 // A cell originates in this column. Ensure we have71 // a min/max width of at least 1px for this column now.72 columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0);73 columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1);74 75 if (cell->preferredLogicalWidthsDirty()) 75 76 cell->computePreferredLogicalWidths(); … … 80 81 } 81 82 83 // All browsers implement a size limit on the cell's max width. 84 // Our limit is based on KHTML's representation that used 16 bits widths. 85 // FIXME: Other browsers have a lower limit for the cell's max width. 86 const int cCellMaxWidth = 32760; 82 87 Length cellLogicalWidth = cell->styleOrColLogicalWidth(); 83 // FIXME: What is this arbitrary value? 84 if (cellLogicalWidth.value() > 32760) 85 cellLogicalWidth.setValue(32760); 88 if (cellLogicalWidth.value() > cCellMaxWidth) 89 cellLogicalWidth.setValue(cCellMaxWidth); 86 90 if (cellLogicalWidth.isNegative()) 87 91 cellLogicalWidth.setValue(0); … … 89 93 case Fixed: 90 94 // ignore width=0 91 if (cellLogicalWidth. value() > 0 && columnLayout.logicalWidth.type() != Percent) {95 if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercent()) { 92 96 int logicalWidth = cell->computeBorderBoxLogicalWidth(cellLogicalWidth.value()); 93 97 if (columnLayout.logicalWidth.isFixed()) { 94 98 // Nav/IE weirdness 95 if ((logicalWidth > columnLayout.logicalWidth.value()) ||96 ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) {97 columnLayout.logicalWidth.setValue( logicalWidth);99 if ((logicalWidth > columnLayout.logicalWidth.value()) 100 || ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) { 101 columnLayout.logicalWidth.setValue(Fixed, logicalWidth); 98 102 fixedContributor = cell; 99 103 } … … 112 116 // FIXME: Need to understand this case and whether it makes sense to compare values 113 117 // which are not necessarily of the same type. 114 if (cellLogicalWidth. isAuto() || (cellLogicalWidth.isRelative() && cellLogicalWidth.value() > columnLayout.logicalWidth.value()))118 if (cellLogicalWidth.value() > columnLayout.logicalWidth.value()) 115 119 columnLayout.logicalWidth = cellLogicalWidth; 116 120 default: … … 118 122 } 119 123 } else if (!effCol || section->primaryCellAt(i, effCol - 1) != cell) { 120 // This spanning cell originates in this column. Ensure we have 121 // a min/max width of at least 1px for this column now. 122 columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0); 123 columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1); 124 // This spanning cell originates in this column. Insert the cell into spanning cells list. 124 125 insertSpanCell(cell); 125 126 }
Note: See TracChangeset
for help on using the changeset viewer.