Log Message
Source/WebCore: RenderMathMLUnderOver adds spacing to the child operator indefinitely when resizing the window. https://bugs.webkit.org/show_bug.cgi?id=137330
Patch by Said Abou-Hallawa <[email protected]> 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 <[email protected]> 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.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (174539 => 174540)
--- trunk/LayoutTests/ChangeLog 2014-10-09 23:29:27 UTC (rev 174539)
+++ trunk/LayoutTests/ChangeLog 2014-10-09 23:48:09 UTC (rev 174540)
@@ -1,3 +1,27 @@
+2014-10-09 Said Abou-Hallawa <[email protected]>
+
+ RenderMathMLUnderOver adds spacing to the child operator indefinitely when zooming or resizing the window.
+ https://bugs.webkit.org/show_bug.cgi?id=137330
+
+ 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.
+
2014-10-09 Dean Jackson <[email protected]>
Import W3C @supports tests
Added: trunk/LayoutTests/mathml/opentype/munderover-window-resize-expected.txt (0 => 174540)
--- trunk/LayoutTests/mathml/opentype/munderover-window-resize-expected.txt (rev 0)
+++ trunk/LayoutTests/mathml/opentype/munderover-window-resize-expected.txt 2014-10-09 23:48:09 UTC (rev 174540)
@@ -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"
Added: trunk/LayoutTests/mathml/opentype/munderover-window-resize.html (0 => 174540)
--- trunk/LayoutTests/mathml/opentype/munderover-window-resize.html (rev 0)
+++ trunk/LayoutTests/mathml/opentype/munderover-window-resize.html 2014-10-09 23:48:09 UTC (rev 174540)
@@ -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>
Modified: trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt (174539 => 174540)
--- trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt 2014-10-09 23:29:27 UTC (rev 174539)
+++ trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt 2014-10-09 23:48:09 UTC (rev 174540)
@@ -7,8 +7,8 @@
RenderMathMLMath {math} at (0,3) size 18x22 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 16x22
RenderMathMLUnderOver {mover} at (0,0) size 16x22
- RenderMathMLOperator {mo} at (-6,1) size 27x21
- RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4
+ RenderMathMLOperator {mo} at (0,1) size 16x21
+ RenderMathMLBlock (anonymous, flex) at (2,0) size 11x4
RenderBlock (anonymous) at (0,0) size 2x4
RenderText at (0,-3) size 2x10
text run at (0,-3) width 2: "\x{219C}"
@@ -18,8 +18,8 @@
RenderMathMLMath {math} at (0,3) size 28x22 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 26x22
RenderMathMLUnderOver {mover} at (0,0) size 26x22
- RenderMathMLOperator {mo} at (-6,1) size 38x21
- RenderMathMLBlock (anonymous, flex) at (2,0) size 32x4
+ RenderMathMLOperator {mo} at (0,1) size 26x21
+ RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4
RenderBlock (anonymous) at (0,0) size 2x4
RenderText at (0,-3) size 2x10
text run at (0,-3) width 2: "\x{219C}"
@@ -29,8 +29,8 @@
RenderMathMLMath {math} at (0,0) size 158x42 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 156x42
RenderMathMLUnderOver {mover} at (0,0) size 156x42
- RenderMathMLOperator {mo} at (-3,1) size 162x41
- RenderMathMLBlock (anonymous, flex) at (2,0) size 157x4
+ RenderMathMLOperator {mo} at (0,1) size 156x41
+ RenderMathMLBlock (anonymous, flex) at (2,0) size 151x4
RenderBlock (anonymous) at (0,0) size 2x4
RenderText at (0,-3) size 2x10
text run at (0,-3) width 2: "\x{219C}"
Modified: trunk/Source/WebCore/ChangeLog (174539 => 174540)
--- trunk/Source/WebCore/ChangeLog 2014-10-09 23:29:27 UTC (rev 174539)
+++ trunk/Source/WebCore/ChangeLog 2014-10-09 23:48:09 UTC (rev 174540)
@@ -1,3 +1,42 @@
+2014-10-09 Said Abou-Hallawa <[email protected]>
+
+ RenderMathMLUnderOver adds spacing to the child operator indefinitely when resizing the window.
+ https://bugs.webkit.org/show_bug.cgi?id=137330
+
+ 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.
+
2014-10-09 Dean Jackson <[email protected]>
Remove ENABLE_CSS3_CONDITIONAL_RULES
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (174539 => 174540)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2014-10-09 23:29:27 UTC (rev 174539)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2014-10-09 23:48:09 UTC (rev 174540)
@@ -1308,6 +1308,15 @@
updateStyle();
}
+void RenderMathMLOperator::resetStretchSize()
+{
+ if (m_isVertical) {
+ m_stretchHeightAboveBaseline = 0;
+ m_stretchDepthBelowBaseline = 0;
+ } else
+ m_stretchWidth = 0;
+}
+
FloatRect RenderMathMLOperator::boundsForGlyph(const GlyphData& data) const
{
return data.fontData->boundsForGlyph(data.glyph);
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (174539 => 174540)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2014-10-09 23:29:27 UTC (rev 174539)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2014-10-09 23:48:09 UTC (rev 174540)
@@ -66,6 +66,7 @@
virtual void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);
void stretchTo(LayoutUnit width);
LayoutUnit stretchSize() const { return m_isVertical ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
+ void resetStretchSize();
bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; }
// FIXME: The displaystyle property is not implemented (https://bugs.webkit.org/show_bug.cgi?id=118737).
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (174539 => 174540)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2014-10-09 23:29:27 UTC (rev 174539)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2014-10-09 23:48:09 UTC (rev 174540)
@@ -74,9 +74,20 @@
void RenderMathMLUnderOver::layout()
{
LayoutUnit stretchWidth = 0;
+ Vector<RenderMathMLOperator*, 2> renderOperators;
+
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->needsLayout())
+ if (child->needsLayout()) {
+ if (is<RenderMathMLBlock>(child)) {
+ if (auto renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator()) {
+ renderOperator->resetStretchSize();
+ renderOperators.append(renderOperator);
+ }
+ }
+
toRenderElement(child)->layout();
+ }
+
// Skipping the embellished op does not work for nested structures like
// <munder><mover><mo>_</mo>...</mover> <mo>_</mo></munder>.
if (child->isBox())
@@ -84,10 +95,8 @@
}
// Set the sizes of (possibly embellished) stretchy operator children.
- for (auto& child : childrenOfType<RenderMathMLBlock>(*this)) {
- if (auto renderOperator = child.unembellishedOperator())
- renderOperator->stretchTo(stretchWidth);
- }
+ for (auto& renderOperator : renderOperators)
+ renderOperator->stretchTo(stretchWidth);
RenderMathMLBlock::layout();
}
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
