Skip to content
Permalink
Browse files
Fix <msubsup> formatting, especially for a tall base, subscript, or s…
…uperscript

https://bugs.webkit.org/show_bug.cgi?id=79274

Patch by David Barton <dbarton@mathscribe.com> on 2012-02-27
Reviewed by Julien Chaffraix.

Source/WebCore:

Move the <msubsup> formatting code in stretchToHeight() to layout(). Then revise the
combined code to produce more vertically accurate results, and without extra white
space. Finally, don't multiply msub/msup/msubsup operator stretching by 1.2.

Test: Added the bug report's attached test case to mathml/presentation/subsup.xhtml, and
it and 5 other test files in mathml/presentation now produce improved results. The
integral sign in mo-stretch.html is no longer scaled up by an extra 1.2, and baselines
are more accurate so the base is higher in msubsup-sub-changed.png. Several examples are
slightly tighter vertically, because their (somewhat) anonymous blocks wrapping
subscripts and superscripts now have the correct font size.

* rendering/mathml/RenderMathMLSubSup.cpp:
(WebCore):
(WebCore::RenderMathMLSubSup::addChild):
(WebCore::RenderMathMLSubSup::stretchToHeight):
(WebCore::RenderMathMLSubSup::layout):
* rendering/mathml/RenderMathMLSubSup.h:
(RenderMathMLSubSup):
* rendering/style/RenderStyle.h:

LayoutTests:

* mathml/presentation/subsup.xhtml:
* platform/mac/mathml/presentation/mo-stretch-expected.png: Added property svn:mime-type.
* platform/mac/mathml/presentation/mo-stretch-expected.txt:
* platform/mac/mathml/presentation/msubsup-base-changed-expected.png:
* platform/mac/mathml/presentation/msubsup-base-changed-expected.txt:
* platform/mac/mathml/presentation/msubsup-sub-changed-expected.png:
* platform/mac/mathml/presentation/msubsup-sub-changed-expected.txt:
* platform/mac/mathml/presentation/msubsup-sup-changed-expected.png:
* platform/mac/mathml/presentation/msubsup-sup-changed-expected.txt:
* platform/mac/mathml/presentation/sub-expected.png:
* platform/mac/mathml/presentation/sub-expected.txt:
* platform/mac/mathml/presentation/subsup-expected.png:
* platform/mac/mathml/presentation/subsup-expected.txt:

Canonical link: https://commits.webkit.org/96842@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
DaveBarton authored and webkit-commit-queue committed Feb 28, 2012
1 parent 1a5c11c commit 35b708da7ab85c50fd18932b95c38eb2e9086beb
@@ -1,3 +1,24 @@
2012-02-27 David Barton <dbarton@mathscribe.com>

Fix <msubsup> formatting, especially for a tall base, subscript, or superscript
https://bugs.webkit.org/show_bug.cgi?id=79274

Reviewed by Julien Chaffraix.

* mathml/presentation/subsup.xhtml:
* platform/mac/mathml/presentation/mo-stretch-expected.png: Added property svn:mime-type.
* platform/mac/mathml/presentation/mo-stretch-expected.txt:
* platform/mac/mathml/presentation/msubsup-base-changed-expected.png:
* platform/mac/mathml/presentation/msubsup-base-changed-expected.txt:
* platform/mac/mathml/presentation/msubsup-sub-changed-expected.png:
* platform/mac/mathml/presentation/msubsup-sub-changed-expected.txt:
* platform/mac/mathml/presentation/msubsup-sup-changed-expected.png:
* platform/mac/mathml/presentation/msubsup-sup-changed-expected.txt:
* platform/mac/mathml/presentation/sub-expected.png:
* platform/mac/mathml/presentation/sub-expected.txt:
* platform/mac/mathml/presentation/subsup-expected.png:
* platform/mac/mathml/presentation/subsup-expected.txt:

2012-02-27 Csaba Osztrogonác <ossy@webkit.org>

