Title: [154475] trunk
Revision
154475
Author
[email protected]
Date
2013-08-23 00:19:17 -0700 (Fri, 23 Aug 2013)

Log Message

MathML: ASSERTION FAILED: !isPreferredLogicalHeightDirty() in RenderMathMLBlock::preferredLogicalHeight() const
https://bugs.webkit.org/show_bug.cgi?id=120157

Reviewed by Antti Koivisto.

RenderListMarker needs to be inserted to the render tree before
we start computing the preferred logical widths for the associated
RenderListItem.

Source/WebCore:

Test: mathml/mn-as-list-item-assert.html

* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded):
(WebCore::RenderListItem::layout):
(WebCore::RenderListItem::computePreferredLogicalWidths):
* rendering/RenderListItem.h:

LayoutTests:

* mathml/mn-as-list-item-assert-expected.txt: Added.
* mathml/mn-as-list-item-assert.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154474 => 154475)


--- trunk/LayoutTests/ChangeLog	2013-08-23 06:24:29 UTC (rev 154474)
+++ trunk/LayoutTests/ChangeLog	2013-08-23 07:19:17 UTC (rev 154475)
@@ -1,3 +1,17 @@
+2013-08-23  Zalan Bujtas  <[email protected]>
+
+        MathML: ASSERTION FAILED: !isPreferredLogicalHeightDirty() in RenderMathMLBlock::preferredLogicalHeight() const
+        https://bugs.webkit.org/show_bug.cgi?id=120157
+
+        Reviewed by Antti Koivisto.
+
+        RenderListMarker needs to be inserted to the render tree before
+        we start computing the preferred logical widths for the associated
+        RenderListItem.
+
+        * mathml/mn-as-list-item-assert-expected.txt: Added.
+        * mathml/mn-as-list-item-assert.html: Added.
+
 2013-08-22  Simon Fraser  <[email protected]>
 
         compositing/geometry/bounds-ignores-hidden-dynamic.html has incorrect initial rendering

Added: trunk/LayoutTests/mathml/mn-as-list-item-assert-expected.txt (0 => 154475)


--- trunk/LayoutTests/mathml/mn-as-list-item-assert-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/mathml/mn-as-list-item-assert-expected.txt	2013-08-23 07:19:17 UTC (rev 154475)
@@ -0,0 +1,2 @@
+This test PASSES if it does not CRASH or ASSERT.
+

Added: trunk/LayoutTests/mathml/mn-as-list-item-assert.html (0 => 154475)


--- trunk/LayoutTests/mathml/mn-as-list-item-assert.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/mn-as-list-item-assert.html	2013-08-23 07:19:17 UTC (rev 154475)
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<head>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+    </script>
+</head>
+<body>
+<math> 
+    <munderover>
+        <mn style="display: list-item;">This test PASSES if it does not CRASH or ASSERT.</mn>
+    </munderover>
+</math>

Modified: trunk/Source/WebCore/ChangeLog (154474 => 154475)


--- trunk/Source/WebCore/ChangeLog	2013-08-23 06:24:29 UTC (rev 154474)
+++ trunk/Source/WebCore/ChangeLog	2013-08-23 07:19:17 UTC (rev 154475)
@@ -1,3 +1,22 @@
+2013-08-23  Zalan Bujtas  <[email protected]>
+
+        MathML: ASSERTION FAILED: !isPreferredLogicalHeightDirty() in RenderMathMLBlock::preferredLogicalHeight() const
+        https://bugs.webkit.org/show_bug.cgi?id=120157
+
+        Reviewed by Antti Koivisto.
+
+        RenderListMarker needs to be inserted to the render tree before
+        we start computing the preferred logical widths for the associated
+        RenderListItem.
+
+        Test: mathml/mn-as-list-item-assert.html
+
+        * rendering/RenderListItem.cpp:
+        (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded):
+        (WebCore::RenderListItem::layout):
+        (WebCore::RenderListItem::computePreferredLogicalWidths):
+        * rendering/RenderListItem.h:
+
 2013-08-22  Gyuyoung Kim  <[email protected]>
 
         Introduce toSVGLinearGradientElement(), and use it

Modified: trunk/Source/WebCore/rendering/RenderListItem.cpp (154474 => 154475)


--- trunk/Source/WebCore/rendering/RenderListItem.cpp	2013-08-23 06:24:29 UTC (rev 154474)
+++ trunk/Source/WebCore/rendering/RenderListItem.cpp	2013-08-23 07:19:17 UTC (rev 154475)
@@ -268,38 +268,36 @@
     return result;
 }
 
