Skip to content

Commit

Permalink
MathML <mroot>: clamp RadicalKernBefore/AfterDegree
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=276427

Reviewed by Rob Buis.

Implements the clamping described in MathML Core.
See https://w3c.github.io/mathml-core/#root-with-index

* LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/radic3als/root-parameters-2-expected.txt: This test passes.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/not-participating-to-parent-layout-expected.txt: tweak the failure message.
* LayoutTests/imported/w3c/web-platform-tests/mathml/relations/css-styling/width-height-001-expected.txt: ditto.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/mathml/relations/css-styling/width-height-001-expected.txt: ditto.
* LayoutTests/platform/glib/mathml/presentation/roots-expected.txt: update render tree expectation.
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/mathml/relations/css-styling/not-participating-to-parent-layout-expected.txt: tweak the failure message.
* LayoutTests/platform/ios/mathml/presentation/roots-expected.txt: update render tree expectation.
* LayoutTests/platform/mac/mathml/presentation/roots-expected.txt: update render tree expectation.
* Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::horizontalParameters): add a indexWidth parameter and perform the clamping fromt the spec.
(WebCore::RenderMathMLRoot::computePreferredLogicalWidths): pass the preferred width of the index to the helper.
(WebCore::RenderMathMLRoot::layoutBlock): pass the width of the index to the helper.
(WebCore::RenderMathMLRoot::paint): ditto.
* Source/WebCore/rendering/mathml/RenderMathMLRoot.h: add indexWidth parameter too.

Canonical link: https://commits.webkit.org/280902@main
  • Loading branch information
