Skip to content
Permalink
Browse files
Refactor RenderMathMLScripts layout to avoid using flexbox
https://bugs.webkit.org/show_bug.cgi?id=153917

Patch by Frederic Wang <fwang@igalia.com> on 2016-04-18
Reviewed by Martin Robinson.

Source/WebCore:

Tests: mathml/mathml-in-html5/subsup-parameters-1.html
       mathml/opentype/large-operators-italic-correction.html

Reimplement RenderMathMLScripts without any flexbox or anonymous.
We also rely on parameters from the MATH table to improve rendering.

* css/mathml.css:
(msub > * + * + *, msup > * + * + *, msubsup > * + * + * + *, msub > mprescripts, msup > mprescripts, msubsup > mprescripts, msub > none, msup > none, msubsup > none, mmultiscripts > mprescripts ~ mprescripts, mmultiscripts > mprescripts ~ mprescripts ~ *): Deleted.
Invalid markup for scripts is now just hidden.
* rendering/mathml/RenderMathMLOperator.h: ditto.
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::unembellishedOperator): Reimplemented.
(WebCore::RenderMathMLScripts::getBaseAndScripts): Helper function to verify whether the
child list is valid and retrieve pointers on important children.
(WebCore::RenderMathMLScripts::spaceAfterScript): Helper function to get the
space after a script.
(WebCore::RenderMathMLScripts::italicCorrection): Helper function to read the
italic correction of a largeop base.
(WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Implement this function.
(WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Helper function to get
the maximum ascent/descent of all the scripts and determine the minimal
sub/sup shifts to apply.
(WebCore::RenderMathMLScripts::mirrorIfNeeded): Helper function to calculate the horizontal
offset depending on the directionality.
(WebCore::RenderMathMLScripts::layoutBlock): Implement this function.
(WebCore::RenderMathMLScripts::firstLineBaseline): Implement this function.
(WebCore::RenderMathMLScripts::paintChildren): Implement this function.
(WebCore::RenderMathMLScripts::RenderMathMLScripts): Deleted.
(WebCore::RenderMathMLScripts::base): Deleted.
(WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair): Deleted.
(WebCore::RenderMathMLScripts::fixAnonymousStyles): Deleted.
(WebCore::RenderMathMLScripts::addChildInternal): Deleted.
(WebCore::RenderMathMLScripts::removeChildInternal): Deleted.
(WebCore::RenderMathMLScripts::addChild): Deleted.
(WebCore::RenderMathMLScripts::removeChild): Deleted.
(WebCore::RenderMathMLScripts::styleDidChange): Deleted.
(WebCore::RenderMathMLScripts::layout): Deleted.
(WebCore::RenderMathMLScriptsWrapper::createAnonymousWrapper): Deleted.
(WebCore::RenderMathMLScriptsWrapper::addChildInternal): Deleted.
(WebCore::RenderMathMLScriptsWrapper::addChild): Deleted.
(WebCore::RenderMathMLScriptsWrapper::removeChildInternal): Deleted.
(WebCore::RenderMathMLScriptsWrapper::removeChild): Deleted.
* rendering/mathml/RenderMathMLScripts.h: Update definitions and remove classes
for anonymous wrappers.

LayoutTests:

We import tests from the MathML in HTML5 test suite to verify various OpenType MATH parameters.
We also add a test for the italic correction of large operators (bug 130325).
Finally, we adjust some tests and expectations to take into account the new rendering.

* imported/mathml-in-html5/LICENSE: Added.
* imported/mathml-in-html5/README.md: Added.
* imported/mathml-in-html5/fonts/math/scripts-spaceafterscript3000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-spaceafterscript3000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subscriptbaselinedropmin9000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subscriptbaselinedropmin9000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subscriptshiftdown6000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subscriptshiftdown6000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subscripttopmax4000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subscripttopmax4000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subsuperscriptgapmin11000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subsuperscriptgapmin11000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptbaselinedropmax10000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptbaselinedropmax10000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptbottommin8000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptbottommin8000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptshiftup7000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptshiftup7000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptshiftupcramped5000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptshiftupcramped5000.woff.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1-expected.txt: Renamed from LayoutTests/mathml/mathml-in-html5/subsup-parameters-1-expected.txt.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1.html: Renamed from LayoutTests/mathml/mathml-in-html5/subsup-parameters-1.html.
* mathml/msubsup-fuzz-expected.txt: Test adjustment: Update the reference now that nothing
is displayed for invalid markup.
* accessibility/mac/mathml-multiscript-expected.txt: ditto.
* mathml/opentype/large-operators-italic-correction.html: Added. This test verifies that the
italic correction from the MATH table is used for positioning subscripts of large operators.
* mathml/opentype/large-operators-italic-correction-expected.txt: Added.
* mathml/presentation/bug95015.html: Test adjustment: move down a bit the covering red
rectangle, since the script is slightly lower.
* mathml/presentation/bug95015-expected.html: ditto
* mathml/presentation/multiscripts-positions.html: Test adjustment: Modify the expected
vertical positions of scripts now that we follow Gecko's behavior.
* mathml/presentation/multiscripts-positions-expected.html: ditto.
* mathml/presentation/multiscripts-noscripts-expected.html: There seem to be small errors in
the ascent of mmultiscripts, probably due to the conversions between firstLineBaseline (int)
and LayoutUnit (fractional pixel). For now, let's tweak the tests.
* mathml/presentation/multiscripts-noscripts.html: ditto.
* mathml/presentation/scripts-height-expected.html: ditto
* mathml/presentation/scripts-height.html: ditto
* mathml/presentation/scripts-horizontal-alignment.html: Modify the test to make it work
with the new layout rules.
* mathml/presentation/scripts-horizontal-alignment-expected.html: ditto.
* platform/gtk/accessibility/math-multiscript-attributes-expected.txt: Test adjustment:
Update reference to take into account a small shift.
* platform/mac/accessibility/math-multiscript-attributes-expected.txt: ditto.
* platform/gtk/mathml/presentation/roots-expected.png: Test adjustment: Update reference to
take into account small rendering changes.
* platform/gtk/mathml/presentation/roots-expected.txt: ditto.
* platform/ios-simulator/mathml/presentation/roots-expected.txt: ditto.
* platform/mac/TestExpectations: Mark some tests for scripts as failing on mac. MATH fonts
are really needed to make them reliable.
* platform/ios-simulator/TestExpectations: Ditto

Canonical link: https://commits.webkit.org/174800@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fred-wang committed Apr 18, 2016
1 parent 594afc2 commit 1341965bbc6acbaa40048d7ef557959a152d8976
Showing with 1,001 additions and 586 deletions.
  1. +57 −0 LayoutTests/ChangeLog
  2. +0 −20 LayoutTests/accessibility/mac/mathml-multiscript-expected.txt
  3. +3 −3 LayoutTests/accessibility/math-multiscript-attributes-expected.txt
  4. +3 −0 LayoutTests/imported/mathml-in-html5/LICENSE
  5. +47 −0 LayoutTests/imported/mathml-in-html5/README.md
  6. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-spaceafterscript3000.woff
  7. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subscriptbaselinedropmin9000.woff
  8. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subscriptshiftdown6000.woff
  9. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subscripttopmax4000.woff
  10. BIN ...-in-html5/fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff
  11. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subsuperscriptgapmin11000.woff
  12. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptbaselinedropmax10000.woff
  13. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptbottommin8000.woff
  14. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptshiftup7000.woff
  15. BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptshiftupcramped5000.woff
  16. +24 −0 ...ests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1-expected.txt
  17. +338 −0 LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1.html
  18. +0 −1 LayoutTests/mathml/msubsup-fuzz-expected.txt
  19. +5 −0 LayoutTests/mathml/opentype/large-operators-italic-correction-expected.txt
  20. +42 −0 LayoutTests/mathml/opentype/large-operators-italic-correction.html
  21. +1 −1 LayoutTests/mathml/presentation/bug95015-expected.html
  22. +1 −1 LayoutTests/mathml/presentation/bug95015.html
  23. +0 −5 LayoutTests/mathml/presentation/multiscripts-noscripts-expected.html
  24. +0 −5 LayoutTests/mathml/presentation/multiscripts-noscripts.html
  25. +2 −2 LayoutTests/mathml/presentation/multiscripts-positions-expected.html
  26. +2 −2 LayoutTests/mathml/presentation/multiscripts-positions.html
  27. +4 −4 LayoutTests/mathml/presentation/scripts-height-expected.html
  28. +4 −4 LayoutTests/mathml/presentation/scripts-height.html
  29. +3 −5 LayoutTests/mathml/presentation/scripts-horizontal-alignment-expected.html
  30. +5 −7 LayoutTests/mathml/presentation/scripts-horizontal-alignment.html
  31. +6 −6 LayoutTests/platform/gtk/accessibility/math-multiscript-attributes-expected.txt
  32. BIN LayoutTests/platform/gtk/mathml/presentation/roots-expected.png
  33. +16 −18 LayoutTests/platform/gtk/mathml/presentation/roots-expected.txt
  34. +4 −0 LayoutTests/platform/ios-simulator/TestExpectations
  35. +33 −35 LayoutTests/platform/ios-simulator/mathml/presentation/roots-expected.txt
  36. +3 −0 LayoutTests/platform/mac/TestExpectations
  37. +52 −0 Source/WebCore/ChangeLog
  38. +2 −6 Source/WebCore/css/mathml.css
  39. +330 −401 Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
  40. +14 −60 Source/WebCore/rendering/mathml/RenderMathMLScripts.h
@@ -1,3 +1,60 @@
2016-04-18 Frederic Wang <fwang@igalia.com>

Refactor RenderMathMLScripts layout to avoid using flexbox
https://bugs.webkit.org/show_bug.cgi?id=153917

Reviewed by Martin Robinson.

We import tests from the MathML in HTML5 test suite to verify various OpenType MATH parameters.
We also add a test for the italic correction of large operators (bug 130325).
Finally, we adjust some tests and expectations to take into account the new rendering.

* imported/mathml-in-html5/LICENSE: Added.
* imported/mathml-in-html5/README.md: Added.
* imported/mathml-in-html5/fonts/math/scripts-spaceafterscript3000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-spaceafterscript3000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subscriptbaselinedropmin9000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subscriptbaselinedropmin9000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subscriptshiftdown6000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subscriptshiftdown6000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subscripttopmax4000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subscripttopmax4000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff.
* imported/mathml-in-html5/fonts/math/scripts-subsuperscriptgapmin11000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-subsuperscriptgapmin11000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptbaselinedropmax10000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptbaselinedropmax10000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptbottommin8000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptbottommin8000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptshiftup7000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptshiftup7000.woff.
* imported/mathml-in-html5/fonts/math/scripts-superscriptshiftupcramped5000.woff: Renamed from LayoutTests/mathml/mathml-in-html5/fonts/scripts-superscriptshiftupcramped5000.woff.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1-expected.txt: Renamed from LayoutTests/mathml/mathml-in-html5/subsup-parameters-1-expected.txt.
* imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1.html: Renamed from LayoutTests/mathml/mathml-in-html5/subsup-parameters-1.html.
* mathml/msubsup-fuzz-expected.txt: Test adjustment: Update the reference now that nothing
is displayed for invalid markup.
* accessibility/mac/mathml-multiscript-expected.txt: ditto.
* mathml/opentype/large-operators-italic-correction.html: Added. This test verifies that the
italic correction from the MATH table is used for positioning subscripts of large operators.
* mathml/opentype/large-operators-italic-correction-expected.txt: Added.
* mathml/presentation/bug95015.html: Test adjustment: move down a bit the covering red
rectangle, since the script is slightly lower.
* mathml/presentation/bug95015-expected.html: ditto
* mathml/presentation/multiscripts-positions.html: Test adjustment: Modify the expected
vertical positions of scripts now that we follow Gecko's behavior.
* mathml/presentation/multiscripts-positions-expected.html: ditto.
* mathml/presentation/multiscripts-noscripts-expected.html: There seem to be small errors in
the ascent of mmultiscripts, probably due to the conversions between firstLineBaseline (int)
and LayoutUnit (fractional pixel). For now, let's tweak the tests.
* mathml/presentation/multiscripts-noscripts.html: ditto.
* mathml/presentation/scripts-height-expected.html: ditto
* mathml/presentation/scripts-height.html: ditto
* mathml/presentation/scripts-horizontal-alignment.html: Modify the test to make it work
with the new layout rules.
* mathml/presentation/scripts-horizontal-alignment-expected.html: ditto.
* platform/gtk/accessibility/math-multiscript-attributes-expected.txt: Test adjustment:
Update reference to take into account a small shift.
* platform/mac/accessibility/math-multiscript-attributes-expected.txt: ditto.
* platform/gtk/mathml/presentation/roots-expected.png: Test adjustment: Update reference to
take into account small rendering changes.
* platform/gtk/mathml/presentation/roots-expected.txt: ditto.
* platform/ios-simulator/mathml/presentation/roots-expected.txt: ditto.
* platform/mac/TestExpectations: Mark some tests for scripts as failing on mac. MATH fonts
are really needed to make them reliable.
* platform/ios-simulator/TestExpectations: Ditto

2016-04-18 Manuel Rego Casasnovas <rego@igalia.com>

[css-grid] Use grid-template-areas to determine the explicit grid
@@ -2,35 +2,15 @@ A
1
2

A
1
2
3

A
4
5

A
4
5
6

A
1
2
3
4
5
6

A

A
1
3
5
6
This tests checks that mmultiscript tags will create the correct accessibility math hierarchy.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -14,7 +14,7 @@ AXRoleDescription: group
AXChildren:
AXHelp:
AXParent:
AXSize: NSSize: {12, 24}
AXSize: NSSize: {12, 25}
AXTitle:
AXDescription:
AXValue:
@@ -104,7 +104,7 @@ AXRoleDescription: group
AXChildren:
AXHelp:
AXParent:
AXSize: NSSize: {9, 19}
AXSize: NSSize: {10, 19}
AXTitle:
AXDescription:
AXValue:
@@ -134,7 +134,7 @@ AXRoleDescription: group
AXChildren:
AXHelp:
AXParent:
AXSize: NSSize: {9, 18}
AXSize: NSSize: {10, 18}
AXTitle:
AXDescription:
AXValue:
@@ -0,0 +1,3 @@
This repository is covered by the dual-licensing approach described in:

http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
@@ -0,0 +1,47 @@
# Tests for the MathML in HTML5 implementation note

This repository contains tests for the
[MathML in HTML5 implementation note](http://www.mathml-association.org/MathMLinHTML5/).
We follow the formats and conventions of
[W3C's Test the Web Forward Project](http://testthewebforward.org/),
please read their documentation for details. The main goals are:
- helping implementers to verify conformance with the technical description
given in the MathML in HTML5 note.
- provide a set of automatable tests to integrate into the testing framework of
web browser developers.

## Installation

You must at least install [git](http://git-scm.com/) and
[python](http://python.org/). Clone the repository with

$ git clone --recursive https://github.com/username/MathMLinHTML5-tests.git

If you cloned the repository without --recursive, you will likely have empty
`resources` and `tools` directories at the root of your cloned repo. You can
clone the submodules with these additional steps:

$ cd MathMLinHTML5-tests
$ git submodule update --init --recursive

Next, generate the MANIFEST.json file with the following command:

$ python tools/manifest/update.py

To verify the tests in your browser, you also need to setup a web server whose
root points to the root of the cloned repo. For a quick setup, you can just run
the `serve.py` Python script at the root:

$ python server.py

Finally, open `index.html` at the web server root to get an overview of all the
tests. Using W3C's wptserve has not been tried but the tests can easily be
imported into other automated testing framework anyway.

## Note on Web fonts

Many of the tests verify OpenType features and require specific Web fonts for
that purpose. WOFF fonts are generated using the Python API of
[fontforge](https://github.com/fontforge/fontforge/). A recent enough version
of FontForge is necessary so that it includes fixes for [WOFF checkSumAdjustment](https://github.com/fontforge/fontforge/issues/926), [USE_TYPO_METRICS flag](https://github.com/fontforge/fontforge/pull/2274) and various bugs in OpenType
MATH.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,24 @@














PASS SpaceAfterScript
PASS SuperscriptShiftUp
PASS SubscriptShiftDown
PASS SubSuperscriptGapMin
PASS SuperscriptBottomMaxWithSubscript
PASS SubscriptTopMax
PASS SuperscriptBottomMin
PASS SubscriptBaselineDrop
PASS SuperscriptBaselineDrop

0 comments on commit 1341965

Please sign in to comment.