Title: [143683] trunk/Source/WebCore
- Revision
- 143683
- Author
- o...@chromium.org
- Date
- 2013-02-21 19:12:04 -0800 (Thu, 21 Feb 2013)
Log Message
Clean up computePreferredLogicalWidths functions in TableLayout subclasses
https://bugs.webkit.org/show_bug.cgi?id=110515
Reviewed by Tony Chang.
No change in behavior. This is just a cleanup in preparation for other
refactoring to this code.
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray):
Move a FIXME here from computePreferredLogicalWidths. It makes more sense here.
(WebCore::FixedTableLayout::computePreferredLogicalWidths):
-Remove outdated or unhelpful comments.
-Isolate the fixed width codepath to make it a bit less convoluted.
(WebCore::FixedTableLayout::layout):
* rendering/FixedTableLayout.h:
The argument to calcWidthArray is never used. Remove it.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (143682 => 143683)
--- trunk/Source/WebCore/ChangeLog 2013-02-22 03:01:18 UTC (rev 143682)
+++ trunk/Source/WebCore/ChangeLog 2013-02-22 03:12:04 UTC (rev 143683)
@@ -1,3 +1,23 @@
+2013-02-21 Ojan Vafai <o...@chromium.org>
+
+ Clean up computePreferredLogicalWidths functions in TableLayout subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=110515
+
+ Reviewed by Tony Chang.
+
+ No change in behavior. This is just a cleanup in preparation for other
+ refactoring to this code.
+
+ * rendering/FixedTableLayout.cpp:
+ (WebCore::FixedTableLayout::calcWidthArray):
+ Move a FIXME here from computePreferredLogicalWidths. It makes more sense here.
+ (WebCore::FixedTableLayout::computePreferredLogicalWidths):
+ -Remove outdated or unhelpful comments.
+ -Isolate the fixed width codepath to make it a bit less convoluted.
+ (WebCore::FixedTableLayout::layout):
+ * rendering/FixedTableLayout.h:
+ The argument to calcWidthArray is never used. Remove it.
+
2013-02-21 Eric Seidel <e...@webkit.org>
LayoutTests/fast/encoding/parser-tests-*.html timeout with threaded HTML parser
Modified: trunk/Source/WebCore/rendering/FixedTableLayout.cpp (143682 => 143683)
--- trunk/Source/WebCore/rendering/FixedTableLayout.cpp 2013-02-22 03:01:18 UTC (rev 143682)
+++ trunk/Source/WebCore/rendering/FixedTableLayout.cpp 2013-02-22 03:12:04 UTC (rev 143683)
@@ -77,8 +77,9 @@
{
}
-int FixedTableLayout::calcWidthArray(int)
+int FixedTableLayout::calcWidthArray()
{
+ // FIXME: We might want to wait until we have all of the first row before computing for the first time.
int usedWidth = 0;
// iterate over all <col> elements
@@ -177,25 +178,13 @@
void FixedTableLayout::computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth)
{
- // FIXME: This entire calculation is incorrect for both minwidth and maxwidth.
-
- // we might want to wait until we have all of the first row before
- // layouting for the first time.
-
- // only need to calculate the minimum width as the sum of the
- // cols/cells with a fixed width.
- //
- // The maximum width is max(minWidth, tableWidth).
int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();
+ minWidth = maxWidth = calcWidthArray() + bordersPaddingAndSpacing;
- int tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0;
- int mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing;
+ Length tableLogicalWidth = m_table->style()->logicalWidth();
+ if (tableLogicalWidth.isFixed() && tableLogicalWidth.isPositive())
+ minWidth = maxWidth = max<int>(minWidth, tableLogicalWidth.value() - bordersPaddingAndSpacing);
- minWidth = max(mw, tableLogicalWidth);
- maxWidth = minWidth;
-
- // This quirk is very similar to one that exists in RenderBlock::calcBlockPrefWidths().
- // Here's the example for this one:
/*
<table style="width:100%; background-color:red"><tr><td>
<table style="background-color:blue"><tr><td>
@@ -220,7 +209,7 @@
// FIXME: It is possible to be called without having properly updated our internal representation.
// This means that our preferred logical widths were not recomputed as expected.
if (nEffCols != m_width.size()) {
- calcWidthArray(tableLogicalWidth);
+ calcWidthArray();
// FIXME: Table layout shouldn't modify our table structure (but does due to columns and column-groups).
nEffCols = m_table->numEffCols();
}
Modified: trunk/Source/WebCore/rendering/FixedTableLayout.h (143682 => 143683)
--- trunk/Source/WebCore/rendering/FixedTableLayout.h 2013-02-22 03:01:18 UTC (rev 143682)
+++ trunk/Source/WebCore/rendering/FixedTableLayout.h 2013-02-22 03:12:04 UTC (rev 143683)
@@ -38,7 +38,7 @@
virtual void layout();
private:
- int calcWidthArray(int tableWidth);
+ int calcWidthArray();
Vector<Length> m_width;
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes