Bug 281232

Summary: <mspace width="1ch"> doens't work
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: MathMLAssignee: Harry Chen <hchen>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, fred.wang, hchen, karlcow, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugzilla.mozilla.org/show_bug.cgi?id=1574751
https://bugzilla.mozilla.org/show_bug.cgi?id=1924672
Attachments:
Description Flags
Test case none

Simon Fraser (smfr)
Reported 2024-10-10 10:03:25 PDT
Created attachment 472896 [details] Test case <mspace width="1ch"> doesn't work in Safari or Firefox. It works in Chrome.
Attachments
Test case (300 bytes, text/html)
2024-10-10 10:03 PDT, Simon Fraser (smfr)
no flags
Radar WebKit Bug Importer
Comment 1 2024-10-10 10:04:29 PDT
Simon Fraser (smfr)
Comment 2 2024-10-10 10:04:53 PDT
Testcase is derived from a PR on the AVIF spec, so this has real-world impact.
Frédéric Wang (:fredw)
Comment 3 2024-10-10 10:25:30 PDT
Thanks the issue is probably that Firefox and WebKit initially relied on the MathML definition of lengths from MathML3 which does not accept ch. They haven't completely migrated to MathML Core's definition, which is just CSS's <length-percentage>: https://developer.mozilla.org/en-US/docs/Web/MathML/Values#legacy_mathml_lengths Regarding tests, web-platform-tests/mathml/relations/css-styling/lengths-1.html web-platform-tests/mathml/relations/css-styling/lengths-2.html don't seem to cover this case. Ideally, we should just switch to the CSS parser for MathML lengths, but meanwhile we could just tweak MathMLElement::LengthType to handle this unit.
Frédéric Wang (:fredw)
Comment 4 2024-10-15 03:16:11 PDT
Comparing https://drafts.csswg.org/css-values/#length-value Vs https://www.w3.org/TR/MathML3/chapter2.html#fund.units the following are missing: ch cap ic vm vh vi vmin vmax rem lh rlh Maybe a first step would be to switch from MathMLElement::Length to CSSValue (see https://searchfox.org/wubkat/rev/cde6cf2e21001cb4055a5f891ce3d7abe5eee3e9/Source/WebCore/css/CSSUnits.h#57) similar to what Firefox does. I guess ideally we should just map MathML attribute values to presentational hints similar to what we do for mathsize for example: https://searchfox.org/wubkat/search?q=addPropertyToPresentationalHintStyle&path=Source%2FWebCore%2Fmathml&case=false&regexp=false ; but using internal (non-webexposed) CSS properties instead. But probably this can be for follow-up bugs.
Frédéric Wang (:fredw)
Comment 5 2024-10-17 01:04:47 PDT
Assigning to Harry, he is willing to give a try.
Note You need to log in before you can comment on or make changes to this bug.