Title: [140479] trunk
Revision
140479
Author
o...@chromium.org
Date
2013-01-22 15:28:02 -0800 (Tue, 22 Jan 2013)

Log Message

REGRESION(r130774): preferred width of tables does not take max-width into account
https://bugs.webkit.org/show_bug.cgi?id=107576

Reviewed by Tony Chang.

Source/WebCore:

Constrain preferred widths by min/max the way we do in other
RenderBlock subclasses. Eventually, we'll shared the code with
RenderBlock, but this is an incremental step in that direction
that we can safely merge into release branches.

Test: fast/table/min-max-width-preferred-size.html

* rendering/RenderTable.cpp:
(WebCore::RenderTable::computePreferredLogicalWidths):

LayoutTests:

* fast/table/min-max-width-preferred-size-expected.txt: Added.
* fast/table/min-max-width-preferred-size.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140478 => 140479)


--- trunk/LayoutTests/ChangeLog	2013-01-22 23:14:56 UTC (rev 140478)
+++ trunk/LayoutTests/ChangeLog	2013-01-22 23:28:02 UTC (rev 140479)
@@ -1,3 +1,13 @@
+2013-01-22  Ojan Vafai  <o...@chromium.org>
+
+        REGRESION(r130774): preferred width of tables does not take max-width into account
+        https://bugs.webkit.org/show_bug.cgi?id=107576
+
+        Reviewed by Tony Chang.
+
+        * fast/table/min-max-width-preferred-size-expected.txt: Added.
+        * fast/table/min-max-width-preferred-size.html: Added.
+
 2013-01-22  Michael Saboff  <msab...@apple.com>
 
         sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A7.2.html is crashing

Added: trunk/LayoutTests/fast/table/min-max-width-preferred-size-expected.txt (0 => 140479)


--- trunk/LayoutTests/fast/table/min-max-width-preferred-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/table/min-max-width-preferred-size-expected.txt	2013-01-22 23:28:02 UTC (rev 140479)
@@ -0,0 +1,5 @@
+ 
+PASS
+
+PASS
+

Added: trunk/LayoutTests/fast/table/min-max-width-preferred-size.html (0 => 140479)


--- trunk/LayoutTests/fast/table/min-max-width-preferred-size.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/min-max-width-preferred-size.html	2013-01-22 23:28:02 UTC (rev 140479)
@@ -0,0 +1,35 @@
+<style>
+.child {
+    width: 75px;
+    height: 20px;
+    background-color: salmon;
+    display: inline-block;
+}
+.container {
+    display: inline-block;
+    border: 5px solid grey;
+}
+table {
+    background-color: pink;
+}
+</style>
+
+<div class="container" data-expected-width=210>
+    <table style="max-width: 200px">
+        <td>
+            <div class="child"></div>
+            <div class="child"></div>
+            <div class="child"></div>
+        </td>
+    </table>
+</div>
+<br>
+
+<div class="container" data-expected-width=210>
+    <table style="width: 100px; min-width: 200px; table-layout: fixed"><td><div class="child"></div></td></table>
+</div>
+
+<script src=""
+<script>
+checkLayout('.container');
+</script>

Modified: trunk/Source/WebCore/ChangeLog (140478 => 140479)


--- trunk/Source/WebCore/ChangeLog	2013-01-22 23:14:56 UTC (rev 140478)
+++ trunk/Source/WebCore/ChangeLog	2013-01-22 23:28:02 UTC (rev 140479)
@@ -1,3 +1,20 @@
+2013-01-22  Ojan Vafai  <o...@chromium.org>
+
+        REGRESION(r130774): preferred width of tables does not take max-width into account
+        https://bugs.webkit.org/show_bug.cgi?id=107576
+
+        Reviewed by Tony Chang.
+
+        Constrain preferred widths by min/max the way we do in other
+        RenderBlock subclasses. Eventually, we'll shared the code with
+        RenderBlock, but this is an incremental step in that direction
+        that we can safely merge into release branches.
+
+        Test: fast/table/min-max-width-preferred-size.html
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::computePreferredLogicalWidths):
+
 2013-01-22  Adam Barth  <aba...@webkit.org>
 
         The BackgroundHTMLParser shouldn't pause when waiting for scripts

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (140478 => 140479)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2013-01-22 23:14:56 UTC (rev 140478)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2013-01-22 23:28:02 UTC (rev 140479)
@@ -726,6 +726,21 @@
     for (unsigned i = 0; i < m_captions.size(); i++)
         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_captions[i]->minPreferredLogicalWidth());
 
+    RenderStyle* styleToUse = style();
+    // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for min-width.
+    if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) {
+        m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value()));
+        m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value()));
+    }
+
+    // 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()) {
+        m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value()));
+        m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value()));
+    }
+
+    // FIXME: We should be adding borderAndPaddingLogicalWidth here, but m_tableLayout->computePreferredLogicalWidths already does,
+    // so a bunch of tests break doing this naively.
     setPreferredLogicalWidthsDirty(false);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to