Implement the mmultiscripts tag
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Sep 2013 08:08:08 +0000 (08:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Sep 2013 08:08:08 +0000 (08:08 +0000)
commitde96c2b8b48bceeee7382790e83e2c33fe9e9e6c
tree107a2cb2bcb9e5e87ab0d85bcd750ede8903d8f0
parentd64157a512a08ac278bbf38cb0ac3b65b476c960
Implement the mmultiscripts tag
https://bugs.webkit.org/show_bug.cgi?id=99618

Patch by Frédéric Wang <fred.wang@free.fr> on 2013-09-15
Reviewed by Chris Fleizach.

Source/WebCore:

Tests: mathml/invalid-scripts-crash.html
       mathml/presentation/multiscripts-equivalence.html
       mathml/presentation/multiscripts-noscripts.html
       mathml/presentation/multiscripts-positions.html
       mathml/presentation/scripts-base-alignment.html
       mathml/presentation/scripts-horizontal-alignment.html
       mathml/presentation/scripts-vertical-alignment.html
       mathml/scripts-addChild.html
       mathml/scripts-removeChild.html

This relies on the existing msub/msup/msubsup code to implement the mmultiscripts tag. This also improves dynamic addition/removal of children for these MathML elements and adds a specific style for invalid children, so that they render like an merror tag. Finally, this fixes a bad memory access in the Accessibility render object of msubsup.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isMathSubscriptSuperscript):
(WebCore::AccessibilityRenderObject::mathSuperscriptObject):
* css/mathml.css:
(mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot):
(mover > :last-child, munderover > :last-child):
(msub > * + *, msup > * + *, msubsup > * + *, mmultiscripts > * + *, munder > * + *, mover > * + *, munderover > * + *):
(merror, msub > * + * + *, msup > * + * + *, msubsup > * + * + * + *, msub > mprescripts, msup > mprescripts, msubsup > mprescripts, msub > none, msup > none, msubsup > none, mmultiscripts > mprescripts ~ mprescripts, mmultiscripts > mprescripts ~ mprescripts ~ *):
* mathml/MathMLInlineContainerElement.cpp:
(WebCore::MathMLInlineContainerElement::createRenderer):
* mathml/mathtags.in:
* rendering/mathml/RenderMathMLBlock.h:
(WebCore::RenderMathMLBlock::isRenderMathMLScripts):
(WebCore::RenderMathMLBlock::isRenderMathMLScriptsWrapper):
* rendering/mathml/RenderMathMLScripts.cpp: Added.
(WebCore::isMPrescripts):
(WebCore::RenderMathMLScripts::RenderMathMLScripts):
(WebCore::RenderMathMLScripts::base):
(WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair):
(WebCore::RenderMathMLScripts::fixAnonymousStyles):
(WebCore::RenderMathMLScripts::addChildInternal):
(WebCore::RenderMathMLScripts::removeChildInternal):
(WebCore::RenderMathMLScripts::addChild):
(WebCore::RenderMathMLScripts::removeChild):
(WebCore::RenderMathMLScripts::styleDidChange):
(WebCore::RenderMathMLScripts::unembellishedOperator):
(WebCore::RenderMathMLScripts::layout):
(WebCore::RenderMathMLScripts::firstLineBoxBaseline):
(WebCore::RenderMathMLScriptsWrapper::createAnonymousWrapper):
(WebCore::RenderMathMLScriptsWrapper::addChildInternal):
(WebCore::RenderMathMLScriptsWrapper::addChild):
(WebCore::RenderMathMLScriptsWrapper::removeChildInternal):
(WebCore::RenderMathMLScriptsWrapper::removeChild):
* rendering/mathml/RenderMathMLScripts.h: Added.
(WebCore::RenderMathMLScriptsWrapper::RenderMathMLScriptsWrapper):
(WebCore::RenderMathMLScriptsWrapper::renderName):
(WebCore::RenderMathMLScriptsWrapper::isRenderMathMLScriptsWrapper):
(WebCore::toRenderMathMLScriptsWrapper):
(WebCore::RenderMathMLScripts::isRenderMathMLScripts):
(WebCore::RenderMathMLScripts::renderName):
(WebCore::toRenderMathMLScripts):
* rendering/mathml/RenderMathMLSubSup.cpp: Removed.
* rendering/mathml/RenderMathMLSubSup.h: Removed.

