Changeset 169963 in webkit


Ignore:
Timestamp:
Jun 13, 2014 11:18:47 PM (10 years ago)
Author:
fred.wang@free.fr
Message:

Draw radicals with glyphs for better rendering
https://bugs.webkit.org/show_bug.cgi?id=119038

Reviewed by Chris Fleizach.

Source/WebCore:
We rewrite RenderMathMLRoot in order to fix bugs with SVG transforms and dynamic modification of children and allow drawing with an OpenType MATH table.
The drawing of the radical sign (without the top bar) is now moved to a RenderMathMLRadicalOperator class inheriting from RenderMathMLOperator.
This class fallbacks to the original drawing with graphic primitives if an OpenType MATH table is not available.

Tests: mathml/opentype/roots-LatinModern.html

mathml/presentation/mroot-transform.html

  • CMakeLists.txt: add files to build system.
  • WebCore.vcxproj/WebCore.vcxproj: ditto.
  • WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
  • WebCore.xcodeproj/project.pbxproj: ditto
  • css/mathml.css: remove rules for msqrt/mroot. The "script level" in mroot is not incremented by 2 as specified in the spec.

(math, mrow, mfenced, merror, mphantom, mstyle, menclose):
(mroot > *:last-child):
(math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle, menclose): Deleted.
(msqrt > *): Deleted.
(mroot): Deleted. This rule was causing bug 126516.
(mroot > * + *): Deleted.

  • rendering/RenderObject.h: Add two new isRenderMathML* functions for dynamic casting.

(WebCore::RenderObject::isRenderMathMLRadicalOperator):
(WebCore::RenderObject::isRenderMathMLRootWrapper):

  • rendering/mathml/RenderMathMLOperator.cpp: Accept a set of operator dictionary flags, all disabled by default. This is to allow anonymous radicas, which don't have any flag.

isFencedOperator() is now replaced with the more general isAnonymous() since we allow anonymous radical operator fors msqrt/mroot.
(WebCore::RenderMathMLOperator::RenderMathMLOperator):
(WebCore::RenderMathMLOperator::setOperatorFlagFromAttribute):
(WebCore::RenderMathMLOperator::setOperatorPropertiesFromOpDictEntry):
(WebCore::RenderMathMLOperator::SetOperatorProperties):
(WebCore::RenderMathMLOperator::updateTokenContent):

  • rendering/mathml/RenderMathMLOperator.h: Allow class to be overriden, redefine the anonymous constructor, remove isFencedOperator().
  • rendering/mathml/RenderMathMLRadicalOperator.cpp: Added.

(WebCore::RenderMathMLRadicalOperator::RenderMathMLRadicalOperator):
(WebCore::RenderMathMLRadicalOperator::stretchTo):
(WebCore::RenderMathMLRadicalOperator::SetOperatorProperties):
(WebCore::RenderMathMLRadicalOperator::computePreferredLogicalWidths):
(WebCore::RenderMathMLRadicalOperator::computeLogicalHeight):
(WebCore::RenderMathMLRadicalOperator::paint):
(WebCore::RenderMathMLRadicalOperator::trailingSpaceError):

  • rendering/mathml/RenderMathMLRadicalOperator.h: Added.
  • rendering/mathml/RenderMathMLRoot.cpp: Rewritten. Some parts to use graphic primitives are moved to RenderMathMLRadicalOperator.cpp.

(WebCore::RenderMathMLRoot::RenderMathMLRoot):
(WebCore::RenderMathMLRoot::baseWrapper):
(WebCore::RenderMathMLRoot::radicalWrapper):
(WebCore::RenderMathMLRoot::indexWrapper):
(WebCore::RenderMathMLRoot::radicalOperator):
(WebCore::RenderMathMLRoot::restructureWrappers):
(WebCore::RenderMathMLRoot::addChild):
(WebCore::RenderMathMLRoot::styleDidChange):
(WebCore::RenderMathMLRoot::updateFromElement):
(WebCore::RenderMathMLRoot::updateStyle):
(WebCore::RenderMathMLRoot::firstLineBaseline):
(WebCore::RenderMathMLRoot::layout):
(WebCore::RenderMathMLRoot::paint):
(WebCore::RenderMathMLRootWrapper::createAnonymousWrapper):
(WebCore::RenderMathMLRootWrapper::removeChildWithoutRestructuring):
(WebCore::RenderMathMLRootWrapper::removeChild):
(WebCore::RenderMathMLRoot::paddingTop): Deleted.
(WebCore::RenderMathMLRoot::paddingBottom): Deleted.
(WebCore::RenderMathMLRoot::paddingLeft): Deleted.
(WebCore::RenderMathMLRoot::paddingRight): Deleted.
(WebCore::RenderMathMLRoot::paddingBefore): Deleted.
(WebCore::RenderMathMLRoot::paddingAfter): Deleted.
(WebCore::RenderMathMLRoot::paddingStart): Deleted.
(WebCore::RenderMathMLRoot::paddingEnd): Deleted.
(WebCore::RenderMathMLRoot::index): Deleted.

  • rendering/mathml/RenderMathMLRoot.h: Rewritten.

(WebCore::RenderMathMLRootWrapper::RenderMathMLRootWrapper):

LayoutTests:
We update the reference for some tests with radicals and enable the tests for addition/removal of children in an msqrt/mroot element.
We also add a test for bug 126516 (SVG transforms not applied to mroot) and a new test for radical drawing using an OpenType MATH table.

  • TestExpectations: enable the tests for addition/removal of children.
  • mathml/opentype/roots-LatinModern.html: Added.
  • mathml/presentation/mroot-transform-expected.html: Added.
  • mathml/presentation/mroot-transform.html: Added.
  • platform/efl/TestExpectations: mark failures for bad references.
  • platform/efl/mathml/opentype/roots-LatinModern-expected.txt: Added.
  • platform/gtk/mathml/opentype/roots-LatinModern-expected.png: Added.
  • platform/gtk/mathml/opentype/roots-LatinModern-expected.txt: Added.
  • platform/gtk/mathml/presentation/mo-stretch-expected.png: update reference.
  • platform/gtk/mathml/presentation/mo-stretch-expected.txt: update reference.
  • platform/gtk/mathml/presentation/roots-expected.png: update reference.
  • platform/gtk/mathml/presentation/roots-expected.txt: update reference.
  • platform/mac/TestExpectations: mark failures for bad references.
  • platform/mac/mathml/opentype/roots-LatinModern-expected.txt: Added.
  • platform/win/TestExpectations: mark failures for bad references.
  • platform/win/mathml/opentype/roots-LatinModern-expected.txt: Added.
