Add support for movablelimits.
https://bugs.webkit.org/show_bug.cgi?id=155542

Patch by Frederic Wang <fwang@igalia.com> on 2016-07-08
Reviewed by Brent Fulgham.

Source/WebCore:

Tests: mathml/presentation/displaystyle-1.html
       mathml/presentation/displaystyle-2.html
       mathml/presentation/displaystyle-3.html
       mathml/presentation/mo-movablelimits-default.html
       mathml/presentation/mo-movablelimits-dynamic.html
       mathml/presentation/mo-movablelimits.html

* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::parseAttribute): Take into account change of movablelimits.
* rendering/mathml/MathMLOperatorDictionary.h: Remove FIXME comment.
* rendering/mathml/MathMLStyle.cpp:
(WebCore::MathMLStyle::updateStyleIfNeeded): Force relayout and width computation when a
displaystyle value change.
* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::shouldMoveLimits): Helper function to test if the operator
should have his limits moved when used as a base of munder/mover/munderover.
* rendering/mathml/RenderMathMLScripts.cpp: Allow munderover/munder/mover elements to use
this class and take the same behavior as the corresponding msubsup/msub/sup except for
the *scriptshift attributes.
(WebCore::RenderMathMLScripts::RenderMathMLScripts):
(WebCore::RenderMathMLScripts::getBaseAndScripts):
(WebCore::RenderMathMLScripts::computePreferredLogicalWidths):
(WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded):
(WebCore::RenderMathMLScripts::layoutBlock):
* rendering/mathml/RenderMathMLScripts.h: Allow some members to be accessible/overridden
by RenderMathMLUnderOver and add munderover/munder/mover in the kind.
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::RenderMathMLUnderOver): We use the code from
RenderMathMLScripts to initialize m_kind.
(WebCore::RenderMathMLUnderOver::shouldMoveLimits): New function to determine if the base
should move its limits.
(WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): We use the code from
RenderMathMLScripts when the base should move its limits.
(WebCore::RenderMathMLUnderOver::layoutBlock): We use the code from RenderMathMLScripts when
the base should move its limits. Also improve the early return for invalid markup.
(WebCore::RenderMathMLUnderOver::unembellishedOperator): Deleted. We use the code from RenderMathMLScripts.
(WebCore::RenderMathMLUnderOver::firstLineBaseline): Deleted. We use the code from RenderMathMLScripts.
* rendering/mathml/RenderMathMLUnderOver.h: We now inherit from RenderMathMLScripts and can
just remove members that exist in the parent. We define shouldMoveLimits() to determine
when the layout should be done the same as RenderMathMLScripts. For now, we try and be
safe with the rest of the code by continuing to claim that we are not a RenderMathMLScripts.

LayoutTests:

We import some reftests from Mozilla and write more tests in order to verify the effect of
movablelimits. We also adjust one existing test due to change in how munderover handles
invalid markup.

* mathml/presentation/displaystyle-1.html: Added. Imported from Mozilla. This verifies the
inheritance of displaystyle via its effect on movablelimits.
* mathml/presentation/displaystyle-1-expected.html: Added.
* mathml/presentation/displaystyle-2.html: Added. Imported from Mozilla. Test the effect of
displaystyle on munder, mover and munderover with a movablelimits base.
* mathml/presentation/displaystyle-2-expected.html: Added.
* mathml/presentation/displaystyle-3.html: Added. Imported from Mozilla. Test dynamic change
of displaystyle via its effect on movablelimits.
* mathml/presentation/displaystyle-3-expected.html: Added.
* mathml/presentation/mo-movablelimits-default.html: Added. Test that the default
movablelimits value from the operator dictionary is correctly read.
* mathml/presentation/mo-movablelimits-default-expected.html: Added.
* mathml/presentation/mo-movablelimits-dynamic.html: Added. Imported from Mozilla.
Test dynamic change of movablelimits.
* mathml/presentation/mo-movablelimits-dynamic-expected.html: Added.
* mathml/presentation/mo-movablelimits.html: Added. Basic test to check the effect of
movablelimits on munder.
* mathml/presentation/mo-movablelimits-expected.html: Added.
* mathml/presentation/underover-scriptshifts.html: Added. This verifies that script shifts
do not have any effect on munderover/mover/munder elements when their limits are rendered
as postscripts.
* mathml/presentation/underover-scriptshifts-expected.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@202970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed