Bug 276026

Summary: [MathML] <mfrac> with out-of-flow numerator/denominator produces unexpected result
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, changseok, dbarton, esprehn+autocc, ews-watchlist, fred.wang, glenn, koivisto, kondapallykalyan, pdr, simon.fraser, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 179739    
Attachments:
Description Flags
[fast-cq]Patch koivisto: review+

Description zalan 2024-06-28 20:01:55 PDT
<rdar://130757408>
Comment 1 zalan 2024-06-28 20:35:08 PDT
Created attachment 471770 [details]
[fast-cq]Patch
Comment 2 EWS 2024-06-29 13:03:42 PDT
Committed 280505@main (c37d84f4267d): <https://commits.webkit.org/280505@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 471770 [details].
Comment 3 Frédéric Wang (:fredw) 2024-07-03 00:14:47 PDT
Comment on attachment 471770 [details]
[fast-cq]Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=471770&action=review

> COMMIT_MESSAGE:8
> +(Alternatively we can mark such content as invalid as they are certainly expected to be inflow boxes, but the rest of the MathML renderers follow this logic.)

For reference the behavior described in MathML Core (  https://www.w3.org/TR/mathml-core/#fractions-mfrac ):

> 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. 

We should probably review all the MathML elements and see if they follow this logic.
Comment 4 zalan 2024-07-03 05:24:58 PDT
(In reply to Frédéric Wang (:fredw) from comment #3)
> Comment on attachment 471770 [details]
> [fast-cq]Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=471770&action=review
> 
> > COMMIT_MESSAGE:8
> > +(Alternatively we can mark such content as invalid as they are certainly expected to be inflow boxes, but the rest of the MathML renderers follow this logic.)
> 
> For reference the behavior described in MathML Core ( 
> https://www.w3.org/TR/mathml-core/#fractions-mfrac ):
> 
> > 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. 
Thank you!
I did a quick search before submitting this patch and landed on the spec, hence my hesitation in the changelog entry.

> 
> We should probably review all the MathML elements and see if they follow
> this logic.
Yeah, we should certainly do that!
Comment 5 Frédéric Wang (:fredw) 2024-07-04 04:04:51 PDT
(In reply to zalan from comment #4)
> > We should probably review all the MathML elements and see if they follow
> > this logic.
> Yeah, we should certainly do that!

OK apparently I already had opened bug 179739 for that and more recently MathML Core specified how to handle it. I'll propose this task to an Igalia's Coding Experience student.
Comment 6 zalan 2024-07-04 05:24:36 PDT
(In reply to Frédéric Wang (:fredw) from comment #5)
> (In reply to zalan from comment #4)
> > > We should probably review all the MathML elements and see if they follow
> > > this logic.
> > Yeah, we should certainly do that!
> 
> OK apparently I already had opened bug 179739 for that and more recently
> MathML Core specified how to handle it. I'll propose this task to an
> Igalia's Coding Experience student.
Awesome! Thank you for taking care of this!