Title: [122282] trunk/Source/WebCore
- Revision
- 122282
- Author
- [email protected]
- Date
- 2012-07-10 17:41:48 -0700 (Tue, 10 Jul 2012)
Log Message
Re-factoring recalcColumn in AutoTableLayout.cpp for readability
https://bugs.webkit.org/show_bug.cgi?id=89636
Patch by Pravin D <[email protected]> on 2012-07-10
Reviewed by Julien Chaffraix.
No test case required. Code re-factoring.
* rendering/AutoTableLayout.cpp:
Added a const integer place holder for 32760.
(WebCore::AutoTableLayout::recalcColumn):
Changes :
1) Moved the continue statement above the bool cellHasContent for an early return.
2) Replaced the constant 32760 by a placeholder.
3) Initialization of columnLayout max and min logical widths is made common for both cells having col span == 1 and span > 1.
4) Removed redundant check for cell logical width type.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (122281 => 122282)
--- trunk/Source/WebCore/ChangeLog 2012-07-11 00:18:35 UTC (rev 122281)
+++ trunk/Source/WebCore/ChangeLog 2012-07-11 00:41:48 UTC (rev 122282)
@@ -1,3 +1,22 @@
+2012-07-10 Pravin D <[email protected]>
+
+ Re-factoring recalcColumn in AutoTableLayout.cpp for readability
+ https://bugs.webkit.org/show_bug.cgi?id=89636
+
+ Reviewed by Julien Chaffraix.
+
+ No test case required. Code re-factoring.
+
+ * rendering/AutoTableLayout.cpp:
+ Added a const integer place holder for 32760.
+
+ (WebCore::AutoTableLayout::recalcColumn):
+ Changes :
+ 1) Moved the continue statement above the bool cellHasContent for an early return.
+ 2) Replaced the constant 32760 by a placeholder.
+ 3) Initialization of columnLayout max and min logical widths is made common for both cells having col span == 1 and span > 1.
+ 4) Removed redundant check for cell logical width type.
+
2012-07-10 Adam Barth <[email protected]>
WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (122281 => 122282)
--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2012-07-11 00:18:35 UTC (rev 122281)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2012-07-11 00:41:48 UTC (rev 122282)
@@ -59,18 +59,19 @@
RenderTableSection::CellStruct current = section->cellAt(i, effCol);
RenderTableCell* cell = current.primaryCell();
- bool cellHasContent = cell && !current.inColSpan && (cell->firstChild() || cell->style()->hasBorder() || cell->style()->hasPadding());
- if (cellHasContent)
- columnLayout.emptyCellsOnly = false;
-
if (current.inColSpan || !cell)
continue;
+ bool cellHasContent = cell->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) {
- // 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->preferredLogicalWidthsDirty())
cell->computePreferredLogicalWidths();
columnLayout.minLogicalWidth = max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth);
@@ -79,22 +80,25 @@
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();
- // FIXME: What is this arbitrary value?
- if (cellLogicalWidth.value() > 32760)
- cellLogicalWidth.setValue(32760);
+ if (cellLogicalWidth.value() > cCellMaxWidth)
+ cellLogicalWidth.setValue(cCellMaxWidth);
if (cellLogicalWidth.isNegative())
cellLogicalWidth.setValue(0);
switch (cellLogicalWidth.type()) {
case Fixed:
// ignore width=0
- if (cellLogicalWidth.value() > 0 && columnLayout.logicalWidth.type() != Percent) {
+ if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.isPercent()) {
int logicalWidth = cell->computeBorderBoxLogicalWidth(cellLogicalWidth.value());
if (columnLayout.logicalWidth.isFixed()) {
// Nav/IE weirdness
- if ((logicalWidth > columnLayout.logicalWidth.value()) ||
- ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) {
- columnLayout.logicalWidth.setValue(logicalWidth);
+ if ((logicalWidth > columnLayout.logicalWidth.value())
+ || ((columnLayout.logicalWidth.value() == logicalWidth) && (maxContributor == cell))) {
+ columnLayout.logicalWidth.setValue(Fixed, logicalWidth);
fixedContributor = cell;
}
} else {
@@ -111,16 +115,13 @@
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.isAuto() || (cellLogicalWidth.isRelative() && cellLogicalWidth.value() > columnLayout.logicalWidth.value()))
+ 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. 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);
+ // This spanning cell originates in this column. Insert the cell into spanning cells list.
insertSpanCell(cell);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes