Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in interpretation of mfrac's shifts? #123

Closed
fred-wang opened this issue Aug 6, 2019 · 5 comments
Closed

Error in interpretation of mfrac's shifts? #123

fred-wang opened this issue Aug 6, 2019 · 5 comments
Labels
MathML Core Issues affecting the MathML Core specification opentype / tex Issues related to OpenType or TeX rules

Comments

@fred-wang
Copy link

fred-wang commented Aug 6, 2019

cc @rwlbuis

In https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness and https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness, MathML Core follows figure 2 of

https://www.tug.org/~vieth/papers/bachotex2009/ot-math-paper.pdf

which interprets shifts relative to math axis. I would need to check the TeXBook but at least Firefox interpret them relative to the baseline:

https://searchfox.org/mozilla-central/source/layout/mathml/nsMathMLmfracFrame.cpp#360

@fred-wang
Copy link
Author

Basic testcase

<math display="block"
      style="font-family: Latin Modern Math; font-size: 20pt">
  <mfrac>
    <mtext style="background: blue">_A_</mtext>
    <mtext style="background: red">_B_</mtext>
  </mfrac>
</math>

and how it renders in Gecko, WebKit and Chromium (top to bottom):

fraction-shifts

@fred-wang
Copy link
Author

From https://docs.microsoft.com/en-us/typography/opentype/spec/math

"Shift — Defines a vertical shift applied to an element sitting on a baseline."

So I think this means shifts are relative to the baseline. The description for each constant does not give more details.

@fred-wang fred-wang added MathML Core Issues affecting the MathML Core specification need implementation update need specification update Issues requiring specification changes need tests Issues related to writing WPT tests opentype / tex Issues related to OpenType or TeX rules labels Aug 6, 2019
@SergeyMalkin
Copy link

I can confirm nominator shift up and denominator shift down are from baseline. This is consistent with shifts for other math structures, e.g. superscript, where making it relative to math axis doesn't make sense.

We will see how to make it clear in the spec.

@fred-wang
Copy link
Author

@SergeyMalkin Thank you for the confirmation!

I'll update the spec/test. Currently the tests use AxisHeight=0 so they work in all browsers, whether or not they use the baseline or math axis as a reference. I need to change that.

@fred-wang
Copy link
Author

OK spec updated. Waiting for web-platform-tests/wpt#18299 to land before closing.

@fred-wang fred-wang removed need specification update Issues requiring specification changes need tests Issues related to writing WPT tests labels Aug 6, 2019
fred-wang added a commit to web-platform-tests/wpt that referenced this issue Aug 6, 2019
fred-wang added a commit to w3c/mathml-core that referenced this issue Aug 7, 2019
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 9, 2019
… fraction shifts, a=testonly

Automatic update from web-platform-tests
MathML: Use non-zero axis height to test fraction shifts (#18299)

See w3c/mathml#123
--

wpt-commits: 67aa02fa5eece637bf8ed99f0e3e3f52f1b0aa72
wpt-pr: 18299
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 9, 2019
…eight parameter., a=testonly

Automatic update from web-platform-tests
mfrac without bar: Remove test for AxisHeight parameter. (#18323)

AxisHeight is no longer involved in the layout:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123
--

wpt-commits: 3abd8090b7e83bb9271f8a4dcab83dea7b5e97c0
wpt-pr: 18323
xeonchen pushed a commit to xeonchen/gecko that referenced this issue Aug 10, 2019
… fraction shifts, a=testonly

Automatic update from web-platform-tests
MathML: Use non-zero axis height to test fraction shifts (#18299)

See w3c/mathml#123
--

wpt-commits: 67aa02fa5eece637bf8ed99f0e3e3f52f1b0aa72
wpt-pr: 18299
xeonchen pushed a commit to xeonchen/gecko that referenced this issue Aug 10, 2019
…eight parameter., a=testonly

Automatic update from web-platform-tests
mfrac without bar: Remove test for AxisHeight parameter. (#18323)

AxisHeight is no longer involved in the layout:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123
--

wpt-commits: 3abd8090b7e83bb9271f8a4dcab83dea7b5e97c0
wpt-pr: 18323
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 13, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

--HG--
extra : moz-landing-system : lando
dbaron pushed a commit to dbaron/gecko that referenced this issue Aug 14, 2019
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 14, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

--HG--
extra : moz-landing-system : lando
caiolima pushed a commit to caiolima/webkit that referenced this issue Aug 31, 2019
https://bugs.webkit.org/show_bug.cgi?id=201242

Patch by Frederic Wang <fwang@igalia.com> on 2019-08-31
Reviewed by Rob Buis.

LayoutTests/imported/w3c:

Update tests and support files for fractions/stacks parameters.

* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2-expected.txt:
Update expectation now that AxisHeight is no longer involved in stacks.
* web-platform-tests/fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomshiftdown6000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topshiftup9000-axisheight1000.woff: Added.
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-1.html:
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2.html:
* web-platform-tests/mathml/support/feature-detection.js: Added.
(MathMLFeatureDetection.has_mspace):
(MathMLFeatureDetection.has_operator_spacing):
(MathMLFeatureDetection.has_mfrac):
(MathMLFeatureDetection.has_msqrt):
(MathMLFeatureDetection.has_menclose):
(MathMLFeatureDetection.has_dir):
(MathMLFeatureDetection.ensure_for_match_reftest):

Source/WebCore:

In fractions, numerator/denominator shifts are currently interpreted relative to the math
axis while they should be relative to the baseline [1]. This patch refactors the
RenderMathMLFraction to do that and aligns more on MathML Core [2] [3]. This fixes serious
rendering bugs in fractions.

[1] w3c/mathml#123
[2] https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness
[3] https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

No new tests, existing tests updated.

* rendering/mathml/RenderMathMLFraction.h: ascentOverHorizontalAxis() is replaced with
fractionAscent() which gives the actual baseline position rather than the math axis position.
fractionParameters() and stackParameters() are modified so that they only return the shifts,
now stored in a shared FractionParameters struct.
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::fractionParameters const): Store existing parameters in local
variables and perform adjustments to the shift values so that the minimal gap constraints
are satisfied. Return them as a FractionParameters.
(WebCore::RenderMathMLFraction::stackParameters const): Ditto.
(WebCore::RenderMathMLFraction::fractionAscent const): This calculates the ascent above
the baseline as described in [2] [3] and replaces ascentOverHorizontalAxis. To minimize
changeset, this continues to ignore contribution of denominator size and not to distinguish
ink or non-ink metrics.
(WebCore::RenderMathMLFraction::layoutBlock): The position of the denominator is now just
calculated as a shift from the baseline. The height is given by the bottom of the
denominator. The old "ascent + mathAxisHeight() + denominatorDescent" does not make any
sense.
(WebCore::RenderMathMLFraction::paint): Use fractionAscent() instead of
ascentOverHorizontalAxis().
(WebCore::RenderMathMLFraction::firstLineBaseline const): Ditto.

LayoutTests:

* TestExpectations: Skip mathml/presentation/stretchy-depth-height-symmetric.html since it
cannot work in a reliable way and should be rewritten. Equivalent checks seem essentially
covered by WPT test mathml/presentation-markup/operators/mo-axis-height-1.html.
See bug 201356.
* platform/win/mathml/presentation/roots-expected.txt: Update windows expectation.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@249360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
bertogg pushed a commit to Igalia/webkit that referenced this issue Sep 2, 2019
https://bugs.webkit.org/show_bug.cgi?id=201242

Patch by Frederic Wang <fwang@igalia.com> on 2019-08-31
Reviewed by Rob Buis.

LayoutTests/imported/w3c:

Update tests and support files for fractions/stacks parameters.

* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2-expected.txt:
Update expectation now that AxisHeight is no longer involved in stacks.
* web-platform-tests/fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomshiftdown6000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topshiftup9000-axisheight1000.woff: Added.
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-1.html:
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2.html:
* web-platform-tests/mathml/support/feature-detection.js: Added.
(MathMLFeatureDetection.has_mspace):
(MathMLFeatureDetection.has_operator_spacing):
(MathMLFeatureDetection.has_mfrac):
(MathMLFeatureDetection.has_msqrt):
(MathMLFeatureDetection.has_menclose):
(MathMLFeatureDetection.has_dir):
(MathMLFeatureDetection.ensure_for_match_reftest):

Source/WebCore:

In fractions, numerator/denominator shifts are currently interpreted relative to the math
axis while they should be relative to the baseline [1]. This patch refactors the
RenderMathMLFraction to do that and aligns more on MathML Core [2] [3]. This fixes serious
rendering bugs in fractions.

[1] w3c/mathml#123
[2] https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness
[3] https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

No new tests, existing tests updated.

* rendering/mathml/RenderMathMLFraction.h: ascentOverHorizontalAxis() is replaced with
fractionAscent() which gives the actual baseline position rather than the math axis position.
fractionParameters() and stackParameters() are modified so that they only return the shifts,
now stored in a shared FractionParameters struct.
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::fractionParameters const): Store existing parameters in local
variables and perform adjustments to the shift values so that the minimal gap constraints
are satisfied. Return them as a FractionParameters.
(WebCore::RenderMathMLFraction::stackParameters const): Ditto.
(WebCore::RenderMathMLFraction::fractionAscent const): This calculates the ascent above
the baseline as described in [2] [3] and replaces ascentOverHorizontalAxis. To minimize
changeset, this continues to ignore contribution of denominator size and not to distinguish
ink or non-ink metrics.
(WebCore::RenderMathMLFraction::layoutBlock): The position of the denominator is now just
calculated as a shift from the baseline. The height is given by the bottom of the
denominator. The old "ascent + mathAxisHeight() + denominatorDescent" does not make any
sense.
(WebCore::RenderMathMLFraction::paint): Use fractionAscent() instead of
ascentOverHorizontalAxis().
(WebCore::RenderMathMLFraction::firstLineBaseline const): Ditto.

LayoutTests:

* TestExpectations: Skip mathml/presentation/stretchy-depth-height-symmetric.html since it
cannot work in a reliable way and should be rewritten. Equivalent checks seem essentially
covered by WPT test mathml/presentation-markup/operators/mo-axis-height-1.html.
See bug 201356.
* platform/win/mathml/presentation/roots-expected.txt: Update windows expectation.

git-svn-id: http://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.26@249406 268f45cc-cd09-0410-ab3c-d52691b4dbfc
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 4, 2019
… fraction shifts, a=testonly

Automatic update from web-platform-tests
MathML: Use non-zero axis height to test fraction shifts (#18299)

See w3c/mathml#123
--

wpt-commits: 67aa02fa5eece637bf8ed99f0e3e3f52f1b0aa72
wpt-pr: 18299

UltraBlame original commit: ff1a1dfad00a10f6bd4ef00e49b40487696f002c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 4, 2019
…eight parameter., a=testonly

Automatic update from web-platform-tests
mfrac without bar: Remove test for AxisHeight parameter. (#18323)

AxisHeight is no longer involved in the layout:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123
--

wpt-commits: 3abd8090b7e83bb9271f8a4dcab83dea7b5e97c0
wpt-pr: 18323

UltraBlame original commit: a4e156a747af12993126a764404b99124a24d5c5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 4, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

UltraBlame original commit: a5d589b74745dca4d522d3abb362103074b03bde
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 4, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

UltraBlame original commit: aa4c230df929a0387b38bb4e0d13c24142000113
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 4, 2019
… fraction shifts, a=testonly

Automatic update from web-platform-tests
MathML: Use non-zero axis height to test fraction shifts (#18299)

See w3c/mathml#123
--

wpt-commits: 67aa02fa5eece637bf8ed99f0e3e3f52f1b0aa72
wpt-pr: 18299

UltraBlame original commit: ff1a1dfad00a10f6bd4ef00e49b40487696f002c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 4, 2019
…eight parameter., a=testonly

Automatic update from web-platform-tests
mfrac without bar: Remove test for AxisHeight parameter. (#18323)

AxisHeight is no longer involved in the layout:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123
--

wpt-commits: 3abd8090b7e83bb9271f8a4dcab83dea7b5e97c0
wpt-pr: 18323

UltraBlame original commit: a4e156a747af12993126a764404b99124a24d5c5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 4, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

UltraBlame original commit: a5d589b74745dca4d522d3abb362103074b03bde
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
… fraction shifts, a=testonly

Automatic update from web-platform-tests
MathML: Use non-zero axis height to test fraction shifts (#18299)

See w3c/mathml#123
--

wpt-commits: 67aa02fa5eece637bf8ed99f0e3e3f52f1b0aa72
wpt-pr: 18299

UltraBlame original commit: ff1a1dfad00a10f6bd4ef00e49b40487696f002c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
…eight parameter., a=testonly

Automatic update from web-platform-tests
mfrac without bar: Remove test for AxisHeight parameter. (#18323)

AxisHeight is no longer involved in the layout:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123
--

wpt-commits: 3abd8090b7e83bb9271f8a4dcab83dea7b5e97c0
wpt-pr: 18323

UltraBlame original commit: a4e156a747af12993126a764404b99124a24d5c5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

UltraBlame original commit: a5d589b74745dca4d522d3abb362103074b03bde
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 4, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

UltraBlame original commit: aa4c230df929a0387b38bb4e0d13c24142000113
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
…nts without bar. r=emilio

AxisHeight is not involved in the layout of <mfrac> with zero linethickness:
https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

Confirmed by Microsoft:
https://lists.w3.org/Archives/Public/public-mathml4/2019Aug/0019.html

See w3c/mathml#123

Differential Revision: https://phabricator.services.mozilla.com/D41189

UltraBlame original commit: aa4c230df929a0387b38bb4e0d13c24142000113
ryanhaddad pushed a commit to WebKit/WebKit that referenced this issue Dec 22, 2020
https://bugs.webkit.org/show_bug.cgi?id=201242

Patch by Frederic Wang <fwang@igalia.com> on 2019-08-31
Reviewed by Rob Buis.

LayoutTests/imported/w3c:

Update tests and support files for fractions/stacks parameters.

* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2-expected.txt:
Update expectation now that AxisHeight is no longer involved in stacks.
* web-platform-tests/fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomshiftdown6000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topshiftup9000-axisheight1000.woff: Added.
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-1.html:
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2.html:
* web-platform-tests/mathml/support/feature-detection.js: Added.
(MathMLFeatureDetection.has_mspace):
(MathMLFeatureDetection.has_operator_spacing):
(MathMLFeatureDetection.has_mfrac):
(MathMLFeatureDetection.has_msqrt):
(MathMLFeatureDetection.has_menclose):
(MathMLFeatureDetection.has_dir):
(MathMLFeatureDetection.ensure_for_match_reftest):

Source/WebCore:

In fractions, numerator/denominator shifts are currently interpreted relative to the math
axis while they should be relative to the baseline [1]. This patch refactors the
RenderMathMLFraction to do that and aligns more on MathML Core [2] [3]. This fixes serious
rendering bugs in fractions.

[1] w3c/mathml#123
[2] https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness
[3] https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

No new tests, existing tests updated.

* rendering/mathml/RenderMathMLFraction.h: ascentOverHorizontalAxis() is replaced with
fractionAscent() which gives the actual baseline position rather than the math axis position.
fractionParameters() and stackParameters() are modified so that they only return the shifts,
now stored in a shared FractionParameters struct.
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::fractionParameters const): Store existing parameters in local
variables and perform adjustments to the shift values so that the minimal gap constraints
are satisfied. Return them as a FractionParameters.
(WebCore::RenderMathMLFraction::stackParameters const): Ditto.
(WebCore::RenderMathMLFraction::fractionAscent const): This calculates the ascent above
the baseline as described in [2] [3] and replaces ascentOverHorizontalAxis. To minimize
changeset, this continues to ignore contribution of denominator size and not to distinguish
ink or non-ink metrics.
(WebCore::RenderMathMLFraction::layoutBlock): The position of the denominator is now just
calculated as a shift from the baseline. The height is given by the bottom of the
denominator. The old "ascent + mathAxisHeight() + denominatorDescent" does not make any
sense.
(WebCore::RenderMathMLFraction::paint): Use fractionAscent() instead of
ascentOverHorizontalAxis().
(WebCore::RenderMathMLFraction::firstLineBaseline const): Ditto.

LayoutTests:

* TestExpectations: Skip mathml/presentation/stretchy-depth-height-symmetric.html since it
cannot work in a reliable way and should be rewritten. Equivalent checks seem essentially
covered by WPT test mathml/presentation-markup/operators/mo-axis-height-1.html.
See bug 201356.
* platform/win/mathml/presentation/roots-expected.txt: Update windows expectation.

Canonical link: https://commits.webkit.org/215029@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JonWBedard pushed a commit to WebKit/WebKit that referenced this issue Dec 1, 2022
https://bugs.webkit.org/show_bug.cgi?id=201242

Patch by Frederic Wang <fwang@igalia.com> on 2019-08-31
Reviewed by Rob Buis.

LayoutTests/imported/w3c:

Update tests and support files for fractions/stacks parameters.

* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2-expected.txt:
Update expectation now that AxisHeight is no longer involved in stacks.
* web-platform-tests/fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-bottomshiftdown6000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff: Added.
* web-platform-tests/fonts/math/stack-topshiftup9000-axisheight1000.woff: Added.
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-1.html:
* web-platform-tests/mathml/presentation-markup/fractions/frac-parameters-2.html:
* web-platform-tests/mathml/support/feature-detection.js: Added.
(MathMLFeatureDetection.has_mspace):
(MathMLFeatureDetection.has_operator_spacing):
(MathMLFeatureDetection.has_mfrac):
(MathMLFeatureDetection.has_msqrt):
(MathMLFeatureDetection.has_menclose):
(MathMLFeatureDetection.has_dir):
(MathMLFeatureDetection.ensure_for_match_reftest):

Source/WebCore:

In fractions, numerator/denominator shifts are currently interpreted relative to the math
axis while they should be relative to the baseline [1]. This patch refactors the
RenderMathMLFraction to do that and aligns more on MathML Core [2] [3]. This fixes serious
rendering bugs in fractions.

[1] w3c/mathml#123
[2] https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness
[3] https://mathml-refresh.github.io/mathml-core/#fraction-with-zero-line-thickness

No new tests, existing tests updated.

* rendering/mathml/RenderMathMLFraction.h: ascentOverHorizontalAxis() is replaced with
fractionAscent() which gives the actual baseline position rather than the math axis position.
fractionParameters() and stackParameters() are modified so that they only return the shifts,
now stored in a shared FractionParameters struct.
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::fractionParameters const): Store existing parameters in local
variables and perform adjustments to the shift values so that the minimal gap constraints
are satisfied. Return them as a FractionParameters.
(WebCore::RenderMathMLFraction::stackParameters const): Ditto.
(WebCore::RenderMathMLFraction::fractionAscent const): This calculates the ascent above
the baseline as described in [2] [3] and replaces ascentOverHorizontalAxis. To minimize
changeset, this continues to ignore contribution of denominator size and not to distinguish
ink or non-ink metrics.
(WebCore::RenderMathMLFraction::layoutBlock): The position of the denominator is now just
calculated as a shift from the baseline. The height is given by the bottom of the
denominator. The old "ascent + mathAxisHeight() + denominatorDescent" does not make any
sense.
(WebCore::RenderMathMLFraction::paint): Use fractionAscent() instead of
ascentOverHorizontalAxis().
(WebCore::RenderMathMLFraction::firstLineBaseline const): Ditto.

LayoutTests:

* TestExpectations: Skip mathml/presentation/stretchy-depth-height-symmetric.html since it
cannot work in a reliable way and should be rewritten. Equivalent checks seem essentially
covered by WPT test mathml/presentation-markup/operators/mo-axis-height-1.html.
See bug 201356.
* platform/win/mathml/presentation/roots-expected.txt: Update windows expectation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MathML Core Issues affecting the MathML Core specification opentype / tex Issues related to OpenType or TeX rules
Projects
None yet
Development

No branches or pull requests

2 participants