RESOLVED FIXED Bug 123348
[MathML] Layout invalid markup as an <mrow>
https://bugs.webkit.org/show_bug.cgi?id=123348
Summary [MathML] Layout invalid markup as an <mrow>
Brent Fulgham
Reported 2013-10-25 11:04:59 PDT
Currently, certain invalid MathML documents (such as a MathML document containing arbitrary HTML markup) is rendered improperly. According to the MathML specification, we should be providing better error information. From http://www.w3.org/TR/MathML3/chapter6.html), Section 6.4 Combining MathML and Other Formats: "In the standard schema, elements from other namespaces are not allowed, but attributes from other namespaces are permitted. MathML processors that encounter unknown XML markup should behave as follows: An attribute from a non-MathML namespace should be silently ignored. An element from a non-MathML namespace should be treated as an error, except in an annotation-xml element. If the element is a child of a presentation element, it should be handled as described in Section 3.3.5 Error Message <merror>. If the element is a child of a content element, it should be handled as described in Section 4.2.9 Error Markup <cerror>. For example, if the second child of an mfrac element is an unknown element, the fraction should be rendered with a denominator that indicates the error."
Attachments
testcase (719 bytes, text/html)
2013-10-27 05:25 PDT, Frédéric Wang (:fredw)
no flags
Martin Robinson
Comment 1 2013-10-25 13:55:49 PDT
I looked at the torture tests in WebKitGTK+ and they seem fine.
Brent Fulgham
Comment 2 2013-10-25 16:32:06 PDT
See also http://www.whatwg.org/specs/web-apps/current-work/multipage/the-map-element.html#mathml: "User agents must act as if any MathML element whose contents does not match the element's content model was replaced, for the purposes of MathML layout and rendering, by an merror element in the MathML namespace containing some appropriate error message."
Frédéric Wang (:fredw)
Comment 3 2013-10-27 05:25:03 PDT
Created attachment 215269 [details] testcase
Brent Fulgham
Comment 4 2013-10-28 09:34:34 PDT
(In reply to comment #1) > I looked at the torture tests in WebKitGTK+ and they seem fine. I think this comment was intended for Bug 121728. :-)
Frédéric Wang (:fredw)
Comment 5 2016-03-14 03:58:56 PDT
At the moment, the choice in the in-progress MathML refactoring is just to not display anything for invalid markup. However, we may do something as in Gecko and the refactoring will make that much easier. So I'm making this depends on bug 153991. (That said, I suspect we want to spend more time on supporting valid markup than on deciding a fallback rendering for invalid markup...)
Frédéric Wang (:fredw)
Comment 6 2022-08-30 02:54:56 PDT
Renaming the bug. MathML Core says to render invalid markup as an mrow, for example: "If the <mfrac> element has less or more than two in-flow children, its layout algorithm is the same as the <mrow> element. Otherwise, the first in-flow child is called numerator, the second in-flow child is called denominator and the layout algorithm is explained below." Chromium does that, and there is a plan for Firefox to align with that behavior.
Radar WebKit Bug Importer
Comment 7 2022-08-30 09:51:35 PDT
Frédéric Wang (:fredw)
Comment 8 2022-12-08 05:34:25 PST
Firefox 106 and Chrome 109 implements the "mrow fallback" behavior described in the MathML Core specification and there is a WPT test for that: https://wpt.fyi/results/mathml/presentation-markup/mrow/mrow-fallback.html
Harry Chen
Comment 9 2024-07-11 11:44:56 PDT
EWS
Comment 10 2024-07-22 16:17:42 PDT
Committed 281218@main (eaf4e99ac1b0): <https://commits.webkit.org/281218@main> Reviewed commits have been landed. Closing PR #30705 and removing active labels.
WebKit Commit Bot
Comment 11 2024-07-22 16:25:14 PDT
Re-opened since this is blocked by bug 276917
Andy Estes
Comment 12 2024-07-22 16:38:18 PDT
Reverted this by mistake. The revert has been undone in https://commits.webkit.org/281221@main.
Note You need to log in before you can comment on or make changes to this bug.