Title: [141517] trunk/Source/WebCore
- Revision
- 141517
- Author
- o...@chromium.org
- Date
- 2013-01-31 17:48:20 -0800 (Thu, 31 Jan 2013)
Log Message
Assert that computePreferredLogicalWidths never calls setNeedsLayout
https://bugs.webkit.org/show_bug.cgi?id=108539
Reviewed by Tony Chang.
computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
This is take 2 after this was rolled out because it was missing the guards
in RenderCounter/RenderQuote.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::minPreferredLogicalWidth):
(WebCore::RenderBox::maxPreferredLogicalWidth):
* rendering/RenderCounter.cpp:
(WebCore::RenderCounter::computePreferredLogicalWidths):
* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::computePreferredLogicalWidths):
* 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 (141516 => 141517)
--- trunk/Source/WebCore/ChangeLog 2013-02-01 01:39:31 UTC (rev 141516)
+++ trunk/Source/WebCore/ChangeLog 2013-02-01 01:48:20 UTC (rev 141517)
@@ -1,3 +1,29 @@
+2013-01-31 Ojan Vafai <o...@chromium.org>
+
+ Assert that computePreferredLogicalWidths never calls setNeedsLayout
+ https://bugs.webkit.org/show_bug.cgi?id=108539
+
+ Reviewed by Tony Chang.
+
+ computePreferredLogicalWidths should only set m_minPreferredLogicalWidth
+ and m_maxPreferredLogicalWidth. It shouldn't have other side-effects.
+ This is take 2 after this was rolled out because it was missing the guards
+ in RenderCounter/RenderQuote.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::minPreferredLogicalWidth):
+ (WebCore::RenderBox::maxPreferredLogicalWidth):
+ * rendering/RenderCounter.cpp:
+ (WebCore::RenderCounter::computePreferredLogicalWidths):
+ * rendering/RenderQuote.cpp:
+ (WebCore::RenderQuote::computePreferredLogicalWidths):
+ * rendering/mathml/RenderMathMLOperator.cpp:
+ (WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
+ * rendering/mathml/RenderMathMLRoot.cpp:
+ (WebCore::RenderMathMLRoot::computePreferredLogicalWidths):
+ * rendering/mathml/RenderMathMLRow.cpp:
+ (WebCore::RenderMathMLRow::computePreferredLogicalWidths):
+
2013-01-31 Abhishek Arya <infe...@chromium.org>
Use ASSERT_WITH_SECURITY_IMPLICATION to catch bad casts in DOM
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (141516 => 141517)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2013-02-01 01:39:31 UTC (rev 141516)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2013-02-01 01:48:20 UTC (rev 141517)
@@ -858,16 +858,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/RenderCounter.cpp (141516 => 141517)
--- trunk/Source/WebCore/rendering/RenderCounter.cpp 2013-02-01 01:39:31 UTC (rev 141516)
+++ trunk/Source/WebCore/rendering/RenderCounter.cpp 2013-02-01 01:48:20 UTC (rev 141517)
@@ -519,7 +519,22 @@
void RenderCounter::computePreferredLogicalWidths(float lead)
{
+#ifndef NDEBUG
+ // FIXME: We shouldn't be modifying the tree in computePreferredLogicalWidths.
+ // Instead, we should properly hook the appropriate changes in the DOM and modify
+ // the render tree then. When that's done, we also won't need to override
+ // computePreferredLogicalWidths at all.
+ // https://bugs.webkit.org/show_bug.cgi?id=104829
+ bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
+ setNeedsLayoutIsForbidden(false);
+#endif
+
setTextInternal(originalText());
+
+#ifndef NDEBUG
+ setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
+#endif
+
RenderText::computePreferredLogicalWidths(lead);
}
Modified: trunk/Source/WebCore/rendering/RenderQuote.cpp (141516 => 141517)
--- trunk/Source/WebCore/rendering/RenderQuote.cpp 2013-02-01 01:39:31 UTC (rev 141516)
+++ trunk/Source/WebCore/rendering/RenderQuote.cpp 2013-02-01 01:48:20 UTC (rev 141517)
@@ -250,9 +250,24 @@
void RenderQuote::computePreferredLogicalWidths(float lead)
{
+#ifndef NDEBUG
+ // FIXME: We shouldn't be modifying the tree in computePreferredLogicalWidths.
+ // Instead, we should properly hook the appropriate changes in the DOM and modify
+ // the render tree then. When that's done, we also won't need to override
+ // computePreferredLogicalWidths at all.
+ // https://bugs.webkit.org/show_bug.cgi?id=104829
+ bool oldSetNeedsLayoutIsForbidden = isSetNeedsLayoutForbidden();
+ setNeedsLayoutIsForbidden(false);
+#endif
+
if (!m_attached)
attachQuote();
setTextInternal(originalText());
+
+#ifndef NDEBUG
+ setNeedsLayoutIsForbidden(oldSetNeedsLayoutIsForbidden);
+#endif
+
RenderText::computePreferredLogicalWidths(lead);
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (141516 => 141517)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2013-02-01 01:39:31 UTC (rev 141516)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2013-02-01 01:48:20 UTC (rev 141517)
@@ -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 (141516 => 141517)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2013-02-01 01:39:31 UTC (rev 141516)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2013-02-01 01:48:20 UTC (rev 141517)
@@ -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 (141516 => 141517)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2013-02-01 01:39:31 UTC (rev 141516)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2013-02-01 01:48:20 UTC (rev 141517)
@@ -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
https://lists.webkit.org/mailman/listinfo/webkit-changes