Location:
trunk
Files:
10 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r169945 r169963  
     12014-06-14  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Draw radicals with glyphs for better rendering
     4        https://bugs.webkit.org/show_bug.cgi?id=119038
     5
     6        Reviewed by Chris Fleizach.
     7
     8        We update the reference for some tests with radicals and enable the tests for addition/removal of children in an msqrt/mroot element.
     9        We also add a test for bug 126516 (SVG transforms not applied to mroot) and a new test for radical drawing using an OpenType MATH table.
     10
     11        * TestExpectations: enable the tests for addition/removal of children.
     12        * mathml/opentype/roots-LatinModern.html: Added.
     13        * mathml/presentation/mroot-transform-expected.html: Added.
     14        * mathml/presentation/mroot-transform.html: Added.
     15        * platform/efl/TestExpectations: mark failures for bad references.
     16        * platform/efl/mathml/opentype/roots-LatinModern-expected.txt: Added.
     17        * platform/gtk/mathml/opentype/roots-LatinModern-expected.png: Added.
     18        * platform/gtk/mathml/opentype/roots-LatinModern-expected.txt: Added.
     19        * platform/gtk/mathml/presentation/mo-stretch-expected.png: update reference.
     20        * platform/gtk/mathml/presentation/mo-stretch-expected.txt: update reference.
     21        * platform/gtk/mathml/presentation/roots-expected.png: update reference.
     22        * platform/gtk/mathml/presentation/roots-expected.txt: update reference.
     23        * platform/mac/TestExpectations: mark failures for bad references.
     24        * platform/mac/mathml/opentype/roots-LatinModern-expected.txt: Added.
     25        * platform/win/TestExpectations: mark failures for bad references.
     26        * platform/win/mathml/opentype/roots-LatinModern-expected.txt: Added.
     27
    1282014-06-13  Commit Queue  <commit-queue@webkit.org>
    229
  • trunk/LayoutTests/TestExpectations

    r169945 r169963  
    6868webkit.org/b/127860 [ Debug ] js/function-apply-aliased.html [ Skip ]
    6969
    70 # These tests verify dynamic manipulation of the mroot and msqrt elements.
    71 # Unfortunately, the current MathML code does not handle them well.
    72 webkit.org/b/119038 mathml/roots-addChild.html [ Skip ]
    73 webkit.org/b/119038 mathml/roots-removeChild.html [ Skip ]
    74 
    7570# This test verifies that a mismatch reftest will fail as intended if both results are same. (introduced in r93187)
    7671fast/harness/sample-fail-mismatch-reftest.html [ WontFix ImageOnlyFailure ]
  • trunk/LayoutTests/platform/efl/TestExpectations

    r169945 r169963  
    16361636webkit.org/b/72828 mathml/opentype/opentype-stretchy-horizontal.html [ Failure ]
    16371637webkit.org/b/72828 mathml/opentype/horizontal-LatinModern-munderover.html [ Failure ]
     1638webkit.org/b/119038 mathml/opentype/roots-LatinModern.html [ Failure ]
     1639webkit.org/b/119038 mathml/presentation/mo-stretch.html [ Failure ]
     1640webkit.org/b/119038 mathml/presentation/roots.xhtml [ Failure ]
    16381641
    16391642# Failures EFL since the inception
  • trunk/LayoutTests/platform/gtk/mathml/presentation/mo-stretch-expected.txt

    r169945 r169963  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x260
    4   RenderBlock {HTML} at (0,0) size 800x260
    5     RenderBody {BODY} at (8,8) size 784x244
     3layer at (0,0) size 800x259
     4  RenderBlock {HTML} at (0,0) size 800x259
     5    RenderBody {BODY} at (8,8) size 784x243
    66      RenderMathMLMath {math} at (0,0) size 126x24 [padding: 0 1 0 1]
    77        RenderMathMLRow {mrow} at (1,0) size 124x24
     
    306306      RenderBR {BR} at (0,0) size 0x0
    307307      RenderMathMLMath {math} at (0,166) size 138x78 [padding: 0 1 0 1]
    308         RenderMathMLSquareRoot {msqrt} at (1,0) size 136x78 [intrinsic padding: 3 0 3 12]
    309           RenderMathMLRow (anonymous) at (12,3) size 124x72
     308        RenderMathMLSquareRoot {msqrt} at (1,0) size 136x78
     309          RenderMathMLBlock (anonymous, flex) at (0,0) size 12x78
     310            RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x78
     311              RenderMathMLBlock (anonymous, flex) at (0,0) size 12x78
     312                RenderBlock (anonymous) at (0,0) size 12x78
     313                  RenderText at (0,-1) size 15x25
     314                    text run at (0,-1) width 15: "\x{221A}"
     315          RenderMathMLRootWrapper at (12,3) size 124x75
    310316            RenderMathMLOperator {mo} at (0,0) size 7x72
    311317              RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14
  • trunk/LayoutTests/platform/gtk/mathml/presentation/roots-expected.txt

    r169945 r169963  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x512
    4   RenderBlock {html} at (0,0) size 800x512
    5     RenderBody {body} at (8,16) size 784x480
    6       RenderBlock {p} at (0,0) size 784x17
    7         RenderText {#text} at (0,0) size 177x17
    8           text run at (0,0) width 177: "square root (should be red): "
    9         RenderMathMLMath {math} at (177,0) size 22x15 [padding: 0 1 0 1]
    10           RenderMathMLSquareRoot {msqrt} at (1,0) size 20x15 [color=#FF0000] [intrinsic padding: 3 0 0 12]
    11             RenderMathMLRow (anonymous) at (12,3) size 8x12
     3layer at (0,0) size 800x506
     4  RenderBlock {html} at (0,0) size 800x506
     5    RenderBody {body} at (8,16) size 784x474
     6      RenderBlock {p} at (0,0) size 784x18
     7        RenderText {#text} at (0,1) size 177x17
     8          text run at (0,1) width 177: "square root (should be red): "
     9        RenderMathMLMath {math} at (177,0) size 22x18 [padding: 0 1 0 1]
     10          RenderMathMLSquareRoot {msqrt} at (1,0) size 20x18 [color=#FF0000]
     11            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     12              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x18
     13                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     14                  RenderBlock (anonymous) at (0,0) size 12x18
     15                    RenderText at (0,-1) size 15x25
     16                      text run at (0,-1) width 15: "\x{221A}"
     17            RenderMathMLRootWrapper at (12,3) size 8x15
    1218              RenderMathMLToken {mn} at (0,0) size 8x12
    1319                RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     
    1521                    RenderText {#text} at (0,-6) size 8x25
    1622                      text run at (0,-6) width 8: "2"
    17       RenderBlock {p} at (0,33) size 784x17
    18         RenderText {#text} at (0,0) size 110x17
    19           text run at (0,0) width 110: "long square root: "
    20         RenderMathMLMath {math} at (110,0) size 49x15 [padding: 0 1 0 1]
    21           RenderMathMLSquareRoot {msqrt} at (1,0) size 47x15 [intrinsic padding: 3 0 0 12]
    22             RenderMathMLRow (anonymous) at (12,3) size 35x12
     23      RenderBlock {p} at (0,34) size 784x18
     24        RenderText {#text} at (0,1) size 110x17
     25          text run at (0,1) width 110: "long square root: "
     26        RenderMathMLMath {math} at (110,0) size 49x18 [padding: 0 1 0 1]
     27          RenderMathMLSquareRoot {msqrt} at (1,0) size 47x18
     28            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     29              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x18
     30                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     31                  RenderBlock (anonymous) at (0,0) size 12x18
     32                    RenderText at (0,-1) size 15x25
     33                      text run at (0,-1) width 15: "\x{221A}"
     34            RenderMathMLRootWrapper at (12,3) size 35x15
    2335              RenderMathMLRow {mrow} at (0,0) size 35x12
    2436                RenderMathMLToken {mi} at (0,3) size 9x9 [padding: 0 2 0 0]
     
    3749                      RenderText {#text} at (0,-6) size 8x25
    3850                        text run at (0,-6) width 8: "1"
    39       RenderBlock {p} at (0,66) size 784x21
    40         RenderText {#text} at (0,4) size 222x17
    41           text run at (0,4) width 222: "long square root with implied row: "
    42         RenderMathMLMath {math} at (222,0) size 55x19 [padding: 0 1 0 1]
    43           RenderMathMLSquareRoot {msqrt} at (1,0) size 53x19 [intrinsic padding: 3 0 0 12]
    44             RenderMathMLRow (anonymous) at (12,3) size 41x16
     51      RenderBlock {p} at (0,68) size 784x22
     52        RenderText {#text} at (0,5) size 222x17
     53          text run at (0,5) width 222: "long square root with implied row: "
     54        RenderMathMLMath {math} at (222,0) size 55x22 [padding: 0 1 0 1]
     55          RenderMathMLSquareRoot {msqrt} at (1,0) size 53x22
     56            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x22
     57              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x22
     58                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x22
     59                  RenderBlock (anonymous) at (0,0) size 12x22
     60                    RenderText at (0,-1) size 15x25
     61                      text run at (0,-1) width 15: "\x{221A}"
     62            RenderMathMLRootWrapper at (12,3) size 41x19
    4563              RenderMathMLScripts {msup} at (0,0) size 15x16
    4664                Base Wrapper at (0,0) size 9x16 [padding: 7 0 0 0]
     
    6684                    RenderText {#text} at (0,-6) size 8x25
    6785                      text run at (0,-6) width 8: "1"
    68       RenderBlock {p} at (0,103) size 784x37
    69         RenderText {#text} at (0,9) size 113x17
    70           text run at (0,9) width 113: "root of a fraction: "
     86      RenderBlock {p} at (0,106) size 784x37
     87        RenderText {#text} at (0,10) size 113x17
     88          text run at (0,10) width 113: "root of a fraction: "
    7189        RenderMathMLMath {math} at (113,0) size 51x38 [padding: 0 1 0 1]
    72           RenderMathMLSquareRoot {msqrt} at (1,0) size 49x38 [intrinsic padding: 3 0 3 12]
    73             RenderMathMLRow (anonymous) at (12,3) size 37x32
     90          RenderMathMLSquareRoot {msqrt} at (1,0) size 49x38
     91            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x38
     92              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x38
     93                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x37
     94                  RenderBlock (anonymous) at (0,0) size 12x37
     95                    RenderText at (0,-1) size 15x25
     96                      text run at (0,-1) width 15: "\x{221A}"
     97            RenderMathMLRootWrapper at (12,3) size 37x35
    7498              RenderMathMLFraction {mfrac} at (1,0) size 35x32
    7599                RenderMathMLBlock (anonymous, flex) at (0,0) size 35x16
     
    107131                          RenderText {#text} at (0,-6) size 8x25
    108132                            text run at (0,-6) width 8: "2"
    109       RenderBlock {p} at (0,156) size 784x21
    110         RenderText {#text} at (0,4) size 173x17
    111           text run at (0,4) width 173: "cube root (should be blue): "
     133      RenderBlock {p} at (0,159) size 784x18
     134        RenderText {#text} at (0,1) size 173x17
     135          text run at (0,1) width 173: "cube root (should be blue): "
    112136        RenderMathMLMath {math} at (173,0) size 23x19 [color=#0000FF] [padding: 0 1 0 1]
    113       RenderBlock {p} at (0,193) size 784x21
    114         RenderText {#text} at (0,4) size 75x17
    115           text run at (0,4) width 75: "long index: "
    116         RenderMathMLMath {math} at (75,0) size 62x19 [padding: 0 1 0 1]
    117       RenderBlock {p} at (0,230) size 784x37
    118         RenderText {#text} at (0,9) size 185x17
    119           text run at (0,9) width 185: "long index w/ complex base: "
    120         RenderMathMLMath {math} at (185,0) size 92x38 [padding: 0 1 0 1]
    121       RenderBlock {p} at (0,283) size 784x46
    122         RenderText {#text} at (0,29) size 75x17
    123           text run at (0,29) width 75: "high index: "
    124         RenderMathMLMath {math} at (75,0) size 25x44 [padding: 0 1 0 1]
    125       RenderBlock {p} at (0,345) size 784x45
    126         RenderText {#text} at (0,21) size 155x17
    127           text run at (0,21) width 155: "Imbricated square roots: "
    128         RenderMathMLMath {math} at (155,0) size 293x45 [padding: 0 1 0 1]
    129           RenderMathMLSquareRoot {msqrt} at (1,0) size 291x45 [intrinsic padding: 3 0 3 12]
    130             RenderMathMLRow (anonymous) at (12,3) size 279x39
    131               RenderMathMLToken {mn} at (0,21) size 8x12
     137          RenderMathMLRoot {mroot} at (1,0) size 21x19
     138            RenderMathMLRootWrapper at (4,0) size 6x19
     139              RenderMathMLToken {mn} at (0,0) size 5x8
     140                RenderMathMLBlock (anonymous, flex) at (0,0) size 5x8
     141                  RenderBlock (anonymous) at (0,0) size 5x8
     142                    RenderText {#text} at (0,-3) size 5x15
     143                      text run at (0,-3) width 5: "3"
     144            RenderMathMLBlock (anonymous, flex) at (0,0) size 13x19
     145              RenderMathMLRadicalOperator (anonymous) at (0,1) size 12x18
     146                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     147                  RenderBlock (anonymous) at (0,0) size 12x18
     148                    RenderText at (0,-1) size 15x25
     149                      text run at (0,-1) width 15: "\x{221A}"
     150            RenderMathMLRootWrapper at (12,4) size 9x15
     151              RenderMathMLToken {mn} at (0,0) size 8x12
     152                RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     153                  RenderBlock (anonymous) at (0,0) size 8x12
     154                    RenderText {#text} at (0,-6) size 8x25
     155                      text run at (0,-6) width 8: "2"
     156      RenderBlock {p} at (0,193) size 784x18
     157        RenderText {#text} at (0,1) size 75x17
     158          text run at (0,1) width 75: "long index: "
     159        RenderMathMLMath {math} at (75,0) size 53x18 [padding: 0 1 0 1]
     160          RenderMathMLRoot {mroot} at (1,0) size 51x18
     161            RenderMathMLRootWrapper at (4,0) size 36x18
     162              RenderMathMLRow {mrow} at (0,0) size 35x7
     163                RenderMathMLToken {mi} at (0,1) size 5x5 [padding: 0 1 0 0]
     164                  RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     165                    RenderBlock (anonymous) at (0,0) size 4x5
     166                      RenderText {#text} at (0,-6) size 4x15
     167                        text run at (0,-6) width 4: "x"
     168                RenderMathMLOperator {mo} at (4,0) size 11x6
     169                  RenderMathMLBlock (anonymous, flex) at (2,0) size 6x6
     170                    RenderBlock (anonymous) at (0,0) size 6x6
     171                      RenderText at (0,-5) size 6x15
     172                        text run at (0,-5) width 6: "+"
     173                RenderMathMLToken {mi} at (14,1) size 6x6 [padding: 0 1 0 0]
     174                  RenderMathMLBlock (anonymous, flex) at (0,0) size 4x6
     175                    RenderBlock (anonymous) at (0,0) size 4x6
     176                      RenderText {#text} at (0,-6) size 4x15
     177                        text run at (0,-6) width 4: "y"
     178                RenderMathMLOperator {mo} at (19,0) size 11x6
     179                  RenderMathMLBlock (anonymous, flex) at (2,0) size 6x6
     180                    RenderBlock (anonymous) at (0,0) size 6x6
     181                      RenderText at (0,-5) size 6x15
     182                        text run at (0,-5) width 6: "+"
     183                RenderMathMLToken {mi} at (29,1) size 6x5 [padding: 0 1 0 0]
     184                  RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     185                    RenderBlock (anonymous) at (0,0) size 4x5
     186                      RenderText {#text} at (0,-6) size 4x15
     187                        text run at (0,-6) width 4: "z"
     188            RenderMathMLBlock (anonymous, flex) at (30,0) size 13x18
     189              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x18
     190                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     191                  RenderBlock (anonymous) at (0,0) size 12x18
     192                    RenderText at (0,-1) size 15x25
     193                      text run at (0,-1) width 15: "\x{221A}"
     194            RenderMathMLRootWrapper at (42,3) size 9x15
     195              RenderMathMLToken {mn} at (0,0) size 8x12
     196                RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     197                  RenderBlock (anonymous) at (0,0) size 8x12
     198                    RenderText {#text} at (0,-6) size 8x25
     199                      text run at (0,-6) width 8: "2"
     200      RenderBlock {p} at (0,227) size 784x37
     201        RenderText {#text} at (0,10) size 185x17
     202          text run at (0,10) width 185: "long index w/ complex base: "
     203        RenderMathMLMath {math} at (185,0) size 81x38 [padding: 0 1 0 1]
     204          RenderMathMLRoot {mroot} at (1,0) size 79x38
     205            RenderMathMLRootWrapper at (4,8) size 36x30
     206              RenderMathMLRow {mrow} at (0,0) size 35x7
     207                RenderMathMLToken {mi} at (0,1) size 5x5 [padding: 0 1 0 0]
     208                  RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     209                    RenderBlock (anonymous) at (0,0) size 4x5
     210                      RenderText {#text} at (0,-6) size 4x15
     211                        text run at (0,-6) width 4: "x"
     212                RenderMathMLOperator {mo} at (4,0) size 11x6
     213                  RenderMathMLBlock (anonymous, flex) at (2,0) size 6x6
     214                    RenderBlock (anonymous) at (0,0) size 6x6
     215                      RenderText at (0,-5) size 6x15
     216                        text run at (0,-5) width 6: "+"
     217                RenderMathMLToken {mi} at (14,1) size 6x6 [padding: 0 1 0 0]
     218                  RenderMathMLBlock (anonymous, flex) at (0,0) size 4x6
     219                    RenderBlock (anonymous) at (0,0) size 4x6
     220                      RenderText {#text} at (0,-6) size 4x15
     221                        text run at (0,-6) width 4: "y"
     222                RenderMathMLOperator {mo} at (19,0) size 11x6
     223                  RenderMathMLBlock (anonymous, flex) at (2,0) size 6x6
     224                    RenderBlock (anonymous) at (0,0) size 6x6
     225                      RenderText at (0,-5) size 6x15
     226                        text run at (0,-5) width 6: "+"
     227                RenderMathMLToken {mi} at (29,1) size 6x5 [padding: 0 1 0 0]
     228                  RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     229                    RenderBlock (anonymous) at (0,0) size 4x5
     230                      RenderText {#text} at (0,-6) size 4x15
     231                        text run at (0,-6) width 4: "z"
     232            RenderMathMLBlock (anonymous, flex) at (30,0) size 13x38
     233              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x38
     234                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x37
     235                  RenderBlock (anonymous) at (0,0) size 12x37
     236                    RenderText at (0,-1) size 15x25
     237                      text run at (0,-1) width 15: "\x{221A}"
     238            RenderMathMLRootWrapper at (42,3) size 37x35
     239              RenderMathMLFraction {mfrac} at (1,0) size 35x32
     240                RenderMathMLBlock (anonymous, flex) at (0,0) size 35x16
     241                  RenderMathMLRow {mrow} at (0,0) size 35x12
     242                    RenderMathMLToken {mi} at (0,3) size 9x9 [padding: 0 2 0 0]
     243                      RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9
     244                        RenderBlock (anonymous) at (0,0) size 7x9
     245                          RenderText {#text} at (0,-9) size 7x25
     246                            text run at (0,-9) width 7: "x"
     247                    RenderMathMLOperator {mo} at (8,2) size 19x10
     248                      RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     249                        RenderBlock (anonymous) at (0,0) size 11x10
     250                          RenderText at (0,-8) size 11x25
     251                            text run at (0,-8) width 11: "+"
     252                    RenderMathMLToken {mn} at (26,0) size 9x12
     253                      RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     254                        RenderBlock (anonymous) at (0,0) size 8x12
     255                          RenderText {#text} at (0,-6) size 8x25
     256                            text run at (0,-6) width 8: "1"
     257                RenderMathMLBlock (anonymous, flex) at (0,15) size 35x17 [padding: 1 0 0 0]
     258                  RenderMathMLRow {mrow} at (0,4) size 35x13
     259                    RenderMathMLToken {mi} at (0,3) size 9x9 [padding: 0 2 0 0]
     260                      RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9
     261                        RenderBlock (anonymous) at (0,0) size 7x9
     262                          RenderText {#text} at (0,-9) size 7x25
     263                            text run at (0,-9) width 7: "x"
     264                    RenderMathMLOperator {mo} at (8,2) size 19x10
     265                      RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     266                        RenderBlock (anonymous) at (0,0) size 11x10
     267                          RenderText at (0,-8) size 11x25
     268                            text run at (0,-8) width 11: "+"
     269                    RenderMathMLToken {mn} at (26,0) size 9x12
     270                      RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     271                        RenderBlock (anonymous) at (0,0) size 8x12
     272                          RenderText {#text} at (0,-6) size 8x25
     273                            text run at (0,-6) width 8: "2"
     274      RenderBlock {p} at (0,280) size 784x35
     275        RenderText {#text} at (0,18) size 75x17
     276          text run at (0,18) width 75: "high index: "
     277        RenderMathMLMath {math} at (75,0) size 27x36 [padding: 0 1 0 1]
     278          RenderMathMLRoot {mroot} at (1,0) size 25x36
     279            RenderMathMLRootWrapper at (4,0) size 10x36
     280              RenderMathMLFraction {mfrac} at (1,0) size 7x26
     281                RenderMathMLBlock (anonymous, flex) at (0,0) size 7x18
     282                  RenderMathMLFraction {mfrac} at (1,0) size 5x16
     283                    RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
     284                      RenderMathMLToken {mi} at (0,0) size 5x5 [padding: 0 1 0 0]
     285                        RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     286                          RenderBlock (anonymous) at (0,0) size 4x5
     287                            RenderText {#text} at (0,-6) size 4x15
     288                              text run at (0,-6) width 4: "x"
     289                    RenderMathMLBlock (anonymous, flex) at (0,6) size 5x10 [padding: 1 0 0 0]
     290                      RenderMathMLToken {mi} at (0,2) size 5x7 [padding: 0 1 0 0]
     291                        RenderMathMLBlock (anonymous, flex) at (0,0) size 4x6
     292                          RenderBlock (anonymous) at (0,0) size 4x6
     293                            RenderText {#text} at (0,-6) size 4x15
     294                              text run at (0,-6) width 4: "y"
     295                RenderMathMLBlock (anonymous, flex) at (0,17) size 7x9 [padding: 1 0 0 0]
     296                  RenderMathMLToken {mi} at (1,2) size 5x6 [padding: 0 1 0 0]
     297                    RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     298                      RenderBlock (anonymous) at (0,0) size 4x5
     299                        RenderText {#text} at (0,-6) size 4x15
     300                          text run at (0,-6) width 4: "z"
     301            RenderMathMLBlock (anonymous, flex) at (4,0) size 13x36
     302              RenderMathMLRadicalOperator (anonymous) at (0,18) size 12x18
     303                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     304                  RenderBlock (anonymous) at (0,0) size 12x18
     305                    RenderText at (0,-1) size 15x25
     306                      text run at (0,-1) width 15: "\x{221A}"
     307            RenderMathMLRootWrapper at (16,21) size 9x15
     308              RenderMathMLToken {mn} at (0,0) size 8x12
     309                RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     310                  RenderBlock (anonymous) at (0,0) size 8x12
     311                    RenderText {#text} at (0,-6) size 8x25
     312                      text run at (0,-6) width 8: "2"
     313      RenderBlock {p} at (0,331) size 784x59
     314        RenderText {#text} at (0,29) size 155x17
     315          text run at (0,29) width 155: "Imbricated square roots: "
     316        RenderMathMLMath {math} at (155,0) size 293x60 [padding: 0 1 0 1]
     317          RenderMathMLSquareRoot {msqrt} at (1,0) size 291x60
     318            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x60
     319              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x60
     320                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x60
     321                  RenderBlock (anonymous) at (0,0) size 12x60
     322                    RenderText at (0,-1) size 15x25
     323                      text run at (0,-1) width 15: "\x{221A}"
     324            RenderMathMLRootWrapper at (12,3) size 279x57
     325              RenderMathMLToken {mn} at (0,28) size 8x12
    132326                RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    133327                  RenderBlock (anonymous) at (0,0) size 8x12
    134328                    RenderText {#text} at (0,-6) size 8x25
    135329                      text run at (0,-6) width 8: "1"
    136               RenderMathMLOperator {mo} at (8,23) size 19x10
     330              RenderMathMLOperator {mo} at (8,30) size 19x10
    137331                RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    138332                  RenderBlock (anonymous) at (0,0) size 11x10
    139333                    RenderText at (0,-8) size 11x25
    140334                      text run at (0,-8) width 11: "+"
    141               RenderMathMLSquareRoot {msqrt} at (26,0) size 253x39 [intrinsic padding: 3 0 3 12]
    142                 RenderMathMLRow (anonymous) at (12,3) size 241x33
    143                   RenderMathMLRow {mrow} at (0,0) size 241x33
    144                     RenderMathMLToken {mn} at (0,18) size 8x12
     335              RenderMathMLSquareRoot {msqrt} at (26,0) size 253x54
     336                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x54
     337                  RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x54
     338                    RenderMathMLBlock (anonymous, flex) at (0,0) size 12x54
     339                      RenderBlock (anonymous) at (0,0) size 12x54
     340                        RenderText at (0,-1) size 15x25
     341                          text run at (0,-1) width 15: "\x{221A}"
     342                RenderMathMLRootWrapper at (12,3) size 241x51
     343                  RenderMathMLRow {mrow} at (0,0) size 241x48
     344                    RenderMathMLToken {mn} at (0,24) size 8x12
    145345                      RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    146346                        RenderBlock (anonymous) at (0,0) size 8x12
    147347                          RenderText {#text} at (0,-6) size 8x25
    148348                            text run at (0,-6) width 8: "2"
    149                     RenderMathMLOperator {mo} at (8,20) size 19x10
     349                    RenderMathMLOperator {mo} at (8,26) size 19x10
    150350                      RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    151351                        RenderBlock (anonymous) at (0,0) size 11x10
    152352                          RenderText at (0,-8) size 11x25
    153353                            text run at (0,-8) width 11: "+"
    154                     RenderMathMLSquareRoot {msqrt} at (26,0) size 215x33 [intrinsic padding: 3 0 3 12]
    155                       RenderMathMLRow (anonymous) at (12,3) size 203x27
    156                         RenderMathMLRow {mrow} at (0,0) size 203x27
    157                           RenderMathMLToken {mn} at (0,15) size 8x12
     354                    RenderMathMLSquareRoot {msqrt} at (26,0) size 215x48
     355                      RenderMathMLBlock (anonymous, flex) at (0,0) size 12x48
     356                        RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x48
     357                          RenderMathMLBlock (anonymous, flex) at (0,0) size 12x48
     358                            RenderBlock (anonymous) at (0,0) size 12x48
     359                              RenderText at (0,-1) size 15x25
     360                                text run at (0,-1) width 15: "\x{221A}"
     361                      RenderMathMLRootWrapper at (12,3) size 203x45
     362                        RenderMathMLRow {mrow} at (0,0) size 203x42
     363                          RenderMathMLToken {mn} at (0,20) size 8x12
    158364                            RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    159365                              RenderBlock (anonymous) at (0,0) size 8x12
    160366                                RenderText {#text} at (0,-6) size 8x25
    161367                                  text run at (0,-6) width 8: "3"
    162                           RenderMathMLOperator {mo} at (8,17) size 19x10
     368                          RenderMathMLOperator {mo} at (8,22) size 19x10
    163369                            RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    164370                              RenderBlock (anonymous) at (0,0) size 11x10
    165371                                RenderText at (0,-8) size 11x25
    166372                                  text run at (0,-8) width 11: "+"
    167                           RenderMathMLSquareRoot {msqrt} at (26,0) size 177x27 [intrinsic padding: 3 0 0 12]
    168                             RenderMathMLRow (anonymous) at (12,3) size 164x24
    169                               RenderMathMLRow {mrow} at (0,0) size 164x24
    170                                 RenderMathMLToken {mn} at (0,12) size 8x12
     373                          RenderMathMLSquareRoot {msqrt} at (26,0) size 177x42
     374                            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x42
     375                              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x42
     376                                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x42
     377                                  RenderBlock (anonymous) at (0,0) size 12x42
     378                                    RenderText at (0,-1) size 15x25
     379                                      text run at (0,-1) width 15: "\x{221A}"
     380                            RenderMathMLRootWrapper at (12,3) size 164x39
     381                              RenderMathMLRow {mrow} at (0,0) size 164x36
     382                                RenderMathMLToken {mn} at (0,16) size 8x12
    171383                                  RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    172384                                    RenderBlock (anonymous) at (0,0) size 8x12
    173385                                      RenderText {#text} at (0,-6) size 8x25
    174386                                        text run at (0,-6) width 8: "4"
    175                                 RenderMathMLOperator {mo} at (8,14) size 19x10
     387                                RenderMathMLOperator {mo} at (8,18) size 19x10
    176388                                  RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    177389                                    RenderBlock (anonymous) at (0,0) size 11x10
    178390                                      RenderText at (0,-8) size 11x25
    179391                                        text run at (0,-8) width 11: "+"
    180                                 RenderMathMLSquareRoot {msqrt} at (26,0) size 138x24 [intrinsic padding: 3 0 0 12]
    181                                   RenderMathMLRow (anonymous) at (12,3) size 126x21
    182                                     RenderMathMLRow {mrow} at (0,0) size 126x21
    183                                       RenderMathMLToken {mn} at (0,8) size 8x13
     392                                RenderMathMLSquareRoot {msqrt} at (26,0) size 138x36
     393                                  RenderMathMLBlock (anonymous, flex) at (0,0) size 12x36
     394                                    RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x36
     395                                      RenderMathMLBlock (anonymous, flex) at (0,0) size 12x36
     396                                        RenderBlock (anonymous) at (0,0) size 12x36
     397                                          RenderText at (0,-1) size 15x25
     398                                            text run at (0,-1) width 15: "\x{221A}"
     399                                  RenderMathMLRootWrapper at (12,3) size 126x33
     400                                    RenderMathMLRow {mrow} at (0,0) size 126x30
     401                                      RenderMathMLToken {mn} at (0,11) size 8x13
    184402                                        RenderMathMLBlock (anonymous, flex) at (0,0) size 8x13
    185403                                          RenderBlock (anonymous) at (0,0) size 8x13
    186404                                            RenderText {#text} at (0,-5) size 8x25
    187405                                              text run at (0,-5) width 8: "5"
    188                                       RenderMathMLOperator {mo} at (8,11) size 19x10
     406                                      RenderMathMLOperator {mo} at (8,14) size 19x10
    189407                                        RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    190408                                          RenderBlock (anonymous) at (0,0) size 11x10
    191409                                            RenderText at (0,-8) size 11x25
    192410                                              text run at (0,-8) width 11: "+"
    193                                       RenderMathMLSquareRoot {msqrt} at (26,0) size 100x21 [intrinsic padding: 3 0 0 12]
    194                                         RenderMathMLRow (anonymous) at (12,3) size 88x18
    195                                           RenderMathMLRow {mrow} at (0,0) size 88x18
    196                                             RenderMathMLToken {mn} at (0,6) size 8x12
     411                                      RenderMathMLSquareRoot {msqrt} at (26,0) size 100x30
     412                                        RenderMathMLBlock (anonymous, flex) at (0,0) size 12x30
     413                                          RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x30
     414                                            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x30
     415                                              RenderBlock (anonymous) at (0,0) size 12x30
     416                                                RenderText at (0,-1) size 15x25
     417                                                  text run at (0,-1) width 15: "\x{221A}"
     418                                        RenderMathMLRootWrapper at (12,3) size 88x27
     419                                          RenderMathMLRow {mrow} at (0,0) size 88x24
     420                                            RenderMathMLToken {mn} at (0,8) size 8x12
    197421                                              RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    198422                                                RenderBlock (anonymous) at (0,0) size 8x12
    199423                                                  RenderText {#text} at (0,-6) size 8x25
    200424                                                    text run at (0,-6) width 8: "6"
    201                                             RenderMathMLOperator {mo} at (8,8) size 19x10
     425                                            RenderMathMLOperator {mo} at (8,10) size 19x10
    202426                                              RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    203427                                                RenderBlock (anonymous) at (0,0) size 11x10
    204428                                                  RenderText at (0,-8) size 11x25
    205429                                                    text run at (0,-8) width 11: "+"
    206                                             RenderMathMLSquareRoot {msqrt} at (26,0) size 62x18 [intrinsic padding: 3 0 0 12]
    207                                               RenderMathMLRow (anonymous) at (12,3) size 50x15
    208                                                 RenderMathMLRow {mrow} at (0,0) size 50x15
    209                                                   RenderMathMLToken {mn} at (0,3) size 8x12
     430                                            RenderMathMLSquareRoot {msqrt} at (26,0) size 62x24
     431                                              RenderMathMLBlock (anonymous, flex) at (0,0) size 12x24
     432                                                RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x24
     433                                                  RenderMathMLBlock (anonymous, flex) at (0,0) size 12x24
     434                                                    RenderBlock (anonymous) at (0,0) size 12x24
     435                                                      RenderText at (0,-1) size 15x25
     436                                                        text run at (0,-1) width 15: "\x{221A}"
     437                                              RenderMathMLRootWrapper at (12,3) size 50x21
     438                                                RenderMathMLRow {mrow} at (0,0) size 50x18
     439                                                  RenderMathMLToken {mn} at (0,4) size 8x12
    210440                                                    RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    211441                                                      RenderBlock (anonymous) at (0,0) size 8x12
    212442                                                        RenderText {#text} at (0,-6) size 8x25
    213443                                                          text run at (0,-6) width 8: "7"
    214                                                   RenderMathMLOperator {mo} at (8,5) size 19x10
     444                                                  RenderMathMLOperator {mo} at (8,6) size 19x10
    215445                                                    RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    216446                                                      RenderBlock (anonymous) at (0,0) size 11x10
    217447                                                        RenderText at (0,-8) size 11x25
    218448                                                          text run at (0,-8) width 11: "+"
    219                                                   RenderMathMLSquareRoot {msqrt} at (26,0) size 24x15 [intrinsic padding: 3 0 0 12]
    220                                                     RenderMathMLRow (anonymous) at (12,3) size 12x12
     449                                                  RenderMathMLSquareRoot {msqrt} at (26,0) size 24x18
     450                                                    RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     451                                                      RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x18
     452                                                        RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     453                                                          RenderBlock (anonymous) at (0,0) size 12x18
     454                                                            RenderText at (0,-1) size 15x25
     455                                                              text run at (0,-1) width 15: "\x{221A}"
     456                                                    RenderMathMLRootWrapper at (12,3) size 12x15
    221457                                                      RenderMathMLToken {mi} at (0,0) size 12x12 [padding: 0 2 0 0]
    222458                                                        RenderMathMLBlock (anonymous, flex) at (0,0) size 10x12
     
    225461                                                              text run at (0,-6) width 10: "A"
    226462        RenderText {#text} at (0,0) size 0x0
    227       RenderBlock {p} at (0,406) size 784x74
     463      RenderBlock {p} at (0,406) size 784x68
    228464        RenderText {#text} at (0,38) size 110x17
    229465          text run at (0,38) width 110: "Imbricated roots: "
    230         RenderMathMLMath {math} at (110,0) size 355x74 [padding: 0 1 0 1]
     466        RenderMathMLMath {math} at (110,0) size 314x69 [padding: 0 1 0 1]
     467          RenderMathMLRoot {mroot} at (1,0) size 312x69
     468            RenderMathMLRootWrapper at (4,19) size 6x50
     469              RenderMathMLToken {mn} at (0,0) size 5x8
     470                RenderMathMLBlock (anonymous, flex) at (0,0) size 5x8
     471                  RenderBlock (anonymous) at (0,0) size 5x8
     472                    RenderText {#text} at (0,-3) size 5x15
     473                      text run at (0,-3) width 5: "3"
     474            RenderMathMLBlock (anonymous, flex) at (0,0) size 13x69
     475              RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x69
     476                RenderMathMLBlock (anonymous, flex) at (0,0) size 12x68
     477                  RenderBlock (anonymous) at (0,0) size 12x68
     478                    RenderText at (0,-1) size 15x25
     479                      text run at (0,-1) width 15: "\x{221A}"
     480            RenderMathMLRootWrapper at (12,3) size 300x66
     481              RenderMathMLRow {mrow} at (0,0) size 299x63
     482                RenderMathMLToken {mn} at (0,37) size 8x12
     483                  RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     484                    RenderBlock (anonymous) at (0,0) size 8x12
     485                      RenderText {#text} at (0,-6) size 8x25
     486                        text run at (0,-6) width 8: "1"
     487                RenderMathMLOperator {mo} at (8,39) size 19x10
     488                  RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     489                    RenderBlock (anonymous) at (0,0) size 11x10
     490                      RenderText at (0,-8) size 11x25
     491                        text run at (0,-8) width 11: "+"
     492                RenderMathMLRoot {mroot} at (26,0) size 273x63
     493                  RenderMathMLRootWrapper at (4,17) size 6x46
     494                    RenderMathMLToken {mn} at (0,0) size 5x8
     495                      RenderMathMLBlock (anonymous, flex) at (0,0) size 5x8
     496                        RenderBlock (anonymous) at (0,0) size 5x8
     497                          RenderText {#text} at (0,-3) size 5x15
     498                            text run at (0,-3) width 5: "4"
     499                  RenderMathMLBlock (anonymous, flex) at (0,0) size 13x63
     500                    RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x63
     501                      RenderMathMLBlock (anonymous, flex) at (0,0) size 12x63
     502                        RenderBlock (anonymous) at (0,0) size 12x63
     503                          RenderText at (0,-1) size 15x25
     504                            text run at (0,-1) width 15: "\x{221A}"
     505                  RenderMathMLRootWrapper at (12,3) size 261x60
     506                    RenderMathMLRow {mrow} at (0,0) size 261x57
     507                      RenderMathMLToken {mn} at (0,33) size 8x12
     508                        RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     509                          RenderBlock (anonymous) at (0,0) size 8x12
     510                            RenderText {#text} at (0,-6) size 8x25
     511                              text run at (0,-6) width 8: "2"
     512                      RenderMathMLOperator {mo} at (8,35) size 19x10
     513                        RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     514                          RenderBlock (anonymous) at (0,0) size 11x10
     515                            RenderText at (0,-8) size 11x25
     516                              text run at (0,-8) width 11: "+"
     517                      RenderMathMLRoot {mroot} at (26,0) size 235x57
     518                        RenderMathMLRootWrapper at (4,15) size 6x42
     519                          RenderMathMLToken {mn} at (0,0) size 5x8
     520                            RenderMathMLBlock (anonymous, flex) at (0,0) size 5x8
     521                              RenderBlock (anonymous) at (0,0) size 5x8
     522                                RenderText {#text} at (0,-3) size 5x15
     523                                  text run at (0,-3) width 5: "5"
     524                        RenderMathMLBlock (anonymous, flex) at (0,0) size 13x57
     525                          RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x57
     526                            RenderMathMLBlock (anonymous, flex) at (0,0) size 12x57
     527                              RenderBlock (anonymous) at (0,0) size 12x57
     528                                RenderText at (0,-1) size 15x25
     529                                  text run at (0,-1) width 15: "\x{221A}"
     530                        RenderMathMLRootWrapper at (12,3) size 223x54
     531                          RenderMathMLRow {mrow} at (0,0) size 222x51
     532                            RenderMathMLToken {mn} at (0,29) size 8x12
     533                              RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     534                                RenderBlock (anonymous) at (0,0) size 8x12
     535                                  RenderText {#text} at (0,-6) size 8x25
     536                                    text run at (0,-6) width 8: "3"
     537                            RenderMathMLOperator {mo} at (8,31) size 19x10
     538                              RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     539                                RenderBlock (anonymous) at (0,0) size 11x10
     540                                  RenderText at (0,-8) size 11x25
     541                                    text run at (0,-8) width 11: "+"
     542                            RenderMathMLRoot {mroot} at (26,0) size 196x51
     543                              RenderMathMLRootWrapper at (4,12) size 6x39
     544                                RenderMathMLToken {mn} at (0,0) size 5x8
     545                                  RenderMathMLBlock (anonymous, flex) at (0,0) size 5x8
     546                                    RenderBlock (anonymous) at (0,0) size 5x8
     547                                      RenderText {#text} at (0,-3) size 5x15
     548                                        text run at (0,-3) width 5: "6"
     549                              RenderMathMLBlock (anonymous, flex) at (0,0) size 13x51
     550                                RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x51
     551                                  RenderMathMLBlock (anonymous, flex) at (0,0) size 12x51
     552                                    RenderBlock (anonymous) at (0,0) size 12x51
     553                                      RenderText at (0,-1) size 15x25
     554                                        text run at (0,-1) width 15: "\x{221A}"
     555                              RenderMathMLRootWrapper at (12,3) size 184x48
     556                                RenderMathMLRow {mrow} at (0,0) size 183x45
     557                                  RenderMathMLToken {mn} at (0,25) size 8x12
     558                                    RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     559                                      RenderBlock (anonymous) at (0,0) size 8x12
     560                                        RenderText {#text} at (0,-6) size 8x25
     561                                          text run at (0,-6) width 8: "4"
     562                                  RenderMathMLOperator {mo} at (8,27) size 19x10
     563                                    RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     564                                      RenderBlock (anonymous) at (0,0) size 11x10
     565                                        RenderText at (0,-8) size 11x25
     566                                          text run at (0,-8) width 11: "+"
     567                                  RenderMathMLRoot {mroot} at (26,0) size 157x45
     568                                    RenderMathMLRootWrapper at (4,11) size 6x34
     569                                      RenderMathMLToken {mn} at (0,0) size 5x7
     570                                        RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
     571                                          RenderBlock (anonymous) at (0,0) size 5x7
     572                                            RenderText {#text} at (0,-4) size 5x15
     573                                              text run at (0,-4) width 5: "7"
     574                                    RenderMathMLBlock (anonymous, flex) at (0,0) size 13x45
     575                                      RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x45
     576                                        RenderMathMLBlock (anonymous, flex) at (0,0) size 12x45
     577                                          RenderBlock (anonymous) at (0,0) size 12x45
     578                                            RenderText at (0,-1) size 15x25
     579                                              text run at (0,-1) width 15: "\x{221A}"
     580                                    RenderMathMLRootWrapper at (12,3) size 145x42
     581                                      RenderMathMLRow {mrow} at (0,0) size 145x39
     582                                        RenderMathMLToken {mn} at (0,20) size 8x13
     583                                          RenderMathMLBlock (anonymous, flex) at (0,0) size 8x13
     584                                            RenderBlock (anonymous) at (0,0) size 8x13
     585                                              RenderText {#text} at (0,-5) size 8x25
     586                                                text run at (0,-5) width 8: "5"
     587                                        RenderMathMLOperator {mo} at (8,23) size 19x10
     588                                          RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     589                                            RenderBlock (anonymous) at (0,0) size 11x10
     590                                              RenderText at (0,-8) size 11x25
     591                                                text run at (0,-8) width 11: "+"
     592                                        RenderMathMLRoot {mroot} at (26,0) size 119x39
     593                                          RenderMathMLRootWrapper at (4,8) size 6x31
     594                                            RenderMathMLToken {mn} at (0,0) size 5x8
     595                                              RenderMathMLBlock (anonymous, flex) at (0,0) size 5x8
     596                                                RenderBlock (anonymous) at (0,0) size 5x8
     597                                                  RenderText {#text} at (0,-3) size 5x15
     598                                                    text run at (0,-3) width 5: "8"
     599                                          RenderMathMLBlock (anonymous, flex) at (0,0) size 13x39
     600                                            RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x39
     601                                              RenderMathMLBlock (anonymous, flex) at (0,0) size 12x39
     602                                                RenderBlock (anonymous) at (0,0) size 12x39
     603                                                  RenderText at (0,-1) size 15x25
     604                                                    text run at (0,-1) width 15: "\x{221A}"
     605                                          RenderMathMLRootWrapper at (12,3) size 107x36
     606                                            RenderMathMLRow {mrow} at (0,0) size 106x33
     607                                              RenderMathMLToken {mn} at (0,17) size 8x12
     608                                                RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     609                                                  RenderBlock (anonymous) at (0,0) size 8x12
     610                                                    RenderText {#text} at (0,-6) size 8x25
     611                                                      text run at (0,-6) width 8: "6"
     612                                              RenderMathMLOperator {mo} at (8,19) size 19x10
     613                                                RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     614                                                  RenderBlock (anonymous) at (0,0) size 11x10
     615                                                    RenderText at (0,-8) size 11x25
     616                                                      text run at (0,-8) width 11: "+"
     617                                              RenderMathMLRoot {mroot} at (26,0) size 80x33
     618                                                RenderMathMLRootWrapper at (4,5) size 6x28
     619                                                  RenderMathMLToken {mn} at (0,0) size 5x8
     620                                                    RenderMathMLBlock (anonymous, flex) at (0,0) size 5x8
     621                                                      RenderBlock (anonymous) at (0,0) size 5x8
     622                                                        RenderText {#text} at (0,-3) size 5x15
     623                                                          text run at (0,-3) width 5: "9"
     624                                                RenderMathMLBlock (anonymous, flex) at (0,0) size 13x33
     625                                                  RenderMathMLRadicalOperator (anonymous) at (0,0) size 12x33
     626                                                    RenderMathMLBlock (anonymous, flex) at (0,0) size 12x33
     627                                                      RenderBlock (anonymous) at (0,0) size 12x33
     628                                                        RenderText at (0,-1) size 15x25
     629                                                          text run at (0,-1) width 15: "\x{221A}"
     630                                                RenderMathMLRootWrapper at (12,3) size 68x30
     631                                                  RenderMathMLRow {mrow} at (0,0) size 68x27
     632                                                    RenderMathMLToken {mn} at (0,13) size 8x12
     633                                                      RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
     634                                                        RenderBlock (anonymous) at (0,0) size 8x12
     635                                                          RenderText {#text} at (0,-6) size 8x25
     636                                                            text run at (0,-6) width 8: "7"
     637                                                    RenderMathMLOperator {mo} at (8,15) size 19x10
     638                                                      RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
     639                                                        RenderBlock (anonymous) at (0,0) size 11x10
     640                                                          RenderText at (0,-8) size 11x25
     641                                                            text run at (0,-8) width 11: "+"
     642                                                    RenderMathMLRoot {mroot} at (26,0) size 42x27
     643                                                      RenderMathMLRootWrapper at (4,0) size 23x27
     644                                                        RenderMathMLFraction {mfrac} at (1,0) size 20x17
     645                                                          RenderMathMLBlock (anonymous, flex) at (0,0) size 20x9
     646                                                            RenderMathMLRow {mrow} at (0,0) size 20x7
     647                                                              RenderMathMLToken {mi} at (0,1) size 5x5 [padding: 0 1 0 0]
     648                                                                RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     649                                                                  RenderBlock (anonymous) at (0,0) size 4x5
     650                                                                    RenderText {#text} at (0,-6) size 4x15
     651                                                                      text run at (0,-6) width 4: "x"
     652                                                              RenderMathMLOperator {mo} at (4,0) size 11x6
     653                                                                RenderMathMLBlock (anonymous, flex) at (2,0) size 6x6
     654                                                                  RenderBlock (anonymous) at (0,0) size 6x6
     655                                                                    RenderText at (0,-5) size 6x15
     656                                                                      text run at (0,-5) width 6: "+"
     657                                                              RenderMathMLToken {mi} at (14,1) size 6x6 [padding: 0 1 0 0]
     658                                                                RenderMathMLBlock (anonymous, flex) at (0,0) size 4x6
     659                                                                  RenderBlock (anonymous) at (0,0) size 4x6
     660                                                                    RenderText {#text} at (0,-6) size 4x15
     661                                                                      text run at (0,-6) width 4: "y"
     662                                                          RenderMathMLBlock (anonymous, flex) at (0,8) size 20x9 [padding: 1 0 0 0]
     663                                                            RenderMathMLToken {mi} at (7,2) size 6x6 [padding: 0 1 0 0]
     664                                                              RenderMathMLBlock (anonymous, flex) at (0,0) size 4x5
     665                                                                RenderBlock (anonymous) at (0,0) size 4x5
     666                                                                  RenderText {#text} at (0,-6) size 4x15
     667                                                                    text run at (0,-6) width 4: "z"
     668                                                      RenderMathMLBlock (anonymous, flex) at (17,0) size 13x27
     669                                                        RenderMathMLRadicalOperator (anonymous) at (0,9) size 12x18
     670                                                          RenderMathMLBlock (anonymous, flex) at (0,0) size 12x18
     671                                                            RenderBlock (anonymous) at (0,0) size 12x18
     672                                                              RenderText at (0,-1) size 15x25
     673                                                                text run at (0,-1) width 15: "\x{221A}"
     674                                                      RenderMathMLRootWrapper at (29,12) size 12x15
     675                                                        RenderMathMLToken {mi} at (0,0) size 12x12 [padding: 0 2 0 0]
     676                                                          RenderMathMLBlock (anonymous, flex) at (0,0) size 10x12
     677                                                            RenderBlock (anonymous) at (0,0) size 10x12
     678                                                              RenderText {#text} at (0,-6) size 10x25
     679                                                                text run at (0,-6) width 10: "A"
    231680        RenderText {#text} at (0,0) size 0x0
    232 layer at (182,172) size 21x19
    233   RenderMathMLRoot {mroot} at (1,0) size 21x19 [intrinsic padding: 7 0 0 13]
    234     RenderMathMLRow (anonymous) at (13,7) size 8x12
    235       RenderMathMLToken {mn} at (0,0) size 8x12
    236         RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    237           RenderBlock (anonymous) at (0,0) size 8x12
    238             RenderText {#text} at (0,-6) size 8x25
    239               text run at (0,-6) width 8: "2"
    240 layer at (182,172) size 13x14
    241   RenderMathMLToken {mn} at (0,0) size 14x15 [padding: 0 5 4 2]
    242     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x10
    243       RenderBlock (anonymous) at (0,0) size 6x10
    244         RenderText {#text} at (0,-4) size 6x19
    245           text run at (0,-4) width 6: "3"
    246 layer at (84,209) size 60x19
    247   RenderMathMLRoot {mroot} at (1,0) size 60x19 [intrinsic padding: 7 0 0 52]
    248     RenderMathMLRow (anonymous) at (52,7) size 8x12
    249       RenderMathMLToken {mn} at (0,0) size 8x12
    250         RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    251           RenderBlock (anonymous) at (0,0) size 8x12
    252             RenderText {#text} at (0,-6) size 8x25
    253               text run at (0,-6) width 8: "2"
    254 layer at (84,209) size 52x14
    255   RenderMathMLRow {mrow} at (0,0) size 53x15 [padding: 0 5 4 2]
    256     RenderMathMLToken {mi} at (2,1) size 7x7 [padding: 0 1 0 0]
    257       RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    258         RenderBlock (anonymous) at (0,0) size 5x7
    259           RenderText {#text} at (0,-7) size 5x19
    260             text run at (0,-7) width 5: "x"
    261     RenderMathMLOperator {mo} at (8,0) size 14x8
    262       RenderMathMLBlock (anonymous, flex) at (2,0) size 9x8
    263         RenderBlock (anonymous) at (0,0) size 8x8
    264           RenderText at (0,-6) size 8x19
    265             text run at (0,-6) width 8: "+"
    266     RenderMathMLToken {mi} at (21,1) size 8x9 [padding: 0 1 0 0]
    267       RenderMathMLBlock (anonymous, flex) at (0,0) size 5x9
    268         RenderBlock (anonymous) at (0,0) size 5x9
    269           RenderText {#text} at (0,-7) size 5x19
    270             text run at (0,-7) width 5: "y"
    271     RenderMathMLOperator {mo} at (28,0) size 14x8
    272       RenderMathMLBlock (anonymous, flex) at (2,0) size 9x8
    273         RenderBlock (anonymous) at (0,0) size 8x8
    274           RenderText at (0,-6) size 8x19
    275             text run at (0,-6) width 8: "+"
    276     RenderMathMLToken {mi} at (41,1) size 7x7 [padding: 0 1 0 0]
    277       RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    278         RenderBlock (anonymous) at (0,0) size 5x7
    279           RenderText {#text} at (0,-7) size 5x19
    280             text run at (0,-7) width 5: "z"
    281 layer at (194,246) size 90x37
    282   RenderMathMLRoot {mroot} at (1,0) size 90x38 [intrinsic padding: 3 0 3 53]
    283     RenderMathMLRow (anonymous) at (53,3) size 37x32
    284       RenderMathMLFraction {mfrac} at (1,0) size 35x32
    285         RenderMathMLBlock (anonymous, flex) at (0,0) size 35x16
    286           RenderMathMLRow {mrow} at (0,0) size 35x12
    287             RenderMathMLToken {mi} at (0,3) size 9x9 [padding: 0 2 0 0]
    288               RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9
    289                 RenderBlock (anonymous) at (0,0) size 7x9
    290                   RenderText {#text} at (0,-9) size 7x25
    291                     text run at (0,-9) width 7: "x"
    292             RenderMathMLOperator {mo} at (8,2) size 19x10
    293               RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    294                 RenderBlock (anonymous) at (0,0) size 11x10
    295                   RenderText at (0,-8) size 11x25
    296                     text run at (0,-8) width 11: "+"
    297             RenderMathMLToken {mn} at (26,0) size 9x12
    298               RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    299                 RenderBlock (anonymous) at (0,0) size 8x12
    300                   RenderText {#text} at (0,-6) size 8x25
    301                     text run at (0,-6) width 8: "1"
    302         RenderMathMLBlock (anonymous, flex) at (0,15) size 35x17 [padding: 1 0 0 0]
    303           RenderMathMLRow {mrow} at (0,4) size 35x13
    304             RenderMathMLToken {mi} at (0,3) size 9x9 [padding: 0 2 0 0]
    305               RenderMathMLBlock (anonymous, flex) at (0,0) size 7x9
    306                 RenderBlock (anonymous) at (0,0) size 7x9
    307                   RenderText {#text} at (0,-9) size 7x25
    308                     text run at (0,-9) width 7: "x"
    309             RenderMathMLOperator {mo} at (8,2) size 19x10
    310               RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    311                 RenderBlock (anonymous) at (0,0) size 11x10
    312                   RenderText at (0,-8) size 11x25
    313                     text run at (0,-8) width 11: "+"
    314             RenderMathMLToken {mn} at (26,0) size 9x12
    315               RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    316                 RenderBlock (anonymous) at (0,0) size 8x12
    317                   RenderText {#text} at (0,-6) size 8x25
    318                     text run at (0,-6) width 8: "2"
    319 layer at (194,254) size 52x14
    320   RenderMathMLRow {mrow} at (0,8) size 53x15 [padding: 0 5 4 2]
    321     RenderMathMLToken {mi} at (2,1) size 7x7 [padding: 0 1 0 0]
    322       RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    323         RenderBlock (anonymous) at (0,0) size 5x7
    324           RenderText {#text} at (0,-7) size 5x19
    325             text run at (0,-7) width 5: "x"
    326     RenderMathMLOperator {mo} at (8,0) size 14x8
    327       RenderMathMLBlock (anonymous, flex) at (2,0) size 9x8
    328         RenderBlock (anonymous) at (0,0) size 8x8
    329           RenderText at (0,-6) size 8x19
    330             text run at (0,-6) width 8: "+"
    331     RenderMathMLToken {mi} at (21,1) size 8x9 [padding: 0 1 0 0]
    332       RenderMathMLBlock (anonymous, flex) at (0,0) size 5x9
    333         RenderBlock (anonymous) at (0,0) size 5x9
    334           RenderText {#text} at (0,-7) size 5x19
    335             text run at (0,-7) width 5: "y"
    336     RenderMathMLOperator {mo} at (28,0) size 14x8
    337       RenderMathMLBlock (anonymous, flex) at (2,0) size 9x8
    338         RenderBlock (anonymous) at (0,0) size 8x8
    339           RenderText at (0,-6) size 8x19
    340             text run at (0,-6) width 8: "+"
    341     RenderMathMLToken {mi} at (41,1) size 7x7 [padding: 0 1 0 0]
    342       RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    343         RenderBlock (anonymous) at (0,0) size 5x7
    344           RenderText {#text} at (0,-7) size 5x19
    345             text run at (0,-7) width 5: "z"
    346 layer at (84,299) size 23x44
    347   RenderMathMLRoot {mroot} at (1,0) size 23x44 [intrinsic padding: 32 0 0 15]
    348     RenderMathMLRow (anonymous) at (15,32) size 8x12
    349       RenderMathMLToken {mn} at (0,0) size 8x12
    350         RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    351           RenderBlock (anonymous) at (0,0) size 8x12
    352             RenderText {#text} at (0,-6) size 8x25
    353               text run at (0,-6) width 8: "2"
    354 layer at (85,299) size 15x39
    355   RenderMathMLFraction {mfrac} at (1,0) size 16x39 [padding: 0 5 4 2]
    356     RenderMathMLBlock (anonymous, flex) at (2,0) size 9x25
    357       RenderMathMLFraction {mfrac} at (1,0) size 7x22
    358         RenderMathMLBlock (anonymous, flex) at (0,0) size 7x10
    359           RenderMathMLToken {mi} at (0,0) size 7x7 [padding: 0 1 0 0]
    360             RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    361               RenderBlock (anonymous) at (0,0) size 5x7
    362                 RenderText {#text} at (0,-7) size 5x19
    363                   text run at (0,-7) width 5: "x"
    364         RenderMathMLBlock (anonymous, flex) at (0,9) size 7x13 [padding: 1 0 0 0]
    365           RenderMathMLToken {mi} at (0,3) size 7x10 [padding: 0 1 0 0]
    366             RenderMathMLBlock (anonymous, flex) at (0,0) size 5x9
    367               RenderBlock (anonymous) at (0,0) size 5x9
    368                 RenderText {#text} at (0,-7) size 5x19
    369                   text run at (0,-7) width 5: "y"
    370     RenderMathMLBlock (anonymous, flex) at (2,24) size 9x11 [padding: 1 0 0 0]
    371       RenderMathMLToken {mi} at (1,3) size 7x8 [padding: 0 1 0 0]
    372         RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    373           RenderBlock (anonymous) at (0,0) size 5x7
    374             RenderText {#text} at (0,-7) size 5x19
    375               text run at (0,-7) width 5: "z"
    376 layer at (119,422) size 352x74
    377   RenderMathMLRoot {mroot} at (1,0) size 353x74 [intrinsic padding: 3 0 3 19]
    378     RenderMathMLRow (anonymous) at (19,3) size 334x68
    379       RenderMathMLRow {mrow} at (0,0) size 334x68
    380         RenderMathMLToken {mn} at (0,38) size 8x12
    381           RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    382             RenderBlock (anonymous) at (0,0) size 8x12
    383               RenderText {#text} at (0,-6) size 8x25
    384                 text run at (0,-6) width 8: "1"
    385         RenderMathMLOperator {mo} at (8,40) size 19x10
    386           RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    387             RenderBlock (anonymous) at (0,0) size 11x10
    388               RenderText at (0,-8) size 11x25
    389                 text run at (0,-8) width 11: "+"
    390 layer at (164,425) size 307x68
    391   RenderMathMLRoot {mroot} at (26,0) size 308x68 [intrinsic padding: 3 0 3 19]
    392     RenderMathMLRow (anonymous) at (19,3) size 289x62
    393       RenderMathMLRow {mrow} at (0,0) size 289x62
    394         RenderMathMLToken {mn} at (0,35) size 8x12
    395           RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    396             RenderBlock (anonymous) at (0,0) size 8x12
    397               RenderText {#text} at (0,-6) size 8x25
    398                 text run at (0,-6) width 8: "2"
    399         RenderMathMLOperator {mo} at (8,37) size 19x10
    400           RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    401             RenderBlock (anonymous) at (0,0) size 11x10
    402               RenderText at (0,-8) size 11x25
    403                 text run at (0,-8) width 11: "+"
    404 layer at (209,428) size 262x62
    405   RenderMathMLRoot {mroot} at (26,0) size 263x62 [intrinsic padding: 3 0 3 19]
    406     RenderMathMLRow (anonymous) at (19,3) size 244x56
    407       RenderMathMLRow {mrow} at (0,0) size 244x56
    408         RenderMathMLToken {mn} at (0,32) size 8x12
    409           RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    410             RenderBlock (anonymous) at (0,0) size 8x12
    411               RenderText {#text} at (0,-6) size 8x25
    412                 text run at (0,-6) width 8: "3"
    413         RenderMathMLOperator {mo} at (8,34) size 19x10
    414           RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    415             RenderBlock (anonymous) at (0,0) size 11x10
    416               RenderText at (0,-8) size 11x25
    417                 text run at (0,-8) width 11: "+"
    418 layer at (254,431) size 217x56
    419   RenderMathMLRoot {mroot} at (26,0) size 218x56 [intrinsic padding: 3 0 3 19]
    420     RenderMathMLRow (anonymous) at (19,3) size 198x50
    421       RenderMathMLRow {mrow} at (0,0) size 198x50
    422         RenderMathMLToken {mn} at (0,29) size 8x12
    423           RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    424             RenderBlock (anonymous) at (0,0) size 8x12
    425               RenderText {#text} at (0,-6) size 8x25
    426                 text run at (0,-6) width 8: "4"
    427         RenderMathMLOperator {mo} at (8,31) size 19x10
    428           RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    429             RenderBlock (anonymous) at (0,0) size 11x10
    430               RenderText at (0,-8) size 11x25
    431                 text run at (0,-8) width 11: "+"
    432 layer at (299,434) size 172x50
    433   RenderMathMLRoot {mroot} at (26,0) size 172x50 [intrinsic padding: 3 0 3 18]
    434     RenderMathMLRow (anonymous) at (18,3) size 154x44
    435       RenderMathMLRow {mrow} at (0,0) size 154x44
    436         RenderMathMLToken {mn} at (0,25) size 8x13
    437           RenderMathMLBlock (anonymous, flex) at (0,0) size 8x13
    438             RenderBlock (anonymous) at (0,0) size 8x13
    439               RenderText {#text} at (0,-5) size 8x25
    440                 text run at (0,-5) width 8: "5"
    441         RenderMathMLOperator {mo} at (8,28) size 19x10
    442           RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    443             RenderBlock (anonymous) at (0,0) size 11x10
    444               RenderText at (0,-8) size 11x25
    445                 text run at (0,-8) width 11: "+"
    446 layer at (343,437) size 128x44
    447   RenderMathMLRoot {mroot} at (26,0) size 128x44 [intrinsic padding: 3 0 3 16]
    448     RenderMathMLRow (anonymous) at (16,3) size 112x38
    449       RenderMathMLRow {mrow} at (0,0) size 112x38
    450         RenderMathMLToken {mn} at (0,23) size 8x12
    451           RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    452             RenderBlock (anonymous) at (0,0) size 8x12
    453               RenderText {#text} at (0,-6) size 8x25
    454                 text run at (0,-6) width 8: "6"
    455         RenderMathMLOperator {mo} at (8,25) size 19x10
    456           RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    457             RenderBlock (anonymous) at (0,0) size 11x10
    458               RenderText at (0,-8) size 11x25
    459                 text run at (0,-8) width 11: "+"
    460 layer at (386,440) size 86x38
    461   RenderMathMLRoot {mroot} at (26,0) size 86x38 [intrinsic padding: 3 0 3 15]
    462     RenderMathMLRow (anonymous) at (15,3) size 71x32
    463       RenderMathMLRow {mrow} at (0,0) size 71x32
    464         RenderMathMLToken {mn} at (0,20) size 8x12
    465           RenderMathMLBlock (anonymous, flex) at (0,0) size 8x12
    466             RenderBlock (anonymous) at (0,0) size 8x12
    467               RenderText {#text} at (0,-6) size 8x25
    468                 text run at (0,-6) width 8: "7"
    469         RenderMathMLOperator {mo} at (8,22) size 19x10
    470           RenderMathMLBlock (anonymous, flex) at (3,0) size 12x10
    471             RenderBlock (anonymous) at (0,0) size 11x10
    472               RenderText at (0,-8) size 11x25
    473                 text run at (0,-8) width 11: "+"
    474 layer at (427,443) size 45x32
    475   RenderMathMLRoot {mroot} at (26,0) size 45x32 [intrinsic padding: 20 0 0 33]
    476     RenderMathMLRow (anonymous) at (33,20) size 12x12
    477       RenderMathMLToken {mi} at (0,0) size 12x12 [padding: 0 2 0 0]
    478         RenderMathMLBlock (anonymous, flex) at (0,0) size 10x12
    479           RenderBlock (anonymous) at (0,0) size 10x12
    480             RenderText {#text} at (0,-6) size 10x25
    481               text run at (0,-6) width 10: "A"
    482 layer at (428,443) size 33x27
    483   RenderMathMLFraction {mfrac} at (1,0) size 33x27 [padding: 0 5 4 2]
    484     RenderMathMLBlock (anonymous, flex) at (2,0) size 27x13
    485       RenderMathMLRow {mrow} at (0,0) size 26x10
    486         RenderMathMLToken {mi} at (0,1) size 7x7 [padding: 0 1 0 0]
    487           RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    488             RenderBlock (anonymous) at (0,0) size 5x7
    489               RenderText {#text} at (0,-7) size 5x19
    490                 text run at (0,-7) width 5: "x"
    491         RenderMathMLOperator {mo} at (6,0) size 14x8
    492           RenderMathMLBlock (anonymous, flex) at (2,0) size 9x8
    493             RenderBlock (anonymous) at (0,0) size 8x8
    494               RenderText at (0,-6) size 8x19
    495                 text run at (0,-6) width 8: "+"
    496         RenderMathMLToken {mi} at (19,1) size 7x9 [padding: 0 1 0 0]
    497           RenderMathMLBlock (anonymous, flex) at (0,0) size 5x9
    498             RenderBlock (anonymous) at (0,0) size 5x9
    499               RenderText {#text} at (0,-7) size 5x19
    500                 text run at (0,-7) width 5: "y"
    501     RenderMathMLBlock (anonymous, flex) at (2,12) size 27x11 [padding: 1 0 0 0]
    502       RenderMathMLToken {mi} at (9,3) size 7x8 [padding: 0 1 0 0]
    503         RenderMathMLBlock (anonymous, flex) at (0,0) size 5x7
    504           RenderBlock (anonymous) at (0,0) size 5x7
    505             RenderText {#text} at (0,-7) size 5x19
    506               text run at (0,-7) width 5: "z"
    507 layer at (386,449) size 13x14
    508   RenderMathMLToken {mn} at (0,9) size 14x15 [padding: 0 5 4 2]
    509     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x10
    510       RenderBlock (anonymous) at (0,0) size 6x10
    511         RenderText {#text} at (0,-4) size 6x19
    512           text run at (0,-4) width 6: "9"
    513 layer at (343,450) size 13x14
    514   RenderMathMLToken {mn} at (0,13) size 14x15 [padding: 0 5 4 2]
    515     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x10
    516       RenderBlock (anonymous) at (0,0) size 6x10
    517         RenderText {#text} at (0,-4) size 6x19
    518           text run at (0,-4) width 6: "8"
    519 layer at (299,451) size 13x13
    520   RenderMathMLToken {mn} at (0,17) size 14x14 [padding: 0 5 4 2]
    521     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x9
    522       RenderBlock (anonymous) at (0,0) size 6x9
    523         RenderText {#text} at (0,-5) size 6x19
    524           text run at (0,-5) width 6: "7"
    525 layer at (254,451) size 13x14
    526   RenderMathMLToken {mn} at (0,20) size 14x15 [padding: 0 5 4 2]
    527     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x10
    528       RenderBlock (anonymous) at (0,0) size 6x10
    529         RenderText {#text} at (0,-4) size 6x19
    530           text run at (0,-4) width 6: "6"
    531 layer at (209,452) size 13x14
    532   RenderMathMLToken {mn} at (0,24) size 14x15 [padding: 0 5 4 2]
    533     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x10
    534       RenderBlock (anonymous) at (0,0) size 6x10
    535         RenderText {#text} at (0,-4) size 6x19
    536           text run at (0,-4) width 6: "5"
    537 layer at (164,453) size 13x14
    538   RenderMathMLToken {mn} at (0,28) size 14x15 [padding: 0 5 4 2]
    539     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x10
    540       RenderBlock (anonymous) at (0,0) size 6x10
    541         RenderText {#text} at (0,-4) size 6x19
    542           text run at (0,-4) width 6: "4"
    543 layer at (119,453) size 13x14
    544   RenderMathMLToken {mn} at (0,31) size 14x15 [padding: 0 5 4 2]
    545     RenderMathMLBlock (anonymous, flex) at (2,0) size 7x10
    546       RenderBlock (anonymous) at (0,0) size 6x10
    547         RenderText {#text} at (0,-4) size 6x19
    548           text run at (0,-4) width 6: "3"
  • trunk/LayoutTests/platform/mac/TestExpectations

    r169945 r169963  
    13261326webkit.org/b/72828 mathml/opentype/opentype-stretchy-horizontal.html [ Failure ]
    13271327webkit.org/b/72828 mathml/opentype/horizontal-LatinModern-munderover.html [ Failure ]
     1328webkit.org/b/119038 mathml/opentype/roots-LatinModern.html [ Failure ]
     1329
     1330# Missing references
     1331webkit.org/b/119038 mathml/presentation/mo-stretch.html [ Failure ]
     1332webkit.org/b/119038 mathml/presentation/roots.xhtml [ Failure ]
    13281333
    13291334# WebKitDataCue is supported, not DataCue
  • trunk/LayoutTests/platform/win/TestExpectations

    r169945 r169963  
    28192819webkit.org/b/72828 mathml/opentype/opentype-stretchy-horizontal.html [ Failure ]
    28202820webkit.org/b/72828 mathml/opentype/horizontal-LatinModern-munderover.html [ Failure ]
     2821webkit.org/b/119038 mathml/opentype/roots-LatinModern.html [ Failure ]
     2822webkit.org/b/119038 mathml/presentation/mo-stretch.html [ Failure ]
     2823webkit.org/b/119038 mathml/presentation/roots.xhtml [ Failure ]
  • trunk/Source/WebCore/CMakeLists.txt

    r169945 r169963  
    23692369    rendering/mathml/RenderMathMLMenclose.cpp
    23702370    rendering/mathml/RenderMathMLOperator.cpp
     2371    rendering/mathml/RenderMathMLRadicalOperator.cpp
    23712372    rendering/mathml/RenderMathMLRoot.cpp
    23722373    rendering/mathml/RenderMathMLRow.cpp
  • trunk/Source/WebCore/ChangeLog

    r169960 r169963  
     12014-06-14  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Draw radicals with glyphs for better rendering
     4        https://bugs.webkit.org/show_bug.cgi?id=119038
     5
     6        Reviewed by Chris Fleizach.
     7
     8        We rewrite RenderMathMLRoot in order to fix bugs with SVG transforms and dynamic modification of children and allow drawing with an OpenType MATH table.
     9        The drawing of the radical sign (without the top bar) is now moved to a RenderMathMLRadicalOperator class inheriting from RenderMathMLOperator.
     10        This class fallbacks to the original drawing with graphic primitives if an OpenType MATH table is not available.
     11
     12        Tests: mathml/opentype/roots-LatinModern.html
     13               mathml/presentation/mroot-transform.html
     14
     15        * CMakeLists.txt: add files to build system.
     16        * WebCore.vcxproj/WebCore.vcxproj: ditto.
     17        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
     18        * WebCore.xcodeproj/project.pbxproj: ditto
     19        * css/mathml.css: remove rules for msqrt/mroot. The "script level" in mroot is not incremented by 2 as specified in the spec.
     20        (math, mrow, mfenced, merror, mphantom, mstyle, menclose):
     21        (mroot > *:last-child):
     22        (math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle, menclose): Deleted.
     23        (msqrt > *): Deleted.
     24        (mroot): Deleted. This rule was causing bug 126516.
     25        (mroot > * + *): Deleted.
     26        * rendering/RenderObject.h: Add two new isRenderMathML* functions for dynamic casting.
     27        (WebCore::RenderObject::isRenderMathMLRadicalOperator):
     28        (WebCore::RenderObject::isRenderMathMLRootWrapper):
     29        * rendering/mathml/RenderMathMLOperator.cpp: Accept a set of operator dictionary flags, all disabled by default. This is to allow anonymous radicas, which don't have any flag.
     30        isFencedOperator() is now replaced with the more general isAnonymous() since we allow anonymous radical operator fors msqrt/mroot.
     31        (WebCore::RenderMathMLOperator::RenderMathMLOperator):
     32        (WebCore::RenderMathMLOperator::setOperatorFlagFromAttribute):
     33        (WebCore::RenderMathMLOperator::setOperatorPropertiesFromOpDictEntry):
     34        (WebCore::RenderMathMLOperator::SetOperatorProperties):
     35        (WebCore::RenderMathMLOperator::updateTokenContent):
     36        * rendering/mathml/RenderMathMLOperator.h: Allow class to be overriden, redefine the anonymous constructor, remove isFencedOperator().
     37        * rendering/mathml/RenderMathMLRadicalOperator.cpp: Added.
     38        (WebCore::RenderMathMLRadicalOperator::RenderMathMLRadicalOperator):
     39        (WebCore::RenderMathMLRadicalOperator::stretchTo):
     40        (WebCore::RenderMathMLRadicalOperator::SetOperatorProperties):
     41        (WebCore::RenderMathMLRadicalOperator::computePreferredLogicalWidths):
     42        (WebCore::RenderMathMLRadicalOperator::computeLogicalHeight):
     43        (WebCore::RenderMathMLRadicalOperator::paint):
     44        (WebCore::RenderMathMLRadicalOperator::trailingSpaceError):
     45        * rendering/mathml/RenderMathMLRadicalOperator.h: Added.
     46        * rendering/mathml/RenderMathMLRoot.cpp: Rewritten. Some parts to use graphic primitives are moved to RenderMathMLRadicalOperator.cpp.
     47        (WebCore::RenderMathMLRoot::RenderMathMLRoot):
     48        (WebCore::RenderMathMLRoot::baseWrapper):
     49        (WebCore::RenderMathMLRoot::radicalWrapper):
     50        (WebCore::RenderMathMLRoot::indexWrapper):
     51        (WebCore::RenderMathMLRoot::radicalOperator):
     52        (WebCore::RenderMathMLRoot::restructureWrappers):
     53        (WebCore::RenderMathMLRoot::addChild):
     54        (WebCore::RenderMathMLRoot::styleDidChange):
     55        (WebCore::RenderMathMLRoot::updateFromElement):
     56        (WebCore::RenderMathMLRoot::updateStyle):
     57        (WebCore::RenderMathMLRoot::firstLineBaseline):
     58        (WebCore::RenderMathMLRoot::layout):
     59        (WebCore::RenderMathMLRoot::paint):
     60        (WebCore::RenderMathMLRootWrapper::createAnonymousWrapper):
     61        (WebCore::RenderMathMLRootWrapper::removeChildWithoutRestructuring):
     62        (WebCore::RenderMathMLRootWrapper::removeChild):
     63        (WebCore::RenderMathMLRoot::paddingTop): Deleted.
     64        (WebCore::RenderMathMLRoot::paddingBottom): Deleted.
     65        (WebCore::RenderMathMLRoot::paddingLeft): Deleted.
     66        (WebCore::RenderMathMLRoot::paddingRight): Deleted.
     67        (WebCore::RenderMathMLRoot::paddingBefore): Deleted.
     68        (WebCore::RenderMathMLRoot::paddingAfter): Deleted.
     69        (WebCore::RenderMathMLRoot::paddingStart): Deleted.
     70        (WebCore::RenderMathMLRoot::paddingEnd): Deleted.
     71        (WebCore::RenderMathMLRoot::index): Deleted.
     72        * rendering/mathml/RenderMathMLRoot.h: Rewritten.
     73        (WebCore::RenderMathMLRootWrapper::RenderMathMLRootWrapper):
     74
    1752014-06-13  Brent Fulgham  <bfulgham@apple.com>
    276
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r169945 r169963  
    1142311423    <ClCompile Include="..\rendering\mathml\RenderMathMLMenclose.cpp" />
    1142411424    <ClCompile Include="..\rendering\mathml\RenderMathMLOperator.cpp" />
     11425    <ClCompile Include="..\rendering\mathml\RenderMathMLRadicalOperator.cpp" />
    1142511426    <ClCompile Include="..\rendering\mathml\RenderMathMLRoot.cpp" />
    1142611427    <ClCompile Include="..\rendering\mathml\RenderMathMLRow.cpp" />
     
    2013420135    <ClInclude Include="..\rendering\mathml\RenderMathMLMenclose.h" />
    2013520136    <ClInclude Include="..\rendering\mathml\RenderMathMLOperator.h" />
     20137    <ClInclude Include="..\rendering\mathml\RenderMathMLRadicalOperator.h" />
    2013620138    <ClInclude Include="..\rendering\mathml\RenderMathMLRoot.h" />
    2013720139    <ClInclude Include="..\rendering\mathml\RenderMathMLRow.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r169945 r169963  
    27432743      <Filter>rendering\mathml</Filter>
    27442744    </ClCompile>
     2745    <ClCompile Include="..\rendering\mathml\RenderMathMLRadicalOperator.cpp">
     2746      <Filter>rendering\mathml</Filter>
     2747    </ClCompile>
    27452748    <ClCompile Include="..\rendering\mathml\RenderMathMLRoot.cpp">
    27462749      <Filter>rendering\mathml</Filter>
     
    96519654    </ClInclude>
    96529655    <ClInclude Include="..\rendering\mathml\RenderMathMLOperator.h">
     9656      <Filter>rendering\mathml</Filter>
     9657    </ClInclude>
     9658    <ClInclude Include="..\rendering\mathml\RenderMathMLRadicalOperator.h">
    96539659      <Filter>rendering\mathml</Filter>
    96549660    </ClInclude>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r169948 r169963  
    14941494                439046DF12DA25E800AF80A2 /* RenderMathMLOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CB12DA25E800AF80A2 /* RenderMathMLOperator.cpp */; };
    14951495                439046E012DA25E800AF80A2 /* RenderMathMLOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */; };
     1496                439046DF12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CB12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp */; };
     1497                439046E012DA25E800BF80A3 /* RenderMathMLRadicalOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CC12DA25E800BF80A3 /* RenderMathMLRadicalOperator.h */; };
    14961498                439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CD12DA25E800AF80A2 /* RenderMathMLRoot.cpp */; };
    14971499                439046E212DA25E800AF80A2 /* RenderMathMLRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CE12DA25E800AF80A2 /* RenderMathMLRoot.h */; };
     
    85158517                439046CB12DA25E800AF80A2 /* RenderMathMLOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLOperator.cpp; path = mathml/RenderMathMLOperator.cpp; sourceTree = "<group>"; };
    85168518                439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLOperator.h; path = mathml/RenderMathMLOperator.h; sourceTree = "<group>"; };
     8519                439046CB12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLRadicalOperator.cpp; path = mathml/RenderMathMLRadicalOperator.cpp; sourceTree = "<group>"; };
     8520                439046CC12DA25E800BF80A3 /* RenderMathMLRadicalOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLRadicalOperator.h; path = mathml/RenderMathMLRadicalOperator.h; sourceTree = "<group>"; };
    85178521                439046CD12DA25E800AF80A2 /* RenderMathMLRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLRoot.cpp; path = mathml/RenderMathMLRoot.cpp; sourceTree = "<group>"; };
    85188522                439046CE12DA25E800AF80A2 /* RenderMathMLRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLRoot.h; path = mathml/RenderMathMLRoot.h; sourceTree = "<group>"; };
     
    1557815582                                439046CB12DA25E800AF80A2 /* RenderMathMLOperator.cpp */,
    1557915583                                439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */,
     15584                                439046CB12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp */,
     15585                                439046CC12DA25E800BF80A3 /* RenderMathMLRadicalOperator.h */,
    1558015586                                439046CD12DA25E800AF80A2 /* RenderMathMLRoot.cpp */,
    1558115587                                439046CE12DA25E800AF80A2 /* RenderMathMLRoot.h */,
     
    2549925505                                439046DE12DA25E800AF80A2 /* RenderMathMLMath.h in Headers */,
    2550025506                                439046E012DA25E800AF80A2 /* RenderMathMLOperator.h in Headers */,
     25507                                439046E012DA25E800BF80A3 /* RenderMathMLRadicalOperator.h in Headers */,
    2550125508                                439046E212DA25E800AF80A2 /* RenderMathMLRoot.h in Headers */,
    2550225509                                439046E412DA25E800AF80A2 /* RenderMathMLRow.h in Headers */,
     
    2896328970                                3571883EEF618793751E4089 /* RenderMathMLMenclose.cpp in Sources */,
    2896428971                                439046DF12DA25E800AF80A2 /* RenderMathMLOperator.cpp in Sources */,
     28972                                439046DF12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp in Sources */,
    2896528973                                439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */,
    2896628974                                439046E312DA25E800AF80A2 /* RenderMathMLRow.cpp in Sources */,
  • trunk/Source/WebCore/css/mathml.css

    r169945 r169963  
    3838}
    3939
    40 math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle, menclose {
     40math, mrow, mfenced, merror, mphantom, mstyle, menclose {
    4141    -webkit-align-items: baseline;
    42 }
    43 msqrt > * { /* This rule is needed because of <msqrt>'s anonymous <mrow>. */
    44     -webkit-align-self: baseline;
    4542}
    4643
     
    8683    font-size: 0.75em; /* FIXME: MathML standard is 0.71em */
    8784}
     85mroot > *:last-child {
     86    font-size: 0.5625em; /* This 0.75^2 since the scriptlevel is incremented by 2 in the index. */
     87}
    8888
    8989mi {
     
    9595msubsup > mi:first-child + * + * {
    9696    -webkit-margin-start: 0.14em; /* This is larger than 0.1em because the child's font-size is smaller than the <msubsup>'s. */
    97 }
    98 
    99 mroot {
    100     position: relative;
    101 }
    102 mroot > * + * {
    103     font-size: 0.75em;
    104     position: absolute;
    105     left: 0;
    106     top: 0;
    107     padding-right: 0.4em;
    108     padding-left: 0.2em;
    109     padding-bottom: 0.35em;
    11097}
    11198
  • trunk/Source/WebCore/rendering/RenderObject.h

    r169945 r169963  
    411411    virtual bool isRenderMathMLTable() const { return false; }
    412412    virtual bool isRenderMathMLOperator() const { return false; }
     413    virtual bool isRenderMathMLRadicalOperator() const { return false; }
    413414    virtual bool isRenderMathMLRow() const { return false; }
    414415    virtual bool isRenderMathMLMath() const { return false; }
     
    416417    virtual bool isRenderMathMLFraction() const { return false; }
    417418    virtual bool isRenderMathMLRoot() const { return false; }
     419    virtual bool isRenderMathMLRootWrapper() const { return false; }
    418420    virtual bool isRenderMathMLSpace() const { return false; }
    419421    virtual bool isRenderMathMLSquareRoot() const { return false; }
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r169945 r169963  
    11461146}
    11471147
    1148 RenderMathMLOperator::RenderMathMLOperator(Document& document, PassRef<RenderStyle> style, const String& operatorString, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag)
     1148RenderMathMLOperator::RenderMathMLOperator(Document& document, PassRef<RenderStyle> style, const String& operatorString, MathMLOperatorDictionary::Form form, unsigned short flags)
    11491149    : RenderMathMLToken(document, std::move(style))
    11501150    , m_stretchHeightAboveBaseline(0)
     
    11531153    , m_isVertical(true)
    11541154    , m_operatorForm(form)
    1155     , m_operatorFlags(flag)
     1155    , m_operatorFlags(flags)
    11561156{
    11571157    updateTokenContent(operatorString);
     
    11601160void RenderMathMLOperator::setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag flag, const QualifiedName& name)
    11611161{
    1162     ASSERT(!isFencedOperator());
     1162    ASSERT(!isAnonymous());
    11631163    const AtomicString& attributeValue = element().fastGetAttribute(name);
    11641164    if (attributeValue == "true")
     
    11711171void RenderMathMLOperator::setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry* entry)
    11721172{
    1173     // If this operator has been created by RenderMathMLFenced, we preserve the Fence and Separator properties.
    1174     if (isFencedOperator())
     1173    // If this operator is anonymous, we preserve the Fence and Separator properties. This is to handle the case of RenderMathMLFenced.
     1174    if (isAnonymous())
    11751175        m_operatorFlags = (m_operatorFlags & (MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator)) | entry->flags;
    11761176    else
     
    11891189    // We determine the form of the operator.
    11901190    bool explicitForm = true;
    1191     if (!isFencedOperator()) {
     1191    if (!isAnonymous()) {
    11921192        const AtomicString& form = element().fastGetAttribute(MathMLNames::formAttr);
    11931193        if (form == "prefix")
     
    12121212
    12131213    // First we initialize with the default values for unknown operators.
    1214     if (isFencedOperator())
     1214    if (isAnonymous())
    12151215        m_operatorFlags &= MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator; // This resets all but the Fence and Separator properties.
    12161216    else
     
    12391239#undef MATHML_OPDICT_SIZE
    12401240
    1241     if (!isFencedOperator()) {
     1241    if (!isAnonymous()) {
    12421242        // Finally, we make the attribute values override the default.
    12431243
     
    13871387void RenderMathMLOperator::updateTokenContent(const String& operatorString)
    13881388{
    1389     ASSERT(isFencedOperator());
     1389    ASSERT(isAnonymous());
    13901390    rebuildTokenContent(operatorString);
    13911391}
     
    13931393void RenderMathMLOperator::updateTokenContent()
    13941394{
    1395     ASSERT(!isFencedOperator());
     1395    ASSERT(!isAnonymous());
    13961396    rebuildTokenContent(element().textContent());
    13971397}
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h

    r169945 r169963  
    5959}
    6060
    61 class RenderMathMLOperator final : public RenderMathMLToken {
     61class RenderMathMLOperator : public RenderMathMLToken {
    6262public:
    6363    RenderMathMLOperator(MathMLElement&, PassRef<RenderStyle>);
    64     RenderMathMLOperator(Document&, PassRef<RenderStyle>, const String& operatorString, MathMLOperatorDictionary::Form, MathMLOperatorDictionary::Flag);
     64    RenderMathMLOperator(Document&, PassRef<RenderStyle>, const String& operatorString, MathMLOperatorDictionary::Form, unsigned short flags = 0);
    6565
    66     void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);
     66    virtual void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);
    6767    void stretchTo(LayoutUnit width);
    6868    LayoutUnit stretchSize() const { return m_isVertical ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
     
    7474    void updateStyle() override final;
    7575
    76     void paint(PaintInfo&, const LayoutPoint&);
     76    virtual void paint(PaintInfo&, const LayoutPoint&);
    7777
    7878    void updateTokenContent(const String& operatorString);
     
    8080    void updateOperatorProperties();
    8181
    82 private:
     82protected:
    8383    virtual const char* renderName() const override { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }
    8484    virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override;
    8585    virtual bool isRenderMathMLOperator() const override { return true; }
    86     bool isFencedOperator() { return isAnonymous(); }
    8786    // The following operators are invisible: U+2061 FUNCTION APPLICATION, U+2062 INVISIBLE TIMES, U+2063 INVISIBLE SEPARATOR, U+2064 INVISIBLE PLUS.
    8887    bool isInvisibleOperator() const { return 0x2061 <= m_operator && m_operator <= 0x2064; }
     
    188187    void setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag, const QualifiedName&);
    189188    void setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry*);
    190     void SetOperatorProperties();
     189    virtual void SetOperatorProperties();
    191190};
    192191
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp

    r169945 r169963  
    3131#include "RenderMathMLRoot.h"
    3232
     33#include "FontCache.h"
    3334#include "GraphicsContext.h"
    3435#include "PaintInfo.h"
    3536#include "RenderIterator.h"
    36 #include "RenderMathMLRow.h"
     37#include "RenderMathMLRadicalOperator.h"
    3738
    3839namespace WebCore {
    3940   
    40 // FIXME: This whole file should be changed to work with various writing modes. See https://bugs.webkit.org/show_bug.cgi?id=48951.
    41 
    42 // Threshold above which the radical shape is modified to look nice with big bases (em)
    43 const float gThresholdBaseHeightEms = 1.5f;
    44 // Normal width of the front of the radical sign, before the base & overbar (em)
    45 const float gFrontWidthEms = 0.75f;
    46 // Gap between the base and overbar (em)
    47 const float gSpaceAboveEms = 0.2f;
    48 // Horizontal position of the bottom point of the radical (* frontWidth)
    49 const float gRadicalBottomPointXFront = 0.5f;
    50 // Lower the radical sign's bottom point (px)
    51 const int gRadicalBottomPointLower = 3;
    52 // Horizontal position of the top left point of the radical "dip" (* frontWidth)
    53 const float gRadicalDipLeftPointXFront = 0.8f;
    54 // Vertical position of the top left point of a sqrt radical "dip" (* baseHeight)
    55 const float gSqrtRadicalDipLeftPointYPos = 0.5f;
    56 // Vertical position of the top left point of an nth root radical "dip" (* baseHeight)
    57 const float gRootRadicalDipLeftPointYPos = 0.625f;
    58 // Vertical shift of the left end point of the radical (em)
    59 const float gRadicalLeftEndYShiftEms = 0.05f;
    60 // Additional bottom root padding if baseHeight > threshold (em)
    61 const float gBigRootBottomPaddingEms = 0.2f;
    62 
    63 // Radical line thickness (em)
    64 const float gRadicalLineThicknessEms = 0.02f;
    65 // Radical thick line thickness (em)
    66 const float gRadicalThickLineThicknessEms = 0.1f;
    67    
     41// RenderMathMLRoot implements drawing of radicals via the <mroot> and <msqrt> elements. For valid MathML elements, the DOM is
     42//
     43// <mroot> Base Index </mroot>
     44// <msqrt> Child1 Child2 ... ChildN </msqrt>
     45//
     46// and the structure of the render tree will be
     47//
     48// IndexWrapper RadicalWrapper BaseWrapper
     49//
     50// where RadicalWrapper contains an <mo>&#x221A;</mo>.
     51// For <mroot>, the IndexWrapper and BaseWrapper should contain exactly one child (Index and Base respectively).
     52// For <msqrt>, the IndexWrapper should be empty and the BaseWrapper can contain any number of children (Child1, ... ChildN).
     53//
     54// In order to accept invalid markup and to handle <mroot> and <msqrt> consistently, we will allow any number of children in the BaseWrapper of <mroot> too.
     55// We will allow the IndexWrapper to be empty and it will always contain the last child of the <mroot> if there are at least 2 elements.
     56
    6857RenderMathMLRoot::RenderMathMLRoot(Element& element, PassRef<RenderStyle> style)
    6958    : RenderMathMLBlock(element, std::move(style))
    70     , m_intrinsicPaddingBefore(0)
    71     , m_intrinsicPaddingAfter(0)
    72     , m_intrinsicPaddingStart(0)
    73     , m_intrinsicPaddingEnd(0)
    7459{
    7560}
     
    7762RenderMathMLRoot::RenderMathMLRoot(Document& document, PassRef<RenderStyle> style)
    7863    : RenderMathMLBlock(document, std::move(style))
    79     , m_intrinsicPaddingBefore(0)
    80     , m_intrinsicPaddingAfter(0)
    81     , m_intrinsicPaddingStart(0)
    82     , m_intrinsicPaddingEnd(0)
    83 {
    84 }
    85 LayoutUnit RenderMathMLRoot::paddingTop() const
    86 {
    87     LayoutUnit result = computedCSSPaddingTop();
    88     switch (style().writingMode()) {
    89     case TopToBottomWritingMode:
    90         return result + m_intrinsicPaddingBefore;
    91     case BottomToTopWritingMode:
    92         return result + m_intrinsicPaddingAfter;
    93     case LeftToRightWritingMode:
    94     case RightToLeftWritingMode:
    95         return result + (style().isLeftToRightDirection() ? m_intrinsicPaddingStart : m_intrinsicPaddingEnd);
    96     }
    97     ASSERT_NOT_REACHED();
    98     return result;
    99 }
    100 
    101 LayoutUnit RenderMathMLRoot::paddingBottom() const
    102 {
    103     LayoutUnit result = computedCSSPaddingBottom();
    104     switch (style().writingMode()) {
    105     case TopToBottomWritingMode:
    106         return result + m_intrinsicPaddingAfter;
    107     case BottomToTopWritingMode:
    108         return result + m_intrinsicPaddingBefore;
    109     case LeftToRightWritingMode:
    110     case RightToLeftWritingMode:
    111         return result + (style().isLeftToRightDirection() ? m_intrinsicPaddingEnd : m_intrinsicPaddingStart);
    112     }
    113     ASSERT_NOT_REACHED();
    114     return result;
    115 }
    116 
    117 LayoutUnit RenderMathMLRoot::paddingLeft() const
    118 {
    119     LayoutUnit result = computedCSSPaddingLeft();
    120     switch (style().writingMode()) {
    121     case LeftToRightWritingMode:
    122         return result + m_intrinsicPaddingBefore;
    123     case RightToLeftWritingMode:
    124         return result + m_intrinsicPaddingAfter;
    125     case TopToBottomWritingMode:
    126     case BottomToTopWritingMode:
    127         return result + (style().isLeftToRightDirection() ? m_intrinsicPaddingStart : m_intrinsicPaddingEnd);
    128     }
    129     ASSERT_NOT_REACHED();
    130     return result;
    131 }
    132 
    133 LayoutUnit RenderMathMLRoot::paddingRight() const
    134 {
    135     LayoutUnit result = computedCSSPaddingRight();
    136     switch (style().writingMode()) {
    137     case RightToLeftWritingMode:
    138         return result + m_intrinsicPaddingBefore;
    139     case LeftToRightWritingMode:
    140         return result + m_intrinsicPaddingAfter;
    141     case TopToBottomWritingMode:
    142     case BottomToTopWritingMode:
    143         return result + (style().isLeftToRightDirection() ? m_intrinsicPaddingEnd : m_intrinsicPaddingStart);
    144     }
    145     ASSERT_NOT_REACHED();
    146     return result;
    147 }
    148 
    149 LayoutUnit RenderMathMLRoot::paddingBefore() const
    150 {
    151     return computedCSSPaddingBefore() + m_intrinsicPaddingBefore;
    152 }
    153 
    154 LayoutUnit RenderMathMLRoot::paddingAfter() const
    155 {
    156     return computedCSSPaddingAfter() + m_intrinsicPaddingAfter;
    157 }
    158 
    159 LayoutUnit RenderMathMLRoot::paddingStart() const
    160 {
    161     return computedCSSPaddingStart() + m_intrinsicPaddingStart;
    162 }
    163 
    164 LayoutUnit RenderMathMLRoot::paddingEnd() const
    165 {
    166     return computedCSSPaddingEnd() + m_intrinsicPaddingEnd;
     64{
     65}
     66
     67RenderMathMLRootWrapper* RenderMathMLRoot::baseWrapper() const
     68{
     69    ASSERT(!isEmpty());
     70    return toRenderMathMLRootWrapper(lastChild());
     71}
     72
     73RenderMathMLBlock* RenderMathMLRoot::radicalWrapper() const
     74{
     75    ASSERT(!isEmpty());
     76    return toRenderMathMLBlock(lastChild()->previousSibling());
     77}
     78
     79RenderMathMLRootWrapper* RenderMathMLRoot::indexWrapper() const
     80{
     81    ASSERT(!isEmpty());
     82    return isRenderMathMLSquareRoot() ? nullptr : toRenderMathMLRootWrapper(firstChild());
     83}
     84
     85RenderMathMLRadicalOperator* RenderMathMLRoot::radicalOperator() const
     86{
     87    ASSERT(!isEmpty());
     88    return toRenderMathMLRadicalOperator(radicalWrapper()->firstChild());
     89}
     90
     91void RenderMathMLRoot::restructureWrappers()
     92{
     93    ASSERT(!isEmpty());
     94
     95    auto base = baseWrapper();
     96    auto index = indexWrapper();
     97    auto radical = radicalWrapper();
     98
     99    // For visual consistency with the initial state, we remove the radical when the base/index wrappers become empty.
     100    if (base->isEmpty() && (!index || index->isEmpty())) {
     101        if (!radical->isEmpty()) {
     102            auto child = radicalOperator();
     103            radical->removeChild(*child);
     104            child->destroy();
     105        }
     106        return;
     107    }
     108
     109    if (radical->isEmpty()) {
     110        // We create the radical operator.
     111        RenderPtr<RenderMathMLRadicalOperator> radicalOperator = createRenderer<RenderMathMLRadicalOperator>(document(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX));
     112        radicalOperator->initializeStyle();
     113        radical->addChild(radicalOperator.leakPtr());
     114    }
     115
     116    if (isRenderMathMLSquareRoot())
     117        return;
     118
     119    if (auto childToMove = base->lastChild()) {
     120        // We move the last child of the base wrapper into the index wrapper if the index wrapper is empty and the base wrapper has at least two children.
     121        if (childToMove->previousSibling() && index->isEmpty()) {
     122            base->removeChildWithoutRestructuring(*childToMove);
     123            index->addChild(childToMove);
     124        }
     125    }
     126
     127    if (auto childToMove = index->firstChild()) {
     128        // We move the first child of the index wrapper into the base wrapper if:
     129        // - either the index wrapper has at least two children.
     130        // - or the base wrapper is empty but the index wrapper is not.
     131        if (childToMove->nextSibling() || base->isEmpty()) {
     132            index->removeChildWithoutRestructuring(*childToMove);
     133            base->addChild(childToMove);
     134        }
     135    }
    167136}
    168137
    169138void RenderMathMLRoot::addChild(RenderObject* newChild, RenderObject* beforeChild)
    170139{
    171     // Insert an implicit <mrow> for <mroot> as well as <msqrt>, to ensure firstChild() will have a box
    172     // to measure and store a glyph-based height for preferredLogicalHeightAfterSizing.
    173     if (!firstChild())
    174         RenderMathMLBlock::addChild(RenderMathMLRow::createAnonymousWithParentRenderer(*this).leakPtr());
    175    
    176     // An <mroot>'s index has { position: absolute }.
    177     if (newChild->style().position() == AbsolutePosition)
    178         RenderMathMLBlock::addChild(newChild);
    179     else
    180         toRenderElement(firstChild())->addChild(newChild, beforeChild && beforeChild->parent() == firstChild() ? beforeChild : 0);
    181 }
    182 
    183 RenderBox* RenderMathMLRoot::index() const
    184 {
    185     if (!firstChild())
    186         return 0;
    187     RenderObject* index = firstChild()->nextSibling();
    188     if (!index || !index->isBox())
    189         return 0;
    190     return toRenderBox(index);
     140    if (isEmpty()) {
     141        if (!isRenderMathMLSquareRoot()) {
     142            // We add the IndexWrapper.
     143            RenderMathMLBlock::addChild(RenderMathMLRootWrapper::createAnonymousWrapper(this).leakPtr());
     144        }
     145
     146        // We create the radicalWrapper
     147        RenderMathMLBlock::addChild(RenderMathMLBlock::createAnonymousMathMLBlock().leakPtr());
     148
     149        // We create the BaseWrapper.
     150        RenderMathMLBlock::addChild(RenderMathMLRootWrapper::createAnonymousWrapper(this).leakPtr());
     151
     152        updateStyle();
     153    }
     154
     155    // We insert the child.
     156    auto base = baseWrapper();
     157    auto index = indexWrapper();
     158    RenderElement* actualParent;
     159    RenderElement* actualBeforeChild;
     160    if (isRenderMathMLSquareRoot()) {
     161        // For square root, we always insert the child into the base wrapper.
     162        actualParent = base;
     163        if (beforeChild && beforeChild->parent() == base)
     164            actualBeforeChild = toRenderElement(beforeChild);
     165        else
     166            actualBeforeChild = nullptr;
     167    } else {
     168        // For mroot, we insert the child into the parent of beforeChild, or at the end of the index. The wrapper structure is reorganize below.
     169        actualParent = beforeChild ? beforeChild->parent() : nullptr;
     170        if (actualParent == base || actualParent == index)
     171            actualBeforeChild = toRenderElement(beforeChild);
     172        else {
     173            actualParent = index;
     174            actualBeforeChild = nullptr;
     175        }
     176    }
     177    actualParent->addChild(newChild, actualBeforeChild);
     178    restructureWrappers();
     179}
     180
     181void RenderMathMLRoot::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
     182{
     183    RenderMathMLBlock::styleDidChange(diff, oldStyle);
     184    if (!isEmpty())
     185        updateStyle();
     186}
     187
     188void RenderMathMLRoot::updateFromElement()
     189{
     190    RenderMathMLBlock::updateFromElement();
     191    if (!isEmpty())
     192        updateStyle();
     193}
     194
     195void RenderMathMLRoot::updateStyle()
     196{
     197    ASSERT(!isEmpty());
     198
     199    // We set some constants to draw the radical, as defined in the OpenType MATH tables.
     200
     201    m_ruleThickness = 0.05f * style().font().size();
     202
     203    // FIXME: The recommended default for m_verticalGap in displaystyle is rule thickness + 1/4 x-height (https://bugs.webkit.org/show_bug.cgi?id=118737).
     204    m_verticalGap = 11 * m_ruleThickness / 4;
     205    m_extraAscender = m_ruleThickness;
     206    LayoutUnit kernBeforeDegree = 5 * style().font().size() / 18;
     207    LayoutUnit kernAfterDegree = -10 * style().font().size() / 18;
     208    m_degreeBottomRaisePercent = 0.6f;
     209
     210    const auto& primaryFontData = style().font().primaryFont();
     211    if (primaryFontData && primaryFontData->mathData()) {
     212        // FIXME: m_verticalGap should use RadicalDisplayStyleVertical in display mode (https://bugs.webkit.org/show_bug.cgi?id=118737).
     213        m_verticalGap = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalVerticalGap);
     214        m_ruleThickness = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalRuleThickness);
     215        m_extraAscender = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalExtraAscender);
     216
     217        if (!isRenderMathMLSquareRoot()) {
     218            kernBeforeDegree = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernBeforeDegree);
     219            kernAfterDegree = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernAfterDegree);
     220            m_degreeBottomRaisePercent = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalDegreeBottomRaisePercent);
     221        }
     222    }
     223
     224    // We set the style of the anonymous wrappers.
     225
     226    auto radical = radicalWrapper();
     227    auto radicalStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
     228    radicalStyle.get().setMarginTop(Length(0, Fixed)); // This will be updated in RenderMathMLRoot::layout().
     229    radical->setStyle(std::move(radicalStyle));
     230    radical->setNeedsLayoutAndPrefWidthsRecalc();
     231
     232    auto base = baseWrapper();
     233    auto baseStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
     234    baseStyle.get().setMarginTop(Length(0, Fixed)); // This will be updated in RenderMathMLRoot::layout().
     235    baseStyle.get().setAlignItems(AlignBaseline);
     236    base->setStyle(std::move(baseStyle));
     237    base->setNeedsLayoutAndPrefWidthsRecalc();
     238
     239    if (!isRenderMathMLSquareRoot()) {
     240        // For mroot, we also set the style of the index wrapper.
     241        auto index = indexWrapper();
     242        auto indexStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
     243        indexStyle.get().setMarginTop(Length(0, Fixed)); // This will be updated in RenderMathMLRoot::layout().
     244        indexStyle.get().setMarginStart(Length(kernBeforeDegree, Fixed));
     245        indexStyle.get().setMarginEnd(Length(kernAfterDegree, Fixed));
     246        indexStyle.get().setAlignItems(AlignBaseline);
     247        index->setStyle(std::move(indexStyle));
     248        index->setNeedsLayoutAndPrefWidthsRecalc();
     249    }
     250}
     251
     252int RenderMathMLRoot::firstLineBaseline() const
     253{
     254    if (!isEmpty()) {
     255        auto base = baseWrapper();
     256        return static_cast<int>(lroundf(base->firstLineBaseline() + base->marginTop()));
     257    }
     258
     259    return RenderMathMLBlock::firstLineBaseline();
    191260}
    192261
    193262void RenderMathMLRoot::layout()
    194263{
    195     for (auto& box : childrenOfType<RenderBox>(*this))
    196         box.layoutIfNeeded();
    197 
    198     int baseHeight = firstChild() && firstChild()->isBox() ? roundToInt(toRenderBox(firstChild())->logicalHeight()) : style().fontSize();
    199     int frontWidth = lroundf(gFrontWidthEms * style().fontSize());
    200    
    201     // Base height above which the shape of the root changes
    202     float thresholdHeight = gThresholdBaseHeightEms * style().fontSize();
    203     if (baseHeight > thresholdHeight && thresholdHeight) {
    204         float shift = std::min<float>((baseHeight - thresholdHeight) / thresholdHeight, 1.0f);
    205         m_overbarLeftPointShift = static_cast<int>(shift * gRadicalBottomPointXFront * frontWidth);
    206         m_intrinsicPaddingAfter = lroundf(gBigRootBottomPaddingEms * style().fontSize());
    207     } else {
    208         m_overbarLeftPointShift = 0;
    209         m_intrinsicPaddingAfter = 0;
    210     }
    211    
    212     int rootPad = lroundf(gSpaceAboveEms * style().fontSize());
    213     m_intrinsicPaddingBefore = rootPad;
    214     m_indexTop = 0;
    215     if (RenderBox* index = this->index()) {
    216         m_intrinsicPaddingStart = roundToInt(index->maxPreferredLogicalWidth()) + m_overbarLeftPointShift;
    217 
    218         int indexHeight = roundToInt(index->logicalHeight());
    219         int partDipHeight = lroundf((1 - gRootRadicalDipLeftPointYPos) * baseHeight);
    220         int rootExtraTop = partDipHeight + indexHeight - (baseHeight + rootPad);
    221         if (rootExtraTop > 0)
    222             m_intrinsicPaddingBefore += rootExtraTop;
    223         else
    224             m_indexTop = - rootExtraTop;
    225     } else
    226         m_intrinsicPaddingStart = frontWidth;
    227 
    228     // FIXME: We should rewrite RenderMathMLRoot to rewrite -webkit-flex-order to get rid of the need
    229     // for intrinsic padding. See https://bugs.webkit.org/show_bug.cgi?id=107151#c2.
    230     // FIXME: We should make it so that the preferred width of RenderMathMLRoots doesn't change during layout.
    231     // Technically, we currently only need to set the dirty bit here if one of the member variables above changes.
    232     setPreferredLogicalWidthsDirty(true);
     264    if (isEmpty()) {
     265        RenderMathMLBlock::layout();
     266        return;
     267    }
     268
     269    // FIXME: It seems that changing the top margin of the base below modifies its logical height and leads to reftest failures.
     270    // For now, we workaround that by avoiding to recompute the child margins if they were not reset in updateStyle().
     271    auto base = baseWrapper();
     272    if (base->marginTop() > 0) {
     273        RenderMathMLBlock::layout();
     274        return;
     275    }
     276
     277    // We layout the children.
     278    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
     279        if (child->needsLayout())
     280            toRenderElement(child)->layout();
     281    }
     282
     283    auto radical = radicalOperator();
     284    if (radical) {
     285        // We stretch the radical sign to cover the height of the base wrapper.
     286        float baseHeight = base->logicalHeight();
     287        float baseHeightAboveBaseline = base->firstLineBaseline();
     288        if (baseHeightAboveBaseline == -1)
     289            baseHeightAboveBaseline = baseHeight;
     290        float baseDepthBelowBaseline = baseHeight - baseHeightAboveBaseline;
     291        baseHeightAboveBaseline += m_verticalGap;
     292        radical->stretchTo(baseHeightAboveBaseline, baseDepthBelowBaseline);
     293
     294        // We modify the top margins to adjust the vertical positions of wrappers.
     295        float radicalTopMargin = m_extraAscender;
     296        float baseTopMargin = m_verticalGap + m_ruleThickness + m_extraAscender;
     297        if (!isRenderMathMLSquareRoot()) {
     298            // For mroot, we try to place the index so the space below its baseline is m_degreeBottomRaisePercent times the height of the radical.
     299            auto index = indexWrapper();
     300            float indexHeight = 0;
     301            if (!index->isEmpty())
     302                indexHeight = toRenderBlock(index->firstChild())->logicalHeight();
     303            float indexTopMargin = (1.0 - m_degreeBottomRaisePercent) * radical->stretchSize() + radicalTopMargin - indexHeight;
     304            if (indexTopMargin < 0) {
     305                // If the index is too tall, we must add space at the top of renderer.
     306                radicalTopMargin -= indexTopMargin;
     307                baseTopMargin -= indexTopMargin;
     308                indexTopMargin = 0;
     309            }
     310            index->style().setMarginTop(Length(indexTopMargin, Fixed));
     311        }
     312        radical->style().setMarginTop(Length(radicalTopMargin, Fixed));
     313        base->style().setMarginTop(Length(baseTopMargin, Fixed));
     314    }
    233315
    234316    RenderMathMLBlock::layout();
    235 
    236     if (RenderBox* index = this->index())
    237         index->setLogicalTop(m_indexTop);
    238317}
    239318
     
    242321    RenderMathMLBlock::paint(info, paintOffset);
    243322   
    244     if (info.context->paintingDisabled() || style().visibility() != VISIBLE)
    245         return;
    246    
    247     IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + contentBoxRect().location());
    248    
    249     int startX = adjustedPaintOffset.x();
    250     int frontWidth = lroundf(gFrontWidthEms * style().fontSize());
    251     int overbarWidth = roundToInt(contentLogicalWidth()) + m_overbarLeftPointShift;
    252    
    253     int baseHeight = roundToInt(contentLogicalHeight());
    254     int rootPad = lroundf(gSpaceAboveEms * style().fontSize());
    255     adjustedPaintOffset.setY(adjustedPaintOffset.y() - rootPad);
    256    
    257     float radicalDipLeftPointYPos = (index() ? gRootRadicalDipLeftPointYPos : gSqrtRadicalDipLeftPointYPos) * baseHeight;
    258    
    259     FloatPoint overbarLeftPoint(startX - m_overbarLeftPointShift, adjustedPaintOffset.y());
    260     FloatPoint bottomPoint(startX - gRadicalBottomPointXFront * frontWidth, adjustedPaintOffset.y() + baseHeight + gRadicalBottomPointLower);
    261     FloatPoint dipLeftPoint(startX - gRadicalDipLeftPointXFront * frontWidth, adjustedPaintOffset.y() + radicalDipLeftPointYPos);
    262     FloatPoint leftEnd(startX - frontWidth, dipLeftPoint.y() + gRadicalLeftEndYShiftEms * style().fontSize());
    263    
     323    if (isEmpty() || info.context->paintingDisabled() || style().visibility() != VISIBLE)
     324        return;
     325
     326    auto base = baseWrapper();
     327    auto radical = radicalOperator();
     328    if (!base || !radical || !m_ruleThickness)
     329        return;
     330
     331    // We draw the radical line.
    264332    GraphicsContextStateSaver stateSaver(*info.context);
    265    
    266     info.context->setStrokeThickness(gRadicalLineThicknessEms * style().fontSize());
     333
     334    info.context->setStrokeThickness(m_ruleThickness);
    267335    info.context->setStrokeStyle(SolidStroke);
    268336    info.context->setStrokeColor(style().visitedDependentColor(CSSPropertyColor), ColorSpaceDeviceRGB);
    269     info.context->setLineJoin(MiterJoin);
    270     info.context->setMiterLimit(style().fontSize());
    271    
    272     Path root;
    273    
    274     root.moveTo(FloatPoint(overbarLeftPoint.x() + overbarWidth, adjustedPaintOffset.y()));
    275     // draw top
    276     root.addLineTo(overbarLeftPoint);
    277     // draw from top left corner to bottom point of radical
    278     root.addLineTo(bottomPoint);
    279     // draw from bottom point to top of left part of radical base "dip"
    280     root.addLineTo(dipLeftPoint);
    281     // draw to end
    282     root.addLineTo(leftEnd);
    283    
    284     info.context->strokePath(root);
    285    
    286     GraphicsContextStateSaver maskStateSaver(*info.context);
    287    
    288     // Build a mask to draw the thick part of the root.
    289     Path mask;
    290    
    291     mask.moveTo(overbarLeftPoint);
    292     mask.addLineTo(bottomPoint);
    293     mask.addLineTo(dipLeftPoint);
    294     mask.addLineTo(FloatPoint(2 * dipLeftPoint.x() - leftEnd.x(), 2 * dipLeftPoint.y() - leftEnd.y()));
    295    
    296     info.context->clip(mask);
    297    
    298     // Draw the thick part of the root.
    299     info.context->setStrokeThickness(gRadicalThickLineThicknessEms * style().fontSize());
    300     info.context->setLineCap(SquareCap);
    301    
    302     Path line;
    303     line.moveTo(bottomPoint);
    304     line.addLineTo(dipLeftPoint);
    305    
    306     info.context->strokePath(line);
     337
     338    // The preferred width of the radical is sometimes incorrect, so we draw a slightly longer line to ensure it touches the radical symbol (https://bugs.webkit.org/show_bug.cgi?id=130326).
     339    LayoutUnit sizeError = radical->trailingSpaceError();
     340    IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + base->location() + LayoutPoint(-sizeError, -(m_verticalGap + m_ruleThickness / 2)));
     341    info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + base->pixelSnappedOffsetWidth() + sizeError, adjustedPaintOffset.y()));
     342}
     343
     344RenderPtr<RenderMathMLRootWrapper> RenderMathMLRootWrapper::createAnonymousWrapper(RenderMathMLRoot* renderObject)
     345{
     346    RenderPtr<RenderMathMLRootWrapper> newBlock = createRenderer<RenderMathMLRootWrapper>(renderObject->document(), RenderStyle::createAnonymousStyleWithDisplay(&renderObject->style(), FLEX));
     347    newBlock->initializeStyle();
     348    return newBlock;
     349}
     350
     351RenderObject* RenderMathMLRootWrapper::removeChildWithoutRestructuring(RenderObject& child)
     352{
     353    return RenderMathMLBlock::removeChild(child);
     354}
     355
     356RenderObject* RenderMathMLRootWrapper::removeChild(RenderObject& child)
     357{
     358    RenderObject* next = RenderMathMLBlock::removeChild(child);
     359
     360    if (!(beingDestroyed() || documentBeingDestroyed()))
     361        toRenderMathMLRoot(parent())->restructureWrappers();
     362
     363    return next;
    307364}
    308365
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h

    r169945 r169963  
    3030
    3131#include "RenderMathMLBlock.h"
     32#include "RenderMathMLRow.h"
    3233
    3334namespace WebCore {
     35
     36class RenderMathMLRadicalOperator;
     37class RenderMathMLRootWrapper;
    3438   
    3539// Render base^(1/index), or sqrt(base) via the derived class RenderMathMLSquareRoot, using radical notation.
    3640class RenderMathMLRoot : public RenderMathMLBlock {
     41
     42friend class RenderMathMLRootWrapper;
     43
    3744public:
    3845    RenderMathMLRoot(Element&, PassRef<RenderStyle>);
    3946    RenderMathMLRoot(Document&, PassRef<RenderStyle>);
    4047
    41     virtual LayoutUnit paddingTop() const override;
    42     virtual LayoutUnit paddingBottom() const override;
    43     virtual LayoutUnit paddingLeft() const override;
    44     virtual LayoutUnit paddingRight() const override;
    45     virtual LayoutUnit paddingBefore() const override;
    46     virtual LayoutUnit paddingAfter() const override;
    47     virtual LayoutUnit paddingStart() const override;
    48     virtual LayoutUnit paddingEnd() const override;
    49 
    5048    virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
     49    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     50    virtual void updateFromElement() override;
    5151   
    5252protected:
     
    5858    virtual bool isRenderMathMLRoot() const override final { return true; }
    5959    virtual const char* renderName() const override { return "RenderMathMLRoot"; }
    60    
    61     // This may return 0 for a non-MathML index (which won't occur in valid MathML).
    62     RenderBox* index() const;
     60    virtual int firstLineBaseline() const override;
     61    void updateStyle();
     62    void restructureWrappers();
    6363
    64     int m_intrinsicPaddingBefore;
    65     int m_intrinsicPaddingAfter;
    66     int m_intrinsicPaddingStart;
    67     int m_intrinsicPaddingEnd;
    68     int m_overbarLeftPointShift;
    69     int m_indexTop;
     64    RenderMathMLRootWrapper* baseWrapper() const;
     65    RenderMathMLBlock* radicalWrapper() const;
     66    RenderMathMLRootWrapper* indexWrapper() const;
     67    RenderMathMLRadicalOperator* radicalOperator() const;
     68
     69    LayoutUnit m_verticalGap;
     70    LayoutUnit m_ruleThickness;
     71    LayoutUnit m_extraAscender;
     72    float m_degreeBottomRaisePercent;
    7073};
    7174   
     75RENDER_OBJECT_TYPE_CASTS(RenderMathMLRoot, isRenderMathMLRoot())
     76
     77// These are specific wrappers for the index and base, that ask the parent to restructure the renderers after child removal.
     78class RenderMathMLRootWrapper : public RenderMathMLRow {
     79
     80friend class RenderMathMLRoot;
     81
     82public:
     83    RenderMathMLRootWrapper(Document& document, PassRef<RenderStyle> style)
     84        : RenderMathMLRow(document, std::move(style)) { }
     85
     86private:
     87    RenderObject* removeChildWithoutRestructuring(RenderObject&);
     88    RenderObject* removeChild(RenderObject&) override;
     89    static RenderPtr<RenderMathMLRootWrapper> createAnonymousWrapper(RenderMathMLRoot* renderObject);
     90    virtual bool isRenderMathMLRootWrapper() const override final { return true; }
     91    virtual const char* renderName() const override { return "RenderMathMLRootWrapper"; }
     92};
     93
     94RENDER_OBJECT_TYPE_CASTS(RenderMathMLRootWrapper, isRenderMathMLRootWrapper())
     95
    7296}
    7397
Note: See TracChangeset for help on using the changeset viewer.