Ensure that RenderMathMLOperator::stretchTo functions are called with stretchy operat...
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 18:04:44 +0000 (18:04 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 18:04:44 +0000 (18:04 +0000)
commit92424b75e2fb77f3e646a638953c8b4c3cd097a2
tree38dd24837a7689829863eaa6b6c33c9b303946a6
parentd3f5ed0a65d67884117ad2de3b9f196b4a0883de
Ensure that RenderMathMLOperator::stretchTo functions are called with stretchy operators that have the correct direction
https://bugs.webkit.org/show_bug.cgi?id=156542

Patch by Frederic Wang <fwang@igalia.com> on 2016-04-14
Reviewed by Darin Adler.

Source/WebCore:

In the RenderMathMLUnderOver refactoring (r199293), we avoided doing a
horizontal stretchTo call for non-stretchy operators. Here we do the
same for RenderMathMLRow and avoid doing a vertical stretchTo call for
horizontal or non-stretchy operators. We also add appropriate ASSERT in
the RenderMathMLOperator::stretchTo functions. To avoid failing tests
with DOM/style update, we make our updates a bit stricter. Hopefully,
we could manage such things better in the future (bug 156536).

Tests: mathml/presentation/row-nonstretchy-or-horizontal.html
       mathml/presentation/underover-nonstretchy-or-vertical.html

* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::parseAttribute): Replace setOperatorFlagAndScheduleLayoutIfNeeded with a stronger rendering update.
Also ensure that this is done when the lspace/rspace attributes change.
This avoids breaking mathml/presentation/mo-lspace-rspace-dynamic.html
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::stretchTo): Add ASSERT to ensure that it is only called with stretchy operators that have the correct direction.
(WebCore::RenderMathMLOperator::styleDidChange): Do a stronger rendering update when the style changes.
This avoids breaking mathml/presentation/style-changed.html
(WebCore::RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded): Deleted.
* rendering/mathml/RenderMathMLOperator.h: Make updateFromElement public so that it can be called from MathMLTextElement::parseAttribute
Remove setOperatorFlagAndScheduleLayoutIfNeeded and declare styleDidChange.
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::layoutRowItems): Only call stretchTo for vertical stretchy operators.

LayoutTests:

Add a test to ensure that nonstretchy or horizontal operators in a
RenderMathMLRow do not stretch. This is similar to the existing test
for munderover and we improve a bit that one too.
Besides the verification of the rendering, these two tests will also
check that the RenderMathMLOperator::stretchTo calls are not done in a
way that violates the ASSERT at the top of stretchTo.

* mathml/presentation/row-nonstretchy-or-horizontal.html: Added.
* mathml/presentation/row-nonstretchy-or-horizontal-expected.html: Added.
* mathml/presentation/underover-nonstretchy-horizontal.html: Removed.
* mathml/presentation/underover-nonstretchy-horizontal-expected.html: Removed.
* mathml/presentation/underover-nonstretchy-or-vertical.html: Renamed from LayoutTests/mathml/presentation/underover-nonstretchy-horizontal.html.
We now also test the case of vertical operators in munderover.
* mathml/presentation/underover-nonstretchy-or-vertical-expected.html: Renamed from LayoutTests/mathml/presentation/underover-nonstretchy-horizontal-expected.html.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal.html [new file with mode: 0644]
LayoutTests/mathml/presentation/underover-nonstretchy-horizontal.html [deleted file]
LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical-expected.html [moved from LayoutTests/mathml/presentation/underover-nonstretchy-horizontal-expected.html with 56% similarity]
LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/mathml/MathMLTextElement.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.h
Source/WebCore/rendering/mathml/RenderMathMLRow.cpp