Title: [111353] trunk/Source/WebCore
- Revision
- 111353
- Author
- [email protected]
- Date
- 2012-03-19 21:53:14 -0700 (Mon, 19 Mar 2012)
Log Message
Move the extra logical height distribution into RenderTable as a new step in our layout algorithm
https://bugs.webkit.org/show_bug.cgi?id=81548
Reviewed by Tony Chang.
Refactoring, no expected change in behavior.
Moving the distribution step into RenderTable is needed to implement a better distribution algorithm that would
span several RenderTableSection (which is what IE and FF are doing right now).
* rendering/RenderTable.cpp:
(WebCore::RenderTable::distributeExtraLogicalHeight):
(WebCore::RenderTable::layout):
Moved the distribution step into distributeExtraLogicalHeight. While at it, changed the code to make use of the helper
methods to iterate over the sections and explicitly floor the LayoutUnit before calling distributeExtraLogicalHeight.
* rendering/RenderTable.h:
Added distributeExtraLogicalHeight.
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows):
Changed the method signature as it doesn't handle the distribution step anymore.
* rendering/RenderTableSection.h:
Updated layoutRows signature and exposed distributeExtraLogicalHeightToRows for RenderTable use.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (111352 => 111353)
--- trunk/Source/WebCore/ChangeLog 2012-03-20 04:50:55 UTC (rev 111352)
+++ trunk/Source/WebCore/ChangeLog 2012-03-20 04:53:14 UTC (rev 111353)
@@ -1,3 +1,31 @@
+2012-03-19 Julien Chaffraix <[email protected]>
+
+ Move the extra logical height distribution into RenderTable as a new step in our layout algorithm
+ https://bugs.webkit.org/show_bug.cgi?id=81548
+
+ Reviewed by Tony Chang.
+
+ Refactoring, no expected change in behavior.
+
+ Moving the distribution step into RenderTable is needed to implement a better distribution algorithm that would
+ span several RenderTableSection (which is what IE and FF are doing right now).
+
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::distributeExtraLogicalHeight):
+ (WebCore::RenderTable::layout):
+ Moved the distribution step into distributeExtraLogicalHeight. While at it, changed the code to make use of the helper
+ methods to iterate over the sections and explicitly floor the LayoutUnit before calling distributeExtraLogicalHeight.
+
+ * rendering/RenderTable.h:
+ Added distributeExtraLogicalHeight.
+
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::layoutRows):
+ Changed the method signature as it doesn't handle the distribution step anymore.
+
+ * rendering/RenderTableSection.h:
+ Updated layoutRows signature and exposed distributeExtraLogicalHeightToRows for RenderTable use.
+
2012-03-19 Anders Carlsson <[email protected]>
Another attempt at fixing the Windows build.
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (111352 => 111353)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2012-03-20 04:50:55 UTC (rev 111352)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2012-03-20 04:53:14 UTC (rev 111353)
@@ -299,6 +299,20 @@
setLogicalHeight(logicalHeight() + caption->logicalHeight() + caption->marginBefore() + caption->marginAfter());
}
+void RenderTable::distributeExtraLogicalHeight(int extraLogicalHeight)
+{
+ if (extraLogicalHeight <= 0)
+ return;
+
+ // FIXME: Distribute the extra logical height between all table sections instead of giving it all to the first one.
+ if (RenderTableSection* section = topSection())
+ extraLogicalHeight = section->distributeExtraLogicalHeightToRows(extraLogicalHeight);
+
+ // FIXME: We really would like to enable this ASSERT to ensure that all the extra space has been distributed.
+ // However our current distribution algorithm does not round properly and thus we can have some remaining height.
+ // ASSERT(!topSection() || !extraLogicalHeight);
+}
+
void RenderTable::layout()
{
ASSERT(needsLayout());
@@ -390,12 +404,11 @@
computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLength);
computedLogicalHeight = max<LayoutUnit>(0, computedLogicalHeight);
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isTableSection())
- // FIXME: Distribute the extra logical height between all table sections instead of giving it all to the first one.
- toRenderTableSection(child)->layoutRows(child == topSection() ? max<LayoutUnit>(0, computedLogicalHeight - totalSectionLogicalHeight) : 0);
- }
+ distributeExtraLogicalHeight(floorToInt(computedLogicalHeight - totalSectionLogicalHeight));
+ for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
+ section->layoutRows();
+
if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !document()->inQuirksMode()) {
// Completely empty tables (with no sections or anything) should at least honor specified height
// in strict mode.
Modified: trunk/Source/WebCore/rendering/RenderTable.h (111352 => 111353)
--- trunk/Source/WebCore/rendering/RenderTable.h 2012-03-20 04:50:55 UTC (rev 111352)
+++ trunk/Source/WebCore/rendering/RenderTable.h 2012-03-20 04:53:14 UTC (rev 111353)
@@ -252,6 +252,8 @@
void recalcSections() const;
void layoutCaption(RenderTableCaption*);
+ void distributeExtraLogicalHeight(int extraLogicalHeight);
+
mutable Vector<LayoutUnit> m_columnPos;
mutable Vector<ColumnStruct> m_columns;
mutable Vector<RenderTableCaption*> m_captions;
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (111352 => 111353)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-03-20 04:50:55 UTC (rev 111352)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-03-20 04:53:14 UTC (rev 111353)
@@ -520,7 +520,7 @@
return remainingExtraLogicalHeight;
}
-int RenderTableSection::layoutRows(int extraLogicalHeight)
+void RenderTableSection::layoutRows()
{
#ifndef NDEBUG
setNeedsLayoutIsForbidden(true);
@@ -538,8 +538,6 @@
m_overflowingCells.clear();
m_forceSlowPaintPathWithOverflowingCell = false;
- extraLogicalHeight = distributeExtraLogicalHeightToRows(extraLogicalHeight);
-
int hspacing = table()->hBorderSpacing();
int vspacing = table()->vBorderSpacing();
unsigned nEffCols = table()->numEffCols();
@@ -738,7 +736,6 @@
ASSERT(hasOverflowingCell == this->hasOverflowingCell());
statePusher.pop();
- return height();
}
int RenderTableSection::calcOuterBorderBefore() const
Modified: trunk/Source/WebCore/rendering/RenderTableSection.h (111352 => 111353)
--- trunk/Source/WebCore/rendering/RenderTableSection.h 2012-03-20 04:50:55 UTC (rev 111352)
+++ trunk/Source/WebCore/rendering/RenderTableSection.h 2012-03-20 04:53:14 UTC (rev 111353)
@@ -73,7 +73,7 @@
void setCellLogicalWidths();
int calcRowLogicalHeight();
- int layoutRows(int logicalHeight);
+ void layoutRows();
RenderTable* table() const { return toRenderTable(parent()); }
@@ -158,6 +158,10 @@
void setCachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide, CollapsedBorderValue);
CollapsedBorderValue& cachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide);
+ // distributeExtraLogicalHeight* methods return the remaining extra logical height.
+ // FIXME: We may want to introduce a structure holding the in-flux layout information.
+ int distributeExtraLogicalHeightToRows(int extraLogicalHeight);
+
protected:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
@@ -185,9 +189,6 @@
void ensureRows(unsigned);
- // Those methods return the remaining extra logical height.
- // FIXME: We may want to introduce a structure holding the in-flux layout information.
- int distributeExtraLogicalHeightToRows(int extraLogicalHeight);
int distributeExtraLogicalHeightToPercentRows(int extraLogicalHeight, int totalPercent);
int distributeExtraLogicalHeightToAutoRows(int extraLogicalHeight, unsigned autoRowsCount);
int distributeRemainingExtraLogicalHeight(int extraLogicalHeight);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes