Chromium Code Reviews| Index: Source/core/rendering/RenderTable.cpp |
| diff --git a/Source/core/rendering/RenderTable.cpp b/Source/core/rendering/RenderTable.cpp |
| index db2c65c451260bebfb9f549c6059ce81ab752246..0f5d565e8b96d550a3b0975cb86a73992623bcae 100644 |
| --- a/Source/core/rendering/RenderTable.cpp |
| +++ b/Source/core/rendering/RenderTable.cpp |
| @@ -272,10 +272,6 @@ void RenderTable::updateLogicalWidth() |
| setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogicalWidth())); |
| } |
| - // Ensure we aren't smaller than our min preferred width. |
| - setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth())); |
| - |
| - |
| // Ensure we aren't bigger than our max-width style. |
| Length styleMaxLogicalWidth = style()->logicalMaxWidth(); |
| if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative()) || styleMaxLogicalWidth.isIntrinsic()) { |
| @@ -283,7 +279,11 @@ void RenderTable::updateLogicalWidth() |
| setLogicalWidth(min<int>(logicalWidth(), computedMaxLogicalWidth)); |
| } |
| - // Ensure we aren't smaller than our min-width style. |
| + // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as |
| + // we ignore it if it means we wouldn't accomodate our content. |
| + setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth())); |
| + |
| + // Ensure we aren't smaller than our min-width style. |
| Length styleMinLogicalWidth = style()->logicalMinWidth(); |
| if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative()) || styleMinLogicalWidth.isIntrinsic()) { |
| LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth); |
| @@ -308,6 +308,10 @@ void RenderTable::updateLogicalWidth() |
| setMarginStart(minimumValueForLength(style()->marginStart(), availableLogicalWidth, renderView)); |
| setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogicalWidth, renderView)); |
| } |
| + |
| + // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate |
| + // its own content which doesn't match CSS nor what authors expect. |
| + ASSERT(logicalWidth() >= minPreferredLogicalWidth()); |
|
esprehn
2013/04/19 08:07:25
Yay!
|
| } |
| // This method takes a RenderStyle's logical width, min-width, or max-width length and computes its actual value. |
| @@ -768,8 +772,9 @@ void RenderTable::computePreferredLogicalWidths() |
| // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for maxWidth. |
| if (styleToUse->logicalMaxWidth().isFixed()) { |
| + // We don't constrain m_minPreferredLogicalWidth as the table should be at least the size of its min-content, regardless of 'max-width'. |
| m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); |
| - m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); |
| + m_maxPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); |
| } |
| // FIXME: We should be adding borderAndPaddingLogicalWidth here, but m_tableLayout->computePreferredLogicalWidths already does, |