LayoutTests/mathml/presentation/mspace-negative-width-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>negative mspace</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8 <!-- Negative space in a <math> element. -->
 9 <table>
 10 <tr>
 11 <td style="border: 1px solid black">
 12 <math>
 13 <mspace width="1em" height="1em" mathbackground="red"></mspace>
 14 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 15 </math>
 16 </td>
 17 </tr>
 18 </table>
 19 <!-- Negative space in an <mrow> element. -->
 20 <table>
 21 <tr>
 22 <td style="border: 1px solid black">
 23 <math>
 24 <mrow>
 25 <mspace width="1em" height="1em" mathbackground="red"></mspace>
 26 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 27 </mrow>
 28 </math>
 29 </td>
 30 </tr>
 31 </table>
 32 <!-- Negative space in an <msqrt> element. -->
 33 <table>
 34 <tr>
 35 <td style="border: 1px solid black">
 36 <math>
 37 <msqrt>
 38 <mspace width="1em" height="1em" mathbackground="red"></mspace>
 39 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 40 </msqrt>
 41 </math>
 42 </td>
 43 </tr>
 44 </table>
 45 <!-- Negative space as a first child of an <mrow> element. -->
 46 <table>
 47 <tr>
 48 <td style="border: 1px solid black">
 49 <math>
 50 <mspace width="1em" height="1em" mathbackground="red"></mspace>
 51 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 52 </math>
 53 </td>
 54 </tr>
 55 </table>
 56 <!-- Negative space as a last child of an <mrow> element. -->
 57 <table>
 58 <tr>
 59 <td style="border: 1px solid black">
 60 <math>
 61 <mspace width="1em" height="1em" mathbackground="red"></mspace>
 62 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 63 </math>
 64 </td>
 65 </tr>
 66 </table>
 67 <!-- Two consecutive successive negative spaces -->
 68 <table>
 69 <tr>
 70 <td style="border: 1px solid black">
 71 <math>
 72 <mspace width="1em" height="1em" mathbackground="red"></mspace>
 73 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 74 </math>
 75 </td>
 76 </tr>
 77 </table>
 78 </body>
 79</html>

LayoutTests/mathml/presentation/mspace-negative-width.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>negative mspace</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8 <!-- Negative space in a <math> element. -->
 9 <table>
 10 <tr>
 11 <td style="border: 1px solid black">
 12 <math>
 13 <mspace width="2em" height="1em" mathbackground="red"></mspace>
 14 <mspace width="-1em"/>
 15 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 16 </math>
 17 </td>
 18 </tr>
 19 </table>
 20 <!-- Negative space in an <mrow> element. -->
 21 <table>
 22 <tr>
 23 <td style="border: 1px solid black">
 24 <math>
 25 <mrow>
 26 <mspace width="2em" height="1em" mathbackground="red"></mspace>
 27 <mspace width="-1em"/>
 28 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 29 </mrow>
 30 </math>
 31 </td>
 32 </tr>
 33 </table>
 34 <!-- Negative space in an <msqrt> element. -->
 35 <table>
 36 <tr>
 37 <td style="border: 1px solid black">
 38 <math>
 39 <msqrt>
 40 <mspace width="2em" height="1em" mathbackground="red"></mspace>
 41 <mspace width="-1em"/>
 42 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 43 </msqrt>
 44 </math>
 45 </td>
 46 </tr>
 47 </table>
 48 <!-- Negative space as a first child of an <mrow> element. -->
 49 <table>
 50 <tr>
 51 <td style="border: 1px solid black">
 52 <math>
 53 <mspace width="2em" height="1em" mathbackground="red"></mspace>
 54 <mrow>
 55 <mspace width="-1em"/>
 56 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 57 </mrow>
 58 </math>
 59 </td>
 60 </tr>
 61 </table>
 62 <!-- Negative space as a last child of an <mrow> element. -->
 63 <table>
 64 <tr>
 65 <td style="border: 1px solid black">
 66 <math>
 67 <mrow>
 68 <mspace width="2em" height="1em" mathbackground="red"></mspace>
 69 <mspace width="-1em"/>
 70 </mrow>
 71 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 72 </math>
 73 </td>
 74 </tr>
 75 </table>
 76 <!-- Two consecutive negative spaces. -->
 77 <table>
 78 <tr>
 79 <td style="border: 1px solid black">
 80 <math>
 81 <mspace width="2em" height="1em" mathbackground="red"></mspace>
 82 <mspace width="-.5em"/>
 83 <mspace width="-.5em"/>
 84 <mspace width="1em" height="1em" mathbackground="blue"></mspace>
 85 </math>
 86 </td>
 87 </tr>
 88 </table>
 89 </body>
 90</html>

LayoutTests/mathml/presentation/negative-namedspace-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>Negative namedspace</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8 <p>
 9 <math>
 10 <mrow>
 11 <mi>x</mi> <mspace width="-0.0555555556em"></mspace> <mi>y</mi>
 12 </mrow>
 13 </math>
 14 </p>
 15 <p>
 16 <math>
 17 <mrow>
 18 <mi>x</mi> <mspace width="-0.111111111em"></mspace> <mi>y</mi>
 19 </mrow>
 20 </math>
 21 <p>
 22 <math>
 23 <mrow>
 24 <mi>x</mi> <mspace width="-0.166666667em"></mspace> <mi>y</mi>
 25 </mrow>
 26 </math>
 27 </p>
 28 <p>
 29 <math>
 30 <mrow>
 31 <mi>x</mi> <mspace width="-0.222222222em"></mspace> <mi>y</mi>
 32 </mrow>
 33 </math>
 34 </p>
 35 <p>
 36 <math>
 37 <mrow>
 38 <mi>x</mi> <mspace width="-0.277777778em"></mspace> <mi>y</mi>
 39 </mrow>
 40 </math>
 41 </p>
 42 <p>
 43 <math>
 44 <mrow>
 45 <mi>x</mi> <mspace width="-0.333333333em"></mspace> <mi>y</mi>
 46 </mrow>
 47 </math>
 48 </p>
 49 <p>
 50 <math>
 51 <mrow>
 52 <mi>x</mi> <mspace width="-0.388888889em"></mspace> <mi>y</mi>
 53 </mrow>
 54 </math>
 55 </p>
 56 </body>
 57</html>

LayoutTests/mathml/presentation/negative-namedspace.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>Negative namedspace</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8 <!-- This verifies the values of the negative named spaces. -->
 9 <p>
 10 <math>
 11 <mrow>
 12 <mi>x</mi> <mspace width="negativeveryverythinmathspace"></mspace> <mi>y</mi>
 13 </mrow>
 14 </math>
 15 </p>
 16 <p>
 17 <math>
 18 <mrow>
 19 <mi>x</mi> <mspace width="negativeverythinmathspace"></mspace> <mi>y</mi>
 20 </mrow>
 21 </math>
 22 </p>
 23 <p>
 24 <math>
 25 <mrow>
 26 <mi>x</mi> <mspace width="negativethinmathspace"></mspace> <mi>y</mi>
 27 </mrow>
 28 </math>
 29 </p>
 30 <p>
 31 <math>
 32 <mrow>
 33 <mi>x</mi> <mspace width="negativemediummathspace"></mspace> <mi>y</mi>
 34 </mrow>
 35 </math>
 36 </p>
 37 <p>
 38 <math>
 39 <mrow>
 40 <mi>x</mi> <mspace width="negativethickmathspace"></mspace> <mi>y</mi>
 41 </mrow>
 42 </math>
 43 </p>
 44 <p>
 45 <math>
 46 <mrow>
 47 <mi>x</mi> <mspace width="negativeverythickmathspace"></mspace> <mi>y</mi>
 48 </mrow>
 49 </math>
 50 </p>
 51 <p>
 52 <math>
 53 <mrow>
 54 <mi>x</mi> <mspace width="negativeveryverythickmathspace"></mspace> <mi>y</mi>
 55 </mrow>
 56 </math>
 57 </p>
 58 </body>
 59</html>

Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp

@@RenderMathMLSpace::RenderMathMLSpace(Element* element)
4141 , m_width(0)
4242 , m_height(0)
4343 , m_depth(0)
 44 , m_marginEnd(0)
4445{
4546}
4647

@@void RenderMathMLSpace::updateFromElement()
5859 m_width = 0;
5960 m_height = 0;
6061 m_depth = 0;
 62 m_marginEnd = 0;
6163 parseMathMLLength(space->getAttribute(MathMLNames::widthAttr), m_width, style());
6264 parseMathMLLength(space->getAttribute(MathMLNames::heightAttr), m_height, style());
6365 parseMathMLLength(space->getAttribute(MathMLNames::depthAttr), m_depth, style());
6466
65  // FIXME: Negative width values should be accepted.
66  if (m_width < 0)
 67 if (m_width < 0) {
 68 m_marginEnd = m_width;
6769 m_width = 0;
 70 }
6871
6972 // If the total height is negative, set vertical dimensions to 0.
7073 if (m_height + m_depth < 0) {

@@void RenderMathMLSpace::updateFromElement()
7275 m_depth = 0;
7376 }
7477
 78 setMarginEnd(m_marginEnd);
 79 setLogicalWidth(m_width);
 80 setLogicalHeight(m_height + m_depth);
7581 setNeedsLayoutAndPrefWidthsRecalc();
7682}
7783
7884void RenderMathMLSpace::updateLogicalWidth()
7985{
 86 RenderMathMLBlock::updateLogicalWidth();
8087 setLogicalWidth(m_width);
 88 setMarginEnd(m_marginEnd);
8189}
8290
8391void RenderMathMLSpace::updateLogicalHeight()
8492{
 93 RenderMathMLBlock::updateLogicalHeight();
8594 setLogicalHeight(m_height + m_depth);
8695}
8796

Source/WebCore/rendering/mathml/RenderMathMLSpace.h

@@private:
5454 LayoutUnit m_width;
5555 LayoutUnit m_height;
5656 LayoutUnit m_depth;
 57 LayoutUnit m_marginEnd;
5758};
5859
5960inline RenderMathMLSpace* toRenderMathMLSpace(RenderMathMLBlock* block)