LayoutTests:

Add many tests for script msub/msup/msubsup/mmultiscripts:
- invalid markup
- equivalence between mmultiscripts without scripts and mrow
- equivalence between mmultiscripts and msub/msup/msubsup
- position of scripts in mmultiscripts
- baseline alignment of msub/msup/msubsup elements
- horizontal/vertical alignment of scripts
- adding/removing children with the DOM

* TestExpectations: Some remaining MathML pixel tests are broken by this patch.
* mathml/invalid-scripts-crash-expected.txt: Added.
* mathml/invalid-scripts-crash.html: Added.
* mathml/presentation/multiscripts-equivalence-expected.html: Added.
* mathml/presentation/multiscripts-equivalence.html: Added.
* mathml/presentation/multiscripts-noscripts-expected.html: Added.
* mathml/presentation/multiscripts-noscripts.html: Added.
* mathml/presentation/multiscripts-positions-expected.html: Added.
* mathml/presentation/multiscripts-positions.html: Added.
* mathml/presentation/scripts-base-alignment-expected.html: Added.
* mathml/presentation/scripts-base-alignment.html: Added.
* mathml/presentation/scripts-horizontal-alignment-expected.html: Added.
* mathml/presentation/scripts-horizontal-alignment.html: Added.
* mathml/presentation/scripts-vertical-alignment-expected.html: Added.
* mathml/presentation/scripts-vertical-alignment.html: Added.
* mathml/scripts-addChild-expected.html: Added.
* mathml/scripts-addChild.html: Added.
* mathml/scripts-removeChild-expected.html: Added.
* mathml/scripts-removeChild.html: Added.
* platform/mac/accessibility/mathml-multiscript-expected.txt: Reference updated.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/mathml/invalid-scripts-crash-expected.txt [new file with mode: 0644]
LayoutTests/mathml/invalid-scripts-crash.html [new file with mode: 0644]
LayoutTests/mathml/presentation/multiscripts-equivalence-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/multiscripts-equivalence.html [new file with mode: 0644]
LayoutTests/mathml/presentation/multiscripts-noscripts-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/multiscripts-noscripts.html [new file with mode: 0644]
LayoutTests/mathml/presentation/multiscripts-positions-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/multiscripts-positions.html [new file with mode: 0644]
LayoutTests/mathml/presentation/scripts-base-alignment-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/scripts-base-alignment.html [new file with mode: 0644]
LayoutTests/mathml/presentation/scripts-horizontal-alignment-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/scripts-horizontal-alignment.html [new file with mode: 0644]
LayoutTests/mathml/presentation/scripts-vertical-alignment-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/scripts-vertical-alignment.html [new file with mode: 0644]
LayoutTests/mathml/scripts-addChild-expected.html [new file with mode: 0644]
LayoutTests/mathml/scripts-addChild.html [new file with mode: 0644]
LayoutTests/mathml/scripts-removeChild-expected.html [new file with mode: 0644]
LayoutTests/mathml/scripts-removeChild.html [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/mathml-multiscript-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/css/mathml.css
Source/WebCore/mathml/MathMLInlineContainerElement.cpp
Source/WebCore/mathml/mathtags.in
Source/WebCore/rendering/mathml/RenderMathMLBlock.h
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp [new file with mode: 0644]
Source/WebCore/rendering/mathml/RenderMathMLScripts.h [new file with mode: 0644]
Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp [deleted file]
Source/WebCore/rendering/mathml/RenderMathMLSubSup.h [deleted file]