[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 14:49:23 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6a88d2aaf8f10344b232366b24b5ed236dfeddb0
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 21 10:08:19 2010 +0000

    2010-10-21  Alex Milowski  <alex at milowski.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            Updated the tests results with changes from the new row layout algorithm.
    
            * mathml/presentation/row.xhtml:
               Added an mrow to make the tests more consistent.
            * platform/mac/mathml/presentation/fenced-expected.txt:
            * platform/mac/mathml/presentation/fenced-mi-expected.txt:
            * platform/mac/mathml/presentation/fractions-expected.checksum:
            * platform/mac/mathml/presentation/fractions-expected.png:
            * platform/mac/mathml/presentation/fractions-expected.txt:
            * platform/mac/mathml/presentation/fractions-vertical-alignment-expected.checksum:
            * platform/mac/mathml/presentation/fractions-vertical-alignment-expected.png:
            * platform/mac/mathml/presentation/fractions-vertical-alignment-expected.txt:
            * platform/mac/mathml/presentation/roots-expected.txt:
            * platform/mac/mathml/presentation/row-alignment-expected.checksum:
            * platform/mac/mathml/presentation/row-alignment-expected.png:
            * platform/mac/mathml/presentation/row-alignment-expected.txt:
            * platform/mac/mathml/presentation/row-expected.txt:
            * platform/mac/mathml/presentation/sub-expected.checksum:
            * platform/mac/mathml/presentation/sub-expected.png:
            * platform/mac/mathml/presentation/sub-expected.txt:
            * platform/mac/mathml/presentation/subsup-expected.txt:
            * platform/mac/mathml/presentation/sup-expected.txt:
            * platform/mac/mathml/presentation/tables-expected.txt:
    2010-10-21  Alex Milowski  <alex at milowski.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            Changed the layout algorithm for rows to avoid unnecessary recursion
            into child rows.  This solves the long rendering time experienced in
            https://bugs.webkit.org/show_bug.cgi?id=43462 as well as reports in
            various other bugs.  The change in the algorithm required some
            tweaks to other rendering objects to make sure that the baseline
            alignment still works.
    
            In addition, an attempt was made to go through the various
            rendering objects for MathML and reduce unnecessary calls that
            mark the tree in need of layout.
    
            * mathml/RenderMathMLFenced.cpp:
            * mathml/RenderMathMLFenced.h:
            * mathml/RenderMathMLFraction.cpp:
            (WebCore::RenderMathMLFraction::layout):
            * mathml/RenderMathMLOperator.cpp:
            (WebCore::RenderMathMLOperator::stretchToHeight):
            * mathml/RenderMathMLRoot.cpp:
            (WebCore::RenderMathMLRoot::layout):
            * mathml/RenderMathMLRow.cpp:
            (WebCore::RenderMathMLRow::layout):
            * mathml/RenderMathMLRow.h:
            (WebCore::RenderMathMLRow::stretchToHeight):
            * mathml/RenderMathMLSubSup.cpp:
            (WebCore::RenderMathMLSubSup::addChild):
            (WebCore::RenderMathMLSubSup::stretchToHeight):
            (WebCore::RenderMathMLSubSup::nonOperatorHeight):
            (WebCore::RenderMathMLSubSup::layout):
            (WebCore::RenderMathMLSubSup::baselinePosition):
            * mathml/RenderMathMLUnderOver.cpp:
            (WebCore::RenderMathMLUnderOver::stretchToHeight):
            (WebCore::RenderMathMLUnderOver::layout):
            (WebCore::RenderMathMLUnderOver::nonOperatorHeight):
            * mathml/mathtags.in:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70221 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 711ff41..a867ab5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,31 @@
+2010-10-21  Alex Milowski  <alex at milowski.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Updated the tests results with changes from the new row layout algorithm.
+
+        * mathml/presentation/row.xhtml:
+           Added an mrow to make the tests more consistent.
+        * platform/mac/mathml/presentation/fenced-expected.txt:
+        * platform/mac/mathml/presentation/fenced-mi-expected.txt:
+        * platform/mac/mathml/presentation/fractions-expected.checksum:
+        * platform/mac/mathml/presentation/fractions-expected.png:
+        * platform/mac/mathml/presentation/fractions-expected.txt:
+        * platform/mac/mathml/presentation/fractions-vertical-alignment-expected.checksum:
+        * platform/mac/mathml/presentation/fractions-vertical-alignment-expected.png:
+        * platform/mac/mathml/presentation/fractions-vertical-alignment-expected.txt:
+        * platform/mac/mathml/presentation/roots-expected.txt:
+        * platform/mac/mathml/presentation/row-alignment-expected.checksum:
+        * platform/mac/mathml/presentation/row-alignment-expected.png:
+        * platform/mac/mathml/presentation/row-alignment-expected.txt:
+        * platform/mac/mathml/presentation/row-expected.txt:
+        * platform/mac/mathml/presentation/sub-expected.checksum:
+        * platform/mac/mathml/presentation/sub-expected.png:
+        * platform/mac/mathml/presentation/sub-expected.txt:
+        * platform/mac/mathml/presentation/subsup-expected.txt:
+        * platform/mac/mathml/presentation/sup-expected.txt:
+        * platform/mac/mathml/presentation/tables-expected.txt:
+
 2010-10-21  Alejandro G. Castro  <alex at igalia.com>
 
         Unreviewed, skip test failing in the GTK bots.
diff --git a/LayoutTests/mathml/presentation/row.xhtml b/LayoutTests/mathml/presentation/row.xhtml
index 0ea8eae..11c60db 100644
--- a/LayoutTests/mathml/presentation/row.xhtml
+++ b/LayoutTests/mathml/presentation/row.xhtml
@@ -14,7 +14,9 @@ mo {
 <p id='t1'>
 16px:
 <math xmlns='http://www.w3.org/1998/Math/MathML'>
+<mrow>
 <mo>{</mo><mi>x</mi><div xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block; height: 16px; width: 16px; vertical-align: -33%; background-color: rgb(0,255,0)'/><mo>}</mo>
+</mrow>
 </math>
 <math xmlns='http://www.w3.org/1998/Math/MathML'>
 <mrow><mo>[</mo><mi>x</mi><div xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block; height: 16px; width: 16px; vertical-align: -33%; background-color: rgb(0,255,0)'/><mo>]</mo></mrow>
diff --git a/LayoutTests/platform/mac/mathml/presentation/fenced-expected.txt b/LayoutTests/platform/mac/mathml/presentation/fenced-expected.txt
index 54968f5..be1e944 100644
--- a/LayoutTests/platform/mac/mathml/presentation/fenced-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/fenced-expected.txt
@@ -4,8 +4,8 @@ layer at (0,0) size 800x103
   RenderBlock {html} at (0,0) size 800x103
     RenderBody {body} at (8,16) size 784x71
       RenderBlock {p} at (0,0) size 784x71
-        RenderBlock {math} at (0,0) size 171x71
-          RenderBlock {mfenced} at (1,0) size 169x71
+        RenderBlock {math} at (0,0) size 170x71
+          RenderBlock {mfenced} at (1,0) size 168x71
             RenderBlock {mfenced} at (1,13) size 6x58
             RenderBlock {div} at (7,22) size 48x48 [bgcolor=#00FF00]
             RenderBlock {mfenced} at (55,35) size 5x16
diff --git a/LayoutTests/platform/mac/mathml/presentation/fenced-mi-expected.txt b/LayoutTests/platform/mac/mathml/presentation/fenced-mi-expected.txt
index 7cb1ef6..49a40be 100644
--- a/LayoutTests/platform/mac/mathml/presentation/fenced-mi-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/fenced-mi-expected.txt
@@ -4,13 +4,12 @@ layer at (0,0) size 800x90
   RenderBlock {html} at (0,0) size 800x90
     RenderBody {body} at (8,16) size 784x58
       RenderBlock {p} at (0,0) size 784x21
-        RenderBlock {math} at (0,0) size 49x21
-          RenderBlock {mfenced} at (1,0) size 47x21
+        RenderBlock {math} at (0,0) size 48x21
+          RenderBlock {mfenced} at (1,0) size 46x21
             RenderBlock {mfenced} at (1,0) size 7x21
-              RenderBlock (anonymous) at (0,0) size 6x21
-                RenderBlock {mfenced} at (0,0) size 6x19
-                  RenderText {mfenced} at (0,-1) size 6x22
-                    text run at (0,-1) width 6: "("
+              RenderBlock {mfenced} at (0,0) size 6x19
+                RenderText {mfenced} at (0,-1) size 6x22
+                  text run at (0,-1) width 6: "("
             RenderInline {mi} at (0,0) size 7x16
               RenderText {#text} at (8,5) size 7x16
                 text run at (8,5) width 7: "x"
@@ -29,10 +28,9 @@ layer at (0,0) size 800x90
               RenderText {#text} at (32,5) size 6x16
                 text run at (32,5) width 6: "z"
             RenderBlock {mfenced} at (38,0) size 7x21
-              RenderBlock (anonymous) at (0,0) size 6x21
-                RenderBlock {mfenced} at (0,0) size 6x19
-                  RenderText {mfenced} at (0,-1) size 6x22
-                    text run at (0,-1) width 6: ")"
+              RenderBlock {mfenced} at (0,0) size 6x19
+                RenderText {mfenced} at (0,-1) size 6x22
+                  text run at (0,-1) width 6: ")"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {p} at (0,37) size 784x21
         RenderBlock {math} at (0,0) size 46x21
diff --git a/LayoutTests/platform/mac/mathml/presentation/fractions-expected.checksum b/LayoutTests/platform/mac/mathml/presentation/fractions-expected.checksum
index 1869460..854c634 100644
--- a/LayoutTests/platform/mac/mathml/presentation/fractions-expected.checksum
+++ b/LayoutTests/platform/mac/mathml/presentation/fractions-expected.checksum
@@ -1 +1 @@
-dc3ba7a80d2d7a0f64276076ce1b9535
\ No newline at end of file
+6eaf27456a4648391bea2d56aa89d6e6
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/mathml/presentation/fractions-expected.png b/LayoutTests/platform/mac/mathml/presentation/fractions-expected.png
index 1b1d98d..c7a0517 100644
Binary files a/LayoutTests/platform/mac/mathml/presentation/fractions-expected.png and b/LayoutTests/platform/mac/mathml/presentation/fractions-expected.png differ
diff --git a/LayoutTests/platform/mac/mathml/presentation/fractions-expected.txt b/LayoutTests/platform/mac/mathml/presentation/fractions-expected.txt
index de0dca6..0bf3a7c 100644
--- a/LayoutTests/platform/mac/mathml/presentation/fractions-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/fractions-expected.txt
@@ -21,7 +21,7 @@ layer at (0,0) size 800x338
           text run at (0,10) width 197: "more complex (should be red): "
         RenderBlock {math} at (197,0) size 33x40
           RenderBlock {mfrac} at (1,0) size 31x40 [color=#FF0000]
-            RenderBlock {mfrac} at (0,0) size 31x19
+            RenderBlock {mfrac} at (0,0) size 22x19
               RenderBlock {mrow} at (3,0) size 25x19
                 RenderInline {mi} at (0,0) size 7x16
                   RenderText {#text} at (0,3) size 7x16
@@ -33,7 +33,7 @@ layer at (0,0) size 800x338
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (17,3) size 8x16
                     text run at (17,3) width 8: "1"
-            RenderBlock {mfrac} at (0,19) size 31x21
+            RenderBlock {mfrac} at (0,19) size 22x21
               RenderBlock {mrow} at (3,2) size 25x19
                 RenderInline {mi} at (0,0) size 7x16
                   RenderText {#text} at (0,3) size 7x16
@@ -98,11 +98,11 @@ layer at (0,0) size 800x338
           text run at (0,10) width 138: "numerator alignment: "
         RenderBlock {math} at (138,0) size 89x37
           RenderBlock {mfrac} at (1,0) size 87x37
-            RenderBlock {mfrac} at (0,0) size 87x19
+            RenderBlock {mfrac} at (0,0) size 51x19
               RenderInline {mi} at (0,0) size 7x16
                 RenderText {#text} at (3,3) size 7x16
                   text run at (3,3) width 7: "x"
-            RenderBlock {mfrac} at (0,19) size 87x18
+            RenderBlock {mfrac} at (0,19) size 51x18
               RenderBlock {mrow} at (4,2) size 80x16
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (0,0) size 8x16
@@ -139,11 +139,11 @@ layer at (0,0) size 800x338
           text run at (227,10) width 4: " "
         RenderBlock {math} at (231,0) size 89x37
           RenderBlock {mfrac} at (1,0) size 87x37
-            RenderBlock {mfrac} at (0,0) size 87x19
+            RenderBlock {mfrac} at (0,0) size 51x19
               RenderInline {mi} at (0,0) size 7x16
-                RenderText {#text} at (40,3) size 7x16
-                  text run at (40,3) width 7: "x"
-            RenderBlock {mfrac} at (0,19) size 87x18
+                RenderText {#text} at (22,3) size 7x16
+                  text run at (22,3) width 7: "x"
+            RenderBlock {mfrac} at (0,19) size 51x18
               RenderBlock {mrow} at (4,2) size 80x16
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (0,0) size 8x16
@@ -180,11 +180,11 @@ layer at (0,0) size 800x338
           text run at (320,10) width 4: " "
         RenderBlock {math} at (324,0) size 89x37
           RenderBlock {mfrac} at (1,0) size 87x37
-            RenderBlock {mfrac} at (0,0) size 87x19
+            RenderBlock {mfrac} at (0,0) size 51x19
               RenderInline {mi} at (0,0) size 7x16
-                RenderText {#text} at (77,3) size 7x16
-                  text run at (77,3) width 7: "x"
-            RenderBlock {mfrac} at (0,19) size 87x18
+                RenderText {#text} at (41,3) size 7x16
+                  text run at (41,3) width 7: "x"
+            RenderBlock {mfrac} at (0,19) size 51x18
               RenderBlock {mrow} at (4,2) size 80x16
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (0,0) size 8x16
@@ -223,7 +223,7 @@ layer at (0,0) size 800x338
           text run at (0,7) width 153: "denominator alignment: "
         RenderBlock {math} at (153,0) size 88x37
           RenderBlock {mfrac} at (1,0) size 86x37
-            RenderBlock {mfrac} at (0,0) size 86x16
+            RenderBlock {mfrac} at (0,0) size 50x16
               RenderBlock {mrow} at (3,0) size 80x16
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (0,0) size 8x16
@@ -256,7 +256,7 @@ layer at (0,0) size 800x338
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (72,0) size 8x16
                     text run at (72,0) width 8: "5"
-            RenderBlock {mfrac} at (0,16) size 86x21
+            RenderBlock {mfrac} at (0,16) size 50x21
               RenderInline {mi} at (0,0) size 7x16
                 RenderText {#text} at (3,5) size 7x16
                   text run at (3,5) width 7: "x"
@@ -264,7 +264,7 @@ layer at (0,0) size 800x338
           text run at (241,7) width 4: " "
         RenderBlock {math} at (245,0) size 88x37
           RenderBlock {mfrac} at (1,0) size 86x37
-            RenderBlock {mfrac} at (0,0) size 86x16
+            RenderBlock {mfrac} at (0,0) size 50x16
               RenderBlock {mrow} at (3,0) size 80x16
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (0,0) size 8x16
@@ -297,15 +297,15 @@ layer at (0,0) size 800x338
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (72,0) size 8x16
                     text run at (72,0) width 8: "5"
-            RenderBlock {mfrac} at (0,16) size 86x21
+            RenderBlock {mfrac} at (0,16) size 50x21
               RenderInline {mi} at (0,0) size 7x16
-                RenderText {#text} at (39,5) size 7x16
-                  text run at (39,5) width 7: "x"
+                RenderText {#text} at (21,5) size 7x16
+                  text run at (21,5) width 7: "x"
         RenderText {#text} at (333,7) size 4x18
           text run at (333,7) width 4: " "
         RenderBlock {math} at (337,0) size 88x37
           RenderBlock {mfrac} at (1,0) size 86x37
-            RenderBlock {mfrac} at (0,0) size 86x16
+            RenderBlock {mfrac} at (0,0) size 50x16
               RenderBlock {mrow} at (3,0) size 80x16
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (0,0) size 8x16
@@ -338,8 +338,8 @@ layer at (0,0) size 800x338
                 RenderInline {mn} at (0,0) size 8x16
                   RenderText {#text} at (72,0) size 8x16
                     text run at (72,0) width 8: "5"
-            RenderBlock {mfrac} at (0,16) size 86x21
+            RenderBlock {mfrac} at (0,16) size 50x21
               RenderInline {mi} at (0,0) size 7x16
-                RenderText {#text} at (76,5) size 7x16
-                  text run at (76,5) width 7: "x"
+                RenderText {#text} at (40,5) size 7x16
+                  text run at (40,5) width 7: "x"
         RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.checksum b/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.checksum
index 3f31ad7..45e5f11 100644
--- a/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.checksum
+++ b/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.checksum
@@ -1 +1 @@
-99c3bc3a8784d9ae0586838ffa347c48
\ No newline at end of file
+d9b0e251df766713ac341bdfe649e65c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.png b/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.png
index 7ac70ab..ff2a098 100644
Binary files a/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.png and b/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.png differ
diff --git a/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.txt b/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.txt
index b9ff54b..71ab63e 100644
--- a/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/fractions-vertical-alignment-expected.txt
@@ -16,7 +16,7 @@ layer at (0,0) size 800x124
         RenderText {math:mo} at (0,0) size 9x16
           text run at (0,0) width 9: "+"
     RenderBlock {math:mfrac} at (28,21) size 44x61
-      RenderBlock {math:mfrac} at (0,0) size 44x40
+      RenderBlock {math:mfrac} at (0,0) size 35x40
         RenderBlock {math:mrow} at (3,0) size 38x40
           RenderInline {math:mi} at (0,0) size 10x16
             RenderText {#text} at (0,13) size 10x16
@@ -34,16 +34,16 @@ layer at (0,0) size 800x124
               RenderInline {math:mi} at (0,0) size 10x16
                 RenderText {#text} at (4,5) size 10x16
                   text run at (4,5) width 10: "E"
-      RenderBlock {math:mfrac} at (0,40) size 44x21
+      RenderBlock {math:mfrac} at (0,40) size 35x21
         RenderInline {math:mi} at (0,0) size 11x16
-          RenderText {#text} at (16,5) size 11x16
-            text run at (16,5) width 11: "C"
+          RenderText {#text} at (12,5) size 11x16
+            text run at (12,5) width 11: "C"
     RenderBlock {math:mo} at (72,55) size 10x16
       RenderBlock {math:mo} at (0,0) size 9x16
         RenderText {math:mo} at (0,0) size 9x16
           text run at (0,0) width 9: "+"
     RenderBlock {math:mfrac} at (82,0) size 72x82
-      RenderBlock {math:mfrac} at (0,0) size 72x61
+      RenderBlock {math:mfrac} at (0,0) size 54x61
         RenderBlock {math:mrow} at (3,0) size 66x61
           RenderInline {math:mi} at (0,0) size 10x16
             RenderText {#text} at (0,34) size 10x16
@@ -53,7 +53,7 @@ layer at (0,0) size 800x124
               RenderText {math:mo} at (0,0) size 9x16
                 text run at (0,0) width 9: "+"
           RenderBlock {math:mfrac} at (20,0) size 46x61
-            RenderBlock {math:mfrac} at (0,0) size 46x40
+            RenderBlock {math:mfrac} at (0,0) size 37x40
               RenderBlock {math:mrow} at (3,0) size 40x40
                 RenderInline {math:mi} at (0,0) size 12x16
                   RenderText {#text} at (0,13) size 12x16
@@ -71,24 +71,24 @@ layer at (0,0) size 800x124
                     RenderInline {math:mi} at (0,0) size 12x16
                       RenderText {#text} at (3,5) size 12x16
                         text run at (3,5) width 12: "G"
-            RenderBlock {math:mfrac} at (0,40) size 46x21
+            RenderBlock {math:mfrac} at (0,40) size 37x21
               RenderInline {math:mi} at (0,0) size 10x16
-                RenderText {#text} at (18,5) size 10x16
-                  text run at (18,5) width 10: "E"
-      RenderBlock {math:mfrac} at (0,61) size 72x21
+                RenderText {#text} at (13,5) size 10x16
+                  text run at (13,5) width 10: "E"
+      RenderBlock {math:mfrac} at (0,61) size 54x21
         RenderInline {math:mi} at (0,0) size 11x16
-          RenderText {#text} at (30,5) size 11x16
-            text run at (30,5) width 11: "C"
+          RenderText {#text} at (21,5) size 11x16
+            text run at (21,5) width 11: "C"
     RenderBlock {math:mo} at (154,55) size 10x16
       RenderBlock {math:mo} at (0,0) size 9x16
         RenderText {math:mo} at (0,0) size 9x16
           text run at (0,0) width 9: "+"
     RenderBlock {math:mfrac} at (164,42) size 71x82
-      RenderBlock {math:mfrac} at (0,0) size 71x19
+      RenderBlock {math:mfrac} at (0,0) size 53x19
         RenderInline {math:mi} at (0,0) size 10x16
-          RenderText {#text} at (30,3) size 10x16
-            text run at (30,3) width 10: "B"
-      RenderBlock {math:mfrac} at (0,19) size 71x63
+          RenderText {#text} at (21,3) size 10x16
+            text run at (21,3) width 10: "B"
+      RenderBlock {math:mfrac} at (0,19) size 53x63
         RenderBlock {math:mrow} at (3,2) size 65x61
           RenderInline {math:mi} at (0,0) size 11x16
             RenderText {#text} at (0,13) size 11x16
@@ -98,11 +98,11 @@ layer at (0,0) size 800x124
               RenderText {math:mo} at (0,0) size 9x16
                 text run at (0,0) width 9: "+"
           RenderBlock {math:mfrac} at (21,0) size 44x61
-            RenderBlock {math:mfrac} at (0,0) size 44x19
+            RenderBlock {math:mfrac} at (0,0) size 35x19
               RenderInline {math:mi} at (0,0) size 12x16
-                RenderText {#text} at (16,3) size 12x16
-                  text run at (16,3) width 12: "D"
-            RenderBlock {math:mfrac} at (0,19) size 44x42
+                RenderText {#text} at (11,3) size 12x16
+                  text run at (11,3) width 12: "D"
+            RenderBlock {math:mfrac} at (0,19) size 35x42
               RenderBlock {math:mrow} at (3,2) size 38x40
                 RenderInline {math:mi} at (0,0) size 10x16
                   RenderText {#text} at (0,13) size 10x16
diff --git a/LayoutTests/platform/mac/mathml/presentation/roots-expected.txt b/LayoutTests/platform/mac/mathml/presentation/roots-expected.txt
index 2c0e2b9..4c8ec0f 100644
--- a/LayoutTests/platform/mac/mathml/presentation/roots-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/roots-expected.txt
@@ -33,9 +33,10 @@ layer at (0,0) size 800x571
         RenderBlock {math} at (222,0) size 44x22
           RenderBlock {msqrt} at (1,0) size 42x22
             RenderBlock {msup} at (12,3) size 13x19
-              RenderInline {mi} at (0,0) size 7x16
-                RenderText {#text} at (0,3) size 7x16
-                  text run at (0,3) width 7: "x"
+              RenderBlock {msup} at (0,0) size 7x19
+                RenderInline {mi} at (0,0) size 7x16
+                  RenderText {#text} at (0,3) size 7x16
+                    text run at (0,3) width 7: "x"
               RenderInline {mn} at (0,0) size 6x12
                 RenderText {#text} at (7,0) size 6x12
                   text run at (7,0) width 6: "2"
@@ -52,7 +53,7 @@ layer at (0,0) size 800x571
         RenderBlock {math} at (113,0) size 45x46
           RenderBlock {msqrt} at (1,0) size 43x46
             RenderBlock {mfrac} at (12,3) size 31x40
-              RenderBlock {mfrac} at (0,0) size 31x19
+              RenderBlock {mfrac} at (0,0) size 22x19
                 RenderBlock {mrow} at (3,0) size 25x19
                   RenderInline {mi} at (0,0) size 7x16
                     RenderText {#text} at (0,3) size 7x16
@@ -64,7 +65,7 @@ layer at (0,0) size 800x571
                   RenderInline {mn} at (0,0) size 8x16
                     RenderText {#text} at (17,3) size 8x16
                       text run at (17,3) width 8: "1"
-              RenderBlock {mfrac} at (0,19) size 31x21
+              RenderBlock {mfrac} at (0,19) size 22x21
                 RenderBlock {mrow} at (3,2) size 25x19
                   RenderInline {mi} at (0,0) size 7x16
                     RenderText {#text} at (0,3) size 7x16
@@ -210,7 +211,7 @@ layer at (194,265) size 73x46
     RenderBlock {mroot} at (41,27) size 0x0
     RenderBlock {mroot} at (41,3) size 32x40
       RenderBlock {mfrac} at (1,0) size 31x40
-        RenderBlock {mfrac} at (0,0) size 31x19
+        RenderBlock {mfrac} at (0,0) size 22x19
           RenderBlock {mrow} at (3,0) size 25x19
             RenderInline {mi} at (0,0) size 7x16
               RenderText {#text} at (0,3) size 7x16
@@ -222,7 +223,7 @@ layer at (194,265) size 73x46
             RenderInline {mn} at (0,0) size 8x16
               RenderText {#text} at (17,3) size 8x16
                 text run at (17,3) width 8: "1"
-        RenderBlock {mfrac} at (0,19) size 31x21
+        RenderBlock {mfrac} at (0,19) size 22x21
           RenderBlock {mrow} at (3,2) size 25x19
             RenderInline {mi} at (0,0) size 7x16
               RenderText {#text} at (0,3) size 7x16
diff --git a/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.checksum b/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.checksum
index 2233755..292d5ea 100644
--- a/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.checksum
+++ b/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.checksum
@@ -1 +1 @@
-7137dd8f5deda6c22a4e32fa9f10b98d
\ No newline at end of file
+a2adcc2b842ee0418f419c8b5653b70b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.png b/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.png
index 2ab5fc3..0494c0b 100644
Binary files a/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.png and b/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.png differ
diff --git a/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.txt b/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.txt
index 9bd912a..983461e 100644
--- a/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/row-alignment-expected.txt
@@ -32,7 +32,7 @@ layer at (0,0) size 800x575
             text run at (0,10) width 27: "text "
           RenderBlock {math} at (27,0) size 33x37
             RenderBlock {mfrac} at (1,0) size 31x37
-              RenderBlock {mfrac} at (0,0) size 31x19
+              RenderBlock {mfrac} at (0,0) size 22x19
                 RenderBlock {mrow} at (3,0) size 25x19
                   RenderInline {mi} at (0,0) size 7x16
                     RenderText {#text} at (0,3) size 7x16
@@ -44,10 +44,10 @@ layer at (0,0) size 800x575
                   RenderInline {mn} at (0,0) size 8x16
                     RenderText {#text} at (17,3) size 8x16
                       text run at (17,3) width 8: "1"
-              RenderBlock {mfrac} at (0,19) size 31x18
+              RenderBlock {mfrac} at (0,19) size 22x18
                 RenderInline {mn} at (0,0) size 8x16
-                  RenderText {#text} at (11,2) size 8x16
-                    text run at (11,2) width 8: "2"
+                  RenderText {#text} at (7,2) size 8x16
+                    text run at (7,2) width 8: "2"
           RenderText {#text} at (0,0) size 0x0
         RenderBlock {p} at (0,100) size 784x37
           RenderText {#text} at (0,10) size 27x18
@@ -61,7 +61,7 @@ layer at (0,0) size 800x575
                 RenderText {mo} at (0,0) size 9x16
                   text run at (0,0) width 9: "+"
             RenderBlock {mfrac} at (18,0) size 31x37
-              RenderBlock {mfrac} at (0,0) size 31x19
+              RenderBlock {mfrac} at (0,0) size 22x19
                 RenderBlock {mrow} at (3,0) size 25x19
                   RenderInline {mi} at (0,0) size 7x16
                     RenderText {#text} at (0,3) size 7x16
@@ -73,10 +73,10 @@ layer at (0,0) size 800x575
                   RenderInline {mn} at (0,0) size 8x16
                     RenderText {#text} at (17,3) size 8x16
                       text run at (17,3) width 8: "1"
-              RenderBlock {mfrac} at (0,19) size 31x18
+              RenderBlock {mfrac} at (0,19) size 22x18
                 RenderInline {mn} at (0,0) size 8x16
-                  RenderText {#text} at (11,2) size 8x16
-                    text run at (11,2) width 8: "2"
+                  RenderText {#text} at (7,2) size 8x16
+                    text run at (7,2) width 8: "2"
           RenderText {#text} at (0,0) size 0x0
       RenderBlock {div} at (0,241) size 784x299
         RenderBlock {h2} at (0,0) size 784x28
@@ -95,7 +95,7 @@ layer at (0,0) size 800x575
                 RenderText {mo} at (0,0) size 9x16
                   text run at (0,0) width 9: "+"
             RenderBlock {mfrac} at (24,4) size 31x37
-              RenderBlock {mfrac} at (0,0) size 31x19
+              RenderBlock {mfrac} at (0,0) size 22x19
                 RenderBlock {mrow} at (3,0) size 25x19
                   RenderInline {mi} at (0,0) size 7x16
                     RenderText {#text} at (0,3) size 7x16
@@ -107,10 +107,10 @@ layer at (0,0) size 800x575
                   RenderInline {mn} at (0,0) size 8x16
                     RenderText {#text} at (17,3) size 8x16
                       text run at (17,3) width 8: "1"
-              RenderBlock {mfrac} at (0,19) size 31x18
+              RenderBlock {mfrac} at (0,19) size 22x18
                 RenderInline {mn} at (0,0) size 8x16
-                  RenderText {#text} at (11,2) size 8x16
-                    text run at (11,2) width 8: "2"
+                  RenderText {#text} at (7,2) size 8x16
+                    text run at (7,2) width 8: "2"
             RenderBlock {mo} at (55,3) size 6x45
           RenderText {#text} at (0,0) size 0x0
         RenderBlock {p} at (0,111) size 784x92
@@ -131,7 +131,7 @@ layer at (0,0) size 800x575
                   RenderText {#text} at (4,3) size 5x12
                     text run at (4,3) width 5: "x"
             RenderBlock {mfrac} at (27,10) size 54x76
-              RenderBlock {mfrac} at (0,0) size 54x37
+              RenderBlock {mfrac} at (0,0) size 36x37
                 RenderBlock {mrow} at (3,0) size 48x37
                   RenderInline {mi} at (0,0) size 7x16
                     RenderText {#text} at (0,13) size 7x16
@@ -141,7 +141,7 @@ layer at (0,0) size 800x575
                       RenderText {mo} at (0,0) size 9x16
                         text run at (0,0) width 9: "+"
                   RenderBlock {mfrac} at (17,0) size 31x37
-                    RenderBlock {mfrac} at (0,0) size 31x19
+                    RenderBlock {mfrac} at (0,0) size 22x19
                       RenderBlock {mrow} at (3,0) size 25x19
                         RenderInline {mi} at (0,0) size 7x16
                           RenderText {#text} at (0,3) size 7x16
@@ -153,11 +153,11 @@ layer at (0,0) size 800x575
                         RenderInline {mn} at (0,0) size 8x16
                           RenderText {#text} at (17,3) size 8x16
                             text run at (17,3) width 8: "1"
-                    RenderBlock {mfrac} at (0,19) size 31x18
+                    RenderBlock {mfrac} at (0,19) size 22x18
                       RenderInline {mn} at (0,0) size 8x16
-                        RenderText {#text} at (11,2) size 8x16
-                          text run at (11,2) width 8: "2"
-              RenderBlock {mfrac} at (0,37) size 54x39
+                        RenderText {#text} at (7,2) size 8x16
+                          text run at (7,2) width 8: "2"
+              RenderBlock {mfrac} at (0,37) size 36x39
                 RenderBlock {mrow} at (3,2) size 48x37
                   RenderInline {mi} at (0,0) size 7x16
                     RenderText {#text} at (0,13) size 7x16
@@ -167,7 +167,7 @@ layer at (0,0) size 800x575
                       RenderText {mo} at (0,0) size 9x16
                         text run at (0,0) width 9: "+"
                   RenderBlock {mfrac} at (17,0) size 31x37
-                    RenderBlock {mfrac} at (0,0) size 31x19
+                    RenderBlock {mfrac} at (0,0) size 22x19
                       RenderBlock {mrow} at (3,0) size 25x19
                         RenderInline {mi} at (0,0) size 7x16
                           RenderText {#text} at (0,3) size 7x16
@@ -179,10 +179,10 @@ layer at (0,0) size 800x575
                         RenderInline {mn} at (0,0) size 8x16
                           RenderText {#text} at (17,3) size 8x16
                             text run at (17,3) width 8: "1"
-                    RenderBlock {mfrac} at (0,19) size 31x18
+                    RenderBlock {mfrac} at (0,19) size 22x18
                       RenderInline {mn} at (0,0) size 8x16
-                        RenderText {#text} at (11,2) size 8x16
-                          text run at (11,2) width 8: "2"
+                        RenderText {#text} at (7,2) size 8x16
+                          text run at (7,2) width 8: "2"
             RenderBlock {mo} at (81,0) size 6x92
           RenderText {#text} at (0,0) size 0x0
         RenderBlock {p} at (0,219) size 784x80
@@ -195,75 +195,84 @@ layer at (0,0) size 800x575
                 RenderTableRow {mtr} at (0,0) size 60x22
                   RenderTableCell {mtd} at (0,0) size 20x22 [r=0 c=0 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 20x22
-                      RenderInline {mi} at (0,0) size 8x16
-                        RenderText {#text} at (0,3) size 8x16
-                          text run at (0,3) width 8: "a"
+                      RenderBlock {msub} at (0,0) size 8x19
+                        RenderInline {mi} at (0,0) size 8x16
+                          RenderText {#text} at (0,3) size 8x16
+                            text run at (0,3) width 8: "a"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (8,10) size 12x12
                           text run at (8,10) width 12: "11"
                   RenderTableCell {mtd} at (20,0) size 20x22 [r=0 c=1 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 20x22
-                      RenderInline {mi} at (0,0) size 8x16
-                        RenderText {#text} at (0,3) size 8x16
-                          text run at (0,3) width 8: "a"
+                      RenderBlock {msub} at (0,0) size 8x19
+                        RenderInline {mi} at (0,0) size 8x16
+                          RenderText {#text} at (0,3) size 8x16
+                            text run at (0,3) width 8: "a"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (8,10) size 12x12
                           text run at (8,10) width 12: "12"
                   RenderTableCell {mtd} at (40,0) size 20x22 [r=0 c=2 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 20x22
-                      RenderInline {mi} at (0,0) size 8x16
-                        RenderText {#text} at (0,3) size 8x16
-                          text run at (0,3) width 8: "a"
+                      RenderBlock {msub} at (0,0) size 8x19
+                        RenderInline {mi} at (0,0) size 8x16
+                          RenderText {#text} at (0,3) size 8x16
+                            text run at (0,3) width 8: "a"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (8,10) size 12x12
                           text run at (8,10) width 12: "13"
                 RenderTableRow {mtr} at (0,22) size 60x22
                   RenderTableCell {mtd} at (0,22) size 20x22 [r=1 c=0 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 20x22
-                      RenderInline {mi} at (0,0) size 8x16
-                        RenderText {#text} at (0,3) size 8x16
-                          text run at (0,3) width 8: "b"
+                      RenderBlock {msub} at (0,0) size 8x19
+                        RenderInline {mi} at (0,0) size 8x16
+                          RenderText {#text} at (0,3) size 8x16
+                            text run at (0,3) width 8: "b"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (8,10) size 12x12
                           text run at (8,10) width 12: "21"
                   RenderTableCell {mtd} at (20,22) size 20x22 [r=1 c=1 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 20x22
-                      RenderInline {mi} at (0,0) size 8x16
-                        RenderText {#text} at (0,3) size 8x16
-                          text run at (0,3) width 8: "b"
+                      RenderBlock {msub} at (0,0) size 8x19
+                        RenderInline {mi} at (0,0) size 8x16
+                          RenderText {#text} at (0,3) size 8x16
+                            text run at (0,3) width 8: "b"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (8,10) size 12x12
                           text run at (8,10) width 12: "22"
                   RenderTableCell {mtd} at (40,22) size 20x22 [r=1 c=2 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 20x22
-                      RenderInline {mi} at (0,0) size 8x16
-                        RenderText {#text} at (0,3) size 8x16
-                          text run at (0,3) width 8: "b"
+                      RenderBlock {msub} at (0,0) size 8x19
+                        RenderInline {mi} at (0,0) size 8x16
+                          RenderText {#text} at (0,3) size 8x16
+                            text run at (0,3) width 8: "b"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (8,10) size 12x12
                           text run at (8,10) width 12: "23"
                 RenderTableRow {mtr} at (0,44) size 60x22
                   RenderTableCell {mtd} at (0,44) size 20x22 [r=2 c=0 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 19x22
-                      RenderInline {mi} at (0,0) size 7x16
-                        RenderText {#text} at (0,3) size 7x16
-                          text run at (0,3) width 7: "c"
+                      RenderBlock {msub} at (0,0) size 7x19
+                        RenderInline {mi} at (0,0) size 7x16
+                          RenderText {#text} at (0,3) size 7x16
+                            text run at (0,3) width 7: "c"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (7,10) size 12x12
                           text run at (7,10) width 12: "31"
                   RenderTableCell {mtd} at (20,44) size 20x22 [r=2 c=1 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 19x22
-                      RenderInline {mi} at (0,0) size 7x16
-                        RenderText {#text} at (0,3) size 7x16
-                          text run at (0,3) width 7: "c"
+                      RenderBlock {msub} at (0,0) size 7x19
+                        RenderInline {mi} at (0,0) size 7x16
+                          RenderText {#text} at (0,3) size 7x16
+                            text run at (0,3) width 7: "c"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (7,10) size 12x12
                           text run at (7,10) width 12: "32"
                   RenderTableCell {mtd} at (40,44) size 20x22 [r=2 c=2 rs=1 cs=1]
                     RenderBlock {msub} at (0,0) size 19x22
-                      RenderInline {mi} at (0,0) size 7x16
-                        RenderText {#text} at (0,3) size 7x16
-                          text run at (0,3) width 7: "c"
+                      RenderBlock {msub} at (0,0) size 7x19
+                        RenderInline {mi} at (0,0) size 7x16
+                          RenderText {#text} at (0,3) size 7x16
+                            text run at (0,3) width 7: "c"
                       RenderInline {mn} at (0,0) size 12x12
                         RenderText {#text} at (7,10) size 12x12
                           text run at (7,10) width 12: "33"
diff --git a/LayoutTests/platform/mac/mathml/presentation/row-expected.txt b/LayoutTests/platform/mac/mathml/presentation/row-expected.txt
index fe04795..7fd30c5 100644
--- a/LayoutTests/platform/mac/mathml/presentation/row-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/row-expected.txt
@@ -20,81 +20,75 @@ layer at (0,0) size 785x614
         RenderText {#text} at (0,2) size 40x18
           text run at (0,2) width 40: "16px: "
         RenderBlock {math} at (40,0) size 45x21
-          RenderBlock {mo} at (1,0) size 10x21 [bgcolor=#C8C8C8]
-            RenderBlock {mo} at (0,0) size 9x19
-              RenderText {mo} at (0,-1) size 9x22
-                text run at (0,-1) width 9: "{"
-          RenderInline {mi} at (0,0) size 7x16
-            RenderText {#text} at (11,5) size 7x16
-              text run at (11,5) width 7: "x"
-          RenderBlock {div} at (18,5) size 16x16 [bgcolor=#00FF00]
-          RenderBlock {mo} at (34,0) size 10x21 [bgcolor=#C8C8C8]
-            RenderBlock {mo} at (0,0) size 9x19
-              RenderText {mo} at (0,-1) size 9x22
-                text run at (0,-1) width 9: "}"
+          RenderBlock {mrow} at (1,0) size 43x21
+            RenderBlock {mo} at (0,0) size 10x21 [bgcolor=#C8C8C8]
+              RenderBlock {mo} at (0,0) size 9x19
+                RenderText {mo} at (0,-1) size 9x22
+                  text run at (0,-1) width 9: "{"
+            RenderInline {mi} at (0,0) size 7x16
+              RenderText {#text} at (10,5) size 7x16
+                text run at (10,5) width 7: "x"
+            RenderBlock {div} at (17,5) size 16x16 [bgcolor=#00FF00]
+            RenderBlock {mo} at (33,0) size 10x21 [bgcolor=#C8C8C8]
+              RenderBlock {mo} at (0,0) size 9x19
+                RenderText {mo} at (0,-1) size 9x22
+                  text run at (0,-1) width 9: "}"
         RenderText {#text} at (85,2) size 4x18
           text run at (85,2) width 4: " "
         RenderBlock {math} at (89,0) size 39x21
           RenderBlock {mrow} at (1,0) size 37x21
             RenderBlock {mo} at (0,0) size 7x21 [bgcolor=#C8C8C8]
-              RenderBlock (anonymous) at (0,0) size 6x21
-                RenderBlock {mo} at (0,0) size 6x19
-                  RenderText {mo} at (0,-1) size 6x22
-                    text run at (0,-1) width 6: "["
+              RenderBlock {mo} at (0,0) size 6x19
+                RenderText {mo} at (0,-1) size 6x22
+                  text run at (0,-1) width 6: "["
             RenderInline {mi} at (0,0) size 7x16
               RenderText {#text} at (7,5) size 7x16
                 text run at (7,5) width 7: "x"
             RenderBlock {div} at (14,5) size 16x16 [bgcolor=#00FF00]
             RenderBlock {mo} at (30,0) size 7x21 [bgcolor=#C8C8C8]
-              RenderBlock (anonymous) at (0,0) size 6x21
-                RenderBlock {mo} at (0,0) size 6x19
-                  RenderText {mo} at (0,-1) size 6x22
-                    text run at (0,-1) width 6: "]"
+              RenderBlock {mo} at (0,0) size 6x19
+                RenderText {mo} at (0,-1) size 6x22
+                  text run at (0,-1) width 6: "]"
         RenderText {#text} at (128,2) size 4x18
           text run at (128,2) width 4: " "
         RenderBlock {math} at (132,0) size 39x21
           RenderBlock {mrow} at (1,0) size 37x21
             RenderBlock {mo} at (0,0) size 7x21 [bgcolor=#C8C8C8]
-              RenderBlock (anonymous) at (0,0) size 6x21
-                RenderBlock {mo} at (0,0) size 6x19
-                  RenderText {mo} at (0,-1) size 6x22
-                    text run at (0,-1) width 6: "("
+              RenderBlock {mo} at (0,0) size 6x19
+                RenderText {mo} at (0,-1) size 6x22
+                  text run at (0,-1) width 6: "("
             RenderInline {mi} at (0,0) size 7x16
               RenderText {#text} at (7,5) size 7x16
                 text run at (7,5) width 7: "x"
             RenderBlock {div} at (14,5) size 16x16 [bgcolor=#00FF00]
             RenderBlock {mo} at (30,0) size 7x21 [bgcolor=#C8C8C8]
-              RenderBlock (anonymous) at (0,0) size 6x21
-                RenderBlock {mo} at (0,0) size 6x19
-                  RenderText {mo} at (0,-1) size 6x22
-                    text run at (0,-1) width 6: ")"
+              RenderBlock {mo} at (0,0) size 6x19
+                RenderText {mo} at (0,-1) size 6x22
+                  text run at (0,-1) width 6: ")"
         RenderText {#text} at (171,2) size 4x18
           text run at (171,2) width 4: " "
         RenderBlock {math} at (175,0) size 35x21
           RenderBlock {mrow} at (1,0) size 33x21
             RenderBlock {mo} at (0,0) size 5x21 [bgcolor=#C8C8C8]
-              RenderBlock (anonymous) at (0,0) size 4x21
-                RenderBlock {mo} at (0,0) size 4x19
-                  RenderText {mo} at (0,-1) size 4x22
-                    text run at (0,-1) width 4: "|"
+              RenderBlock {mo} at (0,0) size 4x19
+                RenderText {mo} at (0,-1) size 4x22
+                  text run at (0,-1) width 4: "|"
             RenderInline {mi} at (0,0) size 7x16
               RenderText {#text} at (5,5) size 7x16
                 text run at (5,5) width 7: "x"
             RenderBlock {div} at (12,5) size 16x16 [bgcolor=#00FF00]
             RenderBlock {mo} at (28,0) size 5x21 [bgcolor=#C8C8C8]
-              RenderBlock (anonymous) at (0,0) size 4x21
-                RenderBlock {mo} at (0,0) size 4x19
-                  RenderText {mo} at (0,-1) size 4x22
-                    text run at (0,-1) width 4: "|"
+              RenderBlock {mo} at (0,0) size 4x19
+                RenderText {mo} at (0,-1) size 4x22
+                  text run at (0,-1) width 4: "|"
         RenderText {#text} at (210,2) size 4x18
           text run at (210,2) width 4: " "
         RenderBlock {math} at (214,0) size 31x21
           RenderBlock {mrow} at (1,0) size 29x21
             RenderBlock {mo} at (0,0) size 6x21 [bgcolor=#C8C8C8]
-              RenderBlock (anonymous) at (0,0) size 5x21
-                RenderBlock {mo} at (0,0) size 5x19
-                  RenderText {mo} at (0,-1) size 5x22
-                    text run at (0,-1) width 5: "\x{222B}"
+              RenderBlock {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 7x16
               RenderText {#text} at (6,5) size 7x16
                 text run at (6,5) width 7: "x"
diff --git a/LayoutTests/platform/mac/mathml/presentation/sub-expected.checksum b/LayoutTests/platform/mac/mathml/presentation/sub-expected.checksum
index 6661fcf..ff6cda5 100644
--- a/LayoutTests/platform/mac/mathml/presentation/sub-expected.checksum
+++ b/LayoutTests/platform/mac/mathml/presentation/sub-expected.checksum
@@ -1 +1 @@
-2e9d9b3a454f2d790c8d0a012fcae480
\ No newline at end of file
+d5998c9a1776f79a14c01b6add75e6f0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/mathml/presentation/sub-expected.png b/LayoutTests/platform/mac/mathml/presentation/sub-expected.png
index d9c85e2..cf62f60 100644
Binary files a/LayoutTests/platform/mac/mathml/presentation/sub-expected.png and b/LayoutTests/platform/mac/mathml/presentation/sub-expected.png differ
diff --git a/LayoutTests/platform/mac/mathml/presentation/sub-expected.txt b/LayoutTests/platform/mac/mathml/presentation/sub-expected.txt
index dab277b..1c8e690 100644
--- a/LayoutTests/platform/mac/mathml/presentation/sub-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/sub-expected.txt
@@ -1,16 +1,17 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x130
-  RenderBlock {html} at (0,0) size 800x130
-    RenderBody {body} at (8,16) size 784x98
+layer at (0,0) size 800x134
+  RenderBlock {html} at (0,0) size 800x134
+    RenderBody {body} at (8,16) size 784x102
       RenderBlock {p} at (0,0) size 784x22
         RenderText {#text} at (0,0) size 27x18
           text run at (0,0) width 27: "text "
         RenderBlock {math} at (27,0) size 15x22
           RenderBlock {msub} at (1,0) size 13x22
-            RenderInline {mi} at (0,0) size 7x16
-              RenderText {#text} at (0,3) size 7x16
-                text run at (0,3) width 7: "x"
+            RenderBlock {msub} at (0,0) size 7x19
+              RenderInline {mi} at (0,0) size 7x16
+                RenderText {#text} at (0,3) size 7x16
+                  text run at (0,3) width 7: "x"
             RenderInline {mn} at (0,0) size 6x12
               RenderText {#text} at (7,10) size 6x12
                 text run at (7,10) width 6: "1"
@@ -18,32 +19,28 @@ layer at (0,0) size 800x130
       RenderBlock {p} at (0,38) size 784x22
         RenderText {#text} at (0,0) size 27x18
           text run at (0,0) width 27: "text "
-        RenderBlock {math} at (27,3) size 20x19
-          RenderBlock {msub} at (1,0) size 18x19
-            RenderBlock {mo} at (0,0) size 9x16
+        RenderBlock {math} at (27,3) size 16x19
+          RenderBlock {msub} at (1,0) size 14x19
+            RenderBlock {msub} at (0,0) size 9x16
               RenderBlock {mo} at (0,0) size 9x16
-                RenderText {mo} at (0,0) size 9x16
-                  text run at (0,0) width 9: "+"
-            RenderText {#text} at (9,0) size 4x16
-              text run at (9,0) width 4: " "
+                RenderBlock {mo} at (0,0) size 9x16
+                  RenderText {mo} at (0,0) size 9x16
+                    text run at (0,0) width 9: "+"
             RenderInline {mi} at (0,0) size 5x12
-              RenderText {#text} at (13,7) size 5x12
-                text run at (13,7) width 5: "x"
-            RenderText {#text} at (0,0) size 0x0
+              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 784x22
-        RenderText {#text} at (0,0) size 27x18
-          text run at (0,0) width 27: "text "
-        RenderBlock {math} at (27,3) size 17x19
-          RenderBlock {msub} at (1,0) size 15x19
-            RenderBlock {mo} at (0,0) size 4x16
-              RenderBlock {mo} at (0,0) size 4x16
-                RenderText {mo} at (0,0) size 4x16
-                  text run at (0,0) width 4: "\x{222B}"
-            RenderText {#text} at (4,0) size 4x16
-              text run at (4,0) width 4: " "
+      RenderBlock {p} at (0,76) size 784x26
+        RenderText {#text} at (0,4) size 27x18
+          text run at (0,4) width 27: "text "
+        RenderBlock {math} at (27,0) size 15x26
+          RenderBlock {msub} at (1,0) size 13x26
+            RenderBlock {msub} at (0,0) size 6x23
+              RenderBlock {mo} at (0,0) size 6x23
+                RenderBlock {mo} at (0,0) size 6x22
+                  RenderText {mo} at (0,-2) size 6x26
+                    text run at (0,-2) width 6: "\x{222B}"
             RenderInline {mi} at (0,0) size 7x12
-              RenderText {#text} at (8,7) size 7x12
-                text run at (8,7) width 7: "Y"
-            RenderText {#text} at (0,0) size 0x0
+              RenderText {#text} at (6,14) size 7x12
+                text run at (6,14) width 7: "Y"
         RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/mathml/presentation/subsup-expected.txt b/LayoutTests/platform/mac/mathml/presentation/subsup-expected.txt
index 309ffb7..f3d8d8e 100644
--- a/LayoutTests/platform/mac/mathml/presentation/subsup-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/subsup-expected.txt
@@ -8,10 +8,10 @@ layer at (0,0) size 800x256
           text run at (0,8) width 36: "both: "
         RenderBlock {math} at (36,0) size 16x32
           RenderBlock {msubsup} at (1,0) size 14x32
-            RenderBlock {msubsup} at (0,8) size 7x19
+            RenderBlock {msubsup} at (0,0) size 7x27
               RenderInline {mi} at (0,0) size 7x16
-                RenderText {#text} at (0,3) size 7x16
-                  text run at (0,3) width 7: "x"
+                RenderText {#text} at (0,11) size 7x16
+                  text run at (0,11) width 7: "x"
             RenderBlock {msubsup} at (8,0) size 6x32
               RenderBlock {msubsup} at (0,0) size 6x16
                 RenderInline {mi} at (0,0) size 5x12
@@ -27,10 +27,10 @@ layer at (0,0) size 800x256
           text run at (0,8) width 148: "long subscript w/ both: "
         RenderBlock {math} at (148,0) size 44x32
           RenderBlock {msubsup} at (1,0) size 42x32
-            RenderBlock {msubsup} at (0,8) size 9x19
+            RenderBlock {msubsup} at (0,0) size 9x27
               RenderInline {mi} at (0,0) size 9x16
-                RenderText {#text} at (0,3) size 9x16
-                  text run at (0,3) width 9: "Z"
+                RenderText {#text} at (0,11) size 9x16
+                  text run at (0,11) width 9: "Z"
             RenderBlock {msubsup} at (10,0) size 32x32
               RenderBlock {msubsup} at (0,0) size 18x16
                 RenderInline {mi} at (0,0) size 3x12
@@ -61,10 +61,10 @@ layer at (0,0) size 800x256
           text run at (0,8) width 160: "long superscript w/ both: "
         RenderBlock {math} at (160,0) size 29x32
           RenderBlock {msubsup} at (1,0) size 27x32
-            RenderBlock {msubsup} at (0,8) size 9x19
+            RenderBlock {msubsup} at (0,0) size 9x27
               RenderInline {mi} at (0,0) size 9x16
-                RenderText {#text} at (0,3) size 9x16
-                  text run at (0,3) width 9: "Z"
+                RenderText {#text} at (0,11) size 9x16
+                  text run at (0,11) width 9: "Z"
             RenderBlock {msubsup} at (10,0) size 17x32
               RenderBlock {msubsup} at (0,0) size 10x16
                 RenderBlock {mrow} at (1,1) size 16x14
@@ -88,10 +88,10 @@ layer at (0,0) size 800x256
           text run at (0,8) width 88: "long w/ both: "
         RenderBlock {math} at (88,0) size 44x32
           RenderBlock {msubsup} at (1,0) size 42x32
-            RenderBlock {msubsup} at (0,8) size 9x19
+            RenderBlock {msubsup} at (0,0) size 9x27
               RenderInline {mi} at (0,0) size 9x16
-                RenderText {#text} at (0,3) size 9x16
-                  text run at (0,3) width 9: "Z"
+                RenderText {#text} at (0,11) size 9x16
+                  text run at (0,11) width 9: "Z"
             RenderBlock {msubsup} at (10,0) size 32x32
               RenderBlock {msubsup} at (0,0) size 18x16
                 RenderBlock {mrow} at (1,1) size 16x14
@@ -131,10 +131,10 @@ layer at (0,0) size 800x256
         RenderBlock {math} at (123,0) size 16x32
           RenderBlock {mrow} at (1,0) size 14x32
             RenderBlock {msubsup} at (0,0) size 14x32
-              RenderBlock {msubsup} at (0,8) size 7x19
+              RenderBlock {msubsup} at (0,0) size 7x27
                 RenderInline {mi} at (0,0) size 7x16
-                  RenderText {#text} at (0,3) size 7x16
-                    text run at (0,3) width 7: "x"
+                  RenderText {#text} at (0,11) size 7x16
+                    text run at (0,11) width 7: "x"
               RenderBlock {msubsup} at (8,0) size 6x32
                 RenderBlock {msubsup} at (0,0) size 6x16
                   RenderInline {mi} at (0,0) size 5x12
diff --git a/LayoutTests/platform/mac/mathml/presentation/sup-expected.txt b/LayoutTests/platform/mac/mathml/presentation/sup-expected.txt
index f838d43..c40399c 100644
--- a/LayoutTests/platform/mac/mathml/presentation/sup-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/sup-expected.txt
@@ -8,9 +8,10 @@ layer at (0,0) size 800x51
           text run at (0,0) width 76: "superscript: "
         RenderBlock {math} at (76,0) size 15x19
           RenderBlock {msup} at (1,0) size 13x19
-            RenderInline {mi} at (0,0) size 7x16
-              RenderText {#text} at (0,3) size 7x16
-                text run at (0,3) width 7: "x"
+            RenderBlock {msup} at (0,0) size 7x19
+              RenderInline {mi} at (0,0) size 7x16
+                RenderText {#text} at (0,3) size 7x16
+                  text run at (0,3) width 7: "x"
             RenderInline {mn} at (0,0) size 6x12
               RenderText {#text} at (7,0) size 6x12
                 text run at (7,0) width 6: "2"
diff --git a/LayoutTests/platform/mac/mathml/presentation/tables-expected.txt b/LayoutTests/platform/mac/mathml/presentation/tables-expected.txt
index 8d9bbd3..ef18d12 100644
--- a/LayoutTests/platform/mac/mathml/presentation/tables-expected.txt
+++ b/LayoutTests/platform/mac/mathml/presentation/tables-expected.txt
@@ -12,75 +12,84 @@ layer at (0,0) size 800x180
               RenderTableRow {mtr} at (0,0) size 60x22
                 RenderTableCell {mtd} at (0,0) size 20x22 [r=0 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "11"
                 RenderTableCell {mtd} at (20,0) size 20x22 [r=0 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "12"
                 RenderTableCell {mtd} at (40,0) size 20x22 [r=0 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "13"
               RenderTableRow {mtr} at (0,22) size 60x22
                 RenderTableCell {mtd} at (0,22) size 20x22 [r=1 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "21"
                 RenderTableCell {mtd} at (20,22) size 20x22 [r=1 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "22"
                 RenderTableCell {mtd} at (40,22) size 20x22 [r=1 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "23"
               RenderTableRow {mtr} at (0,44) size 60x22
                 RenderTableCell {mtd} at (0,44) size 20x22 [r=2 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "31"
                 RenderTableCell {mtd} at (20,44) size 20x22 [r=2 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "32"
                 RenderTableCell {mtd} at (40,44) size 20x22 [r=2 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "33"
@@ -94,75 +103,84 @@ layer at (0,0) size 800x180
               RenderTableRow {mtr} at (0,0) size 60x22
                 RenderTableCell {mtd} at (0,0) size 20x22 [r=0 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 14x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (8,10) size 6x12
                         text run at (8,10) width 6: "1"
                 RenderTableCell {mtd} at (20,0) size 20x22 [r=0 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "12"
                 RenderTableCell {mtd} at (40,0) size 20x22 [r=0 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "13"
               RenderTableRow {mtr} at (0,22) size 60x22
                 RenderTableCell {mtd} at (0,22) size 20x22 [r=1 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "21"
                 RenderTableCell {mtd} at (20,22) size 20x22 [r=1 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 14x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (8,10) size 6x12
                         text run at (8,10) width 6: "2"
                 RenderTableCell {mtd} at (40,22) size 20x22 [r=1 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "23"
               RenderTableRow {mtr} at (0,44) size 60x22
                 RenderTableCell {mtd} at (0,44) size 20x22 [r=2 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "31"
                 RenderTableCell {mtd} at (20,44) size 20x22 [r=2 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "32"
                 RenderTableCell {mtd} at (40,44) size 20x22 [r=2 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 13x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (7,10) size 6x12
                         text run at (7,10) width 6: "3"
@@ -174,75 +192,84 @@ layer at (0,0) size 800x180
               RenderTableRow {mtr} at (0,0) size 60x22
                 RenderTableCell {mtd} at (0,0) size 20x22 [r=0 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (3,0) size 14x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (8,10) size 6x12
                         text run at (8,10) width 6: "1"
                 RenderTableCell {mtd} at (20,0) size 20x22 [r=0 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "12"
                 RenderTableCell {mtd} at (40,0) size 20x22 [r=0 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "13"
               RenderTableRow {mtr} at (0,22) size 60x22
                 RenderTableCell {mtd} at (0,22) size 20x22 [r=1 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "21"
                 RenderTableCell {mtd} at (20,22) size 20x22 [r=1 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (3,0) size 14x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (8,10) size 6x12
                         text run at (8,10) width 6: "2"
                 RenderTableCell {mtd} at (40,22) size 20x22 [r=1 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "23"
               RenderTableRow {mtr} at (0,44) size 60x22
                 RenderTableCell {mtd} at (0,44) size 20x22 [r=2 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "31"
                 RenderTableCell {mtd} at (20,44) size 20x22 [r=2 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "32"
                 RenderTableCell {mtd} at (40,44) size 20x22 [r=2 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (3,0) size 13x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (7,10) size 6x12
                         text run at (7,10) width 6: "3"
@@ -254,75 +281,84 @@ layer at (0,0) size 800x180
               RenderTableRow {mtr} at (0,0) size 60x22
                 RenderTableCell {mtd} at (0,0) size 20x22 [r=0 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (6,0) size 14x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (8,10) size 6x12
                         text run at (8,10) width 6: "1"
                 RenderTableCell {mtd} at (20,0) size 20x22 [r=0 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "12"
                 RenderTableCell {mtd} at (40,0) size 20x22 [r=0 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "a"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "a"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "13"
               RenderTableRow {mtr} at (0,22) size 60x22
                 RenderTableCell {mtd} at (0,22) size 20x22 [r=1 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "21"
                 RenderTableCell {mtd} at (20,22) size 20x22 [r=1 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (6,0) size 14x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (8,10) size 6x12
                         text run at (8,10) width 6: "2"
                 RenderTableCell {mtd} at (40,22) size 20x22 [r=1 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (0,0) size 20x22
-                    RenderInline {mi} at (0,0) size 8x16
-                      RenderText {#text} at (0,3) size 8x16
-                        text run at (0,3) width 8: "b"
+                    RenderBlock {msub} at (0,0) size 8x19
+                      RenderInline {mi} at (0,0) size 8x16
+                        RenderText {#text} at (0,3) size 8x16
+                          text run at (0,3) width 8: "b"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (8,10) size 12x12
                         text run at (8,10) width 12: "23"
               RenderTableRow {mtr} at (0,44) size 60x22
                 RenderTableCell {mtd} at (0,44) size 20x22 [r=2 c=0 rs=1 cs=1]
                   RenderBlock {msub} at (1,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "31"
                 RenderTableCell {mtd} at (20,44) size 20x22 [r=2 c=1 rs=1 cs=1]
                   RenderBlock {msub} at (1,0) size 19x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 12x12
                       RenderText {#text} at (7,10) size 12x12
                         text run at (7,10) width 12: "32"
                 RenderTableCell {mtd} at (40,44) size 20x22 [r=2 c=2 rs=1 cs=1]
                   RenderBlock {msub} at (7,0) size 13x22
-                    RenderInline {mi} at (0,0) size 7x16
-                      RenderText {#text} at (0,3) size 7x16
-                        text run at (0,3) width 7: "c"
+                    RenderBlock {msub} at (0,0) size 7x19
+                      RenderInline {mi} at (0,0) size 7x16
+                        RenderText {#text} at (0,3) size 7x16
+                          text run at (0,3) width 7: "c"
                     RenderInline {mn} at (0,0) size 6x12
                       RenderText {#text} at (7,10) size 6x12
                         text run at (7,10) width 6: "3"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a3202b2..93cf40b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2010-10-21  Alex Milowski  <alex at milowski.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Changed the layout algorithm for rows to avoid unnecessary recursion
+        into child rows.  This solves the long rendering time experienced in
+        https://bugs.webkit.org/show_bug.cgi?id=43462 as well as reports in
+        various other bugs.  The change in the algorithm required some
+        tweaks to other rendering objects to make sure that the baseline
+        alignment still works.
+
+        In addition, an attempt was made to go through the various
+        rendering objects for MathML and reduce unnecessary calls that
+        mark the tree in need of layout.
+
+        * mathml/RenderMathMLFenced.cpp:
+        * mathml/RenderMathMLFenced.h:
+        * mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::layout):
+        * mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::stretchToHeight):
+        * mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::layout):
+        * mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::layout):
+        * mathml/RenderMathMLRow.h:
+        (WebCore::RenderMathMLRow::stretchToHeight):
+        * mathml/RenderMathMLSubSup.cpp:
+        (WebCore::RenderMathMLSubSup::addChild):
+        (WebCore::RenderMathMLSubSup::stretchToHeight):
+        (WebCore::RenderMathMLSubSup::nonOperatorHeight):
+        (WebCore::RenderMathMLSubSup::layout):
+        (WebCore::RenderMathMLSubSup::baselinePosition):
+        * mathml/RenderMathMLUnderOver.cpp:
+        (WebCore::RenderMathMLUnderOver::stretchToHeight):
+        (WebCore::RenderMathMLUnderOver::layout):
+        (WebCore::RenderMathMLUnderOver::nonOperatorHeight):
+        * mathml/mathtags.in:
+
 2010-10-21  Evan Martin  <evan at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebCore/mathml/RenderMathMLFenced.cpp b/WebCore/mathml/RenderMathMLFenced.cpp
index a304fa4..f7bbf71 100644
--- a/WebCore/mathml/RenderMathMLFenced.cpp
+++ b/WebCore/mathml/RenderMathMLFenced.cpp
@@ -142,26 +142,6 @@ void RenderMathMLFenced::addChild(RenderObject* child, RenderObject*)
         RenderBlock::addChild(child, lastChild());
 }
 
-void RenderMathMLFenced::layout() 
-{
-    RenderMathMLRow::layout();
-    
-    int width = 0;
-    for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
-        if (current->isBoxModelObject()) {
-            RenderBoxModelObject* box = toRenderBoxModelObject(current);
-            width += box->offsetWidth();
-        }
-    }
-    width++;
-    style()->setWidth(Length(width, Fixed));
-
-    setNeedsLayoutAndPrefWidthsRecalc();
-    markContainingBlocksForLayout();
-    RenderBlock::layout();
-    
-    setNeedsLayout(false);
-}
 }    
 
 #endif
diff --git a/WebCore/mathml/RenderMathMLFenced.h b/WebCore/mathml/RenderMathMLFenced.h
index 63cdaa8..64e4d90 100644
--- a/WebCore/mathml/RenderMathMLFenced.h
+++ b/WebCore/mathml/RenderMathMLFenced.h
@@ -38,9 +38,6 @@ public:
     virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
     virtual void updateFromElement();
     
-protected:
-    virtual void layout();
-    
 private:
     void makeFences();
     RefPtr<RenderStyle> makeOperatorStyle();
diff --git a/WebCore/mathml/RenderMathMLFraction.cpp b/WebCore/mathml/RenderMathMLFraction.cpp
index 92c8101..1000604 100644
--- a/WebCore/mathml/RenderMathMLFraction.cpp
+++ b/WebCore/mathml/RenderMathMLFraction.cpp
@@ -129,13 +129,6 @@ void RenderMathMLFraction::layout()
 
     RenderBlock::layout();
 
-    // The row layout can affect the numerator/denominator width.
-    // FIXME: This is probably only needed if one of the children
-    // contains an mrow.
-    setNeedsLayoutAndPrefWidthsRecalc();
-    markContainingBlocksForLayout();
-
-    RenderBlock::layout();
 }
 
 void RenderMathMLFraction::paint(PaintInfo& info, int tx, int ty)
diff --git a/WebCore/mathml/RenderMathMLOperator.cpp b/WebCore/mathml/RenderMathMLOperator.cpp
index 1e3b429..9f35480 100644
--- a/WebCore/mathml/RenderMathMLOperator.cpp
+++ b/WebCore/mathml/RenderMathMLOperator.cpp
@@ -67,8 +67,7 @@ void RenderMathMLOperator::stretchToHeight(int height)
     m_stretchHeight = static_cast<int>(height * gOperatorExpansion);
     
     updateBoxModelInfoFromStyle();
-    setNeedsLayoutAndPrefWidthsRecalc();
-    markContainingBlocksForLayout();
+    setNeedsLayout(true);
 }
 
 void RenderMathMLOperator::layout() 
diff --git a/WebCore/mathml/RenderMathMLRoot.cpp b/WebCore/mathml/RenderMathMLRoot.cpp
index ab15c80..ba60c9f 100644
--- a/WebCore/mathml/RenderMathMLRoot.cpp
+++ b/WebCore/mathml/RenderMathMLRoot.cpp
@@ -246,14 +246,14 @@ void RenderMathMLRoot::layout()
     if (rootMarginTop > 0)
         style()->setPaddingTop(Length(rootMarginTop + static_cast<int>(gRootPadding * style()->fontSize()), Fixed));
     
-    setNeedsLayoutAndPrefWidthsRecalc();
-    markContainingBlocksForLayout();
+    setNeedsLayout(true);
+    setPreferredLogicalWidthsDirty(true, false);
     RenderBlock::layout();
 
     indexBox->style()->setBottom(Length(radicalHeight + style()->paddingBottom().value(), Fixed));
 
     // Now that we've potentially changed its position, we need layout the index again.
-    indexBox->setNeedsLayoutAndPrefWidthsRecalc();
+    indexBox->setNeedsLayout(true);
     indexBox->layout();
 }
     
diff --git a/WebCore/mathml/RenderMathMLRow.cpp b/WebCore/mathml/RenderMathMLRow.cpp
index 632b794..ae911fc 100644
--- a/WebCore/mathml/RenderMathMLRow.cpp
+++ b/WebCore/mathml/RenderMathMLRow.cpp
@@ -66,42 +66,27 @@ void RenderMathMLRow::layout()
 {
     RenderBlock::layout();
     
-    // Calculate the maximum height of the row without the operators.
-    int maxHeight = nonOperatorHeight();
-    
-    // Notify contained operators they may need to re-layout their stretched operators.
-    // We need to keep track of the number of children and operators because a row of
-    // operators needs some special handling.
+    int maxHeight = 0;
     int childCount = 0;
     int operatorCount = 0;
-    for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
-        childCount++;
-        if (current->isRenderMathMLBlock()) {
-            RenderMathMLBlock* block = toRenderMathMLBlock(current);
-            block->stretchToHeight(maxHeight);
-            if (block->isRenderMathMLOperator()) 
-                operatorCount++;
-        }
-    }
-    
-    // Layout the non-operators which have just been stretched.
-    setNeedsLayoutAndPrefWidthsRecalc();
-    markContainingBlocksForLayout();
-    RenderBlock::layout();
 
-    // Make a second pass with the real height of the operators.
+    // Calculate the non-operator max height of the row.
     int operatorHeight = 0;
     for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
+        childCount++;
         if (current->isRenderMathMLBlock()) {
             RenderMathMLBlock* block = toRenderMathMLBlock(current);
-            if (!block->hasBase() && !block->isRenderMathMLOperator()) {
-                // Check to see if this box has a larger height.
-                if (block->offsetHeight() > maxHeight)
-                    maxHeight = block->offsetHeight();
-            }
-            if (block->isRenderMathMLOperator())
+            // Check to see if the non-operator block has a greater height.
+            if (!block->hasBase() && !block->isRenderMathMLOperator() && block->offsetHeight() > maxHeight)
+                maxHeight = block->offsetHeight();
+            if (block->hasBase() && block->nonOperatorHeight() > maxHeight) 
+                maxHeight = block->nonOperatorHeight();
+            // If the block is an operator, capture the maximum height and increment the count.
+            if (block->isRenderMathMLOperator()) {
                 if (block->offsetHeight() > operatorHeight)
                     operatorHeight = block->offsetHeight();
+                operatorCount++;
+            }
         } else if (current->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(current);
             // Check to see if this box has a larger height.
@@ -115,34 +100,23 @@ void RenderMathMLRow::layout()
         maxHeight = operatorHeight;
     }
     
-    int stretchHeight = maxHeight;
-    
-    // Stretch the operators again and re-calculate the row height.
-    for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
-        if (current->isRenderMathMLBlock()) {
-            RenderMathMLBlock* block = toRenderMathMLBlock(current);
-            if (block->isRenderMathMLOperator()) {
-                RenderMathMLOperator* mathop = toRenderMathMLOperator(block);
-                mathop->stretchToHeight(stretchHeight);
-            } else {
-                block->stretchToHeight(stretchHeight);
-                RenderBoxModelObject* box = toRenderBoxModelObject(current);
-                // Check to see if this box has a larger height
-                if (box->offsetHeight() > maxHeight)
-                    maxHeight = box->offsetHeight();
+    // Stretch everything to the same height (blocks can ignore the request).
+    if (maxHeight > 0) {
+        bool didStretch = false;
+        for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
+            if (current->isRenderMathMLBlock()) {
+                RenderMathMLBlock* block = toRenderMathMLBlock(current);
+                block->stretchToHeight(maxHeight);
+                didStretch = true;
             }
-        } else if (current->isBoxModelObject()) {
-            RenderBoxModelObject* box = toRenderBoxModelObject(current);
-            // Check to see if this box has a larger height
-            if (box->offsetHeight() > maxHeight)
-                maxHeight = box->offsetHeight();
+        }
+        if (didStretch) {
+            setNeedsLayout(true);
+            setPreferredLogicalWidthsDirty(true, false);
+            RenderBlock::layout();
         }
     }
     
-    // Mark outself as needing layout and do the final layout of the row.
-    setNeedsLayoutAndPrefWidthsRecalc();
-    markContainingBlocksForLayout();
-    RenderBlock::layout();
 }    
 
 int RenderMathMLRow::baselinePosition(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
diff --git a/WebCore/mathml/RenderMathMLRow.h b/WebCore/mathml/RenderMathMLRow.h
index b363b1b..c877561 100644
--- a/WebCore/mathml/RenderMathMLRow.h
+++ b/WebCore/mathml/RenderMathMLRow.h
@@ -38,6 +38,7 @@ public:
     virtual bool isRenderMathMLRow() const { return true; }
     virtual int nonOperatorHeight() const;
     virtual int baselinePosition(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;    
+    virtual void stretchToHeight(int) {}
 protected:
     virtual void layout();
 };
diff --git a/WebCore/mathml/RenderMathMLSubSup.cpp b/WebCore/mathml/RenderMathMLSubSup.cpp
index 8add254..6c9c6b9 100644
--- a/WebCore/mathml/RenderMathMLSubSup.cpp
+++ b/WebCore/mathml/RenderMathMLSubSup.cpp
@@ -95,10 +95,11 @@ void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild
         RefPtr<RenderStyle> wrapperStyle = RenderStyle::create();
         wrapperStyle->inheritFrom(style());
         wrapperStyle->setDisplay(INLINE_BLOCK);
-        wrapperStyle->setVerticalAlign(TOP);
+        wrapperStyle->setVerticalAlign(BASELINE);
         wrapper->setStyle(wrapperStyle.release());
         RenderMathMLBlock::addChild(wrapper, beforeChild);
         wrapper->addChild(child);
+        
     }
 }
 
@@ -111,6 +112,8 @@ void RenderMathMLSubSup::stretchToHeight(int height)
     if (base->firstChild()->isRenderMathMLBlock()) {
         RenderMathMLBlock* block = toRenderMathMLBlock(base->firstChild());
         block->stretchToHeight(static_cast<int>(gSubSupStretch * height));
+        
+        // Adjust the script placement after we stretch
         if (height > 0 && m_kind == SubSup && m_scripts) {
             RenderObject* script = m_scripts->firstChild();
             if (script) {
@@ -124,31 +127,28 @@ void RenderMathMLSubSup::stretchToHeight(int height)
                     RenderBoxModelObject* topBox = toRenderBoxModelObject(top);
                     topBox->updateBoxModelInfoFromStyle();
                 }
-                m_scripts->setNeedsLayoutAndPrefWidthsRecalc();
-                m_scripts->markContainingBlocksForLayout();
+                m_scripts->setNeedsLayout(true);
+                setNeedsLayout(true);
             }
         }
+        
     }
-    updateBoxModelInfoFromStyle();
-    setNeedsLayoutAndPrefWidthsRecalc();
-    markContainingBlocksForLayout();
 }
 
 int RenderMathMLSubSup::nonOperatorHeight() const 
 {
-    return 0;
+    if (m_kind == SubSup) 
+       return static_cast<int>(style()->fontSize()*gSubSupStretch);
+    return static_cast<int>(style()->fontSize());
 }
 
 void RenderMathMLSubSup::layout() 
 {
-    if (firstChild()) {
-        firstChild()->setNeedsLayoutAndPrefWidthsRecalc();
-        firstChild()->markContainingBlocksForLayout();
-    }
-    if (m_scripts) {
-        m_scripts->setNeedsLayoutAndPrefWidthsRecalc();
-        m_scripts->markContainingBlocksForLayout();
-    }
+    if (firstChild())
+        firstChild()->setNeedsLayout(true);
+    if (m_scripts) 
+        m_scripts->setNeedsLayout(true);
+    
     RenderBlock::layout();
     
     if (m_kind == SubSup) {
@@ -165,10 +165,10 @@ void RenderMathMLSubSup::layout()
             int heightDiff = m_scripts ? (m_scripts->offsetHeight() - maxHeight) / 2 : 0;
             if (heightDiff < 0) 
                 heightDiff = 0;
-            base->style()->setMarginTop(Length(heightDiff, Fixed));
+            base->style()->setPaddingTop(Length(heightDiff, Fixed));
         }
-        setNeedsLayoutAndPrefWidthsRecalc();
-        markContainingBlocksForLayout();
+        setNeedsLayout(true);
+        base->setNeedsLayout(true);
         RenderBlock::layout();
     }    
 }
@@ -178,17 +178,17 @@ int RenderMathMLSubSup::baselinePosition(bool firstLine, LineDirectionMode direc
     RenderObject* base = firstChild();
     if (!base) 
         return offsetHeight();
-    base = base->firstChild();
     
     int baseline = offsetHeight();
     if (!base || !base->isBoxModelObject()) 
         return baseline;
 
-    RenderBoxModelObject* box = toRenderBoxModelObject(base);
-
     switch (m_kind) {
     case SubSup:
-        if (m_scripts) {
+        base = base->firstChild();
+        if (m_scripts && base->isBoxModelObject()) {
+            RenderBoxModelObject* box = toRenderBoxModelObject(base);
+            
             int topAdjust = (m_scripts->offsetHeight() - box->offsetHeight()) / 2;
         
             // FIXME: The last bit of this calculation should be more exact.  Why is the 2-3px scaled for zoom necessary?
@@ -197,22 +197,10 @@ int RenderMathMLSubSup::baselinePosition(bool firstLine, LineDirectionMode direc
             return topAdjust + box->baselinePosition(firstLine, direction, linePositionMode) + static_cast<int>((zoomFactor > 1.25 ? 2 : 3) * zoomFactor);
         }
         break;
-    case Sup: {
-        baseline = box->baselinePosition(firstLine, direction, linePositionMode) + 4;
-        // FIXME: The extra amount of the superscript ascending above the base's box
-        // isn't taken into account.  This should be calculated in a more reliable
-        // way.
-        RenderObject* sup = base->nextSibling();
-        if (sup && sup->isBoxModelObject()) {
-            RenderBoxModelObject* box = toRenderBoxModelObject(sup);
-            // we'll take half of the sup's box height into account in the baseline
-            baseline += static_cast<int>(box->offsetHeight() * 0.5);
-        }
-        baseline++;
-        break;
-    }
+    case Sup: 
     case Sub:
-        baseline = box->baselinePosition(true, direction) + 4;
+        RenderBoxModelObject* box = toRenderBoxModelObject(base);
+        baseline = box->baselinePosition(firstLine, direction, linePositionMode);
         break;
     }
     
diff --git a/WebCore/mathml/RenderMathMLUnderOver.cpp b/WebCore/mathml/RenderMathMLUnderOver.cpp
index 69f2c57..a76f6b1 100644
--- a/WebCore/mathml/RenderMathMLUnderOver.cpp
+++ b/WebCore/mathml/RenderMathMLUnderOver.cpp
@@ -118,7 +118,7 @@ inline int getOffsetHeight(RenderObject* obj)
     return 0;
 }
 
-void  RenderMathMLUnderOver::stretchToHeight(int height)
+void RenderMathMLUnderOver::stretchToHeight(int height)
 {
 
     RenderObject* base = firstChild();
@@ -138,9 +138,7 @@ void  RenderMathMLUnderOver::stretchToHeight(int height)
     if (base && base->isRenderMathMLBlock()) {
         RenderMathMLBlock* block = toRenderMathMLBlock(base);
         block->stretchToHeight(height);
-        updateBoxModelInfoFromStyle();
-        setNeedsLayoutAndPrefWidthsRecalc();
-        markContainingBlocksForLayout();
+        setNeedsLayout(true);
     }
 }
 
@@ -241,7 +239,7 @@ void RenderMathMLUnderOver::layout()
         }
         break;
     }
-    setNeedsLayoutAndPrefWidthsRecalc();
+    setNeedsLayout(true);
     RenderBlock::layout();
 }
 
@@ -282,7 +280,17 @@ int RenderMathMLUnderOver::baselinePosition(bool firstLine, LineDirectionMode di
 
 int RenderMathMLUnderOver::nonOperatorHeight() const 
 {
-    return 0;
+    int nonOperators = 0;
+    for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
+        if (current->firstChild()->isRenderMathMLBlock()) {
+            RenderMathMLBlock* block = toRenderMathMLBlock(current->firstChild());
+            if (!block->isRenderMathMLOperator()) 
+                nonOperators += getOffsetHeight(current);
+        } else {
+            nonOperators += getOffsetHeight(current);
+        }
+    }
+    return nonOperators;
 }
 
 }
diff --git a/WebCore/mathml/mathtags.in b/WebCore/mathml/mathtags.in
index 5bb369a..b2dcb93 100644
--- a/WebCore/mathml/mathtags.in
+++ b/WebCore/mathml/mathtags.in
@@ -16,8 +16,8 @@ mi interfaceName=MathMLTextElement
 mn interfaceName=MathMLTextElement
 mo interfaceName=MathMLTextElement
 mtext interfaceName=MathMLTextElement
-msub interfaceName=MathMLElement
-msup interfaceName=MathMLElement
+msub interfaceName=MathMLInlineContainerElement
+msup interfaceName=MathMLInlineContainerElement
 
 #if 0 // Curently only for MathMLNames used by HTMLTreeBuilder.
 ms

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list