Skip to content
Permalink
Browse files
Use the MathOperator to handle some non-stretchy operators
https://bugs.webkit.org/show_bug.cgi?id=157519

Patch by Frederic Wang <fwang@igalia.com> on 2016-06-20
Reviewed by Brent Fulgham.

Source/WebCore:

To prepare for the removal of anonymous text node from the render classes of token elements
we use MathOperator to handle two cases where the actual text to display may not be
available in the DOM: mfenced and minus operators. This change removes support for the
case of mfenced operators with multiple characters since that it is not supported by
MathOperator. It is a edge case that is not used in practice since fences and separators are
only made of a single character. However, it would still be possible to duplicate some
code/logic to add it back if that turns out to be necessary.

No new tests, already covered by existing tests.

* rendering/mathml/MathOperator.cpp:
(WebCore::MathOperator::MathOperator): Rename UndefinedOperator.
(WebCore::RenderMathMLOperator::firstLineBaseline): Improve rounding of ascent so that mfenced operators are correctly aligned.
* rendering/mathml/MathOperator.h: Rename UndefinedOperator, since it can now be used to draw non-stretchy operators.
(WebCore::MathOperator::isStretched): Deleted. This function is no longer used by RenderMathMLOperator.
(WebCore::MathOperator::unstretch): Deleted. This function is no longer used by RenderMathMLOperator.
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Use useMathOperator.
(WebCore::RenderMathMLOperator::rebuildTokenContent): Set the MathOperator when useMathOperator() is true.
When the operator is not likely to stretch we just leave its type as NormalOperator.
(WebCore::RenderMathMLOperator::useMathOperator): Helper function to determine when MathOperator should be used.
(WebCore::RenderMathMLOperator::firstLineBaseline): Use useMathOperator.
(WebCore::RenderMathMLOperator::computeLogicalHeight): Ditto.
(WebCore::RenderMathMLOperator::paint): Ditto.
(WebCore::RenderMathMLOperator::paintChildren): Ditto.
* rendering/mathml/RenderMathMLOperator.h: Declare useMathOperator.

LayoutTests:

We adjust fenced-mi.html to handle one edge case that we no longer support.
We also update some test references on Mac and iOS.

* mathml/presentation/fenced-mi-expected.html: Indicate that this is no longer supported.
* mathml/presentation/fenced-mi.html: Adjust the reference since no text is shown.
* platform/mac/mathml/opentype/large-operators-expected.txt: Update reference.
* platform/mac/mathml/opentype/opentype-stretchy-expected.txt: Ditto.
* platform/mac/mathml/opentype/vertical-expected.txt: Ditto.
* platform/ios-simulator/mathml/opentype/horizontal-munderover-expected.txt: Ditto.
* platform/ios-simulator/mathml/opentype/opentype-stretchy-expected.txt: Ditto.

Canonical link: https://commits.webkit.org/177038@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202271 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fred-wang committed Jun 21, 2016
1 parent 159ba90 commit 31cb96fbb0b93db86ba5ce1795c418c9d877041b
Showing 12 changed files with 307 additions and 244 deletions.
@@ -1,3 +1,21 @@
2016-06-20 Frederic Wang <fwang@igalia.com>

Use the MathOperator to handle some non-stretchy operators
https://bugs.webkit.org/show_bug.cgi?id=157519

Reviewed by Brent Fulgham.

We adjust fenced-mi.html to handle one edge case that we no longer support.
We also update some test references on Mac and iOS.

* mathml/presentation/fenced-mi-expected.html: Indicate that this is no longer supported.
* mathml/presentation/fenced-mi.html: Adjust the reference since no text is shown.
* platform/mac/mathml/opentype/large-operators-expected.txt: Update reference.
* platform/mac/mathml/opentype/opentype-stretchy-expected.txt: Ditto.
* platform/mac/mathml/opentype/vertical-expected.txt: Ditto.
* platform/ios-simulator/mathml/opentype/horizontal-munderover-expected.txt: Ditto.
* platform/ios-simulator/mathml/opentype/opentype-stretchy-expected.txt: Ditto.

2016-06-20 Alexey Proskuryakov <ap@apple.com>

Test expectation update for media/click-placeholder-not-pausing.html
@@ -68,11 +68,11 @@
<p>
<math>
<mrow>
<mo>ABC</mo>
<mo></mo>
<mrow>
<mi>x</mi>
</mrow>
<mo>DEF</mo>
<mo></mo>
</mrow>
</math>
</p>
@@ -34,6 +34,7 @@
</p>

