- Revision
- 208296
- Author
- [email protected]
- Date
- 2016-11-02 12:47:16 -0700 (Wed, 02 Nov 2016)
Log Message
REGRESSION(r203289):Assertion in MathOperator::stretchTo() on Wikipedia Page
https://bugs.webkit.org/show_bug.cgi?id=162933
<rdar://problem/28570590>
Reviewed by Dean Jackson.
Source/WebCore:
A debug assertion is triggered when an empty <mo> tag is used with a "stretchy" flag.
We shouldn't be trying to apply stretch operations on an empty MathML element. Create a
helper function (isStretchy) to encapsulate the fact that only non-empty elements with
the 'MathMLOperatorDictionary::Stretchy' operator flag should have stretching applied.
Test: mathml/empty-mo.html
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::stretchTo): Revise assertion to use new 'isStretchy' predicate.
* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::isStretchy): Added.
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::computeLineVerticalStretch): Use new 'isStretchy' predicate.
(WebCore::RenderMathMLRow::layoutRowItems): Ditto.
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Ditto.
(WebCore::RenderMathMLUnderOver::verticalParameters): Ditto.
LayoutTests:
* mathml/empty-mo-expected.txt: Added.
* mathml/empty-mo.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (208295 => 208296)
--- trunk/LayoutTests/ChangeLog 2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/LayoutTests/ChangeLog 2016-11-02 19:47:16 UTC (rev 208296)
@@ -1,3 +1,14 @@
+2016-11-02 Brent Fulgham <[email protected]>
+
+ REGRESSION(r203289):Assertion in MathOperator::stretchTo() on Wikipedia Page
+ https://bugs.webkit.org/show_bug.cgi?id=162933
+ <rdar://problem/28570590>
+
+ Reviewed by Dean Jackson.
+
+ * mathml/empty-mo-expected.txt: Added.
+ * mathml/empty-mo.html: Added.
+
2016-11-01 Dean Jackson <[email protected]>
Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
Added: trunk/LayoutTests/mathml/empty-mo-expected.txt (0 => 208296)
--- trunk/LayoutTests/mathml/empty-mo-expected.txt (rev 0)
+++ trunk/LayoutTests/mathml/empty-mo-expected.txt 2016-11-02 19:47:16 UTC (rev 208296)
@@ -0,0 +1,14 @@
+Test passes if it does not debug assert.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test 1: Empty <mo> tag:
+
+Test 2: Multi-character <mo> tag:
+
+++
+
Added: trunk/LayoutTests/mathml/empty-mo.html (0 => 208296)
--- trunk/LayoutTests/mathml/empty-mo.html (rev 0)
+++ trunk/LayoutTests/mathml/empty-mo.html 2016-11-02 19:47:16 UTC (rev 208296)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script>
+ description("Test passes if it does not debug assert.");
+ </script>
+</head>
+<body>
+ <div>
+ <p>Test 1: Empty <mo> tag:</p>
+ <math>
+ <mo stretchy="true"></mo>
+ </math>
+ </div>
+ <div>
+ <p>Test 2: Multi-character <mo> tag:</p>
+ <math>
+ <mo stretchy="true">++</mo>
+ </math>
+ </div>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (208295 => 208296)
--- trunk/Source/WebCore/ChangeLog 2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/ChangeLog 2016-11-02 19:47:16 UTC (rev 208296)
@@ -1,3 +1,30 @@
+2016-11-02 Brent Fulgham <[email protected]>
+
+ REGRESSION(r203289):Assertion in MathOperator::stretchTo() on Wikipedia Page
+ https://bugs.webkit.org/show_bug.cgi?id=162933
+ <rdar://problem/28570590>
+
+ Reviewed by Dean Jackson.
+
+ A debug assertion is triggered when an empty <mo> tag is used with a "stretchy" flag.
+
+ We shouldn't be trying to apply stretch operations on an empty MathML element. Create a
+ helper function (isStretchy) to encapsulate the fact that only non-empty elements with
+ the 'MathMLOperatorDictionary::Stretchy' operator flag should have stretching applied.
+
+ Test: mathml/empty-mo.html
+
+ * rendering/mathml/RenderMathMLOperator.cpp:
+ (WebCore::RenderMathMLOperator::stretchTo): Revise assertion to use new 'isStretchy' predicate.
+ * rendering/mathml/RenderMathMLOperator.h:
+ (WebCore::RenderMathMLOperator::isStretchy): Added.
+ * rendering/mathml/RenderMathMLRow.cpp:
+ (WebCore::RenderMathMLRow::computeLineVerticalStretch): Use new 'isStretchy' predicate.
+ (WebCore::RenderMathMLRow::layoutRowItems): Ditto.
+ * rendering/mathml/RenderMathMLUnderOver.cpp:
+ (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Ditto.
+ (WebCore::RenderMathMLUnderOver::verticalParameters): Ditto.
+
2016-11-01 Dean Jackson <[email protected]>
Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (208295 => 208296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-11-02 19:47:16 UTC (rev 208296)
@@ -117,7 +117,7 @@
void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
{
- ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy));
+ ASSERT(isStretchy());
ASSERT(isVertical());
if (!isVertical() || (heightAboveBaseline == m_stretchHeightAboveBaseline && depthBelowBaseline == m_stretchDepthBelowBaseline))
@@ -157,7 +157,7 @@
void RenderMathMLOperator::stretchTo(LayoutUnit width)
{
- ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy));
+ ASSERT(isStretchy());
ASSERT(!isVertical());
if (isVertical() || m_stretchWidth == width)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (208295 => 208296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-11-02 19:47:16 UTC (rev 208296)
@@ -56,6 +56,7 @@
void updateTokenContent() final;
void updateFromElement() final;
virtual UChar32 textContent() const;
+ bool isStretchy() const { return textContent() && hasOperatorFlag(MathMLOperatorDictionary::Stretchy); }
protected:
virtual void updateMathOperator();
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (208295 => 208296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-11-02 19:47:16 UTC (rev 208296)
@@ -63,7 +63,7 @@
for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
if (is<RenderMathMLBlock>(child)) {
auto* renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator();
- if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy))
+ if (renderOperator && renderOperator->isStretchy())
continue;
}
@@ -109,7 +109,7 @@
if (is<RenderMathMLBlock>(child)) {
auto renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator();
- if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && renderOperator->isVertical())
+ if (renderOperator && renderOperator->isStretchy() && renderOperator->isVertical())
renderOperator->stretchTo(ascent, descent);
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (208295 => 208296)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2016-11-02 19:47:16 UTC (rev 208296)
@@ -56,7 +56,7 @@
if (child->needsLayout()) {
if (is<RenderMathMLBlock>(child)) {
if (auto renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator()) {
- if (renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && !renderOperator->isVertical()) {
+ if (renderOperator->isStretchy() && !renderOperator->isVertical()) {
renderOperator->resetStretchSize();
renderOperators.append(renderOperator);
}
@@ -217,7 +217,7 @@
parameters.useUnderOverBarFallBack = false;
return parameters;
}
- if (baseOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && !baseOperator->isVertical()) {
+ if (baseOperator->isStretchy() && !baseOperator->isVertical()) {
// The base is a horizontal stretchy operator, so we read StretchStack constants from the MATH table.
parameters.underGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapBelowMin);
parameters.overGapMin = mathData->getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapAboveMin);