Changeset 164536 in webkit


Ignore:
Timestamp:
Feb 22, 2014 2:08:02 AM (10 years ago)
Author:
fred.wang@free.fr
Message:

Bug 119043 - Large stretch size error for MathML operators.
https://bugs.webkit.org/show_bug.cgi?id=119043

Reviewed by Chris Fleizach.

Source/WebCore:

The MathML code used some arbitrary gOperatorExpansion factor for the
stretch size and 2/3 1/2 constants for the baseline. This change tries
to consider height/depth of siblings of the stretchy operator so that
the stretchy operator now matches its target.

Test: mathml/presentation/stretchy-depth-height.html

  • rendering/RenderObject.h:

(WebCore::RenderObject::isRenderMathMLTable):

  • rendering/mathml/RenderMathMLBlock.h:
  • rendering/mathml/RenderMathMLOperator.cpp:

(WebCore::RenderMathMLOperator::RenderMathMLOperator):
(WebCore::RenderMathMLOperator::stretchTo):
(WebCore::RenderMathMLOperator::findAcceptableStretchyCharacter):
(WebCore::RenderMathMLOperator::updateStyle):
(WebCore::RenderMathMLOperator::firstLineBaseline):
(WebCore::RenderMathMLOperator::computeLogicalHeight):

  • rendering/mathml/RenderMathMLOperator.h:
  • rendering/mathml/RenderMathMLRow.cpp:

(WebCore::RenderMathMLRow::layout):

LayoutTests:

This adds a test to check that the depth/height of stretchy operators match the maximum of their siblings. This also fixes the reference of mo-stretch.html to ignore the stretch error.

  • mathml/presentation/stretchy-depth-height-expected.txt: Added.
  • mathml/presentation/stretchy-depth-height.html: Added.
  • platform/mac/mathml/presentation/mo-stretch-expected.txt:
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164535 r164536  
     12014-02-22  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Bug 119043 - Large stretch size error for MathML operators.
     4        https://bugs.webkit.org/show_bug.cgi?id=119043
     5
     6        Reviewed by Chris Fleizach.
     7
     8        This adds a test to check that the depth/height of stretchy operators match the maximum of their siblings. This also fixes the reference of mo-stretch.html to ignore the stretch error.
     9
     10        * mathml/presentation/stretchy-depth-height-expected.txt: Added.
     11        * mathml/presentation/stretchy-depth-height.html: Added.
     12        * platform/mac/mathml/presentation/mo-stretch-expected.txt:
     13
    1142014-02-22  Frédéric Wang  <fred.wang@free.fr>
    215
  • trunk/LayoutTests/platform/mac/mathml/presentation/mo-stretch-expected.txt

    r164535 r164536  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x216
    4   RenderBlock {HTML} at (0,0) size 800x216
    5     RenderBody {BODY} at (8,8) size 784x200
     3layer at (0,0) size 800x166
     4  RenderBlock {HTML} at (0,0) size 800x166
     5    RenderBody {BODY} at (8,8) size 784x150
    66      RenderMathMLMath {math} at (0,0) size 195x20 [padding: 0 1 0 1]
    77        RenderMathMLRow {mrow} at (1,0) size 193x20
     
    7979        text run at (194,0) width 5: " "
    8080      RenderBR {BR} at (0,0) size 0x0
    81       RenderMathMLMath {math} at (0,20) size 199x114 [padding: 0 1 0 1]
    82         RenderMathMLRow {mrow} at (1,0) size 197x114
    83           RenderMathMLOperator {mo} at (1,22) size 8x92
     81      RenderMathMLMath {math} at (0,20) size 199x76 [padding: 0 1 0 1]
     82        RenderMathMLRow {mrow} at (1,0) size 197x76
     83          RenderMathMLOperator {mo} at (1,0) size 8x76
    8484            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    8585              RenderBlock (anonymous) at (0,0) size 5x14
    8686                RenderText at (0,-6) size 5x24
    8787                  text run at (0,-6) width 5: "("
    88           RenderMathMLOperator {mo} at (13,22) size 8x92
     88          RenderMathMLOperator {mo} at (13,0) size 8x76
    8989            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    9090              RenderBlock (anonymous) at (0,0) size 5x14
    9191                RenderText at (0,-6) size 5x24
    9292                  text run at (0,-6) width 5: ")"
    93           RenderMathMLOperator {mo} at (26,22) size 11x92
     93          RenderMathMLOperator {mo} at (26,0) size 11x76
    9494            RenderMathMLBlock (flex) {mo} at (0,0) size 10x14
    9595              RenderBlock (anonymous) at (0,0) size 8x14
    9696                RenderText at (0,-6) size 8x24
    9797                  text run at (0,-6) width 8: "{"
    98           RenderMathMLOperator {mo} at (43,22) size 11x92
     98          RenderMathMLOperator {mo} at (43,0) size 11x76
    9999            RenderMathMLBlock (flex) {mo} at (0,0) size 10x14
    100100              RenderBlock (anonymous) at (0,0) size 8x14
    101101                RenderText at (0,-6) size 8x24
    102102                  text run at (0,-6) width 8: "}"
    103           RenderMathMLOperator {mo} at (59,22) size 8x92
     103          RenderMathMLOperator {mo} at (59,0) size 8x76
    104104            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    105105              RenderBlock (anonymous) at (0,0) size 5x14
    106106                RenderText at (0,-6) size 5x24
    107107                  text run at (0,-6) width 5: "["
    108           RenderMathMLOperator {mo} at (72,22) size 8x92
     108          RenderMathMLOperator {mo} at (72,0) size 8x76
    109109            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    110110              RenderBlock (anonymous) at (0,0) size 5x14
    111111                RenderText at (0,-6) size 5x24
    112112                  text run at (0,-6) width 5: "]"
    113           RenderMathMLOperator {mo} at (86,22) size 9x92
     113          RenderMathMLOperator {mo} at (86,0) size 9x76
    114114            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    115115              RenderBlock (anonymous) at (0,0) size 8x16
    116116                RenderText at (0,-5) size 8x24
    117117                  text run at (0,-5) width 8: "\x{2308}"
    118           RenderMathMLOperator {mo} at (100,22) size 9x92
     118          RenderMathMLOperator {mo} at (100,0) size 9x76
    119119            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    120120              RenderBlock (anonymous) at (0,0) size 8x16
    121121                RenderText at (0,-5) size 8x24
    122122                  text run at (0,-5) width 8: "\x{2309}"
    123           RenderMathMLOperator {mo} at (115,22) size 8x92
     123          RenderMathMLOperator {mo} at (115,0) size 8x76
    124124            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    125125              RenderBlock (anonymous) at (0,0) size 8x16
    126126                RenderText at (0,-5) size 8x24
    127127                  text run at (0,-5) width 8: "\x{230A}"
    128           RenderMathMLOperator {mo} at (129,22) size 9x92
     128          RenderMathMLOperator {mo} at (129,0) size 9x76
    129129            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    130130              RenderBlock (anonymous) at (0,0) size 8x16
    131131                RenderText at (0,-5) size 8x24
    132132                  text run at (0,-5) width 8: "\x{230B}"
    133           RenderMathMLOperator {mo} at (143,22) size 12x92
     133          RenderMathMLOperator {mo} at (143,0) size 12x76
    134134            RenderMathMLBlock (flex) {mo} at (0,0) size 11x20
    135135              RenderBlock (anonymous) at (0,0) size 7x20
    136136                RenderText at (0,-3) size 7x24
    137137                  text run at (0,-3) width 7: "\x{222B}"
    138           RenderMathMLOperator {mo} at (161,22) size 4x92
     138          RenderMathMLOperator {mo} at (161,0) size 4x76
    139139            RenderMathMLBlock (flex) {mo} at (0,0) size 3x12
    140140              RenderBlock (anonymous) at (0,0) size 3x12
    141141                RenderText at (0,-6) size 3x24
    142142                  text run at (0,-6) width 3: "|"
    143           RenderMathMLOperator {mo} at (170,22) size 9x92
     143          RenderMathMLOperator {mo} at (170,0) size 9x76
    144144            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    145145              RenderBlock (anonymous) at (0,0) size 8x16
    146146                RenderText at (0,-5) size 8x24
    147147                  text run at (0,-5) width 8: "\x{2016}"
    148           RenderMathMLOperator {mo} at (184,22) size 9x92
     148          RenderMathMLOperator {mo} at (184,0) size 9x76
    149149            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    150150              RenderBlock (anonymous) at (0,0) size 8x16
     
    154154      RenderText {#text} at (198,81) size 5x18
    155155        text run at (198,81) width 5: " "
    156       RenderMathMLMath {math} at (202,45) size 199x77 [padding: 0 1 0 1]
    157         RenderMathMLRow {mrow} at (1,0) size 197x77
    158           RenderMathMLOperator {mo} at (1,15) size 8x62
     156      RenderMathMLMath {math} at (202,45) size 199x51 [padding: 0 1 0 1]
     157        RenderMathMLRow {mrow} at (1,0) size 197x51
     158          RenderMathMLOperator {mo} at (1,0) size 8x51
    159159            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    160160              RenderBlock (anonymous) at (0,0) size 5x14
    161161                RenderText at (0,-6) size 5x24
    162162                  text run at (0,-6) width 5: "("
    163           RenderMathMLOperator {mo} at (13,15) size 8x62
     163          RenderMathMLOperator {mo} at (13,0) size 8x51
    164164            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    165165              RenderBlock (anonymous) at (0,0) size 5x14
    166166                RenderText at (0,-6) size 5x24
    167167                  text run at (0,-6) width 5: ")"
    168           RenderMathMLOperator {mo} at (26,15) size 11x62
     168          RenderMathMLOperator {mo} at (26,0) size 11x51
    169169            RenderMathMLBlock (flex) {mo} at (0,0) size 10x14
    170170              RenderBlock (anonymous) at (0,0) size 8x14
    171171                RenderText at (0,-6) size 8x24
    172172                  text run at (0,-6) width 8: "{"
    173           RenderMathMLOperator {mo} at (43,15) size 11x62
     173          RenderMathMLOperator {mo} at (43,0) size 11x51
    174174            RenderMathMLBlock (flex) {mo} at (0,0) size 10x14
    175175              RenderBlock (anonymous) at (0,0) size 8x14
    176176                RenderText at (0,-6) size 8x24
    177177                  text run at (0,-6) width 8: "}"
    178           RenderMathMLOperator {mo} at (59,15) size 8x62
     178          RenderMathMLOperator {mo} at (59,0) size 8x51
    179179            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    180180              RenderBlock (anonymous) at (0,0) size 5x14
    181181                RenderText at (0,-6) size 5x24
    182182                  text run at (0,-6) width 5: "["
    183           RenderMathMLOperator {mo} at (72,15) size 8x62
     183          RenderMathMLOperator {mo} at (72,0) size 8x51
    184184            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    185185              RenderBlock (anonymous) at (0,0) size 5x14
    186186                RenderText at (0,-6) size 5x24
    187187                  text run at (0,-6) width 5: "]"
    188           RenderMathMLOperator {mo} at (86,15) size 9x62
     188          RenderMathMLOperator {mo} at (86,0) size 9x51
    189189            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    190190              RenderBlock (anonymous) at (0,0) size 8x16
    191191                RenderText at (0,-5) size 8x24
    192192                  text run at (0,-5) width 8: "\x{2308}"
    193           RenderMathMLOperator {mo} at (100,15) size 9x62
     193          RenderMathMLOperator {mo} at (100,0) size 9x51
    194194            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    195195              RenderBlock (anonymous) at (0,0) size 8x16
    196196                RenderText at (0,-5) size 8x24
    197197                  text run at (0,-5) width 8: "\x{2309}"
    198           RenderMathMLOperator {mo} at (115,15) size 8x62
     198          RenderMathMLOperator {mo} at (115,0) size 8x51
    199199            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    200200              RenderBlock (anonymous) at (0,0) size 8x16
    201201                RenderText at (0,-5) size 8x24
    202202                  text run at (0,-5) width 8: "\x{230A}"
    203           RenderMathMLOperator {mo} at (129,15) size 9x62
     203          RenderMathMLOperator {mo} at (129,0) size 9x51
    204204            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    205205              RenderBlock (anonymous) at (0,0) size 8x16
    206206                RenderText at (0,-5) size 8x24
    207207                  text run at (0,-5) width 8: "\x{230B}"
    208           RenderMathMLOperator {mo} at (143,15) size 12x62
     208          RenderMathMLOperator {mo} at (143,0) size 12x51
    209209            RenderMathMLBlock (flex) {mo} at (0,0) size 11x20
    210210              RenderBlock (anonymous) at (0,0) size 7x20
    211211                RenderText at (0,-3) size 7x24
    212212                  text run at (0,-3) width 7: "\x{222B}"
    213           RenderMathMLOperator {mo} at (161,15) size 4x62
     213          RenderMathMLOperator {mo} at (161,0) size 4x51
    214214            RenderMathMLBlock (flex) {mo} at (0,0) size 3x12
    215215              RenderBlock (anonymous) at (0,0) size 3x12
    216216                RenderText at (0,-6) size 3x24
    217217                  text run at (0,-6) width 3: "|"
    218           RenderMathMLOperator {mo} at (170,15) size 9x62
     218          RenderMathMLOperator {mo} at (170,0) size 9x51
    219219            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    220220              RenderBlock (anonymous) at (0,0) size 8x16
    221221                RenderText at (0,-5) size 8x24
    222222                  text run at (0,-5) width 8: "\x{2016}"
    223           RenderMathMLOperator {mo} at (184,15) size 9x62
     223          RenderMathMLOperator {mo} at (184,0) size 9x51
    224224            RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    225225              RenderBlock (anonymous) at (0,0) size 8x16
     
    229229      RenderText {#text} at (400,81) size 5x18
    230230        text run at (400,81) width 5: " "
    231       RenderMathMLMath {math} at (404,75) size 199x32 [padding: 0 1 0 1]
    232         RenderMathMLRow {mrow} at (1,0) size 197x32
     231      RenderMathMLMath {math} at (404,75) size 199x26 [padding: 0 1 0 1]
     232        RenderMathMLRow {mrow} at (1,0) size 197x26
    233233          RenderMathMLOperator {mo} at (1,9) size 8x14
    234234            RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
     
    286286                RenderText at (0,-3) size 7x24
    287287                  text run at (0,-3) width 7: "\x{222B}"
    288           RenderMathMLOperator {mo} at (161,6) size 4x26
     288          RenderMathMLOperator {mo} at (161,9) size 4x12
    289289            RenderMathMLBlock (flex) {mo} at (0,0) size 3x12
    290290              RenderBlock (anonymous) at (0,0) size 3x12
     
    305305        text run at (602,81) width 5: " "
    306306      RenderBR {BR} at (0,0) size 0x0
    307       RenderMathMLMath {math} at (0,133) size 211x68 [padding: 0 1 0 1]
    308         RenderMathMLSquareRoot {msqrt} at (1,0) size 209x68 [intrinsic padding: 3 0 3 12]
    309           RenderMathMLRow (anonymous) at (12,3) size 197x62
    310             RenderMathMLOperator {mo} at (1,12) size 8x50
     307      RenderMathMLMath {math} at (0,101) size 211x49 [padding: 0 1 0 1]
     308        RenderMathMLSquareRoot {msqrt} at (1,0) size 209x49 [intrinsic padding: 3 0 3 12]
     309          RenderMathMLRow (anonymous) at (12,3) size 197x43
     310            RenderMathMLOperator {mo} at (1,0) size 8x41
    311311              RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    312312                RenderBlock (anonymous) at (0,0) size 5x14
    313313                  RenderText at (0,-6) size 5x24
    314314                    text run at (0,-6) width 5: "("
    315             RenderMathMLOperator {mo} at (13,12) size 8x50
     315            RenderMathMLOperator {mo} at (13,0) size 8x41
    316316              RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    317317                RenderBlock (anonymous) at (0,0) size 5x14
    318318                  RenderText at (0,-6) size 5x24
    319319                    text run at (0,-6) width 5: ")"
    320             RenderMathMLOperator {mo} at (26,12) size 11x50
     320            RenderMathMLOperator {mo} at (26,29) size 11x14
    321321              RenderMathMLBlock (flex) {mo} at (0,0) size 10x14
    322322                RenderBlock (anonymous) at (0,0) size 8x14
    323323                  RenderText at (0,-6) size 8x24
    324324                    text run at (0,-6) width 8: "{"
    325             RenderMathMLOperator {mo} at (43,12) size 11x50
     325            RenderMathMLOperator {mo} at (43,29) size 11x14
    326326              RenderMathMLBlock (flex) {mo} at (0,0) size 10x14
    327327                RenderBlock (anonymous) at (0,0) size 8x14
    328328                  RenderText at (0,-6) size 8x24
    329329                    text run at (0,-6) width 8: "}"
    330             RenderMathMLOperator {mo} at (59,12) size 8x50
     330            RenderMathMLOperator {mo} at (59,0) size 8x41
    331331              RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    332332                RenderBlock (anonymous) at (0,0) size 5x14
    333333                  RenderText at (0,-6) size 5x24
    334334                    text run at (0,-6) width 5: "["
    335             RenderMathMLOperator {mo} at (72,12) size 8x50
     335            RenderMathMLOperator {mo} at (72,0) size 8x41
    336336              RenderMathMLBlock (flex) {mo} at (0,0) size 7x14
    337337                RenderBlock (anonymous) at (0,0) size 5x14
    338338                  RenderText at (0,-6) size 5x24
    339339                    text run at (0,-6) width 5: "]"
    340             RenderMathMLOperator {mo} at (86,12) size 9x50
     340            RenderMathMLOperator {mo} at (86,0) size 9x41
    341341              RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    342342                RenderBlock (anonymous) at (0,0) size 8x16
    343343                  RenderText at (0,-5) size 8x24
    344344                    text run at (0,-5) width 8: "\x{2308}"
    345             RenderMathMLOperator {mo} at (100,12) size 9x50
     345            RenderMathMLOperator {mo} at (100,0) size 9x41
    346346              RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    347347                RenderBlock (anonymous) at (0,0) size 8x16
    348348                  RenderText at (0,-5) size 8x24
    349349                    text run at (0,-5) width 8: "\x{2309}"
    350             RenderMathMLOperator {mo} at (115,12) size 8x50
     350            RenderMathMLOperator {mo} at (115,0) size 8x41
    351351              RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    352352                RenderBlock (anonymous) at (0,0) size 8x16
    353353                  RenderText at (0,-5) size 8x24
    354354                    text run at (0,-5) width 8: "\x{230A}"
    355             RenderMathMLOperator {mo} at (129,12) size 9x50
     355            RenderMathMLOperator {mo} at (129,0) size 9x41
    356356              RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    357357                RenderBlock (anonymous) at (0,0) size 8x16
    358358                  RenderText at (0,-5) size 8x24
    359359                    text run at (0,-5) width 8: "\x{230B}"
    360             RenderMathMLOperator {mo} at (143,12) size 12x50
     360            RenderMathMLOperator {mo} at (143,0) size 12x41
    361361              RenderMathMLBlock (flex) {mo} at (0,0) size 11x20
    362362                RenderBlock (anonymous) at (0,0) size 7x20
    363363                  RenderText at (0,-3) size 7x24
    364364                    text run at (0,-3) width 7: "\x{222B}"
    365             RenderMathMLOperator {mo} at (161,12) size 4x50
     365            RenderMathMLOperator {mo} at (161,0) size 4x41
    366366              RenderMathMLBlock (flex) {mo} at (0,0) size 3x12
    367367                RenderBlock (anonymous) at (0,0) size 3x12
    368368                  RenderText at (0,-6) size 3x24
    369369                    text run at (0,-6) width 3: "|"
    370             RenderMathMLOperator {mo} at (170,12) size 9x50
     370            RenderMathMLOperator {mo} at (170,0) size 9x41
    371371              RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    372372                RenderBlock (anonymous) at (0,0) size 8x16
    373373                  RenderText at (0,-5) size 8x24
    374374                    text run at (0,-5) width 8: "\x{2016}"
    375             RenderMathMLOperator {mo} at (184,12) size 9x50
     375            RenderMathMLOperator {mo} at (184,0) size 9x41
    376376              RenderMathMLBlock (flex) {mo} at (0,0) size 8x16
    377377                RenderBlock (anonymous) at (0,0) size 8x16
  • trunk/Source/WebCore/ChangeLog

    r164535 r164536  
     12014-02-22  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Bug 119043 - Large stretch size error for MathML operators.
     4        https://bugs.webkit.org/show_bug.cgi?id=119043
     5
     6        Reviewed by Chris Fleizach.
     7
     8        The MathML code used some arbitrary gOperatorExpansion factor for the
     9        stretch size and 2/3 1/2 constants for the baseline. This change tries
     10        to consider height/depth of siblings of the stretchy operator so that
     11        the stretchy operator now matches its target.
     12
     13        Test: mathml/presentation/stretchy-depth-height.html
     14
     15        * rendering/RenderObject.h:
     16        (WebCore::RenderObject::isRenderMathMLTable):
     17        * rendering/mathml/RenderMathMLBlock.h:
     18        * rendering/mathml/RenderMathMLOperator.cpp:
     19        (WebCore::RenderMathMLOperator::RenderMathMLOperator):
     20        (WebCore::RenderMathMLOperator::stretchTo):
     21        (WebCore::RenderMathMLOperator::findAcceptableStretchyCharacter):
     22        (WebCore::RenderMathMLOperator::updateStyle):
     23        (WebCore::RenderMathMLOperator::firstLineBaseline):
     24        (WebCore::RenderMathMLOperator::computeLogicalHeight):
     25        * rendering/mathml/RenderMathMLOperator.h:
     26        * rendering/mathml/RenderMathMLRow.cpp:
     27        (WebCore::RenderMathMLRow::layout):
     28
    1292014-02-22  Frédéric Wang  <fred.wang@free.fr>
    230
  • trunk/Source/WebCore/rendering/RenderObject.h

    r164535 r164536  
    404404#if ENABLE(MATHML)
    405405    virtual bool isRenderMathMLBlock() const { return false; }
     406    virtual bool isRenderMathMLTable() const { return false; }
    406407    virtual bool isRenderMathMLOperator() const { return false; }
    407408    virtual bool isRenderMathMLRow() const { return false; }
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h

    r164535 r164536  
    8787   
    8888private:
     89    virtual bool isRenderMathMLTable() const override final { return true; }
    8990    virtual const char* renderName() const override { return "RenderMathMLTable"; }
    9091};
     92
     93RENDER_OBJECT_TYPE_CASTS(RenderMathMLTable, isRenderMathMLTable())
    9194
    9295// Parsing functions for MathML Length values
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r164535 r164536  
    11211121RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element, PassRef<RenderStyle> style)
    11221122    : RenderMathMLBlock(element, std::move(style))
    1123     , m_stretchHeight(0)
     1123    , m_stretchHeightAboveBaseline(0)
     1124    , m_stretchDepthBelowBaseline(0)
    11241125    , m_operator(0)
    11251126    , m_stretchyCharacter(nullptr)
     
    11311132RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element, PassRef<RenderStyle> style, UChar operatorChar, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag)
    11321133    : RenderMathMLBlock(element, std::move(style))
    1133     , m_stretchHeight(0)
     1134    , m_stretchHeightAboveBaseline(0)
     1135    , m_stretchDepthBelowBaseline(0)
    11341136    , m_operator(operatorChar == hyphenMinus ? minusSign : operatorChar)
    11351137    , m_stretchyCharacter(nullptr)
     
    12511253}
    12521254
    1253 static const float gOperatorExpansion = 1.2f;
    1254 
    1255 float RenderMathMLOperator::expandedStretchHeight() const
    1256 {
    1257     return m_stretchHeight * gOperatorExpansion;
    1258 }
    1259 
    1260 void RenderMathMLOperator::stretchToHeight(int height)
    1261 {
    1262     if (m_stretchHeight == height)
     1255void RenderMathMLOperator::stretchTo(int heightAboveBaseline, int depthBelowBaseline)
     1256{
     1257    if (heightAboveBaseline <= m_stretchHeightAboveBaseline && depthBelowBaseline <= m_stretchDepthBelowBaseline)
    12631258        return;
    12641259
    1265     m_stretchHeight = height;
     1260    m_stretchHeightAboveBaseline = heightAboveBaseline;
     1261    m_stretchDepthBelowBaseline = depthBelowBaseline;
    12661262    updateStyle();
    12671263}
     
    13851381        height += glyphHeightForCharacter(stretchyCharacter->middleGlyph);
    13861382
    1387     if (height > expandedStretchHeight())
     1383    if (height > stretchSize())
    13881384        return 0;
    13891385
     
    14021398
    14031399    float stretchedCharacterHeight = style().fontMetrics().floatHeight();
    1404     m_isStretched = allowStretching && expandedStretchHeight() > stretchedCharacterHeight;
     1400    m_isStretched = allowStretching && stretchSize() > stretchedCharacterHeight;
    14051401
    14061402    // Sometimes we cannot stretch an operator properly, so in that case, we should just use the original size.
     
    14131409{
    14141410    if (m_isStretched)
    1415         return expandedStretchHeight() * 2 / 3 - (expandedStretchHeight() - m_stretchHeight) / 2;
     1411        return m_stretchHeightAboveBaseline;
    14161412    return RenderMathMLBlock::firstLineBaseline();
    14171413}
     
    14201416{
    14211417    if (m_isStretched)
    1422         logicalHeight = expandedStretchHeight();
     1418        logicalHeight = stretchSize();
    14231419    RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
    14241420}
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h

    r164535 r164536  
    6565    MathMLElement& element() { return toMathMLElement(nodeForNonAnonymous()); }
    6666
    67     void stretchToHeight(int pixelHeight);
    68     int stretchHeight() { return m_stretchHeight; }
    69     float expandedStretchHeight() const;
     67    void stretchTo(int heightAboveBaseline, int depthBelowBaseline);
     68    int stretchSize() const { return m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline; }
    7069   
    7170    bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; }
     
    112111    void fillWithExtensionGlyph(PaintInfo&, const LayoutPoint& from, const LayoutPoint& to);
    113112
    114     int m_stretchHeight;
     113    int m_stretchHeightAboveBaseline;
     114    int m_stretchDepthBelowBaseline;
    115115    bool m_isStretched;
    116116
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp

    r164535 r164536  
    5858void RenderMathMLRow::layout()
    5959{
    60     int stretchLogicalHeight = 0;
     60    int stretchHeightAboveBaseline = 0, stretchDepthBelowBaseline = 0;
    6161    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    6262        if (child->needsLayout())
     
    6565        if (child->isRenderMathMLBlock() && toRenderMathMLBlock(child)->unembellishedOperator())
    6666            continue;
    67         if (child->isBox())
    68             stretchLogicalHeight = std::max<int>(stretchLogicalHeight, roundToInt(toRenderBox(child)->logicalHeight()));
     67        int childHeightAboveBaseline = 0, childDepthBelowBaseline = 0;
     68        if (child->isRenderMathMLBlock()) {
     69            RenderMathMLBlock* mathmlChild = toRenderMathMLBlock(child);
     70            childHeightAboveBaseline = mathmlChild->firstLineBaseline();
     71            if (childHeightAboveBaseline == -1)
     72                childHeightAboveBaseline = mathmlChild->logicalHeight();
     73            childDepthBelowBaseline = mathmlChild->logicalHeight() - childHeightAboveBaseline;
     74        } else if (child->isRenderMathMLTable()) {
     75            RenderMathMLTable* tableChild = toRenderMathMLTable(child);
     76            childHeightAboveBaseline = tableChild->firstLineBaseline();
     77            childDepthBelowBaseline = tableChild->logicalHeight() - childHeightAboveBaseline;
     78        } else if (child->isBox()) {
     79            childHeightAboveBaseline = toRenderBox(child)->logicalHeight();
     80            childDepthBelowBaseline = 0;
     81        }
     82        stretchHeightAboveBaseline = std::max<int>(stretchHeightAboveBaseline, roundToInt(childHeightAboveBaseline));
     83        stretchDepthBelowBaseline = std::max<int>(stretchDepthBelowBaseline, roundToInt(childDepthBelowBaseline));
    6984    }
    70     if (!stretchLogicalHeight)
    71         stretchLogicalHeight = style().fontSize();
     85    if (stretchHeightAboveBaseline + stretchDepthBelowBaseline <= 0)
     86        stretchHeightAboveBaseline = style().fontSize();
    7287   
    7388    // Set the sizes of (possibly embellished) stretchy operator children.
    7489    for (auto& child : childrenOfType<RenderMathMLBlock>(*this)) {
    75         if (auto renderMo = child.unembellishedOperator()) {
    76             if (renderMo->stretchHeight() != stretchLogicalHeight)
    77                 renderMo->stretchToHeight(stretchLogicalHeight);
    78         }
     90        if (auto renderOperator = child.unembellishedOperator())
     91            renderOperator->stretchTo(stretchHeightAboveBaseline, stretchDepthBelowBaseline);
    7992    }
    8093
Note: See TracChangeset for help on using the changeset viewer.