<!-- Test for open/close operators with multiple characters -->
<!-- We do not support this edge case. See https://webkit.org/b/157519. -->
<p>
<math>
<mfenced open="ABC" close="DEF">
@@ -4,100 +4,100 @@ layer at (0,0) size 800x52
RenderBlock {HTML} at (0,0) size 800x52
RenderBody {BODY} at (8,16) size 784x20
RenderBlock {P} at (0,0) size 784x20
RenderMathMLMath {math} at (0,13) size 50x3 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x3
RenderMathMLUnderOver {mover} at (0,0) size 48x3
RenderMathMLOperator {mo} at (24,2) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLMath {math} at (0,13) size 50x2 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x2
RenderMathMLUnderOver {mover} at (0,0) size 48x2
RenderMathMLOperator {mo} at (24,2) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-12) size 0x17
text run at (0,-12) width 0: "\x{23DE}"
RenderMathMLSpace {mspace} at (0,0) size 48x2 [bgcolor=#FF0000]
RenderText {#text} at (50,0) size 4x19
text run at (50,0) width 4: " "
RenderMathMLMath {math} at (54,12) size 66x3 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 64x3
RenderMathMLUnderOver {mover} at (0,0) size 64x3
RenderMathMLSpace {mspace} at (0,1) size 64x2 [bgcolor=#FF0000]
RenderMathMLOperator {mo} at (32,0) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLMath {math} at (54,13) size 66x2 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 64x2
RenderMathMLUnderOver {mover} at (0,0) size 64x2
RenderMathMLSpace {mspace} at (0,0) size 64x2 [bgcolor=#FF0000]
RenderMathMLOperator {mo} at (32,0) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-9) size 0x13
text run at (0,-9) width 0: "\x{23DE}"
RenderText {#text} at (120,0) size 4x19
text run at (120,0) width 4: " "
RenderMathMLMath {math} at (124,15) size 50x3 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x3
RenderMathMLUnderOver {munder} at (0,0) size 48x3
RenderMathMLOperator {mo} at (24,0) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLMath {math} at (124,15) size 50x2 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x2
RenderMathMLUnderOver {munder} at (0,0) size 48x2
RenderMathMLOperator {mo} at (24,0) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-12) size 0x17
text run at (0,-12) width 0: "\x{23DE}"
RenderMathMLSpace {mspace} at (0,1) size 48x2 [bgcolor=#FF0000]
RenderMathMLSpace {mspace} at (0,0) size 48x2 [bgcolor=#FF0000]
RenderText {#text} at (174,0) size 4x19
text run at (174,0) width 4: " "
RenderMathMLMath {math} at (178,12) size 66x4 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 64x4
RenderMathMLUnderOver {munderover} at (0,0) size 64x4
RenderMathMLSpace {mspace} at (0,1) size 64x2 [bgcolor=#FF0000]
RenderMathMLOperator {mo} at (32,3) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLMath {math} at (178,13) size 66x2 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 64x2
RenderMathMLUnderOver {munderover} at (0,0) size 64x2
RenderMathMLSpace {mspace} at (0,0) size 64x2 [bgcolor=#FF0000]
RenderMathMLOperator {mo} at (32,2) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-9) size 0x13
text run at (0,-9) width 0: "\x{23DE}"
RenderMathMLOperator {mo} at (32,0) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLOperator {mo} at (32,0) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-9) size 0x13
text run at (0,-9) width 0: "\x{23DE}"
RenderText {#text} at (244,0) size 4x19
text run at (244,0) width 4: " "
RenderMathMLMath {math} at (248,14) size 50x4 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x4
RenderMathMLUnderOver {munderover} at (0,0) size 48x4
RenderMathMLOperator {mo} at (24,1) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLMath {math} at (248,15) size 50x2 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x2
RenderMathMLUnderOver {munderover} at (0,0) size 48x2
RenderMathMLOperator {mo} at (24,0) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-12) size 0x17
text run at (0,-12) width 0: "\x{23DE}"
RenderMathMLSpace {mspace} at (0,2) size 48x2 [bgcolor=#FF0000]
RenderMathMLOperator {mo} at (24,0) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLSpace {mspace} at (0,0) size 48x2 [bgcolor=#FF0000]
RenderMathMLOperator {mo} at (24,0) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-9) size 0x13
text run at (0,-9) width 0: "\x{23DE}"
RenderText {#text} at (298,0) size 4x19
text run at (298,0) width 4: " "
RenderMathMLMath {math} at (302,13) size 50x4 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x4
RenderMathMLUnderOver {munderover} at (0,0) size 48x4
RenderMathMLOperator {mo} at (24,2) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLMath {math} at (302,13) size 50x2 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x2
RenderMathMLUnderOver {munderover} at (0,0) size 48x2
RenderMathMLOperator {mo} at (24,2) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-12) size 0x17
text run at (0,-12) width 0: "\x{23DE}"
RenderMathMLOperator {mo} at (24,3) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLOperator {mo} at (24,2) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-9) size 0x13
text run at (0,-9) width 0: "\x{23DE}"
RenderMathMLSpace {mspace} at (0,0) size 48x2 [bgcolor=#FF0000]
RenderText {#text} at (352,0) size 4x19
text run at (352,0) width 4: " "
RenderMathMLMath {math} at (356,13) size 50x4 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x4
RenderMathMLUnderOver {munder} at (0,0) size 48x4
RenderMathMLUnderOver {mover} at (0,0) size 48x3
RenderMathMLOperator {mo} at (24,2) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLMath {math} at (356,13) size 50x2 [padding: 0 1 0 1]
RenderMathMLRow {mstyle} at (1,0) size 48x2
RenderMathMLUnderOver {munder} at (0,0) size 48x2
RenderMathMLUnderOver {mover} at (0,0) size 48x2
RenderMathMLOperator {mo} at (24,2) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-12) size 0x17
text run at (0,-12) width 0: "\x{23DE}"
RenderMathMLSpace {mspace} at (0,0) size 48x2 [bgcolor=#FF0000]
RenderMathMLOperator {mo} at (24,3) size 0x1
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x1
RenderBlock (anonymous) at (0,0) size 0x1
RenderMathMLOperator {mo} at (24,2) size 0x0
RenderMathMLBlock (anonymous, flex) at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 0x0
RenderText at (0,-9) size 0x13
text run at (0,-9) width 0: "\x{23DE}"
RenderText {#text} at (0,0) size 0x0
@@ -1,27 +1,27 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x340
RenderBlock {HTML} at (0,0) size 800x340
RenderBody {BODY} at (8,16) size 784x308
RenderBlock {P} at (0,0) size 784x35
RenderMathMLMath {math} at (0,20) size 49x11 [padding: 0 1 0 1]
layer at (0,0) size 800x342
RenderBlock {HTML} at (0,0) size 800x342
RenderBody {BODY} at (8,16) size 784x310
RenderBlock {P} at (0,0) size 784x36
RenderMathMLMath {math} at (0,21) size 49x11 [padding: 0 1 0 1]
RenderMathMLRow {mrow} at (1,0) size 47x11
RenderMathMLOperator {mo} at (0,0) size 47x11
RenderMathMLBlock (anonymous, flex) at (2,0) size 42x3
RenderBlock (anonymous) at (0,0) size 3x3
RenderText at (0,-3) size 3x0
text run at (0,-3) width 3: "\x{219F}"
RenderText {#text} at (48,15) size 5x19
text run at (48,15) width 5: " "
RenderMathMLMath {math} at (52,10) size 49x21 [padding: 0 1 0 1]
RenderText {#text} at (48,16) size 5x19
text run at (48,16) width 5: " "
RenderMathMLMath {math} at (52,11) size 49x21 [padding: 0 1 0 1]
RenderMathMLRow {mrow} at (1,0) size 47x21
RenderMathMLOperator {mo} at (0,0) size 47x21
RenderMathMLBlock (anonymous, flex) at (2,0) size 42x3
RenderBlock (anonymous) at (0,0) size 3x3
RenderText at (0,-3) size 3x0
text run at (0,-3) width 3: "\x{219F}"
RenderText {#text} at (100,15) size 5x19
text run at (100,15) width 5: " "
RenderText {#text} at (100,16) size 5x19
text run at (100,16) width 5: " "
RenderMathMLMath {math} at (104,0) size 50x31 [padding: 0 1 0 1]
RenderMathMLRow {mrow} at (1,0) size 47x31
RenderMathMLOperator {mo} at (0,0) size 47x31
@@ -30,7 +30,7 @@ layer at (0,0) size 800x340
RenderText at (0,-3) size 3x0
text run at (0,-3) width 3: "\x{219F}"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,51) size 784x155
RenderBlock {P} at (0,52) size 784x155
RenderMathMLMath {math} at (0,0) size 49x150 [padding: 0 1 0 1]
RenderMathMLRow {mrow} at (1,0) size 47x150
RenderMathMLOperator {mo} at (0,0) size 47x150
@@ -39,7 +39,7 @@ layer at (0,0) size 800x340
RenderText at (0,-3) size 3x0
text run at (0,-3) width 3: "\x{219F}"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,222) size 784x86
RenderBlock {P} at (0,223) size 784x87
RenderMathMLMath {math} at (0,0) size 86x82 [padding: 0 1 0 1]
RenderMathMLRow {mrow} at (1,0) size 84x82
RenderMathMLOperator {mo} at (0,0) size 84x82

0 comments on commit 31cb96f

Please sign in to comment.