Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r174540 - RenderMathMLUnderOver adds spacing to the child opera…
…tor indefinitely when resizing the window. https://bugs.webkit.org/show_bug.cgi?id=137330 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2014-10-09 Reviewed by Darin Adler. The layout for the <mundercover> math object happens in two separate passes. The first pass runs the layout for the two children and then calculates the maximum child width. It then sets the stretch size for the math operator child. And finally it runs the second layout pass by calling the base class layout() function. The base class function then runs the layout for the children rendering blocks. In the operator child function computePreferredLogicalWidths(), the stretch size is used to adjust the width (or the height) of the operator. Then it adds the leading and trailing spaces and the total will be the operator child width. When resizing or zooming the window, the render objects are just invalidated but marked as 'needs- Layout'. The problem is happening because the stretch size of the math operator is not reset before running the layout. The old logical width (or height) of the the math operator child which is equal to the stretch size plus the leading and trailing spaces for is compared with the glyph size if the old logical width ( or height) is larger, it is set to be the stretch size. When it is used again because of invalidation, new leading and trailing spaces are included in the new logical width. So with every zooming-in or out or window resizing, new leading and trailing spaces are added to the logical width of the math operator child or the math <munderober> object. Ensure the stretch size of the math operator render object is reset before running its layout. Running the layout means either the page is just loaded or it's invalidated which means, no layout stall data should be used. Test: mathml/opentype/munderover-window-resize.html * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::resetStretchSize): * rendering/mathml/RenderMathMLOperator.h: resetStretchSize() sets the stretch size to its original value when the class is created. * rendering/mathml/RenderMathMLUnderOver.cpp: (WebCore::RenderMathMLUnderOver::layout): Make sure the operator stretch size is reset before calling its layout. Also make sure the new maximum stretch size to the operator objects that were invalid and needsLayout. LayoutTests: RenderMathMLUnderOver adds spacing to the child operator indefinitely when zooming or resizing the window. https://bugs.webkit.org/show_bug.cgi?id=137330 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2014-10-09 Reviewed by Darin Adler, Daniel Bates. When the alignment is center, which is the common case for math, changing the size of an object affects the position of this object also. We need to confirm that zooming or resizing the window should not affect the rectangle of the over/under math object operator. * mathml/opentype/munderover-window-resize-expected.txt: Added. * mathml/opentype/munderover-window-resize.html: Added. New test with many under and over math objects. After loading the page, the window is resized and the view is zoomed in and out to make sure the layout of these under and over objects were not changed. * platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt: This test was wrong because of the spacing issue. The page has two <mover> math objects at the beginning. Each of them has an <mspace> child. The width of the first <mspace> is 1em while the width of the second <mspace> is 2em. The font size is 10pt. So it is expected to have the first one 10 pixels and the second to be 20 pixels. In the test, the width of the first is 22 and the width of the second is 32. I do expect this test to fail on other platforms since they have the same mistake which is now fixed. I am going to submit the mac expected version only and when it fails I am going to collect the result and submit another patch for the other platforms expected files. Canonical link: https://commits.webkit.org/154760.134@webkitgtk/2.6 git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@175883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
954388f
commit 63c2c44
Showing
8 changed files
with
423 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
220 changes: 220 additions & 0 deletions
220
LayoutTests/mathml/opentype/munderover-window-resize-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
layer at (0,0) size 800x600 | ||
RenderView at (0,0) size 800x600 | ||
layer at (0,0) size 800x40 | ||
RenderBlock {HTML} at (0,0) size 800x40 | ||
RenderBody {BODY} at (8,8) size 784x22 | ||
RenderBlock {DIV} at (0,0) size 784x22 | ||
RenderMathMLMath {math} at (0,0) size 784x22 [padding: 0 1 0 1] | ||
RenderMathMLRow {mrow} at (268,4) size 26x16 | ||
RenderMathMLScripts {mmultiscripts} at (0,0) size 26x16 | ||
Base Wrapper at (8,0) size 9x16 [padding: 2 0 4 0] | ||
RenderMathMLToken {mi} at (0,2) size 8x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "C" | ||
SubSupPair Wrapper at (16,0) size 10x16 | ||
RenderMathMLBlock (flex) {none} at (0,15) size 0x0 | ||
RenderMathMLToken {mi} at (0,0) size 9x7 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 8x7 | ||
RenderBlock (anonymous) at (0,0) size 8x7 | ||
RenderText {#text} at (0,2) size 8x8 | ||
text run at (0,2) width 8: "16" | ||
RenderMathMLBlock (flex) {mprescripts} at (25,0) size 0x16 | ||
SubSupPair Wrapper at (0,0) size 9x16 | ||
RenderMathMLToken {mi} at (4,8) size 5x8 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x7 | ||
RenderBlock (anonymous) at (0,0) size 4x7 | ||
RenderText {#text} at (0,2) size 4x8 | ||
text run at (0,2) width 4: "5" | ||
RenderMathMLToken {mi} at (0,0) size 9x7 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 8x7 | ||
RenderBlock (anonymous) at (0,0) size 8x7 | ||
RenderText {#text} at (0,2) size 8x8 | ||
text run at (0,2) width 8: "10" | ||
RenderMathMLSpace {mspace} at (293,14) size 6x0 | ||
RenderMathMLRow {mrow} at (298,6) size 40x14 | ||
RenderMathMLToken {mn} at (0,0) size 6x9 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 6x9 | ||
RenderBlock (anonymous) at (0,0) size 6x9 | ||
RenderText {#text} at (0,3) size 6x10 | ||
text run at (0,3) width 6: "2" | ||
RenderMathMLOperator {mo} at (6,8) size 0x1 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1 | ||
RenderBlock (anonymous) at (0,0) size 0x1 | ||
RenderText at (0,-5) size 0x10 | ||
text run at (0,-5) width 0: "\x{2062}" | ||
RenderMathMLScripts {msub} at (6,0) size 11x14 | ||
Base Wrapper at (0,0) size 7x14 [padding: 0 0 4 0] | ||
RenderMathMLToken {mi} at (0,0) size 7x9 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "H" | ||
SubSupPair Wrapper at (7,0) size 4x14 | ||
RenderMathMLToken {mn} at (0,6) size 4x8 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x7 | ||
RenderBlock (anonymous) at (0,0) size 4x7 | ||
RenderText {#text} at (0,2) size 4x8 | ||
text run at (0,2) width 4: "2" | ||
RenderMathMLOperator {mo} at (17,2) size 11x7 | ||
RenderMathMLBlock (anonymous, flex) at (2,0) size 7x7 | ||
RenderBlock (anonymous) at (0,0) size 6x7 | ||
RenderText at (0,1) size 6x10 | ||
text run at (0,1) width 6: "+" | ||
RenderMathMLScripts {msub} at (27,0) size 13x14 | ||
Base Wrapper at (0,0) size 8x14 [padding: 0 0 4 0] | ||
RenderMathMLToken {mi} at (0,0) size 8x9 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 8x9 | ||
RenderBlock (anonymous) at (0,0) size 8x9 | ||
RenderText {#text} at (0,3) size 8x10 | ||
text run at (0,3) width 8: "O" | ||
SubSupPair Wrapper at (8,0) size 4x14 | ||
RenderMathMLToken {mn} at (0,6) size 4x8 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x7 | ||
RenderBlock (anonymous) at (0,0) size 4x7 | ||
RenderText {#text} at (0,2) size 4x8 | ||
text run at (0,2) width 4: "2" | ||
RenderMathMLUnderOver {mover} at (338,1) size 22x14 | ||
RenderMathMLOperator {mo} at (0,7) size 22x7 | ||
RenderMathMLBlock (anonymous, flex) at (2,0) size 17x7 | ||
RenderBlock (anonymous) at (0,0) size 10x7 | ||
RenderText at (0,1) size 10x10 | ||
text run at (0,1) width 10: "\x{2192}" | ||
RenderMathMLRow {mrow} at (2,0) size 17x7 | ||
RenderMathMLToken {mi} at (0,0) size 8x6 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x6 | ||
RenderBlock (anonymous) at (0,0) size 7x6 | ||
RenderText {#text} at (0,1) size 7x8 | ||
text run at (0,1) width 7: "m" | ||
RenderMathMLOperator {mo} at (7,4) size 4x3 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 2x3 | ||
RenderBlock (anonymous) at (0,0) size 2x3 | ||
RenderText at (0,-3) size 2x8 | ||
text run at (0,-3) width 2: "," | ||
RenderMathMLToken {mi} at (11,0) size 5x6 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x6 | ||
RenderBlock (anonymous) at (0,0) size 4x6 | ||
RenderText {#text} at (0,1) size 4x8 | ||
text run at (0,1) width 4: "n" | ||
RenderMathMLRow {mrow} at (359,6) size 27x14 | ||
RenderMathMLToken {mn} at (0,0) size 6x9 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 6x9 | ||
RenderBlock (anonymous) at (0,0) size 6x9 | ||
RenderText {#text} at (0,3) size 6x10 | ||
text run at (0,3) width 6: "2" | ||
RenderMathMLOperator {mo} at (6,8) size 0x1 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1 | ||
RenderBlock (anonymous) at (0,0) size 0x1 | ||
RenderText at (0,-5) size 0x10 | ||
text run at (0,-5) width 0: "\x{2062}" | ||
RenderMathMLScripts {msub} at (6,0) size 11x14 | ||
Base Wrapper at (0,0) size 7x14 [padding: 0 0 4 0] | ||
RenderMathMLToken {mi} at (0,0) size 7x9 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "H" | ||
SubSupPair Wrapper at (7,0) size 4x14 | ||
RenderMathMLToken {mn} at (0,6) size 4x8 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x7 | ||
RenderBlock (anonymous) at (0,0) size 4x7 | ||
RenderText {#text} at (0,2) size 4x8 | ||
text run at (0,2) width 4: "2" | ||
RenderMathMLOperator {mo} at (17,8) size 0x1 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1 | ||
RenderBlock (anonymous) at (0,0) size 0x1 | ||
RenderText at (0,-5) size 0x10 | ||
text run at (0,-5) width 0: "\x{2062}" | ||
RenderMathMLToken {mi} at (17,0) size 9x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 8x9 | ||
RenderBlock (anonymous) at (0,0) size 8x9 | ||
RenderText {#text} at (0,3) size 8x10 | ||
text run at (0,3) width 8: "O" | ||
RenderMathMLSpace {mspace} at (385,14) size 6x0 | ||
RenderMathMLRow {mrow} at (390,6) size 9x9 | ||
RenderMathMLToken {mi} at (0,0) size 8x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "A" | ||
RenderMathMLUnderOver {munderover} at (398,3) size 21x19 | ||
RenderMathMLOperator {mo} at (0,6) size 21x6 | ||
RenderMathMLBlock (anonymous, flex) at (2,0) size 16x6 | ||
RenderBlock (anonymous) at (0,0) size 9x6 | ||
RenderText at (0,0) size 9x10 | ||
text run at (0,0) width 9: "\x{2194}" | ||
RenderMathMLToken {mi} at (7,12) size 6x7 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x7 | ||
RenderBlock (anonymous) at (0,0) size 4x7 | ||
RenderText {#text} at (0,2) size 4x8 | ||
text run at (0,2) width 4: "b" | ||
RenderMathMLToken {mn} at (8,0) size 5x6 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x6 | ||
RenderBlock (anonymous) at (0,0) size 4x6 | ||
RenderText {#text} at (0,1) size 4x8 | ||
text run at (0,1) width 4: "a" | ||
RenderMathMLRow {mrow} at (418,6) size 9x9 | ||
RenderMathMLToken {mi} at (0,0) size 8x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "B" | ||
RenderMathMLSpace {mspace} at (426,14) size 6x0 | ||
RenderMathMLRow {mrow} at (431,6) size 9x9 | ||
RenderMathMLToken {mi} at (0,0) size 8x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "A" | ||
RenderMathMLUnderOver {munderover} at (439,1) size 22x21 | ||
RenderMathMLOperator {mo} at (0,6) size 22x8 | ||
RenderMathMLBlock (anonymous, flex) at (2,0) size 17x8 | ||
RenderBlock (anonymous) at (0,0) size 10x8 | ||
RenderText at (0,2) size 10x10 | ||
text run at (0,2) width 10: "\x{21C4}" | ||
RenderMathMLToken {mi} at (8,14) size 5x7 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x7 | ||
RenderBlock (anonymous) at (0,0) size 4x7 | ||
RenderText {#text} at (0,2) size 4x8 | ||
text run at (0,2) width 4: "0" | ||
RenderMathMLToken {mn} at (8,0) size 5x6 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 4x6 | ||
RenderBlock (anonymous) at (0,0) size 4x6 | ||
RenderText {#text} at (0,1) size 4x8 | ||
text run at (0,1) width 4: "a" | ||
RenderMathMLRow {mrow} at (460,6) size 9x9 | ||
RenderMathMLToken {mi} at (0,0) size 8x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "B" | ||
RenderMathMLSpace {mspace} at (468,14) size 6x0 | ||
RenderMathMLRow {mrow} at (473,6) size 9x9 | ||
RenderMathMLToken {mi} at (0,0) size 8x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "A" | ||
RenderMathMLUnderOver {munderover} at (481,0) size 27x22 | ||
RenderMathMLOperator {mo} at (0,7) size 27x8 | ||
RenderMathMLBlock (anonymous, flex) at (2,0) size 22x8 | ||
RenderBlock (anonymous) at (0,0) size 10x8 | ||
RenderText at (0,2) size 10x10 | ||
text run at (0,2) width 10: "\x{21C4}" | ||
RenderMathMLToken {mn} at (6,15) size 14x7 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 13x7 | ||
RenderBlock (anonymous) at (0,0) size 13x7 | ||
RenderText {#text} at (0,2) size 13x8 | ||
text run at (0,2) width 13: "0\x{B0}C" | ||
RenderMathMLToken {mn} at (2,0) size 22x7 | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 21x7 | ||
RenderBlock (anonymous) at (0,0) size 21x7 | ||
RenderText {#text} at (0,2) size 21x8 | ||
text run at (0,2) width 21: "100\x{B0}C" | ||
RenderMathMLRow {mrow} at (507,6) size 9x9 | ||
RenderMathMLToken {mi} at (0,0) size 8x9 [padding: 0 1 0 0] | ||
RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9 | ||
RenderBlock (anonymous) at (0,0) size 7x9 | ||
RenderText {#text} at (0,3) size 7x10 | ||
text run at (0,3) width 7: "B" |
110 changes: 110 additions & 0 deletions
110
LayoutTests/mathml/opentype/munderover-window-resize.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Open Type MATH - under-over operator</title> | ||
<meta charset="utf-8"> | ||
<style type="text/css"> | ||
/* This font is taken from Mozilla's test suite. */ | ||
@font-face { | ||
font-family: stretchy; | ||
src: url("stretchy.woff"); | ||
} | ||
math { | ||
font-family: stretchy; | ||
font-size: 10px; | ||
} | ||
</style> | ||
<body> | ||
<div> | ||
<math display='block'> | ||
<mrow> | ||
<mmultiscripts> | ||
<mi>C</mi> | ||
<none/> | ||
<mi>16</mi> | ||
<mprescripts/> | ||
<mi>5</mi> | ||
<mi>10</mi> | ||
</mmultiscripts> | ||
</mrow> | ||
<mspace width="0.5em"/> | ||
<mrow> | ||
<mn>2</mn> | ||
<mo>⁢</mo> | ||
<msub> | ||
<mi>H</mi> | ||
<mn>2</mn> | ||
</msub> | ||
<mo>+</mo> | ||
<msub> | ||
<mi>O</mi> | ||
<mn>2</mn> | ||
</msub> | ||
</mrow> | ||
<mover> | ||
<mo>→</mo> | ||
<mrow> | ||
<mi>m</mi> | ||
<mo>,</mo> | ||
<mi>n</mi> | ||
</mrow> | ||
</mover> | ||
<mrow> | ||
<mn>2</mn> | ||
<mo>⁢</mo> | ||
<msub> | ||
<mi>H</mi> | ||
<mn>2</mn> | ||
</msub> | ||
<mo>⁢</mo> | ||
<mi>O</mi> | ||
</mrow> | ||
<mspace width="0.5em"/> | ||
<mrow> | ||
<mi>A</mi> | ||
</mrow> | ||
<munderover> | ||
<mo>↔</mo> | ||
<mi>b</mi> | ||
<mn>a</mn> | ||
</munderover> | ||
<mrow> | ||
<mi>B</mi> | ||
</mrow> | ||
<mspace width="0.5em"/> | ||
<mrow> | ||
<mi>A</mi> | ||
</mrow> | ||
<munderover> | ||
<mo>⇄</mo> | ||
<mi>0</mi> | ||
<mn>a</mn> | ||
</munderover> | ||
<mrow> | ||
<mi>B</mi> | ||
</mrow> | ||
<mspace width="0.5em"/> | ||
<mrow> | ||
<mi>A</mi> | ||
</mrow> | ||
<munderover> | ||
<mo>⇄</mo> | ||
<mn>0°C</mn> | ||
<mn>100°C</mn> | ||
</munderover> | ||
<mrow> | ||
<mi>B</mi> | ||
</mrow> | ||
</math> | ||
</div> | ||
<script> | ||
for (var zoom = 110; zoom <= 200; zoom += 10) { | ||
document.body.style.zoom = zoom + "%"; | ||
} | ||
document.body.style.zoom="100%"; | ||
var width = window.outerWidth; | ||
window.resizeTo(250, window.outerHeight); | ||
window.resizeTo(width, window.outerHeight); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.