Use Fraction* parameters from the OpenType MATH table
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jul 2016 15:30:50 +0000 (15:30 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jul 2016 15:30:50 +0000 (15:30 +0000)
commitce2608b24480f4dc8e48e8d25340dfe21d8b4a82
treeaa61bbe83d8187c4fa80fb4bffb3f431b8a86592
parent623879fddaa1eb393fc9e83eea5168c995e36224
Use Fraction* parameters from the OpenType MATH table
https://bugs.webkit.org/show_bug.cgi?id=155639

Source/WebCore:

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

We improve the RenderMathMLFraction so minimal vertical shifts and gaps
from the MATH table (or arbitrary fallback) are used for fractions.
We also change the interpretation of "thick" and "thin" linethickness values
to match Gecko's behavior and the one suggested in the MathML in HTML5 implementation note.

Test: imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1.html

* rendering/mathml/MathMLStyle.cpp:
(WebCore::MathMLStyle::updateStyleIfNeeded): set NeedsLayout after displaystyle change
so that dynamic MathML tests still work.
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::RenderMathMLFraction): Init LayoutUnit members to zero.
(WebCore::RenderMathMLFraction::updateFromElement):
Set new members for fraction gaps and shifts using Fraction* constants or some fallback
values. Change the interpretation of "thick" and "thin".
(WebCore::RenderMathMLFraction::layoutBlock): Use new constants affecting vertical
positions of numerator and denominator.
(WebCore::RenderMathMLFraction::paint): Use m_ascent to set the vertical position
of the fraction bar.
(WebCore::RenderMathMLFraction::firstLineBaseline): We just return m_ascent.
* rendering/mathml/RenderMathMLFraction.h: Make updateFromElement public so that
it can be used in MathMLStyle. Add LayoutUnit members for the ascent of the fraction
and for minimal shifts/gaps values.

LayoutTests:

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

We import a test from the MathML in HTML5 test suite to verify Fraction* parameters.
We also do some small test adjustments.

* TestExpectations: We disable fractions-positions.html for now until it is replaced with a more reliable test.
* imported/mathml-in-html5/fonts/math/fraction-axisheight7000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-denominatorgapmin4000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-denominatorshiftdown3000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-numeratorshiftup11000-rulethickness1000.woff: Added.
* imported/mathml-in-html5/fonts/math/fraction-rulethickness10000.woff: Added.
* imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1-expected.txt: Added.
* imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1.html: Added.
* mathml/presentation/fractions-linethickness-expected.html: Adjust the test to interpret
"thick" and "thin" as suggested the MathML in HTML5 implementation note.
* mathml/presentation/stretchy-depth-height-symmetric.html: Increase error tolerance.
* platform/gtk/mathml/presentation/roots-expected.png: Handle small rendering changes.
* platform/gtk/mathml/presentation/roots-expected.txt: Ditto.
* platform/ios-simulator/mathml/presentation/roots-expected.txt: Ditto.
* platform/mac/mathml/presentation/roots-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-axisheight7000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-denominatorgapmin4000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-denominatorshiftdown3000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-numeratorshiftup11000-rulethickness1000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/fonts/math/fraction-rulethickness10000.woff [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1-expected.txt [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/mathml/presentation-markup/fractions/frac-parameters-1.html [new file with mode: 0644]
LayoutTests/mathml/opentype/fraction-line-expected.html
LayoutTests/mathml/opentype/fraction-line.html
LayoutTests/mathml/presentation/fractions-linethickness-expected.html
LayoutTests/mathml/presentation/stretchy-depth-height-symmetric.html
LayoutTests/platform/gtk/mathml/presentation/roots-expected.png
LayoutTests/platform/gtk/mathml/presentation/roots-expected.txt
LayoutTests/platform/ios-simulator/mathml/presentation/roots-expected.txt
LayoutTests/platform/mac/mathml/presentation/roots-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/mathml/MathMLStyle.cpp
Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
Source/WebCore/rendering/mathml/RenderMathMLFraction.h