Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
with
1,001 additions
and 586 deletions.
- +57 −0 LayoutTests/ChangeLog
- +0 −20 LayoutTests/accessibility/mac/mathml-multiscript-expected.txt
- +3 −3 LayoutTests/accessibility/math-multiscript-attributes-expected.txt
- +3 −0 LayoutTests/imported/mathml-in-html5/LICENSE
- +47 −0 LayoutTests/imported/mathml-in-html5/README.md
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-spaceafterscript3000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subscriptbaselinedropmin9000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subscriptshiftdown6000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subscripttopmax4000.woff
- BIN ...-in-html5/fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-subsuperscriptgapmin11000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptbaselinedropmax10000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptbottommin8000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptshiftup7000.woff
- BIN LayoutTests/imported/mathml-in-html5/fonts/math/scripts-superscriptshiftupcramped5000.woff
- +24 −0 ...ests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1-expected.txt
- +338 −0 LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/scripts/subsup-parameters-1.html
- +0 −1 LayoutTests/mathml/msubsup-fuzz-expected.txt
- +5 −0 LayoutTests/mathml/opentype/large-operators-italic-correction-expected.txt
- +42 −0 LayoutTests/mathml/opentype/large-operators-italic-correction.html
- +1 −1 LayoutTests/mathml/presentation/bug95015-expected.html
- +1 −1 LayoutTests/mathml/presentation/bug95015.html
- +0 −5 LayoutTests/mathml/presentation/multiscripts-noscripts-expected.html
- +0 −5 LayoutTests/mathml/presentation/multiscripts-noscripts.html
- +2 −2 LayoutTests/mathml/presentation/multiscripts-positions-expected.html
- +2 −2 LayoutTests/mathml/presentation/multiscripts-positions.html
- +4 −4 LayoutTests/mathml/presentation/scripts-height-expected.html
- +4 −4 LayoutTests/mathml/presentation/scripts-height.html
- +3 −5 LayoutTests/mathml/presentation/scripts-horizontal-alignment-expected.html
- +5 −7 LayoutTests/mathml/presentation/scripts-horizontal-alignment.html
- +6 −6 LayoutTests/platform/gtk/accessibility/math-multiscript-attributes-expected.txt
- BIN LayoutTests/platform/gtk/mathml/presentation/roots-expected.png
- +16 −18 LayoutTests/platform/gtk/mathml/presentation/roots-expected.txt
- +4 −0 LayoutTests/platform/ios-simulator/TestExpectations
- +33 −35 LayoutTests/platform/ios-simulator/mathml/presentation/roots-expected.txt
- +3 −0 LayoutTests/platform/mac/TestExpectations
- +52 −0 Source/WebCore/ChangeLog
- +2 −6 Source/WebCore/css/mathml.css
- +330 −401 Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
- +14 −60 Source/WebCore/rendering/mathml/RenderMathMLScripts.h
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,24 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
PASS SpaceAfterScript | ||
PASS SuperscriptShiftUp | ||
PASS SubscriptShiftDown | ||
PASS SubSuperscriptGapMin | ||
PASS SuperscriptBottomMaxWithSubscript | ||
PASS SubscriptTopMax | ||
PASS SuperscriptBottomMin | ||
PASS SubscriptBaselineDrop | ||
PASS SuperscriptBaselineDrop | ||
|
Oops, something went wrong.