-void RenderListItem::updateMarkerLocation()
+void RenderListItem::insertOrMoveMarkerRendererIfNeeded()
 {
     // Sanity check the location of our marker.
-    if (m_marker) {
-        RenderObject* markerPar = m_marker->parent();
-        RenderObject* lineBoxParent = getParentOfFirstLineBox(this, m_marker);
-        if (!lineBoxParent) {
-            // If the marker is currently contained inside an anonymous box,
-            // then we are the only item in that anonymous box (since no line box
-            // parent was found).  It's ok to just leave the marker where it is
-            // in this case.
-            if (markerPar && markerPar->isAnonymousBlock())
-                lineBoxParent = markerPar;
-            else
-                lineBoxParent = this;
-        }
+    if (!m_marker)
+        return;
 
-        if (markerPar != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) {
-            // Removing and adding the marker can trigger repainting in
-            // containers other than ourselves, so we need to disable LayoutState.
-            LayoutStateDisabler layoutStateDisabler(view());
-            updateFirstLetter();
-            m_marker->remove();
-            if (!lineBoxParent)
-                lineBoxParent = this;
-            lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent));
-            m_marker->updateMarginsAndContent();
-            // If markerPar is an anonymous block that has lost all its children, destroy it.
-            if (markerPar && markerPar->isAnonymousBlock() && !markerPar->firstChild() && !toRenderBlock(markerPar)->continuation())
-                markerPar->destroy();
-        }
+    RenderObject* currentParent = m_marker->parent();
+    RenderObject* newParent = getParentOfFirstLineBox(this, m_marker);
+    if (!newParent) {
+        // If the marker is currently contained inside an anonymous box,
+        // then we are the only item in that anonymous box (since no line box
+        // parent was found). It's ok to just leave the marker where it is
+        // in this case.
+        if (currentParent && currentParent->isAnonymousBlock())
+            return;
+        newParent = this;
     }
+
+    if (newParent != currentParent) {
+        // Removing and adding the marker can trigger repainting in
+        // containers other than ourselves, so we need to disable LayoutState.
+        LayoutStateDisabler layoutStateDisabler(view());
+        m_marker->remove();
+        newParent->addChild(m_marker, firstNonMarkerChild(newParent));
+        m_marker->updateMarginsAndContent();
+        // If current parent is an anonymous block that has lost all its children, destroy it.
+        if (currentParent && currentParent->isAnonymousBlock() && !currentParent->firstChild() && !toRenderBlock(currentParent)->continuation())
+            currentParent->destroy();
+    }
+
 }
 
 void RenderListItem::layout()
@@ -307,7 +305,7 @@
     StackStats::LayoutCheckPoint layoutCheckPoint;
     ASSERT(needsLayout()); 
 
-    updateMarkerLocation();    
+    insertOrMoveMarkerRendererIfNeeded();
     RenderBlock::layout();
 }
 
@@ -317,6 +315,19 @@
     positionListMarker();
 }
 
+void RenderListItem::computePreferredLogicalWidths()
+{
+#ifndef NDEBUG
+    // FIXME: We shouldn't be modifying the tree in computePreferredLogicalWidths.
+    // Instead, we should insert the marker soon after the tree construction.
+    // This is similar case to RenderCounter::computePreferredLogicalWidths()
+    // See https://bugs.webkit.org/show_bug.cgi?id=104829
+    SetLayoutNeededForbiddenScope layoutForbiddenScope(this, false);
+#endif
+    insertOrMoveMarkerRendererIfNeeded();
+    RenderBlock::computePreferredLogicalWidths();
+}
+
 void RenderListItem::positionListMarker()
 {
     if (m_marker && m_marker->parent()->isBox() && !m_marker->isInside() && m_marker->inlineBoxWrapper()) {

Modified: trunk/Source/WebCore/rendering/RenderListItem.h (154474 => 154475)


--- trunk/Source/WebCore/rendering/RenderListItem.h	2013-08-23 06:24:29 UTC (rev 154474)
+++ trunk/Source/WebCore/rendering/RenderListItem.h	2013-08-23 07:19:17 UTC (rev 154475)
@@ -75,8 +75,9 @@
     virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
 
     virtual void addOverflowFromChildren();
+    virtual void computePreferredLogicalWidths() OVERRIDE;
 
-    void updateMarkerLocation();
+    void insertOrMoveMarkerRendererIfNeeded();
     inline int calcValue() const;
     void updateValueNow() const;
     void explicitValueChanged();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to