Title: [140554] trunk/Source/WebCore
Revision
140554
Author
o...@chromium.org
Date
2013-01-23 10:54:56 -0800 (Wed, 23 Jan 2013)

Log Message

Assert that computePreferredLogicalWidths never calls setNeedsLayout
https://bugs.webkit.org/show_bug.cgi?id=107613

Reviewed by Eric Seidel.

computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
The mathml bits can be removed once https://bugs.webkit.org/show_bug.cgi?id=107353
is resolved.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::minPreferredLogicalWidth):
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::computePreferredLogicalWidths):
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::computePreferredLogicalWidths):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140553 => 140554)


--- trunk/Source/WebCore/ChangeLog	2013-01-23 18:53:57 UTC (rev 140553)
+++ trunk/Source/WebCore/ChangeLog	2013-01-23 18:54:56 UTC (rev 140554)
@@ -1,3 +1,24 @@
+2013-01-23  Ojan Vafai  <o...@chromium.org>
+
+        Assert that computePreferredLogicalWidths never calls setNeedsLayout
+        https://bugs.webkit.org/show_bug.cgi?id=107613
+
+        Reviewed by Eric Seidel.
+
+        computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
+        and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
+        The mathml bits can be removed once https://bugs.webkit.org/show_bug.cgi?id=107353
+        is resolved.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::minPreferredLogicalWidth):
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::computePreferredLogicalWidths):
+        * rendering/mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::computePreferredLogicalWidths):
+
 2013-01-23  Noam Rosenthal  <n...@webkit.org>
 
         REGRESSION(r140518): Broke Chromium Win build (gyp file not updated) (Requested by arv on #webkit).

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (140553 => 140554)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2013-01-23 18:53:57 UTC (rev 140553)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-01-23 18:54:56 UTC (rev 140554)
@@ -849,16 +849,24 @@
 
 LayoutUnit RenderBox::minPreferredLogicalWidth() const
 {
-    if (preferredLogicalWidthsDirty())
+    if (preferredLogicalWidthsDirty()) {
+#ifndef NDEBUG
+        SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<RenderBox*>(this));
+#endif
         const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
+    }
         
     return m_minPreferredLogicalWidth;
 }
 
 LayoutUnit RenderBox::maxPreferredLogicalWidth() const
 {
-    if (preferredLogicalWidthsDirty())
+    if (preferredLogicalWidthsDirty()) {
+#ifndef NDEBUG
+        SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<RenderBox*>(this));
+#endif
         const_cast<RenderBox*>(this)->computePreferredLogicalWidths();
+    }
         
     return m_maxPreferredLogicalWidth;
 }

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (140553 => 140554)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2013-01-23 18:53:57 UTC (rev 140553)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2013-01-23 18:54:56 UTC (rev 140554)
@@ -83,11 +83,21 @@
 void RenderMathMLOperator::computePreferredLogicalWidths() 
 {
     ASSERT(preferredLogicalWidthsDirty());
+
+#ifndef NDEBUG
+    // FIXME: Remove the setNeedsLayoutIsForbidden calls once mathml stops modifying the render tree here.
+    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
+    setNeedsLayoutIsForbidden(false);
+#endif
     
     // Check for an uninitialized operator.
     if (!firstChild())
         updateFromElement();
-    
+
+#ifndef NDEBUG
+    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
+#endif
+
     RenderMathMLBlock::computePreferredLogicalWidths();
 }
 

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (140553 => 140554)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2013-01-23 18:53:57 UTC (rev 140553)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2013-01-23 18:54:56 UTC (rev 140554)
@@ -187,6 +187,12 @@
 {
     ASSERT(preferredLogicalWidthsDirty() && needsLayout());
     
+#ifndef NDEBUG
+    // FIXME: Remove the setNeedsLayoutIsForbidden calls once mathml stops modifying the render tree here.
+    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
+    setNeedsLayoutIsForbidden(false);
+#endif
+    
     computeChildrenPreferredLogicalHeights();
     
     int baseHeight = firstChild() ? roundToInt(preferredLogicalHeightAfterSizing(firstChild())) : style()->fontSize();
@@ -219,7 +225,11 @@
             m_indexTop = - rootExtraTop;
     } else
         m_intrinsicPaddingStart = frontWidth;
-    
+
+#ifndef NDEBUG
+    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
+#endif
+
     RenderMathMLBlock::computePreferredLogicalWidths();
     
     // Shrink our logical width to its probable value now without triggering unnecessary relayout of our children.

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (140553 => 140554)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2013-01-23 18:53:57 UTC (rev 140553)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2013-01-23 18:54:56 UTC (rev 140554)
@@ -54,7 +54,13 @@
 void RenderMathMLRow::computePreferredLogicalWidths()
 {
     ASSERT(preferredLogicalWidthsDirty() && needsLayout());
-    
+
+#ifndef NDEBUG
+    // FIXME: Remove the setNeedsLayoutIsForbidden calls once mathml stops modifying the render tree here.
+    bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
+    setNeedsLayoutIsForbidden(false);
+#endif
+
     computeChildrenPreferredLogicalHeights();
     int stretchLogicalHeight = 0;
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
@@ -77,7 +83,11 @@
                 renderMo->stretchToHeight(stretchLogicalHeight);
         }
     }
-    
+
+#ifndef NDEBUG
+    setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
+#endif
+
     RenderMathMLBlock::computePreferredLogicalWidths();
     
     // Shrink our logical width to its probable value now without triggering unnecessary relayout of our children.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to