ASSERTION FAILED: contentSize >= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForM...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2016 01:55:04 +0000 (01:55 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2016 01:55:04 +0000 (01:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155700
<rdar://problem/27720727>

Reviewed by David Hyatt.

Source/WebCore:

RenderBox::m_minPreferredLogicalWidth/m_maxPreferredLogicalWidth don't need special initial value since
preferredLogicalWidthsDirty flag guards them. -1 as initial value can cause problems for renderers that don't
override RenderBox::computePreferredLogicalWidths().

Test: fast/ruby/assert-when-content-size-is-negative.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::RenderBox):
(WebCore::RenderBox::dirtyLineBoxes):
(WebCore::RenderBox::deleteLineBoxWrapper):
* rendering/RenderBox.h:

LayoutTests:

* fast/ruby/assert-when-content-size-is-negative-expected.txt: Added.
* fast/ruby/assert-when-content-size-is-negative.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/ruby/assert-when-content-size-is-negative-expected.txt [new file with mode: 0644]
LayoutTests/fast/ruby/assert-when-content-size-is-negative.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h

index 63b59e6..7a94150 100644 (file)
@@ -1,3 +1,14 @@
+2016-08-24  Zalan Bujtas  <zalan@apple.com>
+
+        ASSERTION FAILED: contentSize >= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax
+        https://bugs.webkit.org/show_bug.cgi?id=155700
+        <rdar://problem/27720727>
+
+        Reviewed by David Hyatt.
+
+        * fast/ruby/assert-when-content-size-is-negative-expected.txt: Added.
+        * fast/ruby/assert-when-content-size-is-negative.html: Added.
+
 2016-08-24  Jiewen Tan  <jiewen_tan@apple.com>
 
         Unreviewed, rebase iOS simulator WK1 fast/text tests
diff --git a/LayoutTests/fast/ruby/assert-when-content-size-is-negative-expected.txt b/LayoutTests/fast/ruby/assert-when-content-size-is-negative-expected.txt
new file mode 100644 (file)
index 0000000..b99d241
--- /dev/null
@@ -0,0 +1,4 @@
+This tests that inline does not assert when its composite state changes.
+if (window.testRunner) testRunner.dumpAsText();
+* { display: inline-flex; flex-basis: 1; }
+PASS if no assert in debug.
diff --git a/LayoutTests/fast/ruby/assert-when-content-size-is-negative.html b/LayoutTests/fast/ruby/assert-when-content-size-is-negative.html
new file mode 100644 (file)
index 0000000..93b925d
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that inline does not assert when its composite state changes.</title>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<style>
+* {
+    display: inline-flex;
+    flex-basis: 1;
+}
+</style>
+</head>
+<body>
+PASS if no assert in debug.
+<frameset></frameset>
+</body>
+</html>
index 201a007..2c4546d 100644 (file)
@@ -1,3 +1,23 @@
+2016-08-24  Zalan Bujtas  <zalan@apple.com>
+
+        ASSERTION FAILED: contentSize >= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax
+        https://bugs.webkit.org/show_bug.cgi?id=155700
+        <rdar://problem/27720727>
+
+        Reviewed by David Hyatt.
+
+        RenderBox::m_minPreferredLogicalWidth/m_maxPreferredLogicalWidth don't need special initial value since
+        preferredLogicalWidthsDirty flag guards them. -1 as initial value can cause problems for renderers that don't
+        override RenderBox::computePreferredLogicalWidths().    
+
+        Test: fast/ruby/assert-when-content-size-is-negative.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::RenderBox):
+        (WebCore::RenderBox::dirtyLineBoxes):
+        (WebCore::RenderBox::deleteLineBoxWrapper):
+        * rendering/RenderBox.h:
+
 2016-08-24  Alex Christensen  <achristensen@webkit.org>
 
         Import w3c URL tests
index eae72ba..cba8f02 100644 (file)
@@ -144,18 +144,12 @@ static bool skipBodyBackground(const RenderBox* bodyElementRenderer)
 
 RenderBox::RenderBox(Element& element, RenderStyle&& style, BaseTypeFlags baseTypeFlags)
     : RenderBoxModelObject(element, WTFMove(style), baseTypeFlags)
-    , m_minPreferredLogicalWidth(-1)
-    , m_maxPreferredLogicalWidth(-1)
-    , m_inlineBoxWrapper(nullptr)
 {
     setIsBox();
 }
 
 RenderBox::RenderBox(Document& document, RenderStyle&& style, BaseTypeFlags baseTypeFlags)
     : RenderBoxModelObject(document, WTFMove(style), baseTypeFlags)
-    , m_minPreferredLogicalWidth(-1)
-    , m_maxPreferredLogicalWidth(-1)
-    , m_inlineBoxWrapper(nullptr)
 {
     setIsBox();
 }
@@ -2148,13 +2142,14 @@ std::unique_ptr<InlineElementBox> RenderBox::createInlineBox()
 
 void RenderBox::dirtyLineBoxes(bool fullLayout)
 {
-    if (m_inlineBoxWrapper) {
-        if (fullLayout) {
-            delete m_inlineBoxWrapper;
-            m_inlineBoxWrapper = nullptr;
-        } else
-            m_inlineBoxWrapper->dirtyLineBoxes();
-    }
+    if (!m_inlineBoxWrapper)
+        return;
+    
+    if (fullLayout) {
+        delete m_inlineBoxWrapper;
+        m_inlineBoxWrapper = nullptr;
+    } else
+        m_inlineBoxWrapper->dirtyLineBoxes();
 }
 
 void RenderBox::positionLineBox(InlineElementBox& box)
@@ -2190,12 +2185,13 @@ void RenderBox::positionLineBox(InlineElementBox& box)
 
 void RenderBox::deleteLineBoxWrapper()
 {
-    if (m_inlineBoxWrapper) {
-        if (!documentBeingDestroyed())
-            m_inlineBoxWrapper->removeFromParent();
-        delete m_inlineBoxWrapper;
-        m_inlineBoxWrapper = nullptr;
-    }
+    if (!m_inlineBoxWrapper)
+        return;
+    
+    if (!documentBeingDestroyed())
+        m_inlineBoxWrapper->removeFromParent();
+    delete m_inlineBoxWrapper;
+    m_inlineBoxWrapper = nullptr;
 }
 
 LayoutRect RenderBox::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
index c6017d8..2ee8bc5 100644 (file)
@@ -734,7 +734,7 @@ protected:
     LayoutUnit m_maxPreferredLogicalWidth;
 
     // For inline replaced elements, the inline box that owns us.
-    InlineElementBox* m_inlineBoxWrapper;
+    InlineElementBox* m_inlineBoxWrapper { nullptr };
 
     // Our overflow information.
     RefPtr<RenderOverflow> m_overflow;