ASSERT_NOT_REACHED() is touched in WebCore::minimumValueForLength
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 23:25:29 +0000 (23:25 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 23:25:29 +0000 (23:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125781
<rdar://problem/27684457>

Reviewed by Simon Fraser.

Source/WebCore:

RenderTableSection::calcRowLogicalHeight misused minimumValueForLength to fallback to 0 for non-fixed values.
While this patch fixes the assertion, the table section code needs works to support calc values. See webkit.org/b/161273.

Test: fast/table/assert-on-min-max-content-values.html

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcRowLogicalHeight):

LayoutTests:

* fast/table/assert-on-min-max-content-values-expected.txt: Added.
* fast/table/assert-on-min-max-content-values.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205056 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/table/assert-on-min-max-content-values-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/assert-on-min-max-content-values.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTableSection.cpp

index 67572dbe43ffb78dc85d1c52cc775af19aae46c2..8f92dc1fafe40c79a15e86d583943e3c10ddcc45 100644 (file)
@@ -1,3 +1,14 @@
+2016-08-26  Zalan Bujtas  <zalan@apple.com>
+
+        ASSERT_NOT_REACHED() is touched in WebCore::minimumValueForLength
+        https://bugs.webkit.org/show_bug.cgi?id=125781
+        <rdar://problem/27684457>
+
+        Reviewed by Simon Fraser.
+
+        * fast/table/assert-on-min-max-content-values-expected.txt: Added.
+        * fast/table/assert-on-min-max-content-values.html: Added.
+
 2016-08-26  Ryan Haddad  <ryanhaddad@apple.com>
 
         Rebaseline fast/dom/focus-contenteditable.html for ios-simulator after r205044.
diff --git a/LayoutTests/fast/table/assert-on-min-max-content-values-expected.txt b/LayoutTests/fast/table/assert-on-min-max-content-values-expected.txt
new file mode 100644 (file)
index 0000000..e424d77
--- /dev/null
@@ -0,0 +1,2 @@
+PASS if no assert in debug.
+
diff --git a/LayoutTests/fast/table/assert-on-min-max-content-values.html b/LayoutTests/fast/table/assert-on-min-max-content-values.html
new file mode 100644 (file)
index 0000000..f92302b
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't assert on tables with min/max-content values.</title>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+PASS if no assert in debug.
+<table style="-webkit-writing-mode: vertical-rl;">
+<tbody>
+       <tr style="width: -webkit-min-content;"></tr> 
+       <tr style="width: -webkit-max-content;"></tr> 
+       <tr style="width: calc(50px - 10%);"></tr> 
+</tbody>
+</table>
+</body>
+</html>
index 4a2d10d4667d45f1736e2523160833265b25c015..3589ed5edab56e5378e057c273a2e9796c96929b 100644 (file)
@@ -1,3 +1,19 @@
+2016-08-26  Zalan Bujtas  <zalan@apple.com>
+
+        ASSERT_NOT_REACHED() is touched in WebCore::minimumValueForLength
+        https://bugs.webkit.org/show_bug.cgi?id=125781
+        <rdar://problem/27684457>
+
+        Reviewed by Simon Fraser.
+
+        RenderTableSection::calcRowLogicalHeight misused minimumValueForLength to fallback to 0 for non-fixed values.
+        While this patch fixes the assertion, the table section code needs works to support calc values. See webkit.org/b/161273.   
+
+        Test: fast/table/assert-on-min-max-content-values.html
+
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::calcRowLogicalHeight):
+
 2016-08-26  Andreas Kling  <akling@apple.com>
 
         REGRESSION (r204987): fast/canvas-composite-* tests are now flaky assertion failures
index d9bc3f3c70027131e5690b4f7bc8ef86990dd6ca..c85c5424f963a22826d10a337caca416e610c369 100644 (file)
@@ -252,6 +252,15 @@ void RenderTableSection::addCell(RenderTableCell* cell, RenderTableRow* row)
     cell->setCol(table()->effColToCol(col));
 }
 
+static LayoutUnit resolveLogicalHeightForRow(const Length& rowLogicalHeight)
+{
+    if (rowLogicalHeight.isFixed())
+        return rowLogicalHeight.value();
+    if (rowLogicalHeight.isCalculated())
+        return rowLogicalHeight.nonNanCalculatedValue(0);
+    return 0;
+}
+
 LayoutUnit RenderTableSection::calcRowLogicalHeight()
 {
 #ifndef NDEBUG
@@ -279,7 +288,7 @@ LayoutUnit RenderTableSection::calcRowLogicalHeight()
         LayoutUnit baselineDescent = 0;
 
         // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells).
-        m_rowPos[r + 1] = std::max(m_rowPos[r] + minimumValueForLength(m_grid[r].logicalHeight, 0), LayoutUnit::fromPixel(0));
+        m_rowPos[r + 1] = std::max(m_rowPos[r] + resolveLogicalHeightForRow(m_grid[r].logicalHeight), LayoutUnit::fromPixel(0));
 
         Row& row = m_grid[r].row;
         unsigned totalCols = row.size();