[Qt] Unreviewed morning gardening.
@@ -40,5 +40,12 @@
<mrow><msubsup><mi>x</mi><mn>1</mn><mi>k</mi></msubsup></mrow>
</math>
</p>
<p id='t6'>parts with various heights:
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<msubsup><mi>x</mi><mi>n</mi><mfrac><mi>f</mi><mi>g</mi></mfrac></msubsup>
<mo>+</mo><msubsup><mi>x</mi><mfrac><mi>f</mi><mi>g</mi></mfrac><mi>n</mi></msubsup>
<mo>+</mo><msubsup><mfenced><mfrac><mi>f</mi><mi>g</mi></mfrac></mfenced><mi>n</mi><mi>x</mi></msubsup>
</math>
</p>
</body>
</html>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -60,8 +60,8 @@ layer at (0,0) size 800x109
text run at (0,25) width 8: "g"
RenderMathMLRow {mrow} at (9,0) size 44x63
RenderMathMLOperator {mo} at (0,0) size 6x63
RenderMathMLSubSup {msubsup} at (6,4) size 32x52
RenderMathMLBlock {msubsup} at (0,3) size 7x34
RenderMathMLSubSup {msubsup} at (6,7) size 32x52
RenderMathMLBlock {msubsup} at (0,0) size 7x34
RenderInline {mi} at (0,0) size 7x16
RenderText {#text} at (0,18) size 7x16
text run at (0,18) width 7: "x"
@@ -107,20 +107,20 @@ layer at (0,0) size 800x109
RenderMathMLBlock {mo} at (0,0) size 9x16
RenderText {mo} at (0,0) size 9x16
text run at (0,0) width 9: "+"
RenderMathMLRow {mrow} at (127,10) size 38x66
RenderMathMLSubSup {msubsup} at (0,0) size 17x66
RenderMathMLBlock {msubsup} at (0,3) size 10x63
RenderMathMLOperator {mo} at (0,0) size 10x63
RenderMathMLBlock {msubsup} at (11,0) size 6x64
RenderMathMLBlock {msubsup} at (0,-4) size 6x16
RenderMathMLRow {mrow} at (127,19) size 38x53
RenderMathMLSubSup {msubsup} at (0,0) size 17x53
RenderMathMLBlock {msubsup} at (0,0) size 10x53
RenderMathMLOperator {mo} at (0,0) size 10x53
RenderMathMLBlock {msubsup} at (11,0) size 6x53
RenderMathMLBlock {msubsup} at (0,0) size 6x41
RenderInline {mi} at (0,0) size 6x12
RenderText {#text} at (0,3) size 6x12
text run at (0,3) width 6: "b"
RenderMathMLBlock {msubsup} at (0,48) size 6x16
RenderText {#text} at (0,0) size 6x12
text run at (0,0) width 6: "b"
RenderMathMLBlock {msubsup} at (0,41) size 6x12
RenderInline {mi} at (0,0) size 6x12
RenderText {#text} at (0,3) size 6x12
text run at (0,3) width 6: "a"
RenderMathMLRow {mrow} at (17,16) size 21x44
RenderText {#text} at (0,0) size 6x12
text run at (0,0) width 6: "a"
RenderMathMLRow {mrow} at (17,7) size 21x44
RenderMathMLUnderOver {munderover} at (0,0) size 17x44
RenderMathMLBlock (anonymous) at (0,0) size 17x16
RenderInline {mi} at (0,0) size 7x12
@@ -258,30 +258,26 @@ layer at (429,71) size 5x2 scrollHeight 14
text run at (0,-3) width 5: "\x{23A5}"
layer at (429,73) size 5x11 scrollHeight 14
RenderMathMLBlock {mo} at (0,52) size 5x11
layer at (445,21) size 10x10 scrollHeight 15
layer at (445,27) size 10x10 scrollHeight 15
RenderMathMLBlock {mo} at (0,0) size 10x10
layer at (445,31) size 10x10 scrollHeight 14
layer at (445,37) size 10x10 scrollHeight 14
RenderMathMLBlock {mo} at (0,10) size 10x10
RenderText {mo} at (0,-3) size 10x17
text run at (0,-3) width 10: "\x{23AE}"
layer at (445,41) size 10x10 scrollHeight 14
layer at (445,47) size 10x10 scrollHeight 14
RenderMathMLBlock {mo} at (0,20) size 10x10
RenderText {mo} at (0,-3) size 10x17
text run at (0,-3) width 10: "\x{23AE}"
layer at (445,51) size 10x10 scrollHeight 14
layer at (445,57) size 10x10 scrollHeight 14
RenderMathMLBlock {mo} at (0,30) size 10x10
RenderText {mo} at (0,-3) size 10x17
text run at (0,-3) width 10: "\x{23AE}"
layer at (445,61) size 10x10 scrollHeight 14
RenderMathMLBlock {mo} at (0,40) size 10x10
layer at (445,67) size 10x2 scrollHeight 14
RenderMathMLBlock {mo} at (0,40) size 10x2
RenderText {mo} at (0,-3) size 10x17
text run at (0,-3) width 10: "\x{23AE}"
layer at (445,71) size 10x2 scrollHeight 14
RenderMathMLBlock {mo} at (0,50) size 10x2
RenderText {mo} at (0,-3) size 10x17
text run at (0,-3) width 10: "\x{23AE}"
layer at (445,73) size 10x11 scrollHeight 14
RenderMathMLBlock {mo} at (0,52) size 10x11
layer at (445,69) size 10x11 scrollHeight 14
RenderMathMLBlock {mo} at (0,42) size 10x11
layer at (323,9) size 5x11 backgroundClip at (323,8) size 5x10 clip at (323,8) size 5x10 outlineClip at (323,8) size 5x10
RenderBlock (relative positioned) {mo} at (0,0) size 5x11
RenderText {mo} at (0,-3) size 5x17
@@ -314,11 +310,11 @@ layer at (429,70) size 5x11 backgroundClip at (429,73) size 5x11 clip at (429,73
RenderBlock (relative positioned) {mo} at (0,0) size 5x11
RenderText {mo} at (0,-3) size 5x17
text run at (0,-3) width 5: "\x{23A6}"
layer at (445,22) size 10x11 backgroundClip at (445,21) size 10x10 clip at (445,21) size 10x10 outlineClip at (445,21) size 10x10
layer at (445,28) size 10x11 backgroundClip at (445,27) size 10x10 clip at (445,27) size 10x10 outlineClip at (445,27) size 10x10
RenderBlock (relative positioned) {mo} at (0,0) size 10x11
RenderText {mo} at (0,-3) size 10x17
text run at (0,-3) width 10: "\x{2320}"
layer at (445,70) size 10x11 backgroundClip at (445,73) size 10x11 clip at (445,73) size 10x11 outlineClip at (445,73) size 10x11
layer at (445,66) size 10x11 backgroundClip at (445,69) size 10x11 clip at (445,69) size 10x11 outlineClip at (445,69) size 10x11
RenderBlock (relative positioned) {mo} at (0,0) size 10x11
RenderText {mo} at (0,-3) size 10x17
text run at (0,-3) width 10: "\x{2321}"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,23 +1,23 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x64
RenderBlock {html} at (0,0) size 800x64
RenderBody {body} at (8,16) size 784x32
RenderBlock {p} at (0,0) size 784x32
RenderMathMLMath {math} at (0,0) size 16x32
RenderMathMLSubSup {msubsup} at (1,0) size 14x32
RenderMathMLBlock {msubsup} at (0,3) size 7x24
layer at (0,0) size 800x56
RenderBlock {html} at (0,0) size 800x56
RenderBody {body} at (8,16) size 784x24
RenderBlock {p} at (0,0) size 784x24
RenderMathMLMath {math} at (0,0) size 16x24
RenderMathMLSubSup {msubsup} at (1,0) size 14x24
RenderMathMLBlock {msubsup} at (0,0) size 7x20
RenderInline {mi} at (0,0) size 7x16
RenderText {#text} at (0,8) size 7x16
text run at (0,8) width 7: "y"
RenderMathMLBlock {msubsup} at (7,22) size 0x0
RenderMathMLBlock {msubsup} at (8,0) size 6x32
RenderMathMLBlock {msubsup} at (0,0) size 6x16
RenderText {#text} at (0,4) size 7x16
text run at (0,4) width 7: "y"
RenderMathMLBlock {msubsup} at (7,15) size 0x0
RenderMathMLBlock {msubsup} at (8,0) size 6x24
RenderMathMLBlock {msubsup} at (0,0) size 6x12
RenderInline {mi} at (0,0) size 5x12
RenderText {#text} at (0,3) size 5x12
text run at (0,3) width 5: "k"
RenderMathMLBlock {msubsup} at (0,16) size 6x16
RenderText {#text} at (0,0) size 5x12
text run at (0,0) width 5: "k"
RenderMathMLBlock {msubsup} at (0,12) size 6x12
RenderInline {mn} at (0,0) size 6x12
RenderText {#text} at (0,3) size 6x12
text run at (0,3) width 6: "1"
RenderText {#text} at (0,0) size 6x12
text run at (0,0) width 6: "1"
RenderText {#text} at (0,0) size 0x0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,23 +1,23 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x64
RenderBlock {html} at (0,0) size 800x64
RenderBody {body} at (8,16) size 784x32
RenderBlock {p} at (0,0) size 784x32
RenderMathMLMath {math} at (0,0) size 16x32
RenderMathMLSubSup {msubsup} at (1,0) size 14x32
RenderMathMLBlock {msubsup} at (0,3) size 7x24
layer at (0,0) size 800x56
RenderBlock {html} at (0,0) size 800x56
RenderBody {body} at (8,16) size 784x24
RenderBlock {p} at (0,0) size 784x24
RenderMathMLMath {math} at (0,0) size 16x24
RenderMathMLSubSup {msubsup} at (1,0) size 14x24
RenderMathMLBlock {msubsup} at (0,0) size 7x20
RenderInline {mi} at (0,0) size 7x16
RenderText {#text} at (0,8) size 7x16
text run at (0,8) width 7: "x"
RenderMathMLBlock {msubsup} at (8,0) size 6x32
RenderMathMLBlock {msubsup} at (0,0) size 6x16
RenderText {#text} at (0,4) size 7x16
text run at (0,4) width 7: "x"
RenderMathMLBlock {msubsup} at (8,0) size 6x24
RenderMathMLBlock {msubsup} at (0,0) size 6x12
RenderInline {mi} at (0,0) size 5x12
RenderText {#text} at (0,3) size 5x12
text run at (0,3) width 5: "k"
RenderMathMLBlock {msubsup} at (0,16) size 6x0
RenderMathMLBlock {msubsup} at (0,16) size 6x16
RenderText {#text} at (0,0) size 5x12
text run at (0,0) width 5: "k"
RenderMathMLBlock {msubsup} at (0,12) size 6x0
RenderMathMLBlock {msubsup} at (0,12) size 6x12
RenderInline {mn} at (0,0) size 6x12
RenderText {#text} at (0,3) size 6x12
text run at (0,3) width 6: "2"
RenderText {#text} at (0,0) size 6x12
text run at (0,0) width 6: "2"
RenderText {#text} at (0,0) size 0x0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,23 +1,23 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x64
RenderBlock {html} at (0,0) size 800x64
RenderBody {body} at (8,16) size 784x32
RenderBlock {p} at (0,0) size 784x32
RenderMathMLMath {math} at (0,0) size 16x32
RenderMathMLSubSup {msubsup} at (1,0) size 14x32
RenderMathMLBlock {msubsup} at (0,3) size 7x24
layer at (0,0) size 800x56
RenderBlock {html} at (0,0) size 800x56
RenderBody {body} at (8,16) size 784x24
RenderBlock {p} at (0,0) size 784x24
RenderMathMLMath {math} at (0,0) size 16x24
RenderMathMLSubSup {msubsup} at (1,0) size 14x24
RenderMathMLBlock {msubsup} at (0,0) size 7x20
RenderInline {mi} at (0,0) size 7x16
RenderText {#text} at (0,8) size 7x16
text run at (0,8) width 7: "x"
RenderMathMLBlock {msubsup} at (8,0) size 6x32
RenderMathMLBlock {msubsup} at (0,0) size 6x16
RenderText {#text} at (0,4) size 7x16
text run at (0,4) width 7: "x"
RenderMathMLBlock {msubsup} at (8,0) size 6x24
RenderMathMLBlock {msubsup} at (0,0) size 6x12
RenderInline {mi} at (0,0) size 3x12
RenderText {#text} at (0,3) size 3x12
text run at (0,3) width 3: "j"
RenderMathMLBlock {msubsup} at (0,16) size 6x0
RenderMathMLBlock {msubsup} at (0,16) size 6x16
RenderText {#text} at (0,0) size 3x12
text run at (0,0) width 3: "j"
RenderMathMLBlock {msubsup} at (0,12) size 6x0
RenderMathMLBlock {msubsup} at (0,12) size 6x12
RenderInline {mn} at (0,0) size 6x12
RenderText {#text} at (0,3) size 6x12
text run at (0,3) width 6: "1"
RenderText {#text} at (0,0) size 6x12
text run at (0,0) width 6: "1"
RenderText {#text} at (0,0) size 0x0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,8 +1,8 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x134
RenderBlock {html} at (0,0) size 800x134
RenderBody {body} at (8,16) size 784x102
layer at (0,0) size 800x132
RenderBlock {html} at (0,0) size 800x132
RenderBody {body} at (8,16) size 784x100
RenderBlock {p} at (0,0) size 784x22
RenderText {#text} at (0,0) size 27x18
text run at (0,0) width 27: "text "
@@ -30,17 +30,17 @@ layer at (0,0) size 800x134
RenderText {#text} at (9,7) size 5x12
text run at (9,7) width 5: "x"
RenderText {#text} at (0,0) size 0x0
RenderBlock {p} at (0,76) size 784x26
RenderText {#text} at (0,4) size 27x18
text run at (0,4) width 27: "text "
RenderMathMLMath {math} at (27,0) size 15x26
RenderMathMLSubSup {msub} at (1,0) size 13x26
RenderMathMLBlock {msub} at (0,0) size 6x23
RenderMathMLOperator {mo} at (0,0) size 6x23
RenderMathMLBlock {mo} at (0,0) size 6x22
RenderText {mo} at (0,-2) size 6x26
text run at (0,-2) width 6: "\x{222B}"
RenderBlock {p} at (0,76) size 784x24
RenderText {#text} at (0,2) size 27x18
text run at (0,2) width 27: "text "
RenderMathMLMath {math} at (27,0) size 14x24
RenderMathMLSubSup {msub} at (1,0) size 12x24
RenderMathMLBlock {msub} at (0,0) size 5x21
RenderMathMLOperator {mo} at (0,0) size 5x21
RenderMathMLBlock {mo} at (0,0) size 5x19
RenderText {mo} at (0,-1) size 5x22
text run at (0,-1) width 5: "\x{222B}"
RenderInline {mi} at (0,0) size 7x12
RenderText {#text} at (6,14) size 7x12
text run at (6,14) width 7: "Y"
RenderText {#text} at (5,12) size 7x12
text run at (5,12) width 7: "Y"
RenderText {#text} at (0,0) size 0x0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 35b708d

Please sign in to comment.