fred-wang committed Jul 12, 2024
1 parent d8014cf commit 07c9448
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 175 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FAIL RadicalKernBeforeDegree = -1em < 0 assert_approx_equals: should be clamped to 0 expected 0 +/- 1 but got -10
FAIL RadicalKernBeforeAfterDegree = -5em < -3em = -degree's inline size assert_approx_equals: should be clamped to 3em expected 30 +/- 1 but got 50
PASS RadicalKernBeforeDegree = -1em < 0
PASS RadicalKernBeforeAfterDegree = -5em < -3em = -degree's inline size


Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ PASS mphantom layout is not affected by children with "position: fixed" style
PASS mroot preferred width calculation is not affected by children with "display: none" style
PASS mroot layout is not affected by children with "display: none" style
PASS mroot preferred width calculation is not affected by children with "position: absolute" style
FAIL mroot layout is not affected by children with "position: absolute" style assert_approx_equals: inline size expected 8.375 +/- 1 but got 0
FAIL mroot layout is not affected by children with "position: absolute" style assert_approx_equals: inline size expected 13.734375 +/- 1 but got 0
PASS mroot preferred width calculation is not affected by children with "position: fixed" style
FAIL mroot layout is not affected by children with "position: fixed" style assert_approx_equals: inline size expected 8.375 +/- 1 but got 0
FAIL mroot layout is not affected by children with "position: fixed" style assert_approx_equals: inline size expected 13.734375 +/- 1 but got 0
PASS mrow preferred width calculation is not affected by children with "display: none" style
PASS mrow layout is not affected by children with "display: none" style
PASS mrow preferred width calculation is not affected by children with "display: contents" style
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ FAIL width and height properties on mpadded assert_approx_equals: width expected
FAIL inline-size and block-size properties on mpadded assert_approx_equals: width expected 600 +/- 1 but got 0
FAIL width and height properties on mphantom assert_approx_equals: width expected 500 +/- 1 but got 0
FAIL inline-size and block-size properties on mphantom assert_approx_equals: width expected 600 +/- 1 but got 0
FAIL width and height properties on mroot assert_approx_equals: width expected 500 +/- 1 but got 8.375
FAIL inline-size and block-size properties on mroot assert_approx_equals: width expected 600 +/- 1 but got 8.375
FAIL width and height properties on mroot assert_approx_equals: width expected 500 +/- 1 but got 13.734375
FAIL inline-size and block-size properties on mroot assert_approx_equals: width expected 600 +/- 1 but got 13.734375
FAIL width and height properties on mrow assert_approx_equals: width expected 500 +/- 1 but got 0
FAIL inline-size and block-size properties on mrow assert_approx_equals: width expected 600 +/- 1 but got 0
PASS width and height properties on ms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ FAIL width and height properties on mpadded assert_approx_equals: width expected
FAIL inline-size and block-size properties on mpadded assert_approx_equals: width expected 600 +/- 1 but got 0
FAIL width and height properties on mphantom assert_approx_equals: width expected 500 +/- 1 but got 0
FAIL inline-size and block-size properties on mphantom assert_approx_equals: width expected 600 +/- 1 but got 0
FAIL width and height properties on mroot assert_approx_equals: width expected 500 +/- 1 but got 8.546875
FAIL inline-size and block-size properties on mroot assert_approx_equals: width expected 600 +/- 1 but got 8.546875
FAIL width and height properties on mroot assert_approx_equals: width expected 500 +/- 1 but got 17.4375
FAIL inline-size and block-size properties on mroot assert_approx_equals: width expected 600 +/- 1 but got 17.4375
FAIL width and height properties on mrow assert_approx_equals: width expected 500 +/- 1 but got 0
FAIL inline-size and block-size properties on mrow assert_approx_equals: width expected 600 +/- 1 but got 0
PASS width and height properties on ms
Expand Down
102 changes: 51 additions & 51 deletions LayoutTests/platform/glib/mathml/presentation/roots-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ layer at (0,0) size 800x546
RenderBlock {p} at (0,152) size 784x20
RenderText {#text} at (0,0) size 173x17
text run at (0,0) width 173: "cube root (should be blue): "
RenderMathMLMath {math} at (173,1) size 22x18 [color=#0000FF]
RenderMathMLRoot {mroot} at (0,0) size 22x18
RenderMathMLToken {mn} at (13,2) size 9x12
RenderMathMLMath {math} at (173,1) size 26x18 [color=#0000FF]
RenderMathMLRoot {mroot} at (0,0) size 26x18
RenderMathMLToken {mn} at (17,2) size 9x12
RenderBlock (anonymous) at (0,0) size 8x11
RenderText {#text} at (0,-46) size 8x106
text run at (0,-46) width 8: "2"
Expand Down Expand Up @@ -285,9 +285,9 @@ layer at (0,0) size 800x546
RenderBlock {p} at (0,384) size 784x58
RenderText {#text} at (0,21) size 110x17
text run at (0,21) width 110: "Imbricated roots: "
RenderMathMLMath {math} at (110,0) size 353x57
RenderMathMLRoot {mroot} at (0,0) size 353x57
RenderMathMLRow {mrow} at (17,2) size 336x55
RenderMathMLMath {math} at (110,0) size 380x57
RenderMathMLRoot {mroot} at (0,0) size 380x57
RenderMathMLRow {mrow} at (21,2) size 359x55
RenderMathMLToken {mn} at (0,22) size 8x11
RenderBlock (anonymous) at (0,0) size 8x11
RenderText {#text} at (0,-46) size 8x106
Expand All @@ -296,8 +296,8 @@ layer at (0,0) size 800x546
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12: "+"
RenderMathMLRoot {mroot} at (27,0) size 308x55
RenderMathMLRow {mrow} at (17,2) size 291x53
RenderMathMLRoot {mroot} at (27,0) size 331x55
RenderMathMLRow {mrow} at (21,2) size 310x53
RenderMathMLToken {mn} at (0,20) size 8x11
RenderBlock (anonymous) at (0,0) size 8x11
RenderText {#text} at (0,-46) size 8x106
Expand All @@ -306,8 +306,8 @@ layer at (0,0) size 800x546
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12: "+"
RenderMathMLRoot {mroot} at (27,0) size 263x53
RenderMathMLRow {mrow} at (17,2) size 246x51
RenderMathMLRoot {mroot} at (27,0) size 283x53
RenderMathMLRow {mrow} at (21,2) size 262x51
RenderMathMLToken {mn} at (0,18) size 8x12
RenderBlock (anonymous) at (0,0) size 8x12
RenderText {#text} at (0,-46) size 8x106
Expand All @@ -316,8 +316,8 @@ layer at (0,0) size 800x546
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12: "+"
RenderMathMLRoot {mroot} at (27,0) size 219x51
RenderMathMLRow {mrow} at (17,2) size 202x49
RenderMathMLRoot {mroot} at (27,0) size 234x51
RenderMathMLRow {mrow} at (21,2) size 213x49
RenderMathMLToken {mn} at (0,16) size 8x11
RenderBlock (anonymous) at (0,0) size 8x11
RenderText {#text} at (0,-46) size 8x106
Expand All @@ -326,8 +326,8 @@ layer at (0,0) size 800x546
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12: "+"
RenderMathMLRoot {mroot} at (27,0) size 174x49
RenderMathMLRow {mrow} at (16,2) size 158x41
RenderMathMLRoot {mroot} at (27,0) size 186x49
RenderMathMLRow {mrow} at (20,2) size 166x41
RenderMathMLToken {mn} at (0,14) size 8x12
RenderBlock (anonymous) at (0,0) size 8x12
RenderText {#text} at (0,-46) size 8x106
Expand All @@ -336,8 +336,8 @@ layer at (0,0) size 800x546
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12: "+"
RenderMathMLRoot {mroot} at (27,0) size 130x41
RenderMathMLRow {mrow} at (16,2) size 114x31
RenderMathMLRoot {mroot} at (27,0) size 138x41
RenderMathMLRow {mrow} at (20,2) size 118x31
RenderMathMLToken {mn} at (0,12) size 8x12
RenderBlock (anonymous) at (0,0) size 8x12
RenderText {#text} at (0,-46) size 8x106
Expand All @@ -346,8 +346,8 @@ layer at (0,0) size 800x546
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12: "+"
RenderMathMLRoot {mroot} at (27,0) size 87x31
RenderMathMLRow {mrow} at (16,2) size 71x26
RenderMathMLRoot {mroot} at (27,0) size 91x31
RenderMathMLRow {mrow} at (20,2) size 71x26
RenderMathMLToken {mn} at (0,10) size 8x12
RenderBlock (anonymous) at (0,0) size 8x12
RenderText {#text} at (0,-46) size 8x106
Expand Down Expand Up @@ -411,68 +411,68 @@ layer at (0,0) size 800x546
RenderBlock {p} at (0,457) size 784x58
RenderText {#text} at (0,21) size 73x17
text run at (0,21) width 73: "RTL roots: "
RenderMathMLMath {math} at (72,0) size 353x57
RenderMathMLRoot {mroot} at (0,0) size 353x57
RenderMathMLRow {mrow} at (0,2) size 335x55
RenderMathMLToken {mn} at (326,22) size 9x11
RenderMathMLMath {math} at (72,0) size 380x57
RenderMathMLRoot {mroot} at (0,0) size 380x57
RenderMathMLRow {mrow} at (0,2) size 358x55
RenderMathMLToken {mn} at (349,22) size 9x11
RenderBlock (anonymous) at (0,0) size 8x11
RenderText {#text} at (0,-46) size 8x106
text run at (0,-46) width 8: "1"
RenderMathMLOperator {mo} at (307,23) size 20x12
RenderMathMLOperator {mo} at (330,23) size 20x12
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12 RTL: "+"
RenderMathMLRoot {mroot} at (0,0) size 308x55
RenderMathMLRow {mrow} at (0,2) size 290x53
RenderMathMLToken {mn} at (281,20) size 9x11
RenderMathMLRoot {mroot} at (0,0) size 331x55
RenderMathMLRow {mrow} at (0,2) size 310x53
RenderMathMLToken {mn} at (301,20) size 9x11
RenderBlock (anonymous) at (0,0) size 8x11
RenderText {#text} at (0,-46) size 8x106
text run at (0,-46) width 8: "2"
RenderMathMLOperator {mo} at (262,21) size 20x12
RenderMathMLOperator {mo} at (282,21) size 20x12
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12 RTL: "+"
RenderMathMLRoot {mroot} at (0,0) size 263x53
RenderMathMLRow {mrow} at (0,2) size 246x51
RenderMathMLToken {mn} at (237,18) size 9x12
RenderMathMLRoot {mroot} at (0,0) size 283x53
RenderMathMLRow {mrow} at (0,2) size 261x51
RenderMathMLToken {mn} at (252,18) size 9x12
RenderBlock (anonymous) at (0,0) size 8x12
RenderText {#text} at (0,-46) size 8x106
text run at (0,-46) width 8: "3"
RenderMathMLOperator {mo} at (218,19) size 20x12
RenderMathMLOperator {mo} at (233,19) size 20x12
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12 RTL: "+"
RenderMathMLRoot {mroot} at (0,0) size 219x51
RenderMathMLRow {mrow} at (0,2) size 201x49
RenderMathMLToken {mn} at (192,16) size 9x11
RenderMathMLRoot {mroot} at (0,0) size 234x51
RenderMathMLRow {mrow} at (0,2) size 213x49
RenderMathMLToken {mn} at (204,16) size 9x11
RenderBlock (anonymous) at (0,0) size 8x11
RenderText {#text} at (0,-46) size 8x106
text run at (0,-46) width 8: "4"
RenderMathMLOperator {mo} at (173,17) size 20x12
RenderMathMLOperator {mo} at (185,17) size 20x12
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12 RTL: "+"
RenderMathMLRoot {mroot} at (0,0) size 174x49
RenderMathMLRow {mrow} at (0,2) size 157x41
RenderMathMLToken {mn} at (148,14) size 9x12
RenderMathMLRoot {mroot} at (0,0) size 186x49
RenderMathMLRow {mrow} at (0,2) size 165x41
RenderMathMLToken {mn} at (156,14) size 9x12
RenderBlock (anonymous) at (0,0) size 8x12
RenderText {#text} at (0,-46) size 8x106
text run at (0,-46) width 8: "5"
RenderMathMLOperator {mo} at (129,15) size 20x12
RenderMathMLOperator {mo} at (137,15) size 20x12
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12 RTL: "+"
RenderMathMLRoot {mroot} at (0,0) size 130x41
RenderMathMLRow {mrow} at (0,2) size 114x31
RenderMathMLToken {mn} at (105,12) size 9x12
RenderMathMLRoot {mroot} at (0,0) size 138x41
RenderMathMLRow {mrow} at (0,2) size 118x31
RenderMathMLToken {mn} at (109,12) size 9x12
RenderBlock (anonymous) at (0,0) size 8x12
RenderText {#text} at (0,-46) size 8x106
text run at (0,-46) width 8: "6"
RenderMathMLOperator {mo} at (86,13) size 20x12
RenderMathMLOperator {mo} at (90,13) size 20x12
RenderBlock (anonymous) at (3,0) size 13x12
RenderText {#text} at (0,-47) size 12x106
text run at (0,-47) width 12 RTL: "+"
RenderMathMLRoot {mroot} at (0,0) size 87x31
RenderMathMLRoot {mroot} at (0,0) size 91x31
RenderMathMLRow {mrow} at (0,2) size 70x26
RenderMathMLToken {mn} at (61,10) size 9x12
RenderBlock (anonymous) at (0,0) size 8x12
Expand Down Expand Up @@ -505,31 +505,31 @@ layer at (0,0) size 800x546
RenderBlock (anonymous) at (0,0) size 4x4
RenderText {#text} at (0,-28) size 4x60
text run at (0,-28) width 4: "z"
RenderMathMLToken {mn} at (76,5) size 6x8
RenderMathMLToken {mn} at (80,5) size 6x8
RenderBlock (anonymous) at (0,0) size 5x7
RenderText {#text} at (0,-26) size 5x60
text run at (0,-26) width 5: "9"
RenderMathMLToken {mn} at (120,9) size 6x8
RenderMathMLToken {mn} at (128,9) size 6x8
RenderBlock (anonymous) at (0,0) size 5x7
RenderText {#text} at (0,-26) size 5x60
text run at (0,-26) width 5: "8"
RenderMathMLToken {mn} at (164,11) size 6x9
RenderMathMLToken {mn} at (175,11) size 6x9
RenderBlock (anonymous) at (0,0) size 5x8
RenderText {#text} at (0,-25) size 5x60
text run at (0,-25) width 5: "7"
RenderMathMLToken {mn} at (208,13) size 6x8
RenderMathMLToken {mn} at (224,13) size 6x8
RenderBlock (anonymous) at (0,0) size 5x7
RenderText {#text} at (0,-26) size 5x60
text run at (0,-26) width 5: "6"
RenderMathMLToken {mn} at (253,14) size 6x8
RenderMathMLToken {mn} at (272,14) size 6x8
RenderBlock (anonymous) at (0,0) size 5x7
RenderText {#text} at (0,-26) size 5x60
text run at (0,-26) width 5: "5"
RenderMathMLToken {mn} at (297,15) size 6x8
RenderMathMLToken {mn} at (321,15) size 6x8
RenderBlock (anonymous) at (0,0) size 5x7
RenderText {#text} at (0,-25) size 5x60
text run at (0,-25) width 5: "4"
RenderMathMLToken {mn} at (342,16) size 6x8
RenderMathMLToken {mn} at (369,16) size 6x8
RenderBlock (anonymous) at (0,0) size 5x7
RenderText {#text} at (0,-26) size 5x60
text run at (0,-26) width 5: "3"
Expand Down
Loading

0 comments on commit 07c9448

Please sign in to comment.