<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174540] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174540">174540</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-09 16:48:09 -0700 (Thu, 09 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>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 &lt;sabouhallawa@apple.com&gt; on 2014-10-09
Reviewed by Darin Adler.

The layout for the &lt;mundercover&gt; 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 &lt;munderober&gt; 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 &lt;sabouhallawa@apple.com&gt; 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 &lt;mover&gt; math objects at the beginning.
Each of them has an &lt;mspace&gt; child. The width of the first &lt;mspace&gt; is 1em while the width of the second
&lt;mspace&gt; 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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacmathmlopentypeopentypestretchyhorizontalexpectedtxt">trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorh">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlopentypemunderoverwindowresizeexpectedtxt">trunk/LayoutTests/mathml/opentype/munderover-window-resize-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmathmlopentypemunderoverwindowresizehtml">trunk/LayoutTests/mathml/opentype/munderover-window-resize.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174539 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-10-09 23:29:27 UTC (rev 174539)
+++ trunk/LayoutTests/ChangeLog        2014-10-09 23:48:09 UTC (rev 174540)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-10-09  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+        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 &lt;mover&gt; math objects at the beginning.
+        Each of them has an &lt;mspace&gt; child. The width of the first &lt;mspace&gt; is 1em while the width of the second
+        &lt;mspace&gt; 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.
+
</ins><span class="cx"> 2014-10-09  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Import W3C @supports tests
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlopentypemunderoverwindowresizeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/opentype/munderover-window-resize-expected.txt (0 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,220 @@
</span><ins>+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: &quot;C&quot;
+              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: &quot;16&quot;
+              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: &quot;5&quot;
+                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: &quot;10&quot;
+          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: &quot;2&quot;
+            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: &quot;\x{2062}&quot;
+            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: &quot;H&quot;
+              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: &quot;2&quot;
+            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: &quot;+&quot;
+            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: &quot;O&quot;
+              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: &quot;2&quot;
+          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: &quot;\x{2192}&quot;
+            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: &quot;m&quot;
+              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: &quot;,&quot;
+              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: &quot;n&quot;
+          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: &quot;2&quot;
+            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: &quot;\x{2062}&quot;
+            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: &quot;H&quot;
+              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: &quot;2&quot;
+            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: &quot;\x{2062}&quot;
+            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: &quot;O&quot;
+          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: &quot;A&quot;
+          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: &quot;\x{2194}&quot;
+            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: &quot;b&quot;
+            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: &quot;a&quot;
+          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: &quot;B&quot;
+          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: &quot;A&quot;
+          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: &quot;\x{21C4}&quot;
+            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: &quot;0&quot;
+            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: &quot;a&quot;
+          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: &quot;B&quot;
+          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: &quot;A&quot;
+          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: &quot;\x{21C4}&quot;
+            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: &quot;0\x{B0}C&quot;
+            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: &quot;100\x{B0}C&quot;
+          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: &quot;B&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlopentypemunderoverwindowresizehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/opentype/munderover-window-resize.html (0 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Open Type MATH - under-over operator&lt;/title&gt;
+  &lt;meta charset=&quot;utf-8&quot;&gt;
+  &lt;style type=&quot;text/css&quot;&gt;
+    /* This font is taken from Mozilla's test suite. */
+    @font-face {
+      font-family: stretchy;
+      src: url(&quot;stretchy.woff&quot;);
+    }
+    math {
+      font-family: stretchy;
+      font-size: 10px;
+    }
+  &lt;/style&gt;
+&lt;body&gt;
+&lt;div&gt;
+  &lt;math display='block'&gt;
+    &lt;mrow&gt;
+      &lt;mmultiscripts&gt;
+        &lt;mi&gt;C&lt;/mi&gt;
+        &lt;none/&gt;
+        &lt;mi&gt;16&lt;/mi&gt;
+        &lt;mprescripts/&gt;
+        &lt;mi&gt;5&lt;/mi&gt;
+        &lt;mi&gt;10&lt;/mi&gt;
+      &lt;/mmultiscripts&gt;
+    &lt;/mrow&gt;
+    &lt;mspace width=&quot;0.5em&quot;/&gt;
+    &lt;mrow&gt;
+      &lt;mn&gt;2&lt;/mn&gt;
+      &lt;mo&gt;&amp;InvisibleTimes;&lt;/mo&gt;
+      &lt;msub&gt;
+        &lt;mi&gt;H&lt;/mi&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/msub&gt;
+      &lt;mo&gt;+&lt;/mo&gt;
+      &lt;msub&gt;
+        &lt;mi&gt;O&lt;/mi&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/msub&gt;
+    &lt;/mrow&gt;
+    &lt;mover&gt;
+      &lt;mo&gt;&amp;#x02192;&lt;/mo&gt;
+      &lt;mrow&gt;
+        &lt;mi&gt;m&lt;/mi&gt;
+        &lt;mo&gt;,&lt;/mo&gt;
+        &lt;mi&gt;n&lt;/mi&gt;
+      &lt;/mrow&gt;
+    &lt;/mover&gt;
+    &lt;mrow&gt;
+      &lt;mn&gt;2&lt;/mn&gt;
+      &lt;mo&gt;&amp;InvisibleTimes;&lt;/mo&gt;
+      &lt;msub&gt;
+        &lt;mi&gt;H&lt;/mi&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/msub&gt;
+      &lt;mo&gt;&amp;InvisibleTimes;&lt;/mo&gt;
+      &lt;mi&gt;O&lt;/mi&gt;
+    &lt;/mrow&gt;
+    &lt;mspace width=&quot;0.5em&quot;/&gt;
+    &lt;mrow&gt;
+      &lt;mi&gt;A&lt;/mi&gt;
+    &lt;/mrow&gt;
+    &lt;munderover&gt;
+      &lt;mo&gt;&amp;#x02194;&lt;/mo&gt;
+      &lt;mi&gt;b&lt;/mi&gt;
+      &lt;mn&gt;a&lt;/mn&gt;
+    &lt;/munderover&gt;
+    &lt;mrow&gt;
+      &lt;mi&gt;B&lt;/mi&gt;
+    &lt;/mrow&gt;
+    &lt;mspace width=&quot;0.5em&quot;/&gt;
+    &lt;mrow&gt;
+      &lt;mi&gt;A&lt;/mi&gt;
+    &lt;/mrow&gt;
+    &lt;munderover&gt;
+      &lt;mo&gt;&amp;#x021C4;&lt;/mo&gt;
+      &lt;mi&gt;0&lt;/mi&gt;
+      &lt;mn&gt;a&lt;/mn&gt;
+    &lt;/munderover&gt;
+    &lt;mrow&gt;
+      &lt;mi&gt;B&lt;/mi&gt;
+    &lt;/mrow&gt;
+    &lt;mspace width=&quot;0.5em&quot;/&gt;
+    &lt;mrow&gt;
+      &lt;mi&gt;A&lt;/mi&gt;
+    &lt;/mrow&gt;
+    &lt;munderover&gt;
+      &lt;mo&gt;&amp;#x021C4;&lt;/mo&gt;
+      &lt;mn&gt;0&amp;#x000B0;C&lt;/mn&gt;
+      &lt;mn&gt;100&amp;#x000B0;C&lt;/mn&gt;
+    &lt;/munderover&gt;
+    &lt;mrow&gt;
+      &lt;mi&gt;B&lt;/mi&gt;
+    &lt;/mrow&gt;
+  &lt;/math&gt;
+&lt;/div&gt;
+&lt;script&gt;
+        for (var zoom = 110; zoom &lt;= 200; zoom += 10) {
+        document.body.style.zoom = zoom + &quot;%&quot;;
+        }
+    document.body.style.zoom=&quot;100%&quot;;
+    var width = window.outerWidth;
+    window.resizeTo(250, window.outerHeight); 
+    window.resizeTo(width, window.outerHeight);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacmathmlopentypeopentypestretchyhorizontalexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt (174539 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -7,8 +7,8 @@
</span><span class="cx">         RenderMathMLMath {math} at (0,3) size 18x22 [padding: 0 1 0 1]
</span><span class="cx">           RenderMathMLRow {mstyle} at (1,0) size 16x22
</span><span class="cx">             RenderMathMLUnderOver {mover} at (0,0) size 16x22
</span><del>-              RenderMathMLOperator {mo} at (-6,1) size 27x21
-                RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4
</del><ins>+              RenderMathMLOperator {mo} at (0,1) size 16x21
+                RenderMathMLBlock (anonymous, flex) at (2,0) size 11x4
</ins><span class="cx">                   RenderBlock (anonymous) at (0,0) size 2x4
</span><span class="cx">                     RenderText at (0,-3) size 2x10
</span><span class="cx">                       text run at (0,-3) width 2: &quot;\x{219C}&quot;
</span><span class="lines">@@ -18,8 +18,8 @@
</span><span class="cx">         RenderMathMLMath {math} at (0,3) size 28x22 [padding: 0 1 0 1]
</span><span class="cx">           RenderMathMLRow {mstyle} at (1,0) size 26x22
</span><span class="cx">             RenderMathMLUnderOver {mover} at (0,0) size 26x22
</span><del>-              RenderMathMLOperator {mo} at (-6,1) size 38x21
-                RenderMathMLBlock (anonymous, flex) at (2,0) size 32x4
</del><ins>+              RenderMathMLOperator {mo} at (0,1) size 26x21
+                RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4
</ins><span class="cx">                   RenderBlock (anonymous) at (0,0) size 2x4
</span><span class="cx">                     RenderText at (0,-3) size 2x10
</span><span class="cx">                       text run at (0,-3) width 2: &quot;\x{219C}&quot;
</span><span class="lines">@@ -29,8 +29,8 @@
</span><span class="cx">         RenderMathMLMath {math} at (0,0) size 158x42 [padding: 0 1 0 1]
</span><span class="cx">           RenderMathMLRow {mstyle} at (1,0) size 156x42
</span><span class="cx">             RenderMathMLUnderOver {mover} at (0,0) size 156x42
</span><del>-              RenderMathMLOperator {mo} at (-3,1) size 162x41
-                RenderMathMLBlock (anonymous, flex) at (2,0) size 157x4
</del><ins>+              RenderMathMLOperator {mo} at (0,1) size 156x41
+                RenderMathMLBlock (anonymous, flex) at (2,0) size 151x4
</ins><span class="cx">                   RenderBlock (anonymous) at (0,0) size 2x4
</span><span class="cx">                     RenderText at (0,-3) size 2x10
</span><span class="cx">                       text run at (0,-3) width 2: &quot;\x{219C}&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174539 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-10-09  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+        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 &lt;mundercover&gt; 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 &lt;munderober&gt; 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.
+
</ins><span class="cx"> 2014-10-09  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove ENABLE_CSS3_CONDITIONAL_RULES
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (174539 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1308,6 +1308,15 @@
</span><span class="cx">     updateStyle();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderMathMLOperator::resetStretchSize()
+{
+    if (m_isVertical) {
+        m_stretchHeightAboveBaseline = 0;
+        m_stretchDepthBelowBaseline = 0;
+    } else
+        m_stretchWidth = 0;
+}
+
</ins><span class="cx"> FloatRect RenderMathMLOperator::boundsForGlyph(const GlyphData&amp; data) const
</span><span class="cx"> {
</span><span class="cx">     return data.fontData-&gt;boundsForGlyph(data.glyph);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (174539 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx">     virtual void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);
</span><span class="cx">     void stretchTo(LayoutUnit width);
</span><span class="cx">     LayoutUnit stretchSize() const { return m_isVertical ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
</span><ins>+    void resetStretchSize();
</ins><span class="cx">     
</span><span class="cx">     bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags &amp; flag; }
</span><span class="cx">     // FIXME: The displaystyle property is not implemented (https://bugs.webkit.org/show_bug.cgi?id=118737).
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (174539 => 174540)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -74,9 +74,20 @@
</span><span class="cx"> void RenderMathMLUnderOver::layout()
</span><span class="cx"> {
</span><span class="cx">     LayoutUnit stretchWidth = 0;
</span><ins>+    Vector&lt;RenderMathMLOperator*, 2&gt; renderOperators;
+
</ins><span class="cx">     for (RenderObject* child = firstChild(); child; child = child-&gt;nextSibling()) {
</span><del>-        if (child-&gt;needsLayout())
</del><ins>+        if (child-&gt;needsLayout()) {
+            if (is&lt;RenderMathMLBlock&gt;(child)) {
+                if (auto renderOperator = downcast&lt;RenderMathMLBlock&gt;(*child).unembellishedOperator()) {
+                    renderOperator-&gt;resetStretchSize();
+                    renderOperators.append(renderOperator);
+                }
+            }
+
</ins><span class="cx">             toRenderElement(child)-&gt;layout();
</span><ins>+        }
+
</ins><span class="cx">         // Skipping the embellished op does not work for nested structures like
</span><span class="cx">         // &lt;munder&gt;&lt;mover&gt;&lt;mo&gt;_&lt;/mo&gt;...&lt;/mover&gt; &lt;mo&gt;_&lt;/mo&gt;&lt;/munder&gt;.
</span><span class="cx">         if (child-&gt;isBox())
</span><span class="lines">@@ -84,10 +95,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Set the sizes of (possibly embellished) stretchy operator children.
</span><del>-    for (auto&amp; child : childrenOfType&lt;RenderMathMLBlock&gt;(*this)) {
-        if (auto renderOperator = child.unembellishedOperator())
-            renderOperator-&gt;stretchTo(stretchWidth);
-    }
</del><ins>+    for (auto&amp; renderOperator : renderOperators)
+        renderOperator-&gt;stretchTo(stretchWidth);
</ins><span class="cx"> 
</span><span class="cx">     RenderMathMLBlock::layout();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>