Skip to content

Truly independent web browser

Tests/LibWeb: Import MathML layout, styling and DOM tests

Andreas Klingf6050e20809b
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/direction/direction.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/direction/direction.txt
new file mode 100644
index 00000000000..d28225cdc6c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/direction/direction.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Check direction
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-1.txt
new file mode 100644
index 00000000000..00120d68558
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-1.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Fail
+Fail Fraction axis is aligned on the math axis
+Fail Vertical positions of numerator and denominator
+Fail Horizontal alignments of numerator and denominator
+Fail Dimension of mfrac elements
+Fail Preferred width of mfrac elements
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-linethickness-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-linethickness-002.txt
new file mode 100644
index 00000000000..b6986c0fbd8
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-linethickness-002.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail Positive
+Fail Negative
+Fail Percentage
+Fail Named space
+Fail Calc() expression
+Fail Dynamic linethickness
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-1.txt
new file mode 100644
index 00000000000..c0889d4327c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-1.txt
@@ -0,0 +1,25 @@
+Harness status: OK
+
+Found 20 tests
+
+20 Fail
+Fail AxisHeight
+Fail DenominatorDisplayStyleGapMin
+Fail DenominatorDisplayStyleShiftDown
+Fail DenominatorDisplayStyleGapMin Displaystyle
+Fail DenominatorDisplayStyleShiftDown Displaystyle
+Fail DenominatorDisplayStyleGapMin Displaystyle on fraction
+Fail DenominatorDisplayStyleShiftDown Displaystyle on fraction
+Fail DenominatorGapMin
+Fail DenominatorShiftDown
+Fail DenominatorGapMin Displaystyle on fraction
+Fail DenominatorShiftDown Displaystyle on fraction
+Fail NumeratorDisplayStyleGapMin
+Fail NumeratorDisplayStyleShiftDown
+Fail NumeratorDisplayStyleGapMin Displaystyle
+Fail NumeratorDisplayStyleShiftDown Displaystyle
+Fail NumeratorDisplayStyleGapMin Displaystyle on fraction
+Fail NumeratorDisplayStyleShiftDown Displaystyle on fraction
+Fail NumeratorGapMin
+Fail NumeratorShiftDown
+Fail FractionRuleThickness
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-2.txt
new file mode 100644
index 00000000000..0ad9490e3c8
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-2.txt
@@ -0,0 +1,18 @@
+Harness status: OK
+
+Found 13 tests
+
+13 Fail
+Fail BottomDisplayStyleShiftDown
+Fail BottomDisplayStyleShiftDown Displaystyle
+Fail BottomDisplayStyleShiftDown Displaystyle om fraction
+Fail BottomShiftDown
+Fail DisplayStyleGapMin
+Fail DisplayStyleGapMin Dsiplaystyle
+Fail DisplayStyleGapMin Dsiplaystyle on fraction
+Fail GapMin
+Fail TopDisplayStyleShiftUp
+Fail TopDisplayStyleShiftUp Displaystyle
+Fail TopDisplayStyleShiftUp Displaystyle on fraction
+Fail ToShiftUp
+Fail ToShiftUp with Displaystyle on fraction
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-3.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-3.txt
new file mode 100644
index 00000000000..6a7f64a697c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/fractions/frac-parameters-3.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail nonzero linethickness, displaystyle=false
+Fail nonzero linethickness, displaystyle=true
+Fail linethickness=0, displaystyle=false
+Fail linethickness=0, displaystyle=true
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/legacy-orthogonal-pseudo-units.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/legacy-orthogonal-pseudo-units.txt
new file mode 100644
index 00000000000..1b2d444028e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/legacy-orthogonal-pseudo-units.txt
@@ -0,0 +1,12 @@
+Harness status: OK
+
+Found 7 tests
+
+7 Fail
+Fail 200%height is not allowed on width
+Fail 200%depth is not allowed on width
+Fail 200%height is not allowed on lspace
+Fail 200%depth is not allowed on lspace
+Fail 200%width is not allowed on height
+Fail 200%width is not allowed on depth
+Fail 200%width is not allowed on voffset
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-001.txt
new file mode 100644
index 00000000000..9004d5ef0c8
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-001.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 9 tests
+
+3 Pass
+6 Fail
+Pass mpadded (no attributes)
+Fail Different widths
+Fail Different heights
+Fail Different depths
+Fail Various combinations of height, depth and width.
+Pass Preferred width
+Pass dynamic attributes (remove)
+Fail dynamic attributes (attach)
+Fail dynamic attributes (modify)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-002.txt
new file mode 100644
index 00000000000..e68615f5014
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-002.txt
@@ -0,0 +1,16 @@
+Harness status: OK
+
+Found 10 tests
+
+1 Pass
+9 Fail
+Fail mpadded with no attributes
+Fail Different widths
+Fail Different heights
+Fail Percentage calculation for width, height and depth
+Fail Different depths
+Fail Various combinations of height, depth and width.
+Pass Preferred width
+Fail dynamic attributes (remove)
+Fail dynamic attributes (attach)
+Fail dynamic attributes (modify)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-003.txt
new file mode 100644
index 00000000000..fd329a8e02f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-003.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 5 tests
+
+1 Pass
+4 Fail
+Pass lspace/voffset shifts don't affect mpadded preferred width
+Fail lspace/voffset shifts don't affect mpadded size
+Fail content is shifted by the specified lspace/voffset
+Fail content is shifted by the specified lspace/voffset (RTL)
+Fail dynamic changes of lspace/voffset
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-percentage-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-percentage-002.txt
new file mode 100644
index 00000000000..a8457879ccc
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mpadded/mpadded-percentage-002.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Fail
+Fail width='200%' is interpreted as the default value
+Fail height='200%' is interpreted as the default value
+Fail depth='200%' is interpreted as the default value
+Fail lspace='200%' is interpreted as the default value
+Fail voffset='200%' is interpreted as the default value
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/inferred-mrow-baseline.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/inferred-mrow-baseline.txt
new file mode 100644
index 00000000000..d879decf3b3
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/inferred-mrow-baseline.txt
@@ -0,0 +1,19 @@
+Harness status: OK
+
+Found 14 tests
+
+14 Fail
+Fail baseline alignment inside Mrow
+Fail baseline alignment inside Sqrt
+Fail baseline alignment inside Style
+Fail baseline alignment inside Error
+Fail baseline alignment inside Phantom
+Fail baseline alignment inside Math
+Fail baseline alignment inside Menclose
+Fail baseline alignment inside Mpadded
+Fail baseline alignment inside Unknown
+Fail baseline alignment inside Mtd
+Fail baseline alignment inside None
+Fail baseline alignment inside Mprescripts
+Fail baseline alignment inside Mfenced
+Fail baseline alignment inside A
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.txt
new file mode 100644
index 00000000000..3959a63d12a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.txt
@@ -0,0 +1,21 @@
+Harness status: OK
+
+Found 16 tests
+
+16 Fail
+Fail Element is laid out as an mrow with only first child displayed (id=semantics)
+Fail Computed display of children (id=semantics)
+Fail Element is laid out as an mrow with only first child displayed (id=semantics-annotations)
+Fail Computed display of children (id=semantics-annotations)
+Fail Element is laid out as an mrow with only first child displayed (id=maction)
+Fail Computed display of children (id=maction)
+Fail Element is laid out as an mrow with only first child displayed (id=maction-toggle)
+Fail Computed display of children (id=maction-toggle)
+Fail Element is laid out as an mrow with only first child displayed (id=maction-toggle-selection)
+Fail Computed display of children (id=maction-toggle-selection)
+Fail Element is laid out as an mrow with only first child displayed (id=maction-statusline)
+Fail Computed display of children (id=maction-statusline)
+Fail Element is laid out as an mrow with only first child displayed (id=maction-tooltip)
+Fail Computed display of children (id=maction-tooltip)
+Fail Element is laid out as an mrow with only first child displayed (id=maction-input)
+Fail Computed display of children (id=maction-input)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/legacy-mstyle-attributes.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/legacy-mstyle-attributes.txt
new file mode 100644
index 00000000000..be2c27311de
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/legacy-mstyle-attributes.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 9 tests
+
+1 Pass
+8 Fail
+Fail Legacy mstyle attributes do not apply to mspace
+Pass Legacy mstyle attributes do not apply to mfrac
+Fail Legacy mstyle attributes do not apply to mo
+Fail Legacy mstyle attributes do not apply to menclose
+Fail Legacy mstyle attributes do not apply to ms
+Fail Legacy mstyle attributes do not apply to mpadded
+Fail Legacy mstyle attributes do not apply to mover
+Fail Legacy mstyle attributes do not apply to munder
+Fail Legacy mstyle attributes do not apply to munderover
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/merror-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/merror-001.txt
new file mode 100644
index 00000000000..77198914e54
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/merror-001.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 2 tests
+
+1 Pass
+1 Fail
+Pass Default CSS properties on merror
+Fail Bounding box is the same as mrow + 1px border
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/mrow-fallback-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/mrow-fallback-001.txt
new file mode 100644
index 00000000000..94cc50d2de2
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/mrow-fallback-001.txt
@@ -0,0 +1,53 @@
+Harness status: OK
+
+Found 47 tests
+
+9 Pass
+38 Fail
+Pass Invalid <mfrac> should lay out as an mrow (count == 0)
+Fail Invalid <mfrac> should lay out as an mrow (count == 1)
+Fail Invalid <mfrac> should lay out as an mrow (count == 3)
+Fail Invalid <mfrac> should lay out as an mrow (count == 4)
+Fail Invalid <mfrac> should lay out as an mrow (count == 5)
+Pass Invalid <mroot> should lay out as an mrow (count == 0)
+Fail Invalid <mroot> should lay out as an mrow (count == 1)
+Fail Invalid <mroot> should lay out as an mrow (count == 3)
+Fail Invalid <mroot> should lay out as an mrow (count == 4)
+Fail Invalid <mroot> should lay out as an mrow (count == 5)
+Pass Invalid <munder> should lay out as an mrow (count == 0)
+Fail Invalid <munder> should lay out as an mrow (count == 1)
+Fail Invalid <munder> should lay out as an mrow (count == 3)
+Fail Invalid <munder> should lay out as an mrow (count == 4)
+Fail Invalid <munder> should lay out as an mrow (count == 5)
+Pass Invalid <mover> should lay out as an mrow (count == 0)
+Fail Invalid <mover> should lay out as an mrow (count == 1)
+Fail Invalid <mover> should lay out as an mrow (count == 3)
+Fail Invalid <mover> should lay out as an mrow (count == 4)
+Fail Invalid <mover> should lay out as an mrow (count == 5)
+Pass Invalid <munderover> should lay out as an mrow (count == 0)
+Fail Invalid <munderover> should lay out as an mrow (count == 1)
+Fail Invalid <munderover> should lay out as an mrow (count == 2)
+Fail Invalid <munderover> should lay out as an mrow (count == 4)
+Fail Invalid <munderover> should lay out as an mrow (count == 5)
+Pass Invalid <msub> should lay out as an mrow (count == 0)
+Fail Invalid <msub> should lay out as an mrow (count == 1)
+Fail Invalid <msub> should lay out as an mrow (count == 3)
+Fail Invalid <msub> should lay out as an mrow (count == 4)
+Fail Invalid <msub> should lay out as an mrow (count == 5)
+Pass Invalid <msup> should lay out as an mrow (count == 0)
+Fail Invalid <msup> should lay out as an mrow (count == 1)
+Fail Invalid <msup> should lay out as an mrow (count == 3)
+Fail Invalid <msup> should lay out as an mrow (count == 4)
+Fail Invalid <msup> should lay out as an mrow (count == 5)
+Pass Invalid <msubsup> should lay out as an mrow (count == 0)
+Fail Invalid <msubsup> should lay out as an mrow (count == 1)
+Fail Invalid <msubsup> should lay out as an mrow (count == 2)
+Fail Invalid <msubsup> should lay out as an mrow (count == 4)
+Fail Invalid <msubsup> should lay out as an mrow (count == 5)
+Pass Invalid <mmultiscripts> should lay out as an mrow (count == 0)
+Fail Invalid <mmultiscripts> should lay out as an mrow (count == 2)
+Fail Invalid <mmultiscripts> should lay out as an mrow (count == 4)
+Fail Invalid <mmultiscripts> should lay out as an mrow (count == 7)
+Fail Invalid <mmultiscripts> should lay out as an mrow (count == 9)
+Fail Invalid <mmultiscripts> should lay out as an mrow (first in-flow child is an <mprescripts>)
+Fail Invalid <mmultiscripts> should lay out as an mrow (one of the even number of children after the first <mprescripts> is an <mprescripts>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/mrow-preferred-width.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/mrow-preferred-width.txt
new file mode 100644
index 00000000000..4911d8abca0
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/mrow-preferred-width.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail Preferred width of mrow with mspace children
+Fail Preferred width of mrow with mn and mo children
+Fail Preferred width of mrow with mn and embellished op children
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/no-spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/no-spacing.txt
new file mode 100644
index 00000000000..69359a431ac
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/no-spacing.txt
@@ -0,0 +1,59 @@
+Harness status: OK
+
+Found 54 tests
+
+54 Fail
+Fail Spacing inside an <mfrac> child of <math>.
+Fail Spacing around an <mfrac> child of an <math>.
+Fail Spacing inside an <mfrac> child of <mrow>.
+Fail Spacing around an <mfrac> child of an <mrow>.
+Fail Spacing inside an <mfrac> child of <mtd>.
+Fail Spacing around an <mfrac> child of an <mtd>.
+Fail Spacing inside an <msub> child of <math>.
+Fail Spacing around an <msub> child of an <math>.
+Fail Spacing inside an <msub> child of <mrow>.
+Fail Spacing around an <msub> child of an <mrow>.
+Fail Spacing inside an <msub> child of <mtd>.
+Fail Spacing around an <msub> child of an <mtd>.
+Fail Spacing inside an <msup> child of <math>.
+Fail Spacing around an <msup> child of an <math>.
+Fail Spacing inside an <msup> child of <mrow>.
+Fail Spacing around an <msup> child of an <mrow>.
+Fail Spacing inside an <msup> child of <mtd>.
+Fail Spacing around an <msup> child of an <mtd>.
+Fail Spacing inside an <msubsup> child of <math>.
+Fail Spacing around an <msubsup> child of an <math>.
+Fail Spacing inside an <msubsup> child of <mrow>.
+Fail Spacing around an <msubsup> child of an <mrow>.
+Fail Spacing inside an <msubsup> child of <mtd>.
+Fail Spacing around an <msubsup> child of an <mtd>.
+Fail Spacing inside an <mmultiscripts> child of <math>.
+Fail Spacing around an <mmultiscripts> child of an <math>.
+Fail Spacing inside an <mmultiscripts> child of <mrow>.
+Fail Spacing around an <mmultiscripts> child of an <mrow>.
+Fail Spacing inside an <mmultiscripts> child of <mtd>.
+Fail Spacing around an <mmultiscripts> child of an <mtd>.
+Fail Spacing inside an <munder> child of <math>.
+Fail Spacing around an <munder> child of an <math>.
+Fail Spacing inside an <munder> child of <mrow>.
+Fail Spacing around an <munder> child of an <mrow>.
+Fail Spacing inside an <munder> child of <mtd>.
+Fail Spacing around an <munder> child of an <mtd>.
+Fail Spacing inside an <mover> child of <math>.
+Fail Spacing around an <mover> child of an <math>.
+Fail Spacing inside an <mover> child of <mrow>.
+Fail Spacing around an <mover> child of an <mrow>.
+Fail Spacing inside an <mover> child of <mtd>.
+Fail Spacing around an <mover> child of an <mtd>.
+Fail Spacing inside an <munderover> child of <math>.
+Fail Spacing around an <munderover> child of an <math>.
+Fail Spacing inside an <munderover> child of <mrow>.
+Fail Spacing around an <munderover> child of an <mrow>.
+Fail Spacing inside an <munderover> child of <mtd>.
+Fail Spacing around an <munderover> child of an <mtd>.
+Fail Spacing inside an <mroot> child of <math>.
+Fail Spacing around an <mroot> child of an <math>.
+Fail Spacing inside an <mroot> child of <mrow>.
+Fail Spacing around an <mroot> child of an <mrow>.
+Fail Spacing inside an <mroot> child of <mtd>.
+Fail Spacing around an <mroot> child of an <mtd>.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/spacing-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/spacing-002.txt
new file mode 100644
index 00000000000..62ca5c1567e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/spacing-002.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail Spacing properly set for <mo> with a previous sibling and a next sibling..
+Fail Spacing properly set for <mo> with only a next sibling.
+Fail Spacing properly set for <mo> with only a previous sibling.
+Fail Spacing properly set for <mo> with no previous/next siblings (aka embellished operator).
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/spacing.txt
new file mode 100644
index 00000000000..51d2c8911d1
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/mrow/spacing.txt
@@ -0,0 +1,17 @@
+Harness status: OK
+
+Found 12 tests
+
+12 Fail
+Fail operator spacing inside Mrow
+Fail operator spacing inside Sqrt
+Fail operator spacing inside Style
+Fail operator spacing inside Error
+Fail operator spacing inside Phantom
+Fail operator spacing inside Math
+Fail operator spacing inside Menclose
+Fail operator spacing inside Mpadded
+Fail operator spacing inside Unknown
+Fail operator spacing inside Fenced
+Fail operator spacing inside A
+Fail operator spacing inside Mtd
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/character-level-mirroring.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/character-level-mirroring.txt
new file mode 100644
index 00000000000..102f0b982df
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/character-level-mirroring.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail Base glyph (0.5em)
+Fail Size variant (1em)
+Fail Glyph assembly (4em)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/display-operator-min-height-no-workaround.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/display-operator-min-height-no-workaround.txt
new file mode 100644
index 00000000000..ad3401ff1c6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/display-operator-min-height-no-workaround.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail DisplayOperatorMinHeight is not modified
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-001.txt
new file mode 100644
index 00000000000..e8dfcb993af
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-001.txt
@@ -0,0 +1,45 @@
+Harness status: OK
+
+Found 40 tests
+
+40 Fail
+Fail mrow (embellished operator)
+Fail mrow (embellished operator, from in-flow children)
+Fail mrow (not embellished operator)
+Fail mrow (not embellished operator, from in-flow children)
+Fail mstyle (embellished operator)
+Fail mstyle (embellished operator, from in-flow children)
+Fail mstyle (not embellished operator)
+Fail mstyle (not embellished operator, from in-flow children)
+Fail mphantom (embellished operator)
+Fail mphantom (embellished operator, from in-flow children)
+Fail mphantom (not embellished operator)
+Fail mphantom (not embellished operator, from in-flow children)
+Fail mpadded (embellished operator)
+Fail mpadded (embellished operator, from in-flow children)
+Fail mpadded (not embellished operator)
+Fail mpadded (not embellished operator, from in-flow children)
+Fail merror (embellished operator)
+Fail merror (embellished operator, from in-flow children)
+Fail merror (not embellished operator)
+Fail merror (not embellished operator, from in-flow children)
+Fail mprescripts (embellished operator)
+Fail mprescripts (embellished operator, from in-flow children)
+Fail mprescripts (not embellished operator)
+Fail mprescripts (not embellished operator, from in-flow children)
+Fail none (embellished operator)
+Fail none (embellished operator, from in-flow children)
+Fail none (not embellished operator)
+Fail none (not embellished operator, from in-flow children)
+Fail unknown (embellished operator)
+Fail unknown (embellished operator, from in-flow children)
+Fail unknown (not embellished operator)
+Fail unknown (not embellished operator, from in-flow children)
+Fail mfenced (embellished operator)
+Fail mfenced (embellished operator, from in-flow children)
+Fail mfenced (not embellished operator)
+Fail mfenced (not embellished operator, from in-flow children)
+Fail a (embellished operator)
+Fail a (embellished operator, from in-flow children)
+Fail a (not embellished operator)
+Fail a (not embellished operator, from in-flow children)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-002.txt
new file mode 100644
index 00000000000..47702c11fde
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-002.txt
@@ -0,0 +1,37 @@
+Harness status: OK
+
+Found 32 tests
+
+32 Fail
+Fail msub (embellished operator)
+Fail msub (embellished operator, from in-flow children)
+Fail msub (not embellished operator)
+Fail msub (not embellished operator, from in-flow children)
+Fail msup (embellished operator)
+Fail msup (embellished operator, from in-flow children)
+Fail msup (not embellished operator)
+Fail msup (not embellished operator, from in-flow children)
+Fail msubsup (embellished operator)
+Fail msubsup (embellished operator, from in-flow children)
+Fail msubsup (not embellished operator)
+Fail msubsup (not embellished operator, from in-flow children)
+Fail munder (embellished operator)
+Fail munder (embellished operator, from in-flow children)
+Fail munder (not embellished operator)
+Fail munder (not embellished operator, from in-flow children)
+Fail mover (embellished operator)
+Fail mover (embellished operator, from in-flow children)
+Fail mover (not embellished operator)
+Fail mover (not embellished operator, from in-flow children)
+Fail munderover (embellished operator)
+Fail munderover (embellished operator, from in-flow children)
+Fail munderover (not embellished operator)
+Fail munderover (not embellished operator, from in-flow children)
+Fail mmultiscripts (embellished operator)
+Fail mmultiscripts (embellished operator, from in-flow children)
+Fail mmultiscripts (not embellished operator)
+Fail mmultiscripts (not embellished operator, from in-flow children)
+Fail mfrac (embellished operator)
+Fail mfrac (embellished operator, from in-flow children)
+Fail mfrac (not embellished operator)
+Fail mfrac (not embellished operator, from in-flow children)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-003.txt
new file mode 100644
index 00000000000..038c1b612d9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-003.txt
@@ -0,0 +1,19 @@
+Harness status: OK
+
+Found 14 tests
+
+14 Fail
+Fail maction (embellished operator)
+Fail maction (embellished operator, from in-flow children)
+Fail maction (not embellished operator)
+Fail maction (not embellished operator, from in-flow children)
+Fail maction (not embellished operator, empty)
+Fail maction (embellished operator, one child)
+Fail maction (embellished operator, complex)
+Fail semantics (embellished operator)
+Fail semantics (embellished operator, from in-flow children)
+Fail semantics (not embellished operator)
+Fail semantics (not embellished operator, from in-flow children)
+Fail semantics (not embellished operator, empty)
+Fail semantics (embellished operator, one child)
+Fail semantics (embellished operator, complex)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-004.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-004.txt
new file mode 100644
index 00000000000..509e0b301f9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-004.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 10 tests
+
+10 Fail
+Fail Vertical stretching performed for math > mo.
+Fail Vertical stretching performed for Stretching for math[display=block] > mo.
+Fail Vertical stretching performed for math > mrow > mo.
+Fail Vertical stretching performed for Stretching for math[display=block] > mrow > mo.
+Fail Vertical stretching performed for math > mrow > mrow > mo.
+Fail Vertical stretching performed for Stretching for math[display=block] > mrow > mrow > mo.
+Fail Vertical stretching performed for math > mrow > mrow > mrow > mo.
+Fail Vertical stretching performed for Stretching for math[display=block] > mrow > mrow > mrow > mo.
+Fail Vertical stretching performed for math > mrow > mrow > mrow > mrow > mo.
+Fail Vertical stretching performed for Stretching for math[display=block] > mrow > mrow > mrow > mrow > mo.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-dynamic-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-dynamic-002.txt
new file mode 100644
index 00000000000..96f9eff0af5
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-dynamic-002.txt
@@ -0,0 +1,13 @@
+Harness status: OK
+
+Found 8 tests
+
+8 Fail
+Fail container1: Initially an embellished operator
+Fail container2: Initially not an embellished operator
+Fail container1: No longer an embellished operator
+Fail container2: Became an embellished operator
+Fail container3: Initially an embellished operator (testing space-like)
+Fail container4/space-like: Initially not an embellished operator (testing space-like)
+Fail container3: No longer an embellished operator (testing space-like)
+Fail container4: Became an embellished operator (testing space-like)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/largeop-hit-testing.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/largeop-hit-testing.txt
new file mode 100644
index 00000000000..c538adcda14
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/largeop-hit-testing.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Large op hit testing
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-axis-height-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-axis-height-1.txt
new file mode 100644
index 00000000000..822b2d8ad19
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-axis-height-1.txt
@@ -0,0 +1,14 @@
+Harness status: OK
+
+Found 9 tests
+
+9 Fail
+Fail symmetric stretching with respect to the math axis (size variant)
+Fail symmetric stretching with respect to the math axis (glyph assembly)
+Fail Tascent = Tdescent = 0, minsize = 14em
+Fail Tascent = 6em > AxisHeight, Tdescent = 1em, symmetric = false, minsize = 14em
+Fail Tascent = 4em < AxisHeight, Tdescent = 3em, symmetric = false, minsize = 14em
+Fail Tascent = 6em > AxisHeight, Tdescent = 22em, symmetric = false, maxsize = 14em
+Fail Tascent = 4em < AxisHeight, Tdescent = 24em, symmetric = false, maxsize = 14em
+Fail symmetric stretching with respect to the math axis (minsize = 14em)
+Fail symmetric stretching with respect to the math axis (maxsize = 14em)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-font-relative-lengths-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-font-relative-lengths-001.txt
new file mode 100644
index 00000000000..bf19fad6a07
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-font-relative-lengths-001.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 4 tests
+
+1 Pass
+3 Fail
+Fail font-relative lspace refers to the core operator
+Fail font-relative rspace refers to the core operator
+Fail font-relative minsize refers to the core operator
+Pass font-relative maxsize refers to the core operator
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-lspace-rspace-5.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-lspace-rspace-5.txt
new file mode 100644
index 00000000000..58bfe707d01
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-lspace-rspace-5.txt
@@ -0,0 +1,53 @@
+Harness status: OK
+
+Found 48 tests
+
+48 Fail
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, LTR, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, LTR, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, LTR, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, LTR, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, LTR, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, LTR, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, LTR, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, LTR, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, LTR, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, LTR, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, LTR, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, LTR, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, LTR, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, LTR, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, LTR, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, LTR, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, RTL, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, RTL, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, RTL, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, not embellished, RTL, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, RTL, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, RTL, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, RTL, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, not embellished, RTL, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, RTL, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, RTL, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, RTL, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of math, embellished, RTL, glyph assembly).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, RTL, normal text).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, RTL, largeop variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, RTL, stretchy variant).
+Fail lspace/rspace spacing correctly set around operator (child of mtd, embellished, RTL, glyph assembly).
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-minsize-maxsize-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-minsize-maxsize-001.txt
new file mode 100644
index 00000000000..160a1507f72
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-minsize-maxsize-001.txt
@@ -0,0 +1,12 @@
+Harness status: OK
+
+Found 6 tests
+
+1 Pass
+5 Fail
+Fail minsize < 0 is treated as 0
+Fail maxsize < minsize is treated as maxsize = minsize
+Pass minsize < maxsize < 0 is treated as maxsize = minsize = 0
+Fail target size = 0 is treated as Tascent = Tdescent = minsize/2
+Fail minsize/maxsize percentages are relative to the unstretched size
+Fail default minsize/maxsize values
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-no-vertical-adjustment-for-basic-binary-operators.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-no-vertical-adjustment-for-basic-binary-operators.txt
new file mode 100644
index 00000000000..bb633d4d7c5
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-no-vertical-adjustment-for-basic-binary-operators.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Vertical alignment of basic binary operators is not adjusted.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining-default.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining-default.txt
new file mode 100644
index 00000000000..9f66ecf1393
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining-default.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail Default spacing for = + unsupported combining char U+0303
+Fail Default spacing for = + U+0338 + U+20D2 (too many characters)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining.txt
new file mode 100644
index 00000000000..609fd0c5a56
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining.txt
@@ -0,0 +1,13 @@
+Harness status: OK
+
+Found 8 tests
+
+8 Fail
+Fail Spacing around =ΜΈ
+Fail Spacing around =βƒ’
+Fail Spacing around |ΜΈ
+Fail Spacing around |βƒ’
+Fail Spacing around ⋉̸
+Fail Spacing around ⋉⃒
+Fail Spacing around βˆƒΜΈ
+Fail Spacing around βˆƒβƒ’
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-001.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-001.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-002.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-002.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-003.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-003.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-004.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-004.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-004.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-005.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-005.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-005.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-006.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-006.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-006.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-001.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-001.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-002.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-002.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-003.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-003.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-004.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-004.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-004.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-005.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-005.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-005.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-006.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-006.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-006.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-multi-char.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-multi-char.txt
new file mode 100644
index 00000000000..74b099e7917
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-multi-char.txt
@@ -0,0 +1,25 @@
+Harness status: OK
+
+Found 20 tests
+
+20 Fail
+Fail Operator dictionary spacing for "!!" (postfix)
+Fail Operator dictionary spacing for "!=" (infix)
+Fail Operator dictionary spacing for "&&" (infix)
+Fail Operator dictionary spacing for "**" (infix)
+Fail Operator dictionary spacing for "*=" (infix)
+Fail Operator dictionary spacing for "++" (postfix)
+Fail Operator dictionary spacing for "+=" (infix)
+Fail Operator dictionary spacing for "--" (postfix)
+Fail Operator dictionary spacing for "-=" (infix)
+Fail Operator dictionary spacing for "->" (infix)
+Fail Operator dictionary spacing for "//" (infix)
+Fail Operator dictionary spacing for "/=" (infix)
+Fail Operator dictionary spacing for ":=" (infix)
+Fail Operator dictionary spacing for "<=" (infix)
+Fail Operator dictionary spacing for "<>" (infix)
+Fail Operator dictionary spacing for "==" (infix)
+Fail Operator dictionary spacing for ">=" (infix)
+Fail Operator dictionary spacing for "||" (infix)
+Fail Operator dictionary spacing for "||" (postfix)
+Fail Operator dictionary spacing for "||" (prefix)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-001.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-001.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-002.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-002.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-003.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-003.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-004.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-004.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-004.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-005.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-005.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-005.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-006.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-006.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-006.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-001.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-001.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-002.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-002.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-003.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-003.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-004.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-004.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-004.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-005.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-005.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-005.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-006.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-006.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-006.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/symmetric-largeop.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/symmetric-largeop.txt
new file mode 100644
index 00000000000..f43c1f2194e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/symmetric-largeop.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Placement of operators
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/glyph-level-mirroring.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/glyph-level-mirroring.txt
new file mode 100644
index 00000000000..54982ea13d6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/glyph-level-mirroring.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail LTR Direction
+Fail RTL Direction
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/root-parameters-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/root-parameters-1.txt
new file mode 100644
index 00000000000..5d871ac5cf0
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/root-parameters-1.txt
@@ -0,0 +1,12 @@
+Harness status: OK
+
+Found 7 tests
+
+7 Fail
+Fail RadicalDegreeBottomRaisePercent
+Fail RadicalDisplayStyleVerticalGap
+Fail RadicalExtraAscender
+Fail RadicalKernAfterDegree
+Fail RadicalKernBeforeDegree
+Fail RadicalRuleThickness
+Fail RadicalVerticalGap
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/root-parameters-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/root-parameters-2.txt
new file mode 100644
index 00000000000..29ae743c3a9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/radicals/root-parameters-2.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail RadicalKernBeforeDegree = -1em < 0
+Fail RadicalKernBeforeAfterDegree = -5em < -3em = -degree's inline size
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/cramped-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/cramped-001.txt
new file mode 100644
index 00000000000..52b8b50427c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/cramped-001.txt
@@ -0,0 +1,20 @@
+Harness status: OK
+
+Found 15 tests
+
+15 Fail
+Fail child of non-cramped element
+Fail child of cramped element
+Fail child of msqrt
+Fail child of mroot
+Fail child of mfrac
+Fail child of msub
+Fail child of msup
+Fail child of msubsup
+Fail child of munder
+Fail child of mover (non-accent overscript)
+Fail child of munderover (non-accent overscript)
+Fail accent child of mover (accent overscript)
+Fail accent child of munderover (accent overscript)
+Fail mmultiscripts
+Fail element with specified CSS math-shift
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/empty-underover.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/empty-underover.txt
new file mode 100644
index 00000000000..54b16298e52
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/empty-underover.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Size of empty script elements
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-1.txt
new file mode 100644
index 00000000000..75fb23c8037
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-1.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Fail
+Fail Respective horizontal positions
+Fail Alignment of the base on the baseline
+Fail Vertical position of scripts
+Fail Width of scripted elements
+Fail Height of scripted elements
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-2.txt
new file mode 100644
index 00000000000..66187b49510
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-2.txt
@@ -0,0 +1,12 @@
+Harness status: OK
+
+Found 6 tests
+
+1 Pass
+5 Fail
+Fail Respective horizontal positions
+Fail Alignment of the base on the baseline
+Fail Vertical position of scripts
+Fail Width of scripted elements
+Fail Height of scripted elements
+Pass Size of empty elements
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-3.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-3.txt
new file mode 100644
index 00000000000..ac22644855b
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-3.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Fail
+Fail Alignment of the base on the baseline
+Fail Dimensions of the scripted elements
+Fail Vertical positions of scripts
+Fail Horizontal alignment of scripts
+Fail Horizontal positions of scripts
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-4.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-4.txt
new file mode 100644
index 00000000000..c650728b3b2
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-4.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail Alignment on the baseline for bases of different heights
+Fail Vertical position of the scripts for bases of different heights
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-5.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-5.txt
new file mode 100644
index 00000000000..0a0d4b4cec2
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-5.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail Alignment on the baseline with different and large script heights
+Fail Tall subscripts/superscripts are not placed too high/low
+Fail No collisions for tall subscripts and superscripts
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-6-rtl.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-6-rtl.txt
new file mode 100644
index 00000000000..54594308c2f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-6-rtl.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Fail
+Fail mprescripts RTL coordinates and sizes (rtl 2 postscripts)
+Fail mprescripts RTL coordinates and sizes (rtl 2 prescripts)
+Fail mprescripts RTL coordinates and sizes (rtl 2 prescripts, 4 postscripts)
+Fail mprescripts RTL coordinates and sizes (rtl 4 prescripts, 2 postscripts)
+Fail mprescripts RTL coordinates and sizes (rtl prescripts with padding/border/margin)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-6.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-6.txt
new file mode 100644
index 00000000000..455ebc173ef
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-6.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Fail
+Fail mprescripts coordinates and sizes (2 postscripts)
+Fail mprescripts coordinates and sizes (2 prescripts)
+Fail mprescripts coordinates and sizes (2 prescripts, 4 postscripts)
+Fail mprescripts coordinates and sizes (4 prescripts, 2 postscripts)
+Fail mprescripts coordinates and sizes (prescripts with padding/border/margin)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-1.txt
new file mode 100644
index 00000000000..fbee4de4cce
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-1.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 10 tests
+
+10 Fail
+Fail SpaceAfterScript
+Fail SuperscriptShiftUp
+Fail SuperscriptShiftUpCramped
+Fail SubscriptShiftDown
+Fail SubSuperscriptGapMin
+Fail SuperscriptBottomMaxWithSubscript
+Fail SubscriptTopMax
+Fail SuperscriptBottomMin
+Fail SubscriptBaselineDrop
+Fail SuperscriptBaselineDrop
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-2.txt
new file mode 100644
index 00000000000..3576c5b3351
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-2.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail Null Italic Correction
+Fail NonNull Italic Correction (MathGlyphVariantRecord)
+Fail NonNull Italic Correction (GlyphAssembly)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-1.txt
new file mode 100644
index 00000000000..b7d78674d76
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-1.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 5 tests
+
+5 Fail
+Fail Alignment of the base on the baseline
+Fail Horizontal alignments of base and scripts
+Fail Relative vertical positions of base and scripts
+Fail Width of scripted elements
+Fail Height of scripted elements
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-1.txt
new file mode 100644
index 00000000000..0c8941d256d
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-1.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail LowerLimitBaselineDropMin
+Fail LowerLimitGapMin
+Fail UpperLimitBaselineRiseMin
+Fail UpperLimitGapMin
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-2.txt
new file mode 100644
index 00000000000..1660b34456e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-2.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail StretchStackBottomShiftDown
+Fail StretchStackGapBelowMin
+Fail StretchStackTopShiftUp
+Fail StretchStackGapAboveMin
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-3.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-3.txt
new file mode 100644
index 00000000000..6f8d28f2497
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-3.txt
@@ -0,0 +1,13 @@
+Harness status: OK
+
+Found 8 tests
+
+8 Fail
+Fail Baseline alignment
+Fail Heights of bases
+Fail AccentBaseHeight, UnderbarExtraDescender
+Fail AccentBaseHeight, UnderbarVerticalGap
+Fail AccentBaseHeight, OverbarExtraAscender
+Fail AccentBaseHeight, OverbarVerticalGap
+Fail Dynamic change of accentunder attribute
+Fail Dynamic change of accent attribute
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-4.tentative.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-4.tentative.txt
new file mode 100644
index 00000000000..3573e116310
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-4.tentative.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail Baseline alignment
+Fail Heights of bases
+Fail AccentBaseHeight, UnderbarExtraDescender
+Fail AccentBaseHeight, UnderbarVerticalGap
+Fail AccentBaseHeight, OverbarExtraAscender
+Fail AccentBaseHeight, OverbarVerticalGap
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-1.txt
new file mode 100644
index 00000000000..0c8941d256d
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-1.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail LowerLimitBaselineDropMin
+Fail LowerLimitGapMin
+Fail UpperLimitBaselineRiseMin
+Fail UpperLimitGapMin
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-2.txt
new file mode 100644
index 00000000000..1660b34456e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-2.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail StretchStackBottomShiftDown
+Fail StretchStackGapBelowMin
+Fail StretchStackTopShiftUp
+Fail StretchStackGapAboveMin
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/mspace-width-height-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/mspace-width-height-001.txt
new file mode 100644
index 00000000000..8cf88fe1ca6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/mspace-width-height-001.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail width attribute + width property
+Fail height/depth attributes + height property
+Fail height attribute + height property
+Fail depth attribute + height property
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-1.txt
new file mode 100644
index 00000000000..fc18114dd42
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-1.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 9 tests
+
+1 Pass
+8 Fail
+Fail Empty mspace
+Fail Different widths
+Fail Different heights
+Fail Different depths
+Fail Various combinations of height, depth and width.
+Pass Preferred width
+Fail dynamic attributes (remove)
+Fail dynamic attributes (attach)
+Fail dynamic attributes (modify)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-001.txt
new file mode 100644
index 00000000000..8c73a668e0c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-001.txt
@@ -0,0 +1,19 @@
+Harness status: OK
+
+Found 14 tests
+
+14 Fail
+Fail mtext is space-like
+Fail mspace is space-like
+Fail space-like mrow
+Fail non-space-like mrow
+Fail space-like mstyle
+Fail non-space-like mstyle
+Fail space-like mphantom
+Fail non-space-like mphantom
+Fail space-like mpadded
+Fail non-space-like mpadded
+Fail space-like merror
+Fail non-space-like merror
+Fail space-like menclose
+Fail non-space-like menclose
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-002.txt
new file mode 100644
index 00000000000..548e3351dc4
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-002.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail space-like maction
+Fail space-like maction (no first child)
+Fail non-space like maction (first child not space-like)
+Fail space-like semantics
+Fail space-like semantics (no first child)
+Fail non-space like semantics (first child not space-like)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-003.txt
new file mode 100644
index 00000000000..b870c4d84ac
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-003.txt
@@ -0,0 +1,20 @@
+Harness status: OK
+
+Found 15 tests
+
+15 Fail
+Fail mroot is not space-like
+Fail mfrac is not space-like
+Fail mi is not space-like
+Fail mmultiscripts is not space-like
+Fail mn is not space-like
+Fail mo is not space-like
+Fail mover is not space-like
+Fail munder is not space-like
+Fail ms is not space-like
+Fail munderover is not space-like
+Fail msup is not space-like
+Fail msub is not space-like
+Fail msubsup is not space-like
+Fail msqrt is not space-like
+Fail mtable is not space-like
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-004.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-004.txt
new file mode 100644
index 00000000000..559cde8d385
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/spaces/space-like-004.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail complex space-like subtree
+Fail complex space-like subtree, from in-flow children
+Fail complex non-space-like subtree
+Fail complex non-space-like subtree, from in-flow children
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/dynamic-table-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/dynamic-table-001.txt
new file mode 100644
index 00000000000..8c85147577a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/dynamic-table-001.txt
@@ -0,0 +1,14 @@
+Harness status: OK
+
+Found 9 tests
+
+9 Fail
+Fail Filling an empty mtable element
+Fail Filling empty mtr elements
+Fail Filling empty mtd elements
+Fail Filling an empty mtr element
+Fail Filling an empty mtd element
+Fail Adding missing elements
+Fail Removing a row
+Fail Removing a column
+Fail Removing extra elements
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-001.txt
new file mode 100644
index 00000000000..57e311dc33a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-001.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail Layout of table-001
+Fail Layout of table-002
+Fail Layout of table-003
+Fail Layout of table-011
+Fail Layout of table-012
+Fail Layout of table-013
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-002.txt
new file mode 100644
index 00000000000..190a2aff47e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-002.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail Vertical alignment of cells
+Fail Horizontal alignment of cells
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-003.txt
new file mode 100644
index 00000000000..190a2aff47e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-003.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail Vertical alignment of cells
+Fail Horizontal alignment of cells
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-axis-height.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-axis-height.txt
new file mode 100644
index 00000000000..10f36dbc6f0
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-axis-height.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail AxisHeight
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-cell-mrow-layout.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-cell-mrow-layout.txt
new file mode 100644
index 00000000000..84cda8a92eb
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/tables/table-cell-mrow-layout.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail <mtd> relies on mrow algorithm to layout its children
+Fail <mtable> layout does not change if children of <mtd> elements are wrapped in an explicit <mrow>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/attribute-mapping-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/attribute-mapping-002.txt
new file mode 100644
index 00000000000..96ac3d0c36c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/attribute-mapping-002.txt
@@ -0,0 +1,138 @@
+Harness status: OK
+
+Found 132 tests
+
+99 Pass
+33 Fail
+Pass mathvariant on the math element is not mapped to CSS text-transform
+Pass scriptlevel on the math element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the math element are not mapped to math-depth(...)
+Pass displaystyle on the math element is mapped to CSS math-style
+Pass mathvariant on the a element is not mapped to CSS text-transform
+Pass scriptlevel on the a element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the a element are not mapped to math-depth(...)
+Pass displaystyle on the a element is mapped to CSS math-style
+Pass mathvariant on the annotation element is not mapped to CSS text-transform
+Pass scriptlevel on the annotation element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the annotation element are not mapped to math-depth(...)
+Pass displaystyle on the annotation element is mapped to CSS math-style
+Pass mathvariant on the annotation-xml element is not mapped to CSS text-transform
+Pass scriptlevel on the annotation-xml element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the annotation-xml element are not mapped to math-depth(...)
+Pass displaystyle on the annotation-xml element is mapped to CSS math-style
+Pass mathvariant on the maction element is not mapped to CSS text-transform
+Pass scriptlevel on the maction element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the maction element are not mapped to math-depth(...)
+Pass displaystyle on the maction element is mapped to CSS math-style
+Pass mathvariant on the menclose element is not mapped to CSS text-transform
+Pass scriptlevel on the menclose element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the menclose element are not mapped to math-depth(...)
+Pass displaystyle on the menclose element is mapped to CSS math-style
+Pass mathvariant on the merror element is not mapped to CSS text-transform
+Pass scriptlevel on the merror element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the merror element are not mapped to math-depth(...)
+Pass displaystyle on the merror element is mapped to CSS math-style
+Pass mathvariant on the mfrac element is not mapped to CSS text-transform
+Pass scriptlevel on the mfrac element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mfrac element are not mapped to math-depth(...)
+Pass displaystyle on the mfrac element is mapped to CSS math-style
+Pass mathvariant on the mi element is mapped to CSS text-transform
+Pass scriptlevel on the mi element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mi element are not mapped to math-depth(...)
+Pass displaystyle on the mi element is mapped to CSS math-style
+Pass mathvariant on the mmultiscripts element is not mapped to CSS text-transform
+Pass scriptlevel on the mmultiscripts element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mmultiscripts element are not mapped to math-depth(...)
+Pass displaystyle on the mmultiscripts element is mapped to CSS math-style
+Pass mathvariant on the mn element is not mapped to CSS text-transform
+Pass scriptlevel on the mn element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mn element are not mapped to math-depth(...)
+Pass displaystyle on the mn element is mapped to CSS math-style
+Pass mathvariant on the mo element is not mapped to CSS text-transform
+Pass scriptlevel on the mo element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mo element are not mapped to math-depth(...)
+Pass displaystyle on the mo element is mapped to CSS math-style
+Pass mathvariant on the mover element is not mapped to CSS text-transform
+Pass scriptlevel on the mover element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mover element are not mapped to math-depth(...)
+Pass displaystyle on the mover element is mapped to CSS math-style
+Pass mathvariant on the mpadded element is not mapped to CSS text-transform
+Pass scriptlevel on the mpadded element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mpadded element are not mapped to math-depth(...)
+Pass displaystyle on the mpadded element is mapped to CSS math-style
+Pass mathvariant on the mphantom element is not mapped to CSS text-transform
+Pass scriptlevel on the mphantom element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mphantom element are not mapped to math-depth(...)
+Pass displaystyle on the mphantom element is mapped to CSS math-style
+Pass mathvariant on the mprescripts element is not mapped to CSS text-transform
+Pass scriptlevel on the mprescripts element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mprescripts element are not mapped to math-depth(...)
+Pass displaystyle on the mprescripts element is mapped to CSS math-style
+Pass mathvariant on the mroot element is not mapped to CSS text-transform
+Pass scriptlevel on the mroot element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mroot element are not mapped to math-depth(...)
+Pass displaystyle on the mroot element is mapped to CSS math-style
+Pass mathvariant on the mrow element is not mapped to CSS text-transform
+Pass scriptlevel on the mrow element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mrow element are not mapped to math-depth(...)
+Pass displaystyle on the mrow element is mapped to CSS math-style
+Pass mathvariant on the ms element is not mapped to CSS text-transform
+Pass scriptlevel on the ms element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the ms element are not mapped to math-depth(...)
+Pass displaystyle on the ms element is mapped to CSS math-style
+Pass mathvariant on the mspace element is not mapped to CSS text-transform
+Pass scriptlevel on the mspace element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mspace element are not mapped to math-depth(...)
+Pass displaystyle on the mspace element is mapped to CSS math-style
+Pass mathvariant on the msqrt element is not mapped to CSS text-transform
+Pass scriptlevel on the msqrt element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the msqrt element are not mapped to math-depth(...)
+Pass displaystyle on the msqrt element is mapped to CSS math-style
+Pass mathvariant on the mstyle element is not mapped to CSS text-transform
+Pass scriptlevel on the mstyle element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mstyle element are not mapped to math-depth(...)
+Pass displaystyle on the mstyle element is mapped to CSS math-style
+Pass mathvariant on the msub element is not mapped to CSS text-transform
+Pass scriptlevel on the msub element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the msub element are not mapped to math-depth(...)
+Pass displaystyle on the msub element is mapped to CSS math-style
+Pass mathvariant on the msubsup element is not mapped to CSS text-transform
+Pass scriptlevel on the msubsup element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the msubsup element are not mapped to math-depth(...)
+Pass displaystyle on the msubsup element is mapped to CSS math-style
+Pass mathvariant on the msup element is not mapped to CSS text-transform
+Pass scriptlevel on the msup element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the msup element are not mapped to math-depth(...)
+Pass displaystyle on the msup element is mapped to CSS math-style
+Pass mathvariant on the mtable element is not mapped to CSS text-transform
+Pass scriptlevel on the mtable element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mtable element are not mapped to math-depth(...)
+Pass displaystyle on the mtable element is mapped to CSS math-style
+Pass mathvariant on the mtd element is not mapped to CSS text-transform
+Pass scriptlevel on the mtd element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mtd element are not mapped to math-depth(...)
+Pass displaystyle on the mtd element is mapped to CSS math-style
+Pass mathvariant on the mtext element is not mapped to CSS text-transform
+Pass scriptlevel on the mtext element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mtext element are not mapped to math-depth(...)
+Pass displaystyle on the mtext element is mapped to CSS math-style
+Pass mathvariant on the mtr element is not mapped to CSS text-transform
+Pass scriptlevel on the mtr element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the mtr element are not mapped to math-depth(...)
+Pass displaystyle on the mtr element is mapped to CSS math-style
+Pass mathvariant on the munder element is not mapped to CSS text-transform
+Pass scriptlevel on the munder element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the munder element are not mapped to math-depth(...)
+Pass displaystyle on the munder element is mapped to CSS math-style
+Pass mathvariant on the munderover element is not mapped to CSS text-transform
+Pass scriptlevel on the munderover element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the munderover element are not mapped to math-depth(...)
+Pass displaystyle on the munderover element is mapped to CSS math-style
+Pass mathvariant on the none element is not mapped to CSS text-transform
+Pass scriptlevel on the none element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the none element are not mapped to math-depth(...)
+Pass displaystyle on the none element is mapped to CSS math-style
+Pass mathvariant on the semantics element is not mapped to CSS text-transform
+Pass scriptlevel on the semantics element is mapped to math-depth(...)
+Fail invalid scriptlevel values on the semantics element are not mapped to math-depth(...)
+Pass displaystyle on the semantics element is mapped to CSS math-style
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-1.txt
new file mode 100644
index 00000000000..a48c2c70fd3
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-1.txt
@@ -0,0 +1,41 @@
+Harness status: OK
+
+Found 36 tests
+
+36 Fail
+Fail math element (lowercase)
+Fail math element (explicit display, lowercase)
+Fail mstyle element (lowercase)
+Fail mtable element (lowercase)
+Fail mfrac element (lowercase)
+Fail mroot element (lowercase)
+Fail msub element (lowercase)
+Fail msup element (lowercase)
+Fail msubsup element (lowercase)
+Fail munder element (lowercase)
+Fail mover element (lowercase)
+Fail munderover element (lowercase)
+Fail math element (uppercase)
+Fail math element (explicit display, uppercase)
+Fail mstyle element (uppercase)
+Fail mtable element (uppercase)
+Fail mfrac element (uppercase)
+Fail mroot element (uppercase)
+Fail msub element (uppercase)
+Fail msup element (uppercase)
+Fail msubsup element (uppercase)
+Fail munder element (uppercase)
+Fail mover element (uppercase)
+Fail munderover element (uppercase)
+Fail math element (alternate_case)
+Fail math element (explicit display, alternate_case)
+Fail mstyle element (alternate_case)
+Fail mtable element (alternate_case)
+Fail mfrac element (alternate_case)
+Fail mroot element (alternate_case)
+Fail msub element (alternate_case)
+Fail msup element (alternate_case)
+Fail msubsup element (alternate_case)
+Fail munder element (alternate_case)
+Fail mover element (alternate_case)
+Fail munderover element (alternate_case)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-2.txt
new file mode 100644
index 00000000000..c477608d0f8
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-2.txt
@@ -0,0 +1,32 @@
+Harness status: OK
+
+Found 27 tests
+
+27 Fail
+Fail mtable element (lowercase)
+Fail mfrac element (lowercase)
+Fail mroot element (lowercase)
+Fail msub element (lowercase)
+Fail msup element (lowercase)
+Fail msubsup element (lowercase)
+Fail munder element (lowercase)
+Fail mover element (lowercase)
+Fail munderover element (lowercase)
+Fail mtable element (uppercase)
+Fail mfrac element (uppercase)
+Fail mroot element (uppercase)
+Fail msub element (uppercase)
+Fail msup element (uppercase)
+Fail msubsup element (uppercase)
+Fail munder element (uppercase)
+Fail mover element (uppercase)
+Fail munderover element (uppercase)
+Fail mtable element (alternate_case)
+Fail mfrac element (alternate_case)
+Fail mroot element (alternate_case)
+Fail msub element (alternate_case)
+Fail msup element (alternate_case)
+Fail msubsup element (alternate_case)
+Fail munder element (alternate_case)
+Fail mover element (alternate_case)
+Fail munderover element (alternate_case)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-3.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-3.txt
new file mode 100644
index 00000000000..456ea981f9f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/displaystyle-3.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail movablelimits for munder element (displaystyle=false)
+Fail movablelimits for munder element (displaystyle=true)
+Fail movablelimits for mover element (displaystyle=false)
+Fail movablelimits for mover element (displaystyle=true)
+Fail movablelimits for munderover element (displaystyle=false)
+Fail movablelimits for munderover element (displaystyle=true)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/floats/not-floating-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/floats/not-floating-001.txt
new file mode 100644
index 00000000000..ee1214879a3
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/floats/not-floating-001.txt
@@ -0,0 +1,30 @@
+Harness status: OK
+
+Found 24 tests
+
+11 Pass
+13 Fail
+Pass float child ignored in a
+Fail float child ignored in maction
+Pass float child ignored in menclose
+Pass float child ignored in merror
+Fail float child ignored in mfrac
+Fail float child ignored in mi
+Pass float child ignored in mmultiscripts
+Fail float child ignored in mn
+Fail float child ignored in mo
+Fail float child ignored in mover
+Pass float child ignored in mpadded
+Pass float child ignored in mphantom
+Fail float child ignored in mroot
+Pass float child ignored in mrow
+Fail float child ignored in ms
+Pass float child ignored in msqrt
+Pass float child ignored in mstyle
+Fail float child ignored in msub
+Pass float child ignored in msubsup
+Fail float child ignored in msup
+Fail float child ignored in mtext
+Fail float child ignored in munder
+Pass float child ignored in munderover
+Fail float child ignored in semantics
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/ignored-properties-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/ignored-properties-001.txt
new file mode 100644
index 00000000000..284248cb261
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/ignored-properties-001.txt
@@ -0,0 +1,266 @@
+Harness status: OK
+
+Found 260 tests
+
+10 Pass
+250 Fail
+Fail a preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail a layout is not affected by writing-mode: vertical-rl;
+Fail a preferred width calculation is not affected by white-space: normal;
+Fail a layout is not affected by white-space: normal;
+Fail a preferred width calculation is not affected by float: right;
+Fail a layout is not affected by float: right;
+Fail a preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail a layout is not affected by align-content: end; justify-content: end;
+Fail a preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail a layout is not affected by align-self: end; justify-self: end;
+Fail maction preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail maction layout is not affected by writing-mode: vertical-rl;
+Fail maction preferred width calculation is not affected by white-space: normal;
+Fail maction layout is not affected by white-space: normal;
+Fail maction preferred width calculation is not affected by float: right;
+Fail maction layout is not affected by float: right;
+Fail maction preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail maction layout is not affected by align-content: end; justify-content: end;
+Fail maction preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail maction layout is not affected by align-self: end; justify-self: end;
+Fail menclose preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail menclose layout is not affected by writing-mode: vertical-rl;
+Fail menclose preferred width calculation is not affected by white-space: normal;
+Fail menclose layout is not affected by white-space: normal;
+Fail menclose preferred width calculation is not affected by float: right;
+Fail menclose layout is not affected by float: right;
+Fail menclose preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail menclose layout is not affected by align-content: end; justify-content: end;
+Fail menclose preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail menclose layout is not affected by align-self: end; justify-self: end;
+Fail merror preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail merror layout is not affected by writing-mode: vertical-rl;
+Fail merror preferred width calculation is not affected by white-space: normal;
+Fail merror layout is not affected by white-space: normal;
+Fail merror preferred width calculation is not affected by float: right;
+Fail merror layout is not affected by float: right;
+Fail merror preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail merror layout is not affected by align-content: end; justify-content: end;
+Fail merror preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail merror layout is not affected by align-self: end; justify-self: end;
+Pass mfrac preferred width calculation is not affected by writing-mode: vertical-rl;
+Pass mfrac layout is not affected by writing-mode: vertical-rl;
+Pass mfrac preferred width calculation is not affected by white-space: normal;
+Pass mfrac layout is not affected by white-space: normal;
+Pass mfrac preferred width calculation is not affected by float: right;
+Pass mfrac layout is not affected by float: right;
+Pass mfrac preferred width calculation is not affected by align-content: end; justify-content: end;
+Pass mfrac layout is not affected by align-content: end; justify-content: end;
+Pass mfrac preferred width calculation is not affected by align-self: end; justify-self: end;
+Pass mfrac layout is not affected by align-self: end; justify-self: end;
+Fail mi preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mi layout is not affected by writing-mode: vertical-rl;
+Fail mi preferred width calculation is not affected by white-space: normal;
+Fail mi layout is not affected by white-space: normal;
+Fail mi preferred width calculation is not affected by float: right;
+Fail mi layout is not affected by float: right;
+Fail mi preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mi layout is not affected by align-content: end; justify-content: end;
+Fail mi preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mi layout is not affected by align-self: end; justify-self: end;
+Fail mmultiscripts preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mmultiscripts layout is not affected by writing-mode: vertical-rl;
+Fail mmultiscripts preferred width calculation is not affected by white-space: normal;
+Fail mmultiscripts layout is not affected by white-space: normal;
+Fail mmultiscripts preferred width calculation is not affected by float: right;
+Fail mmultiscripts layout is not affected by float: right;
+Fail mmultiscripts preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mmultiscripts layout is not affected by align-content: end; justify-content: end;
+Fail mmultiscripts preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mmultiscripts layout is not affected by align-self: end; justify-self: end;
+Fail mn preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mn layout is not affected by writing-mode: vertical-rl;
+Fail mn preferred width calculation is not affected by white-space: normal;
+Fail mn layout is not affected by white-space: normal;
+Fail mn preferred width calculation is not affected by float: right;
+Fail mn layout is not affected by float: right;
+Fail mn preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mn layout is not affected by align-content: end; justify-content: end;
+Fail mn preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mn layout is not affected by align-self: end; justify-self: end;
+Fail mo preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mo layout is not affected by writing-mode: vertical-rl;
+Fail mo preferred width calculation is not affected by white-space: normal;
+Fail mo layout is not affected by white-space: normal;
+Fail mo preferred width calculation is not affected by float: right;
+Fail mo layout is not affected by float: right;
+Fail mo preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mo layout is not affected by align-content: end; justify-content: end;
+Fail mo preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mo layout is not affected by align-self: end; justify-self: end;
+Fail mover preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mover layout is not affected by writing-mode: vertical-rl;
+Fail mover preferred width calculation is not affected by white-space: normal;
+Fail mover layout is not affected by white-space: normal;
+Fail mover preferred width calculation is not affected by float: right;
+Fail mover layout is not affected by float: right;
+Fail mover preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mover layout is not affected by align-content: end; justify-content: end;
+Fail mover preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mover layout is not affected by align-self: end; justify-self: end;
+Fail mpadded preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mpadded layout is not affected by writing-mode: vertical-rl;
+Fail mpadded preferred width calculation is not affected by white-space: normal;
+Fail mpadded layout is not affected by white-space: normal;
+Fail mpadded preferred width calculation is not affected by float: right;
+Fail mpadded layout is not affected by float: right;
+Fail mpadded preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mpadded layout is not affected by align-content: end; justify-content: end;
+Fail mpadded preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mpadded layout is not affected by align-self: end; justify-self: end;
+Fail mphantom preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mphantom layout is not affected by writing-mode: vertical-rl;
+Fail mphantom preferred width calculation is not affected by white-space: normal;
+Fail mphantom layout is not affected by white-space: normal;
+Fail mphantom preferred width calculation is not affected by float: right;
+Fail mphantom layout is not affected by float: right;
+Fail mphantom preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mphantom layout is not affected by align-content: end; justify-content: end;
+Fail mphantom preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mphantom layout is not affected by align-self: end; justify-self: end;
+Fail mroot preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mroot layout is not affected by writing-mode: vertical-rl;
+Fail mroot preferred width calculation is not affected by white-space: normal;
+Fail mroot layout is not affected by white-space: normal;
+Fail mroot preferred width calculation is not affected by float: right;
+Fail mroot layout is not affected by float: right;
+Fail mroot preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mroot layout is not affected by align-content: end; justify-content: end;
+Fail mroot preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mroot layout is not affected by align-self: end; justify-self: end;
+Fail mrow preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mrow layout is not affected by writing-mode: vertical-rl;
+Fail mrow preferred width calculation is not affected by white-space: normal;
+Fail mrow layout is not affected by white-space: normal;
+Fail mrow preferred width calculation is not affected by float: right;
+Fail mrow layout is not affected by float: right;
+Fail mrow preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mrow layout is not affected by align-content: end; justify-content: end;
+Fail mrow preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mrow layout is not affected by align-self: end; justify-self: end;
+Fail ms preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail ms layout is not affected by writing-mode: vertical-rl;
+Fail ms preferred width calculation is not affected by white-space: normal;
+Fail ms layout is not affected by white-space: normal;
+Fail ms preferred width calculation is not affected by float: right;
+Fail ms layout is not affected by float: right;
+Fail ms preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail ms layout is not affected by align-content: end; justify-content: end;
+Fail ms preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail ms layout is not affected by align-self: end; justify-self: end;
+Fail mspace preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mspace layout is not affected by writing-mode: vertical-rl;
+Fail mspace preferred width calculation is not affected by white-space: normal;
+Fail mspace layout is not affected by white-space: normal;
+Fail mspace preferred width calculation is not affected by float: right;
+Fail mspace layout is not affected by float: right;
+Fail mspace preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mspace layout is not affected by align-content: end; justify-content: end;
+Fail mspace preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mspace layout is not affected by align-self: end; justify-self: end;
+Fail msqrt preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail msqrt layout is not affected by writing-mode: vertical-rl;
+Fail msqrt preferred width calculation is not affected by white-space: normal;
+Fail msqrt layout is not affected by white-space: normal;
+Fail msqrt preferred width calculation is not affected by float: right;
+Fail msqrt layout is not affected by float: right;
+Fail msqrt preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail msqrt layout is not affected by align-content: end; justify-content: end;
+Fail msqrt preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail msqrt layout is not affected by align-self: end; justify-self: end;
+Fail mstyle preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mstyle layout is not affected by writing-mode: vertical-rl;
+Fail mstyle preferred width calculation is not affected by white-space: normal;
+Fail mstyle layout is not affected by white-space: normal;
+Fail mstyle preferred width calculation is not affected by float: right;
+Fail mstyle layout is not affected by float: right;
+Fail mstyle preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mstyle layout is not affected by align-content: end; justify-content: end;
+Fail mstyle preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mstyle layout is not affected by align-self: end; justify-self: end;
+Fail msub preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail msub layout is not affected by writing-mode: vertical-rl;
+Fail msub preferred width calculation is not affected by white-space: normal;
+Fail msub layout is not affected by white-space: normal;
+Fail msub preferred width calculation is not affected by float: right;
+Fail msub layout is not affected by float: right;
+Fail msub preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail msub layout is not affected by align-content: end; justify-content: end;
+Fail msub preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail msub layout is not affected by align-self: end; justify-self: end;
+Fail msubsup preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail msubsup layout is not affected by writing-mode: vertical-rl;
+Fail msubsup preferred width calculation is not affected by white-space: normal;
+Fail msubsup layout is not affected by white-space: normal;
+Fail msubsup preferred width calculation is not affected by float: right;
+Fail msubsup layout is not affected by float: right;
+Fail msubsup preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail msubsup layout is not affected by align-content: end; justify-content: end;
+Fail msubsup preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail msubsup layout is not affected by align-self: end; justify-self: end;
+Fail msup preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail msup layout is not affected by writing-mode: vertical-rl;
+Fail msup preferred width calculation is not affected by white-space: normal;
+Fail msup layout is not affected by white-space: normal;
+Fail msup preferred width calculation is not affected by float: right;
+Fail msup layout is not affected by float: right;
+Fail msup preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail msup layout is not affected by align-content: end; justify-content: end;
+Fail msup preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail msup layout is not affected by align-self: end; justify-self: end;
+Fail mtable preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mtable layout is not affected by writing-mode: vertical-rl;
+Fail mtable preferred width calculation is not affected by white-space: normal;
+Fail mtable layout is not affected by white-space: normal;
+Fail mtable preferred width calculation is not affected by float: right;
+Fail mtable layout is not affected by float: right;
+Fail mtable preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mtable layout is not affected by align-content: end; justify-content: end;
+Fail mtable preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mtable layout is not affected by align-self: end; justify-self: end;
+Fail mtext preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail mtext layout is not affected by writing-mode: vertical-rl;
+Fail mtext preferred width calculation is not affected by white-space: normal;
+Fail mtext layout is not affected by white-space: normal;
+Fail mtext preferred width calculation is not affected by float: right;
+Fail mtext layout is not affected by float: right;
+Fail mtext preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail mtext layout is not affected by align-content: end; justify-content: end;
+Fail mtext preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail mtext layout is not affected by align-self: end; justify-self: end;
+Fail munder preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail munder layout is not affected by writing-mode: vertical-rl;
+Fail munder preferred width calculation is not affected by white-space: normal;
+Fail munder layout is not affected by white-space: normal;
+Fail munder preferred width calculation is not affected by float: right;
+Fail munder layout is not affected by float: right;
+Fail munder preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail munder layout is not affected by align-content: end; justify-content: end;
+Fail munder preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail munder layout is not affected by align-self: end; justify-self: end;
+Fail munderover preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail munderover layout is not affected by writing-mode: vertical-rl;
+Fail munderover preferred width calculation is not affected by white-space: normal;
+Fail munderover layout is not affected by white-space: normal;
+Fail munderover preferred width calculation is not affected by float: right;
+Fail munderover layout is not affected by float: right;
+Fail munderover preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail munderover layout is not affected by align-content: end; justify-content: end;
+Fail munderover preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail munderover layout is not affected by align-self: end; justify-self: end;
+Fail semantics preferred width calculation is not affected by writing-mode: vertical-rl;
+Fail semantics layout is not affected by writing-mode: vertical-rl;
+Fail semantics preferred width calculation is not affected by white-space: normal;
+Fail semantics layout is not affected by white-space: normal;
+Fail semantics preferred width calculation is not affected by float: right;
+Fail semantics layout is not affected by float: right;
+Fail semantics preferred width calculation is not affected by align-content: end; justify-content: end;
+Fail semantics layout is not affected by align-content: end; justify-content: end;
+Fail semantics preferred width calculation is not affected by align-self: end; justify-self: end;
+Fail semantics layout is not affected by align-self: end; justify-self: end;
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/lengths-2.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/lengths-2.txt
new file mode 100644
index 00000000000..b06461010fd
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/lengths-2.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail Units
+Fail Trimming of space
+Fail Non-negative numbers
+Fail Non-positive numbers
+Fail Legacy namedspaces
+Fail Legacy numbers
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/multi-column-layout.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/multi-column-layout.txt
new file mode 100644
index 00000000000..aa4d707d25d
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/multi-column-layout.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail mspace layout in multicol
+Fail mfrac layout in multicol
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/not-participating-to-parent-layout.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/not-participating-to-parent-layout.txt
new file mode 100644
index 00000000000..6953c5acbf1
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/not-participating-to-parent-layout.txt
@@ -0,0 +1,172 @@
+Harness status: OK
+
+Found 166 tests
+
+6 Pass
+160 Fail
+Fail a preferred width calculation is not affected by children with "display: none" style
+Fail a layout is not affected by children with "display: none" style
+Fail a preferred width calculation is not affected by children with "display: contents" style
+Fail a layout is not affected by children with "display: contents" style
+Fail a preferred width calculation is not affected by children with "position: absolute" style
+Fail a layout is not affected by children with "position: absolute" style
+Fail a preferred width calculation is not affected by children with "position: fixed" style
+Fail a layout is not affected by children with "position: fixed" style
+Fail maction preferred width calculation is not affected by children with "display: none" style
+Fail maction layout is not affected by children with "display: none" style
+Fail maction preferred width calculation is not affected by children with "position: absolute" style
+Fail maction layout is not affected by children with "position: absolute" style
+Fail maction preferred width calculation is not affected by children with "position: fixed" style
+Fail maction layout is not affected by children with "position: fixed" style
+Fail menclose preferred width calculation is not affected by children with "display: none" style
+Fail menclose layout is not affected by children with "display: none" style
+Fail menclose preferred width calculation is not affected by children with "display: contents" style
+Fail menclose layout is not affected by children with "display: contents" style
+Fail menclose preferred width calculation is not affected by children with "position: absolute" style
+Fail menclose layout is not affected by children with "position: absolute" style
+Fail menclose preferred width calculation is not affected by children with "position: fixed" style
+Fail menclose layout is not affected by children with "position: fixed" style
+Fail merror preferred width calculation is not affected by children with "display: none" style
+Fail merror layout is not affected by children with "display: none" style
+Fail merror preferred width calculation is not affected by children with "display: contents" style
+Fail merror layout is not affected by children with "display: contents" style
+Fail merror preferred width calculation is not affected by children with "position: absolute" style
+Fail merror layout is not affected by children with "position: absolute" style
+Fail merror preferred width calculation is not affected by children with "position: fixed" style
+Fail merror layout is not affected by children with "position: fixed" style
+Pass mfrac preferred width calculation is not affected by children with "display: none" style
+Pass mfrac layout is not affected by children with "display: none" style
+Pass mfrac preferred width calculation is not affected by children with "position: absolute" style
+Pass mfrac layout is not affected by children with "position: absolute" style
+Pass mfrac preferred width calculation is not affected by children with "position: fixed" style
+Pass mfrac layout is not affected by children with "position: fixed" style
+Fail mi preferred width calculation is not affected by children with "display: none" style
+Fail mi layout is not affected by children with "display: none" style
+Fail mi preferred width calculation is not affected by children with "position: absolute" style
+Fail mi layout is not affected by children with "position: absolute" style
+Fail mi preferred width calculation is not affected by children with "position: fixed" style
+Fail mi layout is not affected by children with "position: fixed" style
+Fail mmultiscripts preferred width calculation is not affected by children with "display: none" style
+Fail mmultiscripts layout is not affected by children with "display: none" style
+Fail mmultiscripts preferred width calculation is not affected by children with "position: absolute" style
+Fail mmultiscripts layout is not affected by children with "position: absolute" style
+Fail mmultiscripts preferred width calculation is not affected by children with "position: fixed" style
+Fail mmultiscripts layout is not affected by children with "position: fixed" style
+Fail mn preferred width calculation is not affected by children with "display: none" style
+Fail mn layout is not affected by children with "display: none" style
+Fail mn preferred width calculation is not affected by children with "position: absolute" style
+Fail mn layout is not affected by children with "position: absolute" style
+Fail mn preferred width calculation is not affected by children with "position: fixed" style
+Fail mn layout is not affected by children with "position: fixed" style
+Fail mo preferred width calculation is not affected by children with "display: none" style
+Fail mo layout is not affected by children with "display: none" style
+Fail mo preferred width calculation is not affected by children with "position: absolute" style
+Fail mo layout is not affected by children with "position: absolute" style
+Fail mo preferred width calculation is not affected by children with "position: fixed" style
+Fail mo layout is not affected by children with "position: fixed" style
+Fail mover preferred width calculation is not affected by children with "display: none" style
+Fail mover layout is not affected by children with "display: none" style
+Fail mover preferred width calculation is not affected by children with "position: absolute" style
+Fail mover layout is not affected by children with "position: absolute" style
+Fail mover preferred width calculation is not affected by children with "position: fixed" style
+Fail mover layout is not affected by children with "position: fixed" style
+Fail mpadded preferred width calculation is not affected by children with "display: none" style
+Fail mpadded layout is not affected by children with "display: none" style
+Fail mpadded preferred width calculation is not affected by children with "display: contents" style
+Fail mpadded layout is not affected by children with "display: contents" style
+Fail mpadded preferred width calculation is not affected by children with "position: absolute" style
+Fail mpadded layout is not affected by children with "position: absolute" style
+Fail mpadded preferred width calculation is not affected by children with "position: fixed" style
+Fail mpadded layout is not affected by children with "position: fixed" style
+Fail mphantom preferred width calculation is not affected by children with "display: none" style
+Fail mphantom layout is not affected by children with "display: none" style
+Fail mphantom preferred width calculation is not affected by children with "display: contents" style
+Fail mphantom layout is not affected by children with "display: contents" style
+Fail mphantom preferred width calculation is not affected by children with "position: absolute" style
+Fail mphantom layout is not affected by children with "position: absolute" style
+Fail mphantom preferred width calculation is not affected by children with "position: fixed" style
+Fail mphantom layout is not affected by children with "position: fixed" style
+Fail mroot preferred width calculation is not affected by children with "display: none" style
+Fail mroot layout is not affected by children with "display: none" style
+Fail mroot preferred width calculation is not affected by children with "position: absolute" style
+Fail mroot layout is not affected by children with "position: absolute" style
+Fail mroot preferred width calculation is not affected by children with "position: fixed" style
+Fail mroot layout is not affected by children with "position: fixed" style
+Fail mrow preferred width calculation is not affected by children with "display: none" style
+Fail mrow layout is not affected by children with "display: none" style
+Fail mrow preferred width calculation is not affected by children with "display: contents" style
+Fail mrow layout is not affected by children with "display: contents" style
+Fail mrow preferred width calculation is not affected by children with "position: absolute" style
+Fail mrow layout is not affected by children with "position: absolute" style
+Fail mrow preferred width calculation is not affected by children with "position: fixed" style
+Fail mrow layout is not affected by children with "position: fixed" style
+Fail ms preferred width calculation is not affected by children with "display: none" style
+Fail ms layout is not affected by children with "display: none" style
+Fail ms preferred width calculation is not affected by children with "position: absolute" style
+Fail ms layout is not affected by children with "position: absolute" style
+Fail ms preferred width calculation is not affected by children with "position: fixed" style
+Fail ms layout is not affected by children with "position: fixed" style
+Fail msqrt preferred width calculation is not affected by children with "display: none" style
+Fail msqrt layout is not affected by children with "display: none" style
+Fail msqrt preferred width calculation is not affected by children with "display: contents" style
+Fail msqrt layout is not affected by children with "display: contents" style
+Fail msqrt preferred width calculation is not affected by children with "position: absolute" style
+Fail msqrt layout is not affected by children with "position: absolute" style
+Fail msqrt preferred width calculation is not affected by children with "position: fixed" style
+Fail msqrt layout is not affected by children with "position: fixed" style
+Fail mstyle preferred width calculation is not affected by children with "display: none" style
+Fail mstyle layout is not affected by children with "display: none" style
+Fail mstyle preferred width calculation is not affected by children with "display: contents" style
+Fail mstyle layout is not affected by children with "display: contents" style
+Fail mstyle preferred width calculation is not affected by children with "position: absolute" style
+Fail mstyle layout is not affected by children with "position: absolute" style
+Fail mstyle preferred width calculation is not affected by children with "position: fixed" style
+Fail mstyle layout is not affected by children with "position: fixed" style
+Fail msub preferred width calculation is not affected by children with "display: none" style
+Fail msub layout is not affected by children with "display: none" style
+Fail msub preferred width calculation is not affected by children with "position: absolute" style
+Fail msub layout is not affected by children with "position: absolute" style
+Fail msub preferred width calculation is not affected by children with "position: fixed" style
+Fail msub layout is not affected by children with "position: fixed" style
+Fail msubsup preferred width calculation is not affected by children with "display: none" style
+Fail msubsup layout is not affected by children with "display: none" style
+Fail msubsup preferred width calculation is not affected by children with "position: absolute" style
+Fail msubsup layout is not affected by children with "position: absolute" style
+Fail msubsup preferred width calculation is not affected by children with "position: fixed" style
+Fail msubsup layout is not affected by children with "position: fixed" style
+Fail msup preferred width calculation is not affected by children with "display: none" style
+Fail msup layout is not affected by children with "display: none" style
+Fail msup preferred width calculation is not affected by children with "position: absolute" style
+Fail msup layout is not affected by children with "position: absolute" style
+Fail msup preferred width calculation is not affected by children with "position: fixed" style
+Fail msup layout is not affected by children with "position: fixed" style
+Fail mtable preferred width calculation is not affected by children with "display: none" style
+Fail mtable layout is not affected by children with "display: none" style
+Fail mtable preferred width calculation is not affected by children with "position: absolute" style
+Fail mtable layout is not affected by children with "position: absolute" style
+Fail mtable preferred width calculation is not affected by children with "position: fixed" style
+Fail mtable layout is not affected by children with "position: fixed" style
+Fail mtext preferred width calculation is not affected by children with "display: none" style
+Fail mtext layout is not affected by children with "display: none" style
+Fail mtext preferred width calculation is not affected by children with "position: absolute" style
+Fail mtext layout is not affected by children with "position: absolute" style
+Fail mtext preferred width calculation is not affected by children with "position: fixed" style
+Fail mtext layout is not affected by children with "position: fixed" style
+Fail munder preferred width calculation is not affected by children with "display: none" style
+Fail munder layout is not affected by children with "display: none" style
+Fail munder preferred width calculation is not affected by children with "position: absolute" style
+Fail munder layout is not affected by children with "position: absolute" style
+Fail munder preferred width calculation is not affected by children with "position: fixed" style
+Fail munder layout is not affected by children with "position: fixed" style
+Fail munderover preferred width calculation is not affected by children with "display: none" style
+Fail munderover layout is not affected by children with "display: none" style
+Fail munderover preferred width calculation is not affected by children with "position: absolute" style
+Fail munderover layout is not affected by children with "position: absolute" style
+Fail munderover preferred width calculation is not affected by children with "position: fixed" style
+Fail munderover layout is not affected by children with "position: fixed" style
+Fail semantics preferred width calculation is not affected by children with "display: none" style
+Fail semantics layout is not affected by children with "display: none" style
+Fail semantics preferred width calculation is not affected by children with "position: absolute" style
+Fail semantics layout is not affected by children with "position: absolute" style
+Fail semantics preferred width calculation is not affected by children with "position: fixed" style
+Fail semantics layout is not affected by children with "position: fixed" style
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.txt
new file mode 100644
index 00000000000..1e313dd09fc
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.txt
@@ -0,0 +1,32 @@
+Harness status: OK
+
+Found 26 tests
+
+1 Pass
+25 Fail
+Fail position: absolute on <a> element itself
+Fail position: absolute on <maction> element itself
+Fail position: absolute on <menclose> element itself
+Fail position: absolute on <merror> element itself
+Pass position: absolute on <mfrac> element itself
+Fail position: absolute on <mi> element itself
+Fail position: absolute on <mmultiscripts> element itself
+Fail position: absolute on <mn> element itself
+Fail position: absolute on <mo> element itself
+Fail position: absolute on <mover> element itself
+Fail position: absolute on <mpadded> element itself
+Fail position: absolute on <mphantom> element itself
+Fail position: absolute on <mroot> element itself
+Fail position: absolute on <mrow> element itself
+Fail position: absolute on <ms> element itself
+Fail position: absolute on <mspace> element itself
+Fail position: absolute on <msqrt> element itself
+Fail position: absolute on <mstyle> element itself
+Fail position: absolute on <msub> element itself
+Fail position: absolute on <msubsup> element itself
+Fail position: absolute on <msup> element itself
+Fail position: absolute on <mtable> element itself
+Fail position: absolute on <mtext> element itself
+Fail position: absolute on <munder> element itself
+Fail position: absolute on <munderover> element itself
+Fail position: absolute on <semantics> element itself
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/all-mathml-containers.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/all-mathml-containers.txt
new file mode 100644
index 00000000000..5f73b7d5dc6
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/all-mathml-containers.txt
@@ -0,0 +1,56 @@
+Harness status: OK
+
+Found 50 tests
+
+2 Pass
+48 Fail
+Fail position: absolute; children in a
+Fail position: absolute; children in maction
+Fail position: absolute; children in menclose
+Fail position: absolute; children in merror
+Pass position: absolute; children in mfrac
+Fail position: absolute; children in mi
+Fail position: absolute; children in mmultiscripts
+Fail position: absolute; children in mn
+Fail position: absolute; children in mo
+Fail position: absolute; children in mover
+Fail position: absolute; children in mpadded
+Fail position: absolute; children in mphantom
+Fail position: absolute; children in mroot
+Fail position: absolute; children in mrow
+Fail position: absolute; children in ms
+Fail position: absolute; children in msqrt
+Fail position: absolute; children in mstyle
+Fail position: absolute; children in msub
+Fail position: absolute; children in msubsup
+Fail position: absolute; children in msup
+Fail position: absolute; children in mtable
+Fail position: absolute; children in mtext
+Fail position: absolute; children in munder
+Fail position: absolute; children in munderover
+Fail position: absolute; children in semantics
+Fail position: fixed; children in a
+Fail position: fixed; children in maction
+Fail position: fixed; children in menclose
+Fail position: fixed; children in merror
+Pass position: fixed; children in mfrac
+Fail position: fixed; children in mi
+Fail position: fixed; children in mmultiscripts
+Fail position: fixed; children in mn
+Fail position: fixed; children in mo
+Fail position: fixed; children in mover
+Fail position: fixed; children in mpadded
+Fail position: fixed; children in mphantom
+Fail position: fixed; children in mroot
+Fail position: fixed; children in mrow
+Fail position: fixed; children in ms
+Fail position: fixed; children in msqrt
+Fail position: fixed; children in mstyle
+Fail position: fixed; children in msub
+Fail position: fixed; children in msubsup
+Fail position: fixed; children in msup
+Fail position: fixed; children in mtable
+Fail position: fixed; children in mtext
+Fail position: fixed; children in munder
+Fail position: fixed; children in munderover
+Fail position: fixed; children in semantics
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/border-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/border-001.txt
new file mode 100644
index 00000000000..6247cf514c4
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/border-001.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail Border properties on mrow
+Fail Border properties on mrow (rtl)
+Fail Border properties on mrow (shorthand)
+Fail Border properties on mrow (logical)
+Fail Border properties on mrow (logical, rtl)
+Fail Border properties on mrow (logical, shorthand)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/border-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/border-002.txt
new file mode 100644
index 00000000000..a33c2adc87c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/border-002.txt
@@ -0,0 +1,57 @@
+Harness status: OK
+
+Found 51 tests
+
+2 Pass
+49 Fail
+Fail Border properties on a
+Fail Border properties on a (rtl)
+Fail Border properties on maction
+Fail Border properties on maction (rtl)
+Fail Border properties on menclose
+Fail Border properties on menclose (rtl)
+Fail Border properties on merror
+Fail Border properties on merror (rtl)
+Pass Border properties on mfrac
+Pass Border properties on mfrac (rtl)
+Fail Border properties on mi
+Fail Border properties on mi (rtl)
+Fail Border properties on mmultiscripts
+Fail Border properties on mmultiscripts (rtl)
+Fail Border properties on mn
+Fail Border properties on mn (rtl)
+Fail Border properties on mo
+Fail Border properties on mo (rtl)
+Fail Border properties on mover
+Fail Border properties on mover (rtl)
+Fail Border properties on mpadded
+Fail Border properties on mpadded (rtl)
+Fail Border properties on mphantom
+Fail Border properties on mphantom (rtl)
+Fail Border properties on mroot
+Fail Border properties on mroot (rtl)
+Fail Border properties on mrow
+Fail Border properties on mrow (rtl)
+Fail Border properties on ms
+Fail Border properties on ms (rtl)
+Fail Border properties on mspace
+Fail Border properties on msqrt
+Fail Border properties on msqrt (rtl)
+Fail Border properties on mstyle
+Fail Border properties on mstyle (rtl)
+Fail Border properties on msub
+Fail Border properties on msub (rtl)
+Fail Border properties on msubsup
+Fail Border properties on msubsup (rtl)
+Fail Border properties on msup
+Fail Border properties on msup (rtl)
+Fail Border properties on mtable
+Fail Border properties on mtable (rtl)
+Fail Border properties on mtext
+Fail Border properties on mtext (rtl)
+Fail Border properties on munder
+Fail Border properties on munder (rtl)
+Fail Border properties on munderover
+Fail Border properties on munderover (rtl)
+Fail Border properties on semantics
+Fail Border properties on semantics (rtl)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-001.txt
new file mode 100644
index 00000000000..13d15131ffd
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-001.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail Margin properties on mrow
+Fail Margin properties on mrow (rtl)
+Fail Margin properties on mrow (shorthand)
+Fail Margin properties on mrow (logical)
+Fail Margin properties on mrow (logical, rtl)
+Fail Margin properties on mrow (logical, shorthand)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-002.txt
new file mode 100644
index 00000000000..3588cdc5f2c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-002.txt
@@ -0,0 +1,82 @@
+Harness status: OK
+
+Found 76 tests
+
+3 Pass
+73 Fail
+Fail Margin properties on a
+Fail Margin properties on a (rtl)
+Fail Margin properties on a (no margin-collapsing)
+Fail Margin properties on maction
+Fail Margin properties on maction (rtl)
+Fail Margin properties on maction (no margin-collapsing)
+Fail Margin properties on menclose
+Fail Margin properties on menclose (rtl)
+Fail Margin properties on menclose (no margin-collapsing)
+Fail Margin properties on merror
+Fail Margin properties on merror (rtl)
+Fail Margin properties on merror (no margin-collapsing)
+Pass Margin properties on mfrac
+Pass Margin properties on mfrac (rtl)
+Pass Margin properties on mfrac (no margin-collapsing)
+Fail Margin properties on mi
+Fail Margin properties on mi (rtl)
+Fail Margin properties on mi (no margin-collapsing)
+Fail Margin properties on mmultiscripts
+Fail Margin properties on mmultiscripts (rtl)
+Fail Margin properties on mmultiscripts (no margin-collapsing)
+Fail Margin properties on mn
+Fail Margin properties on mn (rtl)
+Fail Margin properties on mn (no margin-collapsing)
+Fail Margin properties on mo
+Fail Margin properties on mo (rtl)
+Fail Margin properties on mo (no margin-collapsing)
+Fail Margin properties on mover
+Fail Margin properties on mover (rtl)
+Fail Margin properties on mover (no margin-collapsing)
+Fail Margin properties on mpadded
+Fail Margin properties on mpadded (rtl)
+Fail Margin properties on mpadded (no margin-collapsing)
+Fail Margin properties on mphantom
+Fail Margin properties on mphantom (rtl)
+Fail Margin properties on mphantom (no margin-collapsing)
+Fail Margin properties on mroot
+Fail Margin properties on mroot (rtl)
+Fail Margin properties on mroot (no margin-collapsing)
+Fail Margin properties on mrow
+Fail Margin properties on mrow (rtl)
+Fail Margin properties on mrow (no margin-collapsing)
+Fail Margin properties on ms
+Fail Margin properties on ms (rtl)
+Fail Margin properties on ms (no margin-collapsing)
+Fail Margin properties on mspace
+Fail Margin properties on msqrt
+Fail Margin properties on msqrt (rtl)
+Fail Margin properties on msqrt (no margin-collapsing)
+Fail Margin properties on mstyle
+Fail Margin properties on mstyle (rtl)
+Fail Margin properties on mstyle (no margin-collapsing)
+Fail Margin properties on msub
+Fail Margin properties on msub (rtl)
+Fail Margin properties on msub (no margin-collapsing)
+Fail Margin properties on msubsup
+Fail Margin properties on msubsup (rtl)
+Fail Margin properties on msubsup (no margin-collapsing)
+Fail Margin properties on msup
+Fail Margin properties on msup (rtl)
+Fail Margin properties on msup (no margin-collapsing)
+Fail Margin properties on mtable
+Fail Margin properties on mtable (rtl)
+Fail Margin properties on mtable (no margin-collapsing)
+Fail Margin properties on mtext
+Fail Margin properties on mtext (rtl)
+Fail Margin properties on mtext (no margin-collapsing)
+Fail Margin properties on munder
+Fail Margin properties on munder (rtl)
+Fail Margin properties on munder (no margin-collapsing)
+Fail Margin properties on munderover
+Fail Margin properties on munderover (rtl)
+Fail Margin properties on munderover (no margin-collapsing)
+Fail Margin properties on semantics
+Fail Margin properties on semantics (rtl)
+Fail Margin properties on semantics (no margin-collapsing)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-003.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-003.txt
new file mode 100644
index 00000000000..c88ae6399b9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-003.txt
@@ -0,0 +1,22 @@
+Harness status: OK
+
+Found 17 tests
+
+17 Fail
+Fail Margin properties on the children of a
+Fail Margin properties on the children of menclose
+Fail Margin properties on the children of merror
+Fail Margin properties on the children of mfrac
+Fail Margin properties on the children of mmultiscripts
+Fail Margin properties on the children of mover
+Fail Margin properties on the children of mpadded
+Fail Margin properties on the children of mphantom
+Fail Margin properties on the children of mroot
+Fail Margin properties on the children of mrow
+Fail Margin properties on the children of msqrt
+Fail Margin properties on the children of mstyle
+Fail Margin properties on the children of msub
+Fail Margin properties on the children of msubsup
+Fail Margin properties on the children of msup
+Fail Margin properties on the children of munder
+Fail Margin properties on the children of munderover
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-001.txt
new file mode 100644
index 00000000000..66caf781277
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-001.txt
@@ -0,0 +1,11 @@
+Harness status: OK
+
+Found 6 tests
+
+6 Fail
+Fail Padding properties on mrow
+Fail Padding properties on mrow (rtl)
+Fail Padding properties on mrow (shorthand)
+Fail Padding properties on mrow (logical)
+Fail Padding properties on mrow (logical, rtl)
+Fail Padding properties on mrow (logical, shorthand)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-002.txt
new file mode 100644
index 00000000000..57d0bec0ae7
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-002.txt
@@ -0,0 +1,57 @@
+Harness status: OK
+
+Found 51 tests
+
+2 Pass
+49 Fail
+Fail Padding properties on a
+Fail Padding properties on a (rtl)
+Fail Padding properties on maction
+Fail Padding properties on maction (rtl)
+Fail Padding properties on menclose
+Fail Padding properties on menclose (rtl)
+Fail Padding properties on merror
+Fail Padding properties on merror (rtl)
+Pass Padding properties on mfrac
+Pass Padding properties on mfrac (rtl)
+Fail Padding properties on mi
+Fail Padding properties on mi (rtl)
+Fail Padding properties on mmultiscripts
+Fail Padding properties on mmultiscripts (rtl)
+Fail Padding properties on mn
+Fail Padding properties on mn (rtl)
+Fail Padding properties on mo
+Fail Padding properties on mo (rtl)
+Fail Padding properties on mover
+Fail Padding properties on mover (rtl)
+Fail Padding properties on mpadded
+Fail Padding properties on mpadded (rtl)
+Fail Padding properties on mphantom
+Fail Padding properties on mphantom (rtl)
+Fail Padding properties on mroot
+Fail Padding properties on mroot (rtl)
+Fail Padding properties on mrow
+Fail Padding properties on mrow (rtl)
+Fail Padding properties on ms
+Fail Padding properties on ms (rtl)
+Fail Padding properties on mspace
+Fail Padding properties on msqrt
+Fail Padding properties on msqrt (rtl)
+Fail Padding properties on mstyle
+Fail Padding properties on mstyle (rtl)
+Fail Padding properties on msub
+Fail Padding properties on msub (rtl)
+Fail Padding properties on msubsup
+Fail Padding properties on msubsup (rtl)
+Fail Padding properties on msup
+Fail Padding properties on msup (rtl)
+Fail Padding properties on mtable
+Fail Padding properties on mtable (rtl)
+Fail Padding properties on mtext
+Fail Padding properties on mtext (rtl)
+Fail Padding properties on munder
+Fail Padding properties on munder (rtl)
+Fail Padding properties on munderover
+Fail Padding properties on munderover (rtl)
+Fail Padding properties on semantics
+Fail Padding properties on semantics (rtl)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-border-mpadded-baseline.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-border-mpadded-baseline.txt
new file mode 100644
index 00000000000..580a01b47c5
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-border-mpadded-baseline.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail Empty mpadded with padding-top and border-top
+Fail Empty mpadded with padding and border on all sides
+Fail Non-empty mpadded with padding-top and border-top
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/size-containment-001.tentative.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/size-containment-001.tentative.txt
new file mode 100644
index 00000000000..a0ab4a02c79
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/size-containment-001.tentative.txt
@@ -0,0 +1,50 @@
+Harness status: OK
+
+Found 44 tests
+
+2 Pass
+42 Fail
+Fail intrinsic size of a with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of a with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of maction with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of maction with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of menclose with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of menclose with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of merror with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of merror with contain: size; contain-intrinsic-inline-size: 111px;
+Pass intrinsic size of mfrac with contain: size; contain-intrinsic-inline-size: 111px;
+Pass inline-size of mfrac with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mi with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mi with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mmultiscripts with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mmultiscripts with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mn with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mn with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mo with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mo with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mover with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mover with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mpadded with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mpadded with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mphantom with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mphantom with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mrow with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mrow with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of ms with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of ms with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mstyle with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mstyle with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of msub with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of msub with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of msubsup with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of msubsup with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of msup with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of msup with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of mtext with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of mtext with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of munder with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of munder with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of munderover with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of munderover with contain: size; contain-intrinsic-inline-size: 111px;
+Fail intrinsic size of semantics with contain: size; contain-intrinsic-inline-size: 111px;
+Fail inline-size of semantics with contain: size; contain-intrinsic-inline-size: 111px;
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/width-height-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/width-height-001.txt
new file mode 100644
index 00000000000..ea59634db7f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/width-height-001.txt
@@ -0,0 +1,109 @@
+Harness status: OK
+
+Found 103 tests
+
+4 Pass
+99 Fail
+Fail width and height properties on a
+Fail inline-size and block-size properties on a
+Fail width and height properties on a (content overflowing)
+Fail width property on a (preferred width)
+Fail width and height properties on maction
+Fail inline-size and block-size properties on maction
+Fail width and height properties on maction (content overflowing)
+Fail width property on maction (preferred width)
+Fail width and height properties on menclose
+Fail inline-size and block-size properties on menclose
+Fail width and height properties on menclose (content overflowing)
+Fail width property on menclose (preferred width)
+Fail width and height properties on merror
+Fail inline-size and block-size properties on merror
+Fail width and height properties on merror (content overflowing)
+Fail width property on merror (preferred width)
+Pass width and height properties on mfrac
+Pass inline-size and block-size properties on mfrac
+Pass width and height properties on mfrac (content overflowing)
+Pass width property on mfrac (preferred width)
+Fail width and height properties on mi
+Fail inline-size and block-size properties on mi
+Fail width and height properties on mi (content overflowing)
+Fail width property on mi (preferred width)
+Fail width and height properties on mmultiscripts
+Fail inline-size and block-size properties on mmultiscripts
+Fail width and height properties on mmultiscripts (content overflowing)
+Fail width property on mmultiscripts (preferred width)
+Fail width and height properties on mn
+Fail inline-size and block-size properties on mn
+Fail width and height properties on mn (content overflowing)
+Fail width property on mn (preferred width)
+Fail width and height properties on mo
+Fail inline-size and block-size properties on mo
+Fail width and height properties on mo (content overflowing)
+Fail width property on mo (preferred width)
+Fail width and height properties on mover
+Fail inline-size and block-size properties on mover
+Fail width and height properties on mover (content overflowing)
+Fail width property on mover (preferred width)
+Fail width and height properties on mpadded
+Fail inline-size and block-size properties on mpadded
+Fail width and height properties on mpadded (content overflowing)
+Fail width property on mpadded (preferred width)
+Fail width and height properties on mphantom
+Fail inline-size and block-size properties on mphantom
+Fail width and height properties on mphantom (content overflowing)
+Fail width property on mphantom (preferred width)
+Fail width and height properties on mroot
+Fail inline-size and block-size properties on mroot
+Fail width and height properties on mroot (content overflowing)
+Fail width property on mroot (preferred width)
+Fail width and height properties on mrow
+Fail inline-size and block-size properties on mrow
+Fail width and height properties on mrow (content overflowing)
+Fail width property on mrow (preferred width)
+Fail width and height properties on ms
+Fail inline-size and block-size properties on ms
+Fail width and height properties on ms (content overflowing)
+Fail width property on ms (preferred width)
+Fail width and height properties on mspace
+Fail inline-size and block-size properties on mspace
+Fail width and height properties on mspace (content overflowing)
+Fail width property on mspace (preferred width)
+Fail width and height properties on msqrt
+Fail inline-size and block-size properties on msqrt
+Fail width and height properties on msqrt (content overflowing)
+Fail width property on msqrt (preferred width)
+Fail width and height properties on mstyle
+Fail inline-size and block-size properties on mstyle
+Fail width and height properties on mstyle (content overflowing)
+Fail width property on mstyle (preferred width)
+Fail width and height properties on msub
+Fail inline-size and block-size properties on msub
+Fail width and height properties on msub (content overflowing)
+Fail width property on msub (preferred width)
+Fail width and height properties on msubsup
+Fail inline-size and block-size properties on msubsup
+Fail width and height properties on msubsup (content overflowing)
+Fail width property on msubsup (preferred width)
+Fail width and height properties on msup
+Fail inline-size and block-size properties on msup
+Fail width and height properties on msup (content overflowing)
+Fail width property on msup (preferred width)
+Fail width and height properties on mtable
+Fail inline-size and block-size properties on mtable
+Fail width property on mtable (preferred width)
+Fail width and height properties on mtext
+Fail inline-size and block-size properties on mtext
+Fail width and height properties on mtext (content overflowing)
+Fail width property on mtext (preferred width)
+Fail width and height properties on munder
+Fail inline-size and block-size properties on munder
+Fail width and height properties on munder (content overflowing)
+Fail width property on munder (preferred width)
+Fail width and height properties on munderover
+Fail inline-size and block-size properties on munderover
+Fail width and height properties on munderover (content overflowing)
+Fail width property on munderover (preferred width)
+Fail width and height properties on semantics
+Fail inline-size and block-size properties on semantics
+Fail width and height properties on semantics (content overflowing)
+Fail width property on semantics (preferred width)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/width-height-005.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/width-height-005.txt
new file mode 100644
index 00000000000..d9be8dc16ed
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/width-height-005.txt
@@ -0,0 +1,46 @@
+Harness status: OK
+
+Found 40 tests
+
+38 Pass
+2 Fail
+Pass mrow
+Pass mrow (horizontal overflow)
+Pass RTL mrow
+Pass RTL mrow (horizontal overflow)
+Pass mpadded
+Pass mpadded (horizontal overflow)
+Pass RTL mpadded
+Pass RTL mpadded (horizontal overflow)
+Pass msqrt
+Pass msqrt (horizontal overflow)
+Pass RTL msqrt
+Pass RTL msqrt (horizontal overflow)
+Pass mroot
+Pass mroot (horizontal overflow)
+Pass RTL mroot
+Pass RTL mroot (horizontal overflow)
+Pass msub
+Pass msub (horizontal overflow)
+Pass RTL msub
+Pass RTL msub (horizontal overflow)
+Pass msup
+Pass msup (horizontal overflow)
+Pass RTL msup
+Pass RTL msup (horizontal overflow)
+Pass msubsup
+Pass msubsup (horizontal overflow)
+Pass RTL msubsup
+Pass RTL msubsup (horizontal overflow)
+Pass mmultiscripts
+Pass mmultiscripts (horizontal overflow)
+Pass RTL mmultiscripts
+Pass RTL mmultiscripts (horizontal overflow)
+Pass mtext
+Fail mtext (horizontal overflow)
+Pass RTL mtext
+Fail RTL mtext (horizontal overflow)
+Pass legacy menclose
+Pass legacy menclose (horizontal overflow)
+Pass RTL legacy menclose
+Pass RTL legacy menclose (horizontal overflow)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-001.txt
new file mode 100644
index 00000000000..93ec5cfa438
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-001.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 2 tests
+
+1 Pass
+1 Fail
+Pass Inheritance of CSS writing-mode and direction (id='horizontal-tb_rtl')
+Fail Layout of mrow (id='horizontal-tb_rtl')
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-002.txt
new file mode 100644
index 00000000000..4249b1d1406
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-002.txt
@@ -0,0 +1,35 @@
+Harness status: OK
+
+Found 30 tests
+
+30 Fail
+Fail Layout of a (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of maction (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of menclose (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of merror (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mfrac (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mi (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mmultiscripts (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mn (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mo (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mover (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mpadded (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mphantom (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mprescripts (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mroot (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mrow (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of ms (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mspace (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of msqrt (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mstyle (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of msub (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of msubsup (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of msup (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mtable (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mtd (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mtext (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of mtr (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of munder (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of munderover (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of none (writing-mode: horizontal-tb; direction: rtl;)
+Fail Layout of semantics (writing-mode: horizontal-tb; direction: rtl;)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/canvas-visited-privacy.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/canvas-visited-privacy.txt
new file mode 100644
index 00000000000..77057d34479
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/canvas-visited-privacy.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Ensure MathML 'a' elements inside SVG drawn to canvas do not leak :visited styles via getImageData
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/clipboard-event-handlers.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/clipboard-event-handlers.txt
new file mode 100644
index 00000000000..9fa36225514
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/clipboard-event-handlers.txt
@@ -0,0 +1,15 @@
+Harness status: OK
+
+Found 9 tests
+
+3 Pass
+6 Fail
+Pass copy: dispatching an Event at a <math> element must trigger element.oncopy
+Fail oncopy: the content attribute must be compiled into a function as the corresponding property
+Fail oncopy: dynamic changes on the attribute
+Pass cut: dispatching an Event at a <math> element must trigger element.oncut
+Fail oncut: the content attribute must be compiled into a function as the corresponding property
+Fail oncut: dynamic changes on the attribute
+Pass paste: dispatching an Event at a <math> element must trigger element.onpaste
+Fail onpaste: the content attribute must be compiled into a function as the corresponding property
+Fail onpaste: dynamic changes on the attribute
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/content-editable.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/content-editable.txt
new file mode 100644
index 00000000000..cda347cd864
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/content-editable.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail mspace layout in content-editable div
+Fail mfrac layout in content-editable div
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/display-1.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/display-1.txt
new file mode 100644
index 00000000000..5dc91fd95e9
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/display-1.txt
@@ -0,0 +1,16 @@
+Harness status: OK
+
+Found 11 tests
+
+11 Fail
+Fail Test display math lowercase
+Fail Test inline math lowercase
+Fail Test width on display=block math lowercase
+Fail Test display math uppercase
+Fail Test inline math uppercase
+Fail Test width on display=block math uppercase
+Fail Test display math alternate_case
+Fail Test inline math alternate_case
+Fail Test width on display=block math alternate_case
+Fail Test dynamically setting display=block
+Fail Test dynamically setting display=inline
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/dynamic-childlist-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/dynamic-childlist-001.txt
new file mode 100644
index 00000000000..cf062efedab
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/dynamic-childlist-001.txt
@@ -0,0 +1,49 @@
+Harness status: OK
+
+Found 44 tests
+
+44 Fail
+Fail Adding missing children to mfrac
+Fail Removing child from valid mfrac
+Fail Adding child to valid mfrac
+Fail Removing extra child from mfrac
+Fail Adding missing children to munder
+Fail Removing child from valid munder
+Fail Adding child to valid munder
+Fail Removing extra child from munder
+Fail Adding missing children to mover
+Fail Removing child from valid mover
+Fail Adding child to valid mover
+Fail Removing extra child from mover
+Fail Adding missing children to munderover
+Fail Removing child from valid munderover
+Fail Adding child to valid munderover
+Fail Removing extra child from munderover
+Fail Adding missing children to msub
+Fail Removing child from valid msub
+Fail Adding child to valid msub
+Fail Removing extra child from msub
+Fail Adding missing children to msup
+Fail Removing child from valid msup
+Fail Adding child to valid msup
+Fail Removing extra child from msup
+Fail Adding missing children to msubsup
+Fail Removing child from valid msubsup
+Fail Adding child to valid msubsup
+Fail Removing extra child from msubsup
+Fail Adding missing children to mroot
+Fail Removing child from valid mroot
+Fail Adding child to valid mroot
+Fail Removing extra child from mroot
+Fail Removing children from msqrt
+Fail Adding children to msqrt
+Fail Removing children from mpadded
+Fail Adding children to mpadded
+Fail Removing children from mspace
+Fail Adding children to mspace
+Fail multiscripts child count from 3 to 0
+Fail multiscripts child count from 3 to 1
+Fail multiscripts child count from 3 to 2
+Fail multiscripts child count from 0 to 3
+Fail multiscripts child count from 3 to 6
+Fail multiscripts child count from 3 to 8
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/dynamic-childlist-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/dynamic-childlist-002.txt
new file mode 100644
index 00000000000..1ed6cc6736a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/dynamic-childlist-002.txt
@@ -0,0 +1,31 @@
+Harness status: OK
+
+Found 26 tests
+
+26 Fail
+Fail Appending and removing children to a
+Fail Appending and removing children to maction
+Fail Appending and removing children to menclose
+Fail Appending and removing children to merror
+Fail Appending and removing children to mfrac
+Fail Appending and removing children to mi
+Fail Appending and removing children to mmultiscripts
+Fail Appending and removing children to mn
+Fail Appending and removing children to mo
+Fail Appending and removing children to mover
+Fail Appending and removing children to mpadded
+Fail Appending and removing children to mphantom
+Fail Appending and removing children to mroot
+Fail Appending and removing children to mrow
+Fail Appending and removing children to ms
+Fail Appending and removing children to mspace
+Fail Appending and removing children to msqrt
+Fail Appending and removing children to mstyle
+Fail Appending and removing children to msub
+Fail Appending and removing children to msubsup
+Fail Appending and removing children to msup
+Fail Appending and removing children to mtable
+Fail Appending and removing children to mtext
+Fail Appending and removing children to munder
+Fail Appending and removing children to munderover
+Fail Appending and removing children to semantics
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/href-click-004.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/href-click-004.txt
new file mode 100644
index 00000000000..110f770a0e2
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/href-click-004.txt
@@ -0,0 +1,34 @@
+Harness status: OK
+
+Found 28 tests
+
+26 Pass
+2 Fail
+Fail annotation with href attribute does not react to click.
+Fail annotation-xml with href attribute does not react to click.
+Pass maction with href attribute does not react to click.
+Pass menclose with href attribute does not react to click.
+Pass merror with href attribute does not react to click.
+Pass mfrac with href attribute does not react to click.
+Pass mi with href attribute does not react to click.
+Pass mmultiscripts with href attribute does not react to click.
+Pass mn with href attribute does not react to click.
+Pass mo with href attribute does not react to click.
+Pass mover with href attribute does not react to click.
+Pass mpadded with href attribute does not react to click.
+Pass mphantom with href attribute does not react to click.
+Pass mroot with href attribute does not react to click.
+Pass mrow with href attribute does not react to click.
+Pass ms with href attribute does not react to click.
+Pass msqrt with href attribute does not react to click.
+Pass mstyle with href attribute does not react to click.
+Pass msub with href attribute does not react to click.
+Pass msubsup with href attribute does not react to click.
+Pass msup with href attribute does not react to click.
+Pass mtable with href attribute does not react to click.
+Pass mtd with href attribute does not react to click.
+Pass mtext with href attribute does not react to click.
+Pass mtr with href attribute does not react to click.
+Pass munder with href attribute does not react to click.
+Pass munderover with href attribute does not react to click.
+Pass semantics with href attribute does not react to click.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/integration-point-4.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/integration-point-4.txt
new file mode 100644
index 00000000000..3d94a837d37
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/integration-point-4.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail mspace layout in SVG foreignObject
+Fail mfrac layout in SVG foreignObject
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/integration-point-5.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/integration-point-5.txt
new file mode 100644
index 00000000000..30d9cb1b7df
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/integration-point-5.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail mspace layout in sibling of SVG foreignObject[overflow=visible]
+Fail mfrac layout in sibling of SVG with foreignObject[overflow=visible]
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/math-global-event-handlers.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/math-global-event-handlers.txt
new file mode 100644
index 00000000000..6055c864758
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/math-global-event-handlers.txt
@@ -0,0 +1,3 @@
+Harness status: Error
+
+Found 0 tests
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
new file mode 100644
index 00000000000..6ef95c4e467
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
@@ -0,0 +1,78 @@
+Harness status: OK
+
+Found 72 tests
+
+40 Pass
+32 Fail
+Fail style-src-attr 'none' blocks inline style on <a>
+Pass CSP absent allows inline style on <a>
+Pass style-src-attr 'unsafe-inline' allows inline style on <a>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <a>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <a>
+Fail style-src 'none' fallback blocks inline style on <a>
+Pass style-src 'unsafe-inline' fallback allows inline style on <a>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <a>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <a>
+Fail style-src-attr 'none' blocks inline style on <annotation>
+Pass CSP absent allows inline style on <annotation>
+Pass style-src-attr 'unsafe-inline' allows inline style on <annotation>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <annotation>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <annotation>
+Fail style-src 'none' fallback blocks inline style on <annotation>
+Pass style-src 'unsafe-inline' fallback allows inline style on <annotation>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <annotation>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <annotation>
+Fail style-src-attr 'none' blocks inline style on <annotation-xml>
+Pass CSP absent allows inline style on <annotation-xml>
+Pass style-src-attr 'unsafe-inline' allows inline style on <annotation-xml>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <annotation-xml>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <annotation-xml>
+Fail style-src 'none' fallback blocks inline style on <annotation-xml>
+Pass style-src 'unsafe-inline' fallback allows inline style on <annotation-xml>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <annotation-xml>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <annotation-xml>
+Fail style-src-attr 'none' blocks inline style on <maction>
+Pass CSP absent allows inline style on <maction>
+Pass style-src-attr 'unsafe-inline' allows inline style on <maction>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <maction>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <maction>
+Fail style-src 'none' fallback blocks inline style on <maction>
+Pass style-src 'unsafe-inline' fallback allows inline style on <maction>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <maction>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <maction>
+Fail style-src-attr 'none' blocks inline style on <menclose>
+Pass CSP absent allows inline style on <menclose>
+Pass style-src-attr 'unsafe-inline' allows inline style on <menclose>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <menclose>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <menclose>
+Fail style-src 'none' fallback blocks inline style on <menclose>
+Pass style-src 'unsafe-inline' fallback allows inline style on <menclose>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <menclose>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <menclose>
+Fail style-src-attr 'none' blocks inline style on <merror>
+Pass CSP absent allows inline style on <merror>
+Pass style-src-attr 'unsafe-inline' allows inline style on <merror>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <merror>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <merror>
+Fail style-src 'none' fallback blocks inline style on <merror>
+Pass style-src 'unsafe-inline' fallback allows inline style on <merror>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <merror>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <merror>
+Fail style-src-attr 'none' blocks inline style on <mfrac>
+Pass CSP absent allows inline style on <mfrac>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mfrac>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mfrac>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mfrac>
+Fail style-src 'none' fallback blocks inline style on <mfrac>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mfrac>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mfrac>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mfrac>
+Fail style-src-attr 'none' blocks inline style on <mi>
+Pass CSP absent allows inline style on <mi>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mi>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mi>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mi>
+Fail style-src 'none' fallback blocks inline style on <mi>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mi>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mi>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mi>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
new file mode 100644
index 00000000000..e225d3e9537
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
@@ -0,0 +1,78 @@
+Harness status: OK
+
+Found 72 tests
+
+40 Pass
+32 Fail
+Fail style-src-attr 'none' blocks inline style on <mrow>
+Pass CSP absent allows inline style on <mrow>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mrow>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mrow>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mrow>
+Fail style-src 'none' fallback blocks inline style on <mrow>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mrow>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mrow>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mrow>
+Fail style-src-attr 'none' blocks inline style on <ms>
+Pass CSP absent allows inline style on <ms>
+Pass style-src-attr 'unsafe-inline' allows inline style on <ms>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <ms>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <ms>
+Fail style-src 'none' fallback blocks inline style on <ms>
+Pass style-src 'unsafe-inline' fallback allows inline style on <ms>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <ms>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <ms>
+Fail style-src-attr 'none' blocks inline style on <mspace>
+Pass CSP absent allows inline style on <mspace>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mspace>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mspace>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mspace>
+Fail style-src 'none' fallback blocks inline style on <mspace>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mspace>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mspace>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mspace>
+Fail style-src-attr 'none' blocks inline style on <msqrt>
+Pass CSP absent allows inline style on <msqrt>
+Pass style-src-attr 'unsafe-inline' allows inline style on <msqrt>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <msqrt>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <msqrt>
+Fail style-src 'none' fallback blocks inline style on <msqrt>
+Pass style-src 'unsafe-inline' fallback allows inline style on <msqrt>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <msqrt>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <msqrt>
+Fail style-src-attr 'none' blocks inline style on <mstyle>
+Pass CSP absent allows inline style on <mstyle>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mstyle>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mstyle>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mstyle>
+Fail style-src 'none' fallback blocks inline style on <mstyle>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mstyle>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mstyle>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mstyle>
+Fail style-src-attr 'none' blocks inline style on <msub>
+Pass CSP absent allows inline style on <msub>
+Pass style-src-attr 'unsafe-inline' allows inline style on <msub>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <msub>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <msub>
+Fail style-src 'none' fallback blocks inline style on <msub>
+Pass style-src 'unsafe-inline' fallback allows inline style on <msub>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <msub>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <msub>
+Fail style-src-attr 'none' blocks inline style on <msubsup>
+Pass CSP absent allows inline style on <msubsup>
+Pass style-src-attr 'unsafe-inline' allows inline style on <msubsup>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <msubsup>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <msubsup>
+Fail style-src 'none' fallback blocks inline style on <msubsup>
+Pass style-src 'unsafe-inline' fallback allows inline style on <msubsup>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <msubsup>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <msubsup>
+Fail style-src-attr 'none' blocks inline style on <msup>
+Pass CSP absent allows inline style on <msup>
+Pass style-src-attr 'unsafe-inline' allows inline style on <msup>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <msup>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <msup>
+Fail style-src 'none' fallback blocks inline style on <msup>
+Pass style-src 'unsafe-inline' fallback allows inline style on <msup>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <msup>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <msup>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
new file mode 100644
index 00000000000..7ff31276764
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
@@ -0,0 +1,78 @@
+Harness status: OK
+
+Found 72 tests
+
+40 Pass
+32 Fail
+Fail style-src-attr 'none' blocks inline style on <mtable>
+Pass CSP absent allows inline style on <mtable>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mtable>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mtable>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mtable>
+Fail style-src 'none' fallback blocks inline style on <mtable>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mtable>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mtable>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mtable>
+Fail style-src-attr 'none' blocks inline style on <mtd>
+Pass CSP absent allows inline style on <mtd>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mtd>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mtd>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mtd>
+Fail style-src 'none' fallback blocks inline style on <mtd>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mtd>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mtd>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mtd>
+Fail style-src-attr 'none' blocks inline style on <mtext>
+Pass CSP absent allows inline style on <mtext>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mtext>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mtext>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mtext>
+Fail style-src 'none' fallback blocks inline style on <mtext>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mtext>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mtext>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mtext>
+Fail style-src-attr 'none' blocks inline style on <mtr>
+Pass CSP absent allows inline style on <mtr>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mtr>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mtr>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mtr>
+Fail style-src 'none' fallback blocks inline style on <mtr>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mtr>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mtr>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mtr>
+Fail style-src-attr 'none' blocks inline style on <munder>
+Pass CSP absent allows inline style on <munder>
+Pass style-src-attr 'unsafe-inline' allows inline style on <munder>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <munder>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <munder>
+Fail style-src 'none' fallback blocks inline style on <munder>
+Pass style-src 'unsafe-inline' fallback allows inline style on <munder>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <munder>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <munder>
+Fail style-src-attr 'none' blocks inline style on <munderover>
+Pass CSP absent allows inline style on <munderover>
+Pass style-src-attr 'unsafe-inline' allows inline style on <munderover>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <munderover>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <munderover>
+Fail style-src 'none' fallback blocks inline style on <munderover>
+Pass style-src 'unsafe-inline' fallback allows inline style on <munderover>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <munderover>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <munderover>
+Fail style-src-attr 'none' blocks inline style on <none>
+Pass CSP absent allows inline style on <none>
+Pass style-src-attr 'unsafe-inline' allows inline style on <none>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <none>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <none>
+Fail style-src 'none' fallback blocks inline style on <none>
+Pass style-src 'unsafe-inline' fallback allows inline style on <none>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <none>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <none>
+Fail style-src-attr 'none' blocks inline style on <semantics>
+Pass CSP absent allows inline style on <semantics>
+Pass style-src-attr 'unsafe-inline' allows inline style on <semantics>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <semantics>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <semantics>
+Fail style-src 'none' fallback blocks inline style on <semantics>
+Pass style-src 'unsafe-inline' fallback allows inline style on <semantics>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <semantics>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <semantics>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
new file mode 100644
index 00000000000..bed331d034b
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/[email protected]
@@ -0,0 +1,78 @@
+Harness status: OK
+
+Found 72 tests
+
+40 Pass
+32 Fail
+Fail style-src-attr 'none' blocks inline style on <mmultiscripts>
+Pass CSP absent allows inline style on <mmultiscripts>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mmultiscripts>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mmultiscripts>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mmultiscripts>
+Fail style-src 'none' fallback blocks inline style on <mmultiscripts>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mmultiscripts>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mmultiscripts>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mmultiscripts>
+Fail style-src-attr 'none' blocks inline style on <mn>
+Pass CSP absent allows inline style on <mn>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mn>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mn>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mn>
+Fail style-src 'none' fallback blocks inline style on <mn>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mn>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mn>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mn>
+Fail style-src-attr 'none' blocks inline style on <mo>
+Pass CSP absent allows inline style on <mo>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mo>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mo>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mo>
+Fail style-src 'none' fallback blocks inline style on <mo>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mo>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mo>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mo>
+Fail style-src-attr 'none' blocks inline style on <mover>
+Pass CSP absent allows inline style on <mover>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mover>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mover>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mover>
+Fail style-src 'none' fallback blocks inline style on <mover>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mover>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mover>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mover>
+Fail style-src-attr 'none' blocks inline style on <mpadded>
+Pass CSP absent allows inline style on <mpadded>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mpadded>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mpadded>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mpadded>
+Fail style-src 'none' fallback blocks inline style on <mpadded>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mpadded>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mpadded>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mpadded>
+Fail style-src-attr 'none' blocks inline style on <mphantom>
+Pass CSP absent allows inline style on <mphantom>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mphantom>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mphantom>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mphantom>
+Fail style-src 'none' fallback blocks inline style on <mphantom>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mphantom>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mphantom>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mphantom>
+Fail style-src-attr 'none' blocks inline style on <mprescripts>
+Pass CSP absent allows inline style on <mprescripts>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mprescripts>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mprescripts>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mprescripts>
+Fail style-src 'none' fallback blocks inline style on <mprescripts>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mprescripts>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mprescripts>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mprescripts>
+Fail style-src-attr 'none' blocks inline style on <mroot>
+Pass CSP absent allows inline style on <mroot>
+Pass style-src-attr 'unsafe-inline' allows inline style on <mroot>
+Pass style-src-attr 'unsafe-hashes' with matching hash allows inline style on <mroot>
+Fail style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <mroot>
+Fail style-src 'none' fallback blocks inline style on <mroot>
+Pass style-src 'unsafe-inline' fallback allows inline style on <mroot>
+Pass style-src-attr 'unsafe-inline' overrides style-src 'none' on <mroot>
+Fail style-src-attr 'none' overrides style-src 'unsafe-inline' on <mroot>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/tabindex-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/tabindex-002.txt
new file mode 100644
index 00000000000..308ff6b48a8
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/tabindex-002.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Fail
+Fail Elements with different tabindex must be focused sequentially when pressing 'Tab' keys
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/text-and-math/basic-mathematical-alphanumeric-symbols-with-default-font.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/text-and-math/basic-mathematical-alphanumeric-symbols-with-default-font.txt
new file mode 100644
index 00000000000..5f400612d67
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/text-and-math/basic-mathematical-alphanumeric-symbols-with-default-font.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail Bold mathematical alphanumeric symbol with the default font
+Fail Italic mathematical alphanumeric symbol with the default font
+Fail Bold-italic mathematical alphanumeric symbol with the default font
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/axisheight5000-verticalarrow14000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/axisheight5000-verticalarrow14000.woff
new file mode 100644
index 00000000000..70f366a3d0b
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/axisheight5000-verticalarrow14000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/css-units.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/css-units.woff
new file mode 100644
index 00000000000..0957a2fc973
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/css-units.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-axisheight7000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-axisheight7000-rulethickness1000.woff
new file mode 100644
index 00000000000..2a9d78cc9d4
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-axisheight7000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff
new file mode 100644
index 00000000000..e4d381edaf2
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff
new file mode 100644
index 00000000000..28e41f5cfb3
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatorgapmin4000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatorgapmin4000-rulethickness1000.woff
new file mode 100644
index 00000000000..ab648f5eb66
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatorgapmin4000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff
new file mode 100644
index 00000000000..f0e0d5cbc2b
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff
new file mode 100644
index 00000000000..2e910bbf421
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff
new file mode 100644
index 00000000000..d6f530d8e10
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff
new file mode 100644
index 00000000000..1b5d60bb144
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff
new file mode 100644
index 00000000000..d2685397960
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-rulethickness10000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-rulethickness10000.woff
new file mode 100644
index 00000000000..ec69f2424f2
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/fraction-rulethickness10000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight1250.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight1250.woff
new file mode 100644
index 00000000000..1a3fb2e725c
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight1250.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff
new file mode 100644
index 00000000000..0b4f8bf46a7
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight3000-2AFF-axisheight1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight3000-2AFF-axisheight1000.woff
new file mode 100644
index 00000000000..13d3e4ad4ed
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight3000-2AFF-axisheight1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight5000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight5000.woff
new file mode 100644
index 00000000000..53fcc13a160
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight5000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight7000-2AFF-italiccorrection5000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight7000-2AFF-italiccorrection5000.woff
new file mode 100644
index 00000000000..601a424a94b
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/largeop-displayoperatorminheight7000-2AFF-italiccorrection5000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-lowerlimitbaselinedropmin3000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-lowerlimitbaselinedropmin3000.woff
new file mode 100644
index 00000000000..76395db141c
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-lowerlimitbaselinedropmin3000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-lowerlimitgapmin11000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-lowerlimitgapmin11000.woff
new file mode 100644
index 00000000000..df67de52bd0
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-lowerlimitgapmin11000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-upperlimitbaselinerisemin5000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-upperlimitbaselinerisemin5000.woff
new file mode 100644
index 00000000000..f5d7b9c84e6
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-upperlimitbaselinerisemin5000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-upperlimitgapmin7000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-upperlimitgapmin7000.woff
new file mode 100644
index 00000000000..c88e7a9c709
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/limits-upperlimitgapmin7000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/operators.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/operators.woff
new file mode 100644
index 00000000000..ec4256ffe5c
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/operators.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-degreebottomraisepercent25-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-degreebottomraisepercent25-rulethickness1000.woff
new file mode 100644
index 00000000000..b334dd99e0c
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-degreebottomraisepercent25-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-displaystyleverticalgap7000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-displaystyleverticalgap7000-rulethickness1000.woff
new file mode 100644
index 00000000000..cb702661195
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-displaystyleverticalgap7000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-extraascender3000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-extraascender3000-rulethickness1000.woff
new file mode 100644
index 00000000000..cf064b1c07e
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-extraascender3000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff
new file mode 100644
index 00000000000..61ab4163ac9
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-kernbeforedegree4000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-kernbeforedegree4000-rulethickness1000.woff
new file mode 100644
index 00000000000..9ed871062ef
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-kernbeforedegree4000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-negativekernbeforedegree1000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-negativekernbeforedegree1000-rulethickness1000.woff
new file mode 100644
index 00000000000..ef00335b1cb
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-negativekernbeforedegree1000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-rtlm.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-rtlm.woff
new file mode 100644
index 00000000000..043b5b24625
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-rtlm.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-rulethickness8000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-rulethickness8000.woff
new file mode 100644
index 00000000000..090caa9efd3
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-rulethickness8000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-verticalgap6000-rulethickness1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-verticalgap6000-rulethickness1000.woff
new file mode 100644
index 00000000000..873a3d9f2de
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/radical-verticalgap6000-rulethickness1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-spaceafterscript3000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-spaceafterscript3000.woff
new file mode 100644
index 00000000000..44f9ece8570
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-spaceafterscript3000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscriptbaselinedropmin9000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscriptbaselinedropmin9000.woff
new file mode 100644
index 00000000000..46880c1d0ce
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscriptbaselinedropmin9000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscriptshiftdown6000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscriptshiftdown6000.woff
new file mode 100644
index 00000000000..3565f7aaa8d
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscriptshiftdown6000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscripttopmax4000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscripttopmax4000.woff
new file mode 100644
index 00000000000..69cd23de8b5
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subscripttopmax4000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff
new file mode 100644
index 00000000000..2f9da79063b
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subsuperscriptgapmin11000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subsuperscriptgapmin11000.woff
new file mode 100644
index 00000000000..d85dfee15e3
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-subsuperscriptgapmin11000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptbaselinedropmax10000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptbaselinedropmax10000.woff
new file mode 100644
index 00000000000..3f528edfe04
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptbaselinedropmax10000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptbottommin8000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptbottommin8000.woff
new file mode 100644
index 00000000000..f3937e869bc
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptbottommin8000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptshiftup7000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptshiftup7000.woff
new file mode 100644
index 00000000000..845afdf2ff3
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptshiftup7000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptshiftupcramped5000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptshiftupcramped5000.woff
new file mode 100644
index 00000000000..c85e7f65135
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/scripts-superscriptshiftupcramped5000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff
new file mode 100644
index 00000000000..d8f8ae48a6d
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-bottomshiftdown6000-axisheight1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-bottomshiftdown6000-axisheight1000.woff
new file mode 100644
index 00000000000..a3a491dbaf1
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-bottomshiftdown6000-axisheight1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-displaystylegapmin4000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-displaystylegapmin4000.woff
new file mode 100644
index 00000000000..a94d6286eab
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-displaystylegapmin4000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-gapmin8000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-gapmin8000.woff
new file mode 100644
index 00000000000..a4428d1d49b
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-gapmin8000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff
new file mode 100644
index 00000000000..bb286182e47
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-topshiftup9000-axisheight1000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-topshiftup9000-axisheight1000.woff
new file mode 100644
index 00000000000..52bc04458ca
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stack-topshiftup9000-axisheight1000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-bottomshiftdown3000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-bottomshiftdown3000.woff
new file mode 100644
index 00000000000..275a4350c91
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-bottomshiftdown3000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-gapabovemin7000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-gapabovemin7000.woff
new file mode 100644
index 00000000000..af61d8ed329
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-gapabovemin7000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-gapbelowmin11000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-gapbelowmin11000.woff
new file mode 100644
index 00000000000..8900a81419f
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-gapbelowmin11000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-topshiftup5000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-topshiftup5000.woff
new file mode 100644
index 00000000000..7a90c74f3e5
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchstack-topshiftup5000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchy-text-direction-asymetrical.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchy-text-direction-asymetrical.woff
new file mode 100644
index 00000000000..8b4e1858449
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchy-text-direction-asymetrical.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchy.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchy.woff
new file mode 100644
index 00000000000..ac7d908f6e2
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/stretchy.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-overbarextraascender3000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-overbarextraascender3000.woff
new file mode 100644
index 00000000000..2aa7133879b
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-overbarextraascender3000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-overbarverticalgap11000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-overbarverticalgap11000.woff
new file mode 100644
index 00000000000..0f975115d93
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-overbarverticalgap11000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-underbarextradescender5000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-underbarextradescender5000.woff
new file mode 100644
index 00000000000..bb3e4658d8c
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-underbarextradescender5000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-underbarverticalgap7000.woff b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-underbarverticalgap7000.woff
new file mode 100644
index 00000000000..36a4e869d11
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fonts/math/underover-accentbaseheight4000-underbarverticalgap7000.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/direction/direction.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/direction/direction.html
new file mode 100644
index 00000000000..d8ed49ee517
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/direction/direction.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html dir="rtl">
+<head>
+<meta charset="utf-8"/>
+<title>Verify computed direction</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element">
+<meta name="assert" content="Verify computed direction value.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests() {
+ test(function() {
+ assert_equals(window.getComputedStyle(document.getElementById('x1')).direction, "ltr");
+ assert_equals(window.getComputedStyle(document.getElementById('x2')).direction, "ltr");
+ assert_equals(window.getComputedStyle(document.getElementById('x3')).direction, "ltr");
+ assert_equals(window.getComputedStyle(document.getElementById('x4')).direction, "rtl");
+ }, "Check direction");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <!-- Test the CSS direction and dir attribute on the <math> element. It
+ should be "ltr", except if an explicit dir="rtl" is used. -->
+
+ <p>Χ©Χ•Χ¨Χ©Χ™ ΧžΧ©Χ•Χ•ΧΧ” ΧžΧ•Χ“Χ’Χ©Χͺ Χ–Χ• <math id="x1"> <mrow> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mrow> </math> ΧžΧ•Χ“Χ’Χ©Χ™Χ גם הם</p>
+
+ <p>Χ©Χ•Χ¨Χ©Χ™ ΧžΧ©Χ•Χ•ΧΧ” ΧžΧ•Χ“Χ’Χ©Χͺ Χ–Χ• <math id="x2" dir="ltr"> <mrow> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mrow> </math> ΧžΧ•Χ“Χ’Χ©Χ™Χ גם הם</p>
+
+ <p>Χ©Χ•Χ¨Χ©Χ™ ΧžΧ©Χ•Χ•ΧΧ” ΧžΧ•Χ“Χ’Χ©Χͺ Χ–Χ• <math id="x3" dir="invalid"> <mrow> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mrow> </math> ΧžΧ•Χ“Χ’Χ©Χ™Χ גם הם</p>
+
+ <p>Χ©Χ•Χ¨Χ©Χ™ ΧžΧ©Χ•Χ•ΧΧ” ΧžΧ•Χ“Χ’Χ©Χͺ Χ–Χ• <math id="x4" dir="rtl"> <mrow> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mrow> </math> ΧžΧ•Χ“Χ’Χ©Χ™Χ גם הם</p>
+
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-1.html
new file mode 100644
index 00000000000..ef3ef11424b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-1.html
@@ -0,0 +1,191 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Fraction</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<link rel="help" href="https://w3c.github.io/mathml-core/#fraction-with-nonzero-line-thickness">
+<link rel="help" href="https://w3c.github.io/mathml-core/#fraction-with-zero-line-thickness">
+<meta name="assert" content="Verify fraction metrics for different sizes of numerator and denominator.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math, mspace {
+ /* OS/2.sxHeight = 800 */
+ /* post.underlineThickness == 20 */
+ font-family: Ahem, math;
+ font-size: 10px;
+ }
+ div.shrink-wrap {
+ background: yellow;
+ display: inline-block;
+ margin-top: 5px;
+ padding-top: 5px;
+ }
+</style>
+<script>
+ const xHeight = 800;
+ const underlineThickness = 800;
+ const emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ box.center = (box.left + box.right) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 4;
+ var mathAxis = getBox("baseline").top - (xHeight/2) * emToPx;
+ for (var i = 0; i <= 4; i++) {
+ var frac = getBox("frac" + i);
+ var num = getBox("frac" + i + "num");
+ var den = getBox("frac" + i + "den");
+ // To estimate the fraction axis, we calculate barycenter between the
+ // top and bottom of the fraction, using the heights of numerator and
+ // denominator as weights.
+ var fracAxis = (frac.top * den.height + frac.bottom * num.height) / (num.height + den.height);
+ assert_approx_equals(fracAxis, mathAxis, e, "frac" + i + " fraction bar");
+ }
+ }, "Fraction axis is aligned on the math axis");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ for (var i = 0; i < 10; i++) {
+ assert_less_than_equal(getBox("frac" + i + "num").bottom, getBox("frac" + i + "den").top, "numerator is above denominator");
+ assert_less_than(getBox("frac" + i + "den").top - getBox("frac" + i + "num").bottom, 5, "The gap between numerator and denominator is not too large");
+ }
+ }, "Vertical positions of numerator and denominator");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 3;
+ for (var i = 0; i < 10; i++)
+ assert_approx_equals(getBox("frac" + i + "num").center, getBox("frac" + i + "den").center, e, "numerator and denominator are horizontally centered");
+ }, "Horizontal alignments of numerator and denominator");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 5;
+ for (var i = 0; i < 10; i++) {
+ var frac = getBox("frac" + i);
+ var num = getBox("frac" + i + "num");
+ var den = getBox("frac" + i + "den");
+ assert_approx_equals(frac.height, den.bottom - num.top, e, "height of frac " + i + " is determined by the bottom/top sides of the denominator/numerator");
+ assert_approx_equals(frac.width, Math.max(num.right, den.right) - Math.min(num.left, den.left), e, "width of frac " + i + " is determined by the left/right sides of the denominator/numerator (plus some spacing)");
+ }
+ }, "Dimension of mfrac elements");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection.has_mfrac());
+
+ Array.from(document.getElementsByClassName("shrink-wrap")).forEach((container) => {
+ var marginPx = 2; // By default fractions have 1px margin on each side.
+ var epsilon = 1;
+ var containerWidth = container.getBoundingClientRect().width;
+ var children = container.getElementsByTagName("mspace");
+ var numWidth = children[0].getBoundingClientRect().width;
+ var denWidth = children[1].getBoundingClientRect().width;
+ assert_approx_equals(containerWidth, marginPx + Math.max(numWidth, denWidth), epsilon, "Should be the maximum preferred width of numerator/denominator.");
+ });
+ }, "Preferred width of mfrac elements");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="baseline" width="1em" height="0em" depth="1em" style="background: black"/>
+ <mfrac id="frac0">
+ <mspace id="frac0num" width="15px" height="15px" style="background: blue"/>
+ <mspace id="frac0den" width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac1">
+ <mspace id="frac1num" width="30px" height="15px" style="background: blue"/>
+ <mspace id="frac1den" width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac2">
+ <mspace id="frac2num" width="15px" height="15px" style="background: blue"/>
+ <mspace id="frac2den" width="30px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac3">
+ <mspace id="frac3num" width="15px" height="30px" style="background: blue"/>
+ <mspace id="frac3den" width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac4">
+ <mspace id="frac4num" width="15px" height="15px" style="background: blue"/>
+ <mspace id="frac4den" width="15px" height="30px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac5" linethickness="0px">
+ <mspace id="frac5num" width="15px" height="15px" style="background: blue"/>
+ <mspace id="frac5den" width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac6" linethickness="0px">
+ <mspace id="frac6num" width="30px" height="15px" style="background: blue"/>
+ <mspace id="frac6den" width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac7" linethickness="0px">
+ <mspace id="frac7num" width="15px" height="15px" style="background: blue"/>
+ <mspace id="frac7den" width="30px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac8" linethickness="0px">
+ <mspace id="frac8num" width="15px" height="30px" style="background: blue"/>
+ <mspace id="frac8den" width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ <mfrac id="frac9" linethickness="0px">
+ <mspace id="frac9num" width="15px" height="15px" style="background: blue"/>
+ <mspace id="frac9den" width="15px" height="30px" style="background: green"/>
+ </mfrac>
+ </math>
+ </p>
+ <div class="shrink-wrap">
+ <math>
+ <mfrac>
+ <mspace width="30px" height="15px" style="background: blue"/>
+ <mspace width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mfrac>
+ <mspace width="15px" height="15px" style="background: blue"/>
+ <mspace width="30px" height="15px" style="background: green"/>
+ </mfrac>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mfrac linethickness="0px">
+ <mspace width="30px" height="15px" style="background: blue"/>
+ <mspace width="15px" height="15px" style="background: green"/>
+ </mfrac>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mfrac linethickness="0px">
+ <mspace width="15px" height="15px" style="background: blue"/>
+ <mspace width="30px" height="15px" style="background: green"/>
+ </mfrac>
+ </math>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-linethickness-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-linethickness-002.html
new file mode 100644
index 00000000000..794fff68bd2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-linethickness-002.html
@@ -0,0 +1,131 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>fractions linethickness</title>
+ <link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+ <link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript">
+ <meta name="assert" content="Verifies fraction with positive, negative, percent and named space linethickness values.">
+ <script src="../../../resources/testharness.js"></script>
+ <script src="../../../resources/testharnessreport.js"></script>
+ <script src="../../../mathml/support/feature-detection.js"></script>
+ <script src="../../../mathml/support/fonts.js"></script>
+ <style type="text/css">
+ @font-face {
+ font-family: TestFont;
+ src: url("../../../fonts/math/fraction-rulethickness10000.woff");
+ }
+ math {
+ /* FractionRuleThickness = 10000 * 10 / 1000 = 100px; */
+ font-family: "TestFont";
+ font-size: 10px;
+ }
+ </style>
+ <script>
+ function LineThickness(aId) {
+ var mfrac = document.getElementById(aId);
+ var numBox = mfrac.firstElementChild.getBoundingClientRect();
+ var denumBox = mfrac.lastElementChild.getBoundingClientRect();
+ return denumBox.top - numBox.bottom;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ var defaultRuleThickness = 100;
+ var epsilon = 2;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(LineThickness("positive"), 5.67 * 10, epsilon);
+ }, "Positive");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ /* Negative values are treated as 0 */
+ assert_approx_equals(LineThickness("negative"), 0, epsilon);
+ }, "Negative");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(LineThickness("percent"), defaultRuleThickness * 234 / 100, epsilon);
+ }, "Percentage");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ /* Namedspace values are invalid in MathML Core. */
+ assert_approx_equals(LineThickness("namedspace"), defaultRuleThickness, epsilon);
+ }, "Named space");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ /* Calc() expressions are invalid in MathML Core. */
+ assert_approx_equals(LineThickness("calc"), defaultRuleThickness, epsilon);
+ }, "Calc() expression");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ document.getElementById("dynamic-attach").setAttribute("linethickness", "400%");
+ document.getElementById("dynamic-modify").setAttribute("linethickness", "200%");
+ document.getElementById("dynamic-remove").removeAttribute("linethickness");
+ assert_approx_equals(LineThickness("dynamic-attach"), defaultRuleThickness * 4, epsilon, "attach");
+ assert_approx_equals(LineThickness("dynamic-modify"), defaultRuleThickness * 2, epsilon, "modify");
+ assert_approx_equals(LineThickness("dynamic-remove"), defaultRuleThickness, epsilon, "remove");
+ }, "Dynamic linethickness");
+
+ done();
+ }
+ </script>
+ </head>
+ <body>
+ <math>
+ <mfrac id="positive" linethickness="5.67em">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ <math>
+ <mfrac id="negative" linethickness="-1.23em">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ <math>
+ <mfrac id="percent" linethickness="234%">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ <math>
+ <mfrac id="namedspace" linethickness="veryverythickmathspace">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ <math>
+ <mfrac id="calc" linethickness="calc(20px)">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ <math>
+ <mfrac id="dynamic-attach">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ <math>
+ <mfrac id="dynamic-modify" linethickness="300%">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ <math>
+ <mfrac id="dynamic-remove" linethickness="300%">
+ <mspace width="20px" height="10px" style="background: blue"></mspace>
+ <mspace width="20px" height="10px" style="background: cyan"></mspace>
+ </mfrac>
+ </math>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-1.html
new file mode 100644
index 00000000000..e4078675613
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-1.html
@@ -0,0 +1,440 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Fraction parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<meta name="assert" content="Element mfrac correctly uses the fraction parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: axisheight7000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-axisheight7000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: denominatordisplaystylegapmin5000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: denominatorgapmin4000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-denominatorgapmin4000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: denominatorshiftdown3000-axisheight1000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-denominatorshiftdown3000-axisheight1000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: numeratordisplaystylegapmin8000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: numeratorgapmin9000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: numeratorshiftup11000-axisheight1000-rulethickness1000;
+ src: url("../../../fonts/math/fraction-numeratorshiftup11000-axisheight1000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: rulethickness10000;
+ src: url("../../../fonts/math/fraction-rulethickness10000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 7000 * emToPx;
+ var v2 = 1000 * emToPx;
+ assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom,
+ v1 + v2 / 2, epsilon, "mfrac: axis height");
+ }, "AxisHeight");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 5000 * emToPx;
+ assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom,
+ v1, epsilon, "mfrac: denominator gap");
+ }, "DenominatorDisplayStyleGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 6000 * emToPx;
+ assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom,
+ v1, epsilon, "mfrac: denominator shift");
+ }, "DenominatorDisplayStyleShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 5000 * emToPx;
+ assert_approx_equals(getBox("den0002b").top - getBox("ref0002b").bottom,
+ v1, epsilon, "mfrac: denominator gap");
+ }, "DenominatorDisplayStyleGapMin Displaystyle");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var v1 = 6000 * emToPx;
+ assert_approx_equals(getBox("den0003b").top - getBox("ref0003b").bottom,
+ v1, epsilon, "mfrac: denominator shift");
+ }, "DenominatorDisplayStyleShiftDown Displaystyle");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var v1 = 5000 * emToPx;
+ assert_approx_equals(getBox("den0002c").top - getBox("ref0002c").bottom,
+ v1, epsilon, "mfrac: denominator gap");
+ }, "DenominatorDisplayStyleGapMin Displaystyle on fraction");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var v1 = 6000 * emToPx;
+ assert_approx_equals(getBox("den0003c").top - getBox("ref0003c").bottom,
+ v1, epsilon, "mfrac: denominator shift");
+ }, "DenominatorDisplayStyleShiftDown Displaystyle on fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var v1 = 4000 * emToPx;
+ assert_approx_equals(getBox("den0004").top - getBox("ref0004").bottom,
+ v1, epsilon, "mfrac: denominator gap");
+ }, "DenominatorGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 3000 * emToPx;
+ assert_approx_equals(getBox("den0005").top - getBox("ref0005").bottom,
+ v1, epsilon, "mfrac: denominator shift");
+ }, "DenominatorShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var v1 = 4000 * emToPx;
+ assert_approx_equals(getBox("den0004b").top - getBox("ref0004b").bottom,
+ v1, epsilon, "mfrac: denominator gap");
+ }, "DenominatorGapMin Displaystyle on fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 3000 * emToPx;
+ assert_approx_equals(getBox("den0005b").top - getBox("ref0005b").bottom,
+ v1, epsilon, "mfrac: denominator shift");
+ }, "DenominatorShiftDown Displaystyle on fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 8000 * emToPx;
+ assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom,
+ v1, epsilon, "mfrac: numerator gap");
+ }, "NumeratorDisplayStyleGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 2000 * emToPx;
+ assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom,
+ v1, epsilon, "mfrac: numerator shift");
+ }, "NumeratorDisplayStyleShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 8000 * emToPx;
+ assert_approx_equals(getBox("ref0006b").top - getBox("num0006b").bottom,
+ v1, epsilon, "mfrac: numerator gap");
+ }, "NumeratorDisplayStyleGapMin Displaystyle");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 2000 * emToPx;
+ assert_approx_equals(getBox("ref0007b").top - getBox("num0007b").bottom,
+ v1, epsilon, "mfrac: numerator shift");
+ }, "NumeratorDisplayStyleShiftDown Displaystyle");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 8000 * emToPx;
+ assert_approx_equals(getBox("ref0006c").top - getBox("num0006c").bottom,
+ v1, epsilon, "mfrac: numerator gap");
+ }, "NumeratorDisplayStyleGapMin Displaystyle on fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 2000 * emToPx;
+ assert_approx_equals(getBox("ref0007c").top - getBox("num0007c").bottom,
+ v1, epsilon, "mfrac: numerator shift");
+ }, "NumeratorDisplayStyleShiftDown Displaystyle on fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 9000 * emToPx;
+ assert_approx_equals(getBox("ref0008").top - getBox("num0008").bottom,
+ v1, epsilon, "mfrac: numerator gap");
+ }, "NumeratorGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 11000 * emToPx;
+ assert_approx_equals(getBox("ref0009").top - getBox("num0009").bottom,
+ v1, epsilon, "mfrac: numerator shift");
+ }, "NumeratorShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 10000 * emToPx;
+ assert_approx_equals(getBox("den0010").top - getBox("num0010").bottom,
+ v1, epsilon, "mfrac: rule thickness");
+ }, "FractionRuleThickness");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: axisheight7000-rulethickness1000;">
+ <mspace id="ref0001" depth="1em" width="3em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em" height="1em" id="num0001" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math display="block" style="font-family: denominatordisplaystylegapmin5000-rulethickness1000;">
+ <mspace id="ref0002" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em"/>
+ <mspace width="3em" height="1em" id="den0002" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math display="block" style="font-family: denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0003" width="3em" height="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0003" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: denominatordisplaystylegapmin5000-rulethickness1000;">
+ <mspace id="ref0002b" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em"/>
+ <mspace width="3em" height="1em" id="den0002b" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0003b" width="3em" height="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0003b" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: denominatordisplaystylegapmin5000-rulethickness1000;">
+ <mspace id="ref0002c" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac displaystyle="true">
+ <mspace width="3em"/>
+ <mspace width="3em" height="1em" id="den0002c" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: denominatordisplaystyleshiftdown6000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0003c" width="3em" height="1em" style="background: green"/>
+ <mfrac displaystyle="true">
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0003c" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: denominatorgapmin4000-rulethickness1000;">
+ <mspace id="ref0004" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em"/>
+ <mspace width="3em" height="1em" id="den0004" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: denominatorshiftdown3000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0005" width="3em" height="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0005" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: denominatorgapmin4000-rulethickness1000;">
+ <mspace id="ref0004b" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac displaystyle="false">
+ <mspace width="3em"/>
+ <mspace width="3em" height="1em" id="den0004b" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: denominatorshiftdown3000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0005b" width="3em" height="1em" style="background: green"/>
+ <mfrac displaystyle="false">
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0005b" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math display="block" style="font-family: numeratordisplaystylegapmin8000-rulethickness1000;">
+ <mspace id="ref0006" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em" depth="1em" id="num0006" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math display="block" style="font-family: numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0007" width="3em"
+ depth="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em" height="1em" id="num0007" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: numeratordisplaystylegapmin8000-rulethickness1000;">
+ <mspace id="ref0006b" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em" depth="1em" id="num0006b" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0007b" width="3em"
+ depth="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em" height="1em" id="num0007b" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: numeratordisplaystylegapmin8000-rulethickness1000;">
+ <mspace id="ref0006c" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac displaystyle="true">
+ <mspace width="3em" depth="1em" id="num0006c" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: numeratordisplaystyleshiftup2000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0007c" width="3em"
+ depth="1em" style="background: green"/>
+ <mfrac displaystyle="true">
+ <mspace width="3em" height="1em" id="num0007c" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: numeratorgapmin9000-rulethickness1000;">
+ <mspace id="ref0008" width="3em"
+ height=".5em" depth=".5em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em" depth="1em" id="num0008" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: numeratorshiftup11000-axisheight1000-rulethickness1000;">
+ <mspace id="ref0009" width="3em"
+ depth="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="3em" height="1em" id="num0009" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: rulethickness10000">
+ <mfrac>
+ <mspace width="3em" height="1em" id="num0010" style="background: blue"/>
+ <mspace width="3em" depth="1em" id="den0010" style="background: green"/>
+ </mfrac>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-2.html
new file mode 100644
index 00000000000..77bf0707bb4
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-2.html
@@ -0,0 +1,290 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Stack parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<meta name="assert" content="Element mfrac correctly uses the stack parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: bottomdisplaystyleshiftdown5000-axisheight1000;
+ src: url("../../../fonts/math/stack-bottomdisplaystyleshiftdown5000-axisheight1000.woff");
+ }
+ @font-face {
+ font-family: bottomshiftdown6000-axisheight1000;
+ src: url("../../../fonts/math/stack-bottomshiftdown6000-axisheight1000.woff");
+ }
+ @font-face {
+ font-family: displaystylegapmin4000;
+ src: url("../../../fonts/math/stack-displaystylegapmin4000.woff");
+ }
+ @font-face {
+ font-family: gapmin8000;
+ src: url("../../../fonts/math/stack-gapmin8000.woff");
+ }
+ @font-face {
+ font-family: topdisplaystyleshiftup3000-axisheight1000;
+ src: url("../../../fonts/math/stack-topdisplaystyleshiftup3000-axisheight1000.woff");
+ }
+ @font-face {
+ font-family: topshiftup9000-axisheight1000;
+ src: url("../../../fonts/math/stack-topshiftup9000-axisheight1000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom,
+ v, epsilon, "mfrac: denominator shift");
+ }, "BottomDisplayStyleShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("den0002b").top - getBox("ref0002b").bottom,
+ v, epsilon, "mfrac: denominator shift");
+ }, "BottomDisplayStyleShiftDown Displaystyle");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("den0002c").top - getBox("ref0002c").bottom,
+ v, epsilon, "mfrac: denominator shift");
+ }, "BottomDisplayStyleShiftDown Displaystyle om fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 6000 * emToPx;
+ assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom,
+ v, epsilon, "mfrac: denominator shift");
+ }, "BottomShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 4000 * emToPx;
+ assert_approx_equals(getBox("den0004").top - getBox("num0004").bottom,
+ v, epsilon, "mfrac: gap");
+ }, "DisplayStyleGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 4000 * emToPx;
+ assert_approx_equals(getBox("den0004b").top - getBox("num0004b").bottom,
+ v, epsilon, "mfrac: gap");
+ }, "DisplayStyleGapMin Dsiplaystyle");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 4000 * emToPx;
+ assert_approx_equals(getBox("den0004c").top - getBox("num0004c").bottom,
+ v, epsilon, "mfrac: gap");
+ }, "DisplayStyleGapMin Dsiplaystyle on fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 8000 * emToPx;
+ assert_approx_equals(getBox("den0005").top - getBox("num0005").bottom,
+ v, epsilon, "mfrac: gap");
+ }, "GapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom,
+ v, epsilon, "mfrac: numerator shift");
+ }, "TopDisplayStyleShiftUp");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("ref0006b").top - getBox("num0006b").bottom,
+ v, epsilon, "mfrac: numerator shift");
+ }, "TopDisplayStyleShiftUp Displaystyle");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("ref0006c").top - getBox("num0006c").bottom,
+ v, epsilon, "mfrac: numerator shift");
+ }, "TopDisplayStyleShiftUp Displaystyle on fraction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 9000 * emToPx;
+ assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom,
+ v, epsilon, "mfrac: numerator shift");
+ }, "ToShiftUp");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 9000 * emToPx;
+ assert_approx_equals(getBox("ref0007b").top - getBox("num0007b").bottom,
+ v, epsilon, "mfrac: numerator shift");
+ }, "ToShiftUp with Displaystyle on fraction");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math display="block" style="font-family: bottomdisplaystyleshiftdown5000-axisheight1000;">
+ <mspace id="ref0002" width="3em" height="1em" style="background: green"/>
+ <mfrac linethickness="0px">
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0002" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: bottomdisplaystyleshiftdown5000-axisheight1000;">
+ <mspace id="ref0002b" width="3em" height="1em" style="background: green"/>
+ <mfrac linethickness="0px">
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0002b" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: bottomdisplaystyleshiftdown5000-axisheight1000;">
+ <mspace id="ref0002c" width="3em" height="1em" style="background: green"/>
+ <mfrac displaystyle="true" linethickness="0px">
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0002c" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: bottomshiftdown6000-axisheight1000;">
+ <mspace id="ref0003" width="3em" height="1em" style="background: green"/>
+ <mfrac linethickness="0px">
+ <mspace width="3em"/>
+ <mspace width="3em" depth="1em" id="den0003" style="background: blue"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math display="block" style="font-family: displaystylegapmin4000;">
+ <mfrac linethickness="0px">
+ <mspace width="3em" height="1em" id="num0004" style="background: blue"/>
+ <mspace width="3em" depth="1em" id="den0004" style="background: green"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: displaystylegapmin4000;">
+ <mfrac linethickness="0px">
+ <mspace width="3em" height="1em" id="num0004b" style="background: blue"/>
+ <mspace width="3em" depth="1em" id="den0004b" style="background: green"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: displaystylegapmin4000;">
+ <mfrac displaystyle="true" linethickness="0px">
+ <mspace width="3em" height="1em" id="num0004c" style="background: blue"/>
+ <mspace width="3em" depth="1em" id="den0004c" style="background: green"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: gapmin8000;">
+ <mfrac linethickness="0px">
+ <mspace width="3em" height="1em" id="num0005" style="background: blue"/>
+ <mspace width="3em" depth="1em" id="den0005" style="background: green"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math display="block" style="font-family: topdisplaystyleshiftup3000-axisheight1000;">
+ <mspace id="ref0006" width="3em" depth="1em" style="background: green"/>
+ <mfrac linethickness="0px">
+ <mspace width="3em" height="1em" id="num0006" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: topdisplaystyleshiftup3000-axisheight1000;">
+ <mspace id="ref0006b" width="3em" depth="1em" style="background: green"/>
+ <mfrac linethickness="0px">
+ <mspace width="3em" height="1em" id="num0006b" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: topdisplaystyleshiftup3000-axisheight1000;">
+ <mspace id="ref0006c" width="3em" depth="1em" style="background: green"/>
+ <mfrac displaystyle="true" linethickness="0px">
+ <mspace width="3em" height="1em" id="num0006c" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: topshiftup9000-axisheight1000;">
+ <mspace id="ref0007" width="3em" depth="1em" style="background: green"/>
+ <mfrac linethickness="0px">
+ <mspace width="3em" height="1em" id="num0007" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true" style="font-family: topshiftup9000-axisheight1000;">
+ <mspace id="ref0007b" width="3em" depth="1em" style="background: green"/>
+ <mfrac displaystyle="false" linethickness="0px">
+ <mspace width="3em" height="1em" id="num0007b" style="background: blue"/>
+ <mspace width="3em"/>
+ </mfrac>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-3.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-3.html
new file mode 100644
index 00000000000..3e298bd3d05
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/fractions/frac-parameters-3.html
@@ -0,0 +1,168 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Fraction/Stack parameters (fallback)</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<meta name="assert" content="Element mfrac correctly uses the fraction fallback parameters.">
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ /* Testing fallback values is tricky as we don't have a lot of flexibility to
+ make sure one parameter is not shadowed by another one. We also use the
+ Ahem font here, so can't really play with the fallback values involved. */
+ math, mspace {
+ font-size: 200px; /* Large value because underlineThickness is small */
+ }
+ math {
+ /* OS/2.sxHeight = 800 */
+ /* post.underlineThickness == 20 */
+ font-family: Ahem;
+ }
+</style>
+<script>
+ const emToPx = 200 / 1000; // font-size: 200px, font.em = 1000
+ const epsilon = 1;
+ const xHeight = 800;
+ const underlineThickness = 20;
+
+ // NB: This test assumes the fallback shifts are all equal to zero.
+ const axisHeight = xHeight / 2;
+ const fractionRuleThickness = underlineThickness;
+ const fractionNumeratorGapMin = underlineThickness;
+ const fractionDenominatorGapMin = underlineThickness;
+ const fractionNumeratorDisplayStyleGapMin = 3 * underlineThickness;
+ const fractionDenominatorDisplayStyleGapMin = 3 * underlineThickness;
+ const stackGapMin = 3 * underlineThickness;
+ const stackDisplayStyleGapMin = 7 * underlineThickness;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(axisHeight * emToPx,
+ (getBox("ref0001").top -
+ getBox("num0001").bottom) -
+ (fractionRuleThickness/2 +
+ fractionNumeratorGapMin) * emToPx,
+ epsilon);
+ assert_approx_equals((getBox("den0002").top -
+ getBox("num0002").bottom),
+ (fractionNumeratorGapMin +
+ fractionRuleThickness +
+ fractionDenominatorGapMin) * emToPx,
+ epsilon);
+ }, "nonzero linethickness, displaystyle=false");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(axisHeight * emToPx,
+ (getBox("ref0003").top -
+ getBox("num0003").bottom) -
+ (fractionRuleThickness/2 +
+ fractionNumeratorDisplayStyleGapMin) * emToPx,
+ epsilon, "mfrac: thickness, axis height");
+ assert_approx_equals((getBox("den0004").top -
+ getBox("num0004").bottom),
+ (fractionNumeratorDisplayStyleGapMin +
+ fractionRuleThickness +
+ fractionDenominatorDisplayStyleGapMin) * emToPx,
+ epsilon);
+ }, "nonzero linethickness, displaystyle=true");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals((getBox("ref1001").top -
+ getBox("num1001").bottom),
+ stackGapMin/2 * emToPx,
+ epsilon);
+ assert_approx_equals((getBox("den1001").top) -
+ getBox("ref1001").top,
+ stackGapMin/2 * emToPx,
+ epsilon);
+ }, "linethickness=0, displaystyle=false");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals((getBox("ref1002").top -
+ getBox("num1002").bottom),
+ stackDisplayStyleGapMin/2 * emToPx,
+ epsilon);
+ assert_approx_equals((getBox("den1002").top) -
+ getBox("ref1002").top,
+ stackDisplayStyleGapMin/2 * emToPx,
+ epsilon);
+ }, "linethickness=0, displaystyle=true");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="ref0001" height="0em" depth="1em" width="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="1em" height="2em" depth="0em" id="num0001" style="background: blue"/>
+ <mspace width="1em" height="0em" depth="2em" id="den0001" style="background: purple"/>
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mfrac>
+ <mspace width="1em" height="2em" depth="4em" id="num0002" style="background: blue"/>
+ <mspace width="1em" height="4em" depth="2em" id="den0002" style="background: purple"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true">
+ <mspace id="ref0003" height="0em" depth="1em" width="1em" style="background: green"/>
+ <mfrac>
+ <mspace width="1em" height="2em" depth="0em" id="num0003" style="background: blue"/>
+ <mspace width="1em" height="0em" depth="2em" id="den0003" style="background: purple"/>
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math displaystyle="true">
+ <mfrac>
+ <mspace width="1em" height="2em" depth="4em" id="num0004" style="background: blue"/>
+ <mspace width="1em" height="4em" depth="2em" id="den0004" style="background: purple"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <mspace id="ref1001" height="0em" depth="1em" width="1em" style="background: green"/>
+ <mfrac linethickness="0">
+ <mspace width="1em" height="2em" depth="0em" id="num1001" style="background: blue"/>
+ <mspace width="1em" height="0em" depth="2em" id="den1001" style="background: purple"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math displaystyle="true">
+ <mspace id="ref1002" height="0em" depth="1em" width="1em" style="background: green"/>
+ <mfrac linethickness="0">
+ <mspace width="1em" height="2em" depth="0em" id="num1002" style="background: blue"/>
+ <mspace width="1em" height="0em" depth="2em" id="den1002" style="background: purple"/>
+ </mfrac>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/legacy-orthogonal-pseudo-units.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/legacy-orthogonal-pseudo-units.html
new file mode 100644
index 00000000000..4e542fc00b5
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/legacy-orthogonal-pseudo-units.html
@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Legacy mpadded pseudo-units relying on orthogonal metrics</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.mpadded">
+<meta name="assert" content="Legacy pseudo-units depending on orthogonal metrics">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<style>
+ .testedElement {
+ background: red;
+ }
+</style>
+</head>
+<body>
+ <div id="log"></div>
+
+ <p>
+ <math>
+ <mpadded id="reference">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+
+ <p>
+ <!-- width cannot use vertical pseudo-units -->
+ <math>
+ <mpadded class="testedElement" width="200%height">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ <math>
+ <mpadded class="testedElement" width="200%depth">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+
+ <p>
+ <!-- lspace cannot use vertical pseudo-units -->
+ <math>
+ <mpadded class="testedElement" lspace="200%height">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ <math>
+ <mpadded class="testedElement" lspace="200%depth">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <!-- height cannot use horizontal pseudo-units -->
+ <math>
+ <mpadded class="testedElement" height="200%width">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <!-- depth cannot use horizontal pseudo-units -->
+ <math>
+ <mpadded class="testedElement" depth="200%width">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <!-- voffset cannot use horizontal pseudo-units -->
+ <math>
+ <mpadded class="testedElement" voffset="200%width">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+<script type="text/javascript">
+ Array.from(document.getElementsByClassName("testedElement")).forEach(mpadded => {
+ var reference = document.getElementById("reference");
+ const name = ["width", "depth", "height", "lspace", "voffset"].find(attr => mpadded.hasAttribute(attr));
+ const epsilon = 1;
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ compareLayout(mpadded, reference, epsilon);
+ }, `${mpadded.getAttribute(name)} is not allowed on ${name}`);
+ });
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-001.html
new file mode 100644
index 00000000000..d95b74c43b6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-001.html
@@ -0,0 +1,147 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>mpadded</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<meta name="assert" content="Verify metrics of empty mpadded element for different values of height, depth and width">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+ var epsilon = 1;
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ test(function() {
+ var none = getBox("none");
+ assert_equals(none.width, 0, "zero width");
+ assert_approx_equals(getBox("baseline").bottom - none.top, 0, epsilon, "zero depth");
+ assert_approx_equals(none.bottom - getBox("baseline").bottom, 0, epsilon, "zero depth");
+ }, "mpadded (no attributes)");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("width" + i);
+ assert_approx_equals(mpadded.width, 25*(i+1), epsilon, "width " + i);
+ assert_approx_equals(getBox("baseline").bottom - mpadded.top, 0, epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline").bottom, 0, epsilon, "depth" + i);
+ }
+ }, "Different widths");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("height" + i);
+ assert_equals(mpadded.width, 0, "width" + i);
+ assert_approx_equals(getBox("baseline").bottom - mpadded.top, 25*(i+1), epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline").bottom, 0, epsilon, "depth" + i);
+ }
+ }, "Different heights");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("depth" + i);
+ assert_equals(mpadded.width, 0, "width" + i);
+ assert_approx_equals(getBox("baseline").bottom - mpadded.top, 0, epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline").bottom, 25*(i+1), epsilon, "depth" + i);
+ }
+ }, "Different depths");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("mpadded" + i);
+ assert_approx_equals(mpadded.width, 25*(1+i%3), epsilon, "width" + i);
+ assert_approx_equals(getBox("baseline").bottom - mpadded.top, 25*(1+(i+1)%3), epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline").bottom, 25*(1+(i+2)%3), epsilon, "depth" + i);
+ }
+ }, "Various combinations of height, depth and width.");
+
+ test(function() {
+ var container = document.getElementById("containerForPreferredWidth");
+ var mpadded = container.getElementsByTagName("mpadded")[0];
+ var containerWidth = container.getBoundingClientRect().width;
+ var mpaddedWidth = mpadded.getBoundingClientRect().width;
+ assert_approx_equals(containerWidth, mpaddedWidth, epsilon);
+ }, "Preferred width");
+
+ // Dynamically set attributes.
+ ["width", "height", "depth"].forEach(function (name, index) {
+ document.getElementById("dynamic-remove").removeAttribute(name);
+ let length = `${50 + index * 10}px`;
+ document.getElementById("dynamic-attach").setAttribute(name, length);
+ document.getElementById("dynamic-modify").setAttribute(name, length);
+ });
+ let baseline = getBox("baseline2").bottom;
+
+ test(function() {
+ let remove = getBox("dynamic-remove");
+ assert_approx_equals(remove.width, 0, epsilon);
+ assert_approx_equals(remove.height, 0, epsilon);
+ assert_approx_equals(remove.top, baseline, epsilon);
+ }, "dynamic attributes (remove)");
+
+ test(function() {
+ let attach = getBox("dynamic-attach");
+ assert_approx_equals(attach.width, 50, epsilon);
+ assert_approx_equals(attach.height, 60 + 70, epsilon);
+ assert_approx_equals(baseline - attach.top, 60, epsilon);
+ }, "dynamic attributes (attach)");
+
+ test(function() {
+ let modify = getBox("dynamic-modify");
+ assert_approx_equals(modify.width, 50, epsilon);
+ assert_approx_equals(modify.height, 60 + 70, epsilon);
+ assert_approx_equals(baseline - modify.top, 60, epsilon);
+ }, "dynamic attributes (modify)");
+
+ done();
+ }
+</script>
+<style>
+div.shrink-wrap {
+ background: yellow;
+ display: inline-block;
+ margin-top: 5px;
+ padding-top: 5px;
+}
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <span id="baseline" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mpadded id="none"/>
+ <mpadded id="width0" width="25px"/>
+ <mpadded id="width1" width="50px"/>
+ <mpadded id="width2" width="75px"/>
+ <mpadded id="height0" height="25px"/>
+ <mpadded id="height1" height="50px"/>
+ <mpadded id="height2" height="75px"/>
+ <mpadded id="depth0" depth="25px"/>
+ <mpadded id="depth1" depth="50px"/>
+ <mpadded id="depth2" depth="75px"/>
+ <mpadded id="mpadded0" width="25px" height="50px" depth="75px" style="background: green"/>
+ <mpadded id="mpadded1" width="50px" height="75px" depth="25px" style="background: blue"/>
+ <mpadded id="mpadded2" width="75px" height="25px" depth="50px" style="background: green"/>
+ </math>
+ </p>
+ <div>
+ <div id="containerForPreferredWidth" class="shrink-wrap">
+ <math><mpadded width="75px" height="25px" depth="50px" style="background: green"/></math>
+ </div>
+ </div>
+ <p>
+ <span id="baseline2" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mpadded id="dynamic-attach" style="background: lightgreen"/>
+ <mpadded id="dynamic-remove" width="10px" height="20px" depth="30px" style="background: lightyellow"/>
+ <mpadded id="dynamic-modify" width="100px" height="200px" depth="300px" style="background: pink"/>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-002.html
new file mode 100644
index 00000000000..81d0755dd68
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-002.html
@@ -0,0 +1,164 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>mpadded</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<meta name="assert" content="Verify metrics of nonempty mpadded element for different values of height, depth and width">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+ var epsilon = 1;
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ const contentWidth = 100;
+ const contentDepth = 125;
+ const contentHeight = 150;
+
+ test(function() {
+ var none = getBox("none");
+ assert_equals(none.width, contentWidth, "content width");
+ assert_approx_equals(getBox("baseline").bottom - none.top, contentHeight, epsilon, "content height");
+ assert_approx_equals(none.bottom - getBox("baseline").bottom, contentDepth, epsilon, "content height");
+ }, "mpadded with no attributes");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("width" + i);
+ assert_approx_equals(mpadded.width, 25*(i+1), epsilon, "width " + i);
+ assert_approx_equals(getBox("baseline").bottom - mpadded.top, contentHeight, epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline").bottom, contentDepth, epsilon, "depth" + i);
+ }
+ }, "Different widths");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("height" + i);
+ assert_equals(mpadded.width, contentWidth, "width" + i);
+ assert_approx_equals(getBox("baseline").bottom - mpadded.top, 25*(i+1), epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline").bottom, contentDepth, epsilon, "depth" + i);
+ }
+ }, "Different heights");
+
+ test(function() {
+ var mpadded = getBox("percentages");
+ assert_equals(mpadded.width, contentWidth, "width");
+ assert_approx_equals(getBox("baseline").bottom - mpadded.top, contentHeight, epsilon, "height");
+ assert_approx_equals(mpadded.bottom - getBox("baseline").bottom, contentDepth, epsilon, "depth");
+ }, "Percentage calculation for width, height and depth");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("depth" + i);
+ assert_equals(mpadded.width, contentWidth, "width" + i);
+ assert_approx_equals(getBox("baseline2").bottom - mpadded.top, contentHeight, epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline2").bottom, 25*(i+1), epsilon, "depth" + i);
+ }
+ }, "Different depths");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var mpadded = getBox("mpadded" + i);
+ assert_approx_equals(mpadded.width, 25*(1+i%3), epsilon, "width" + i);
+ assert_approx_equals(getBox("baseline2").bottom - mpadded.top, 25*(1+(i+1)%3), epsilon, "height" + i);
+ assert_approx_equals(mpadded.bottom - getBox("baseline2").bottom, 25*(1+(i+2)%3), epsilon, "depth" + i);
+ }
+ }, "Various combinations of height, depth and width.");
+
+ test(function() {
+ var container = document.getElementById("containerForPreferredWidth");
+ var mpadded = container.getElementsByTagName("mpadded")[0];
+ var containerWidth = container.getBoundingClientRect().width;
+ var mpaddedWidth = mpadded.getBoundingClientRect().width;
+ assert_approx_equals(containerWidth, mpaddedWidth, epsilon);
+ }, "Preferred width");
+
+ // Dynamically set attributes.
+ ["width", "height", "depth"].forEach(function (name, index) {
+ document.getElementById("dynamic-remove").removeAttribute(name);
+ let length = `${50 + index * 10}px`;
+ document.getElementById("dynamic-attach").setAttribute(name, length);
+ document.getElementById("dynamic-modify").setAttribute(name, length);
+ });
+ let baseline = getBox("baseline3").bottom;
+
+ test(function() {
+ let remove = getBox("dynamic-remove");
+ assert_approx_equals(remove.width, contentWidth, epsilon);
+ assert_approx_equals(remove.height, contentHeight + contentDepth, epsilon);
+ assert_approx_equals(baseline - remove.top, contentHeight, epsilon);
+ }, "dynamic attributes (remove)");
+
+ test(function() {
+ let attach = getBox("dynamic-attach");
+ assert_approx_equals(attach.width, 50, epsilon);
+ assert_approx_equals(attach.height, 60 + 70, epsilon);
+ assert_approx_equals(baseline - attach.top, 60, epsilon);
+ }, "dynamic attributes (attach)");
+
+ test(function() {
+ let modify = getBox("dynamic-modify");
+ assert_approx_equals(modify.width, 50, epsilon);
+ assert_approx_equals(modify.height, 60 + 70, epsilon);
+ assert_approx_equals(baseline - modify.top, 60, epsilon);
+ }, "dynamic attributes (modify)");
+
+ done();
+ }
+</script>
+<style>
+div.shrink-wrap {
+ background: yellow;
+ display: inline-block;
+ margin-top: 5px;
+ padding-top: 5px;
+}
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <span id="baseline" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mpadded id="none"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="width0" width="25px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="width1" width="50px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="width2" width="75px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="height0" height="25px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="height1" height="50px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="height2" height="75px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="percentages" width="50%" height="33%" depth="10%"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ </math>
+ </p>
+ <p>
+ <span id="baseline2" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mpadded id="depth0" depth="25px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="depth1" depth="50px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="depth2" depth="75px"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="mpadded0" width="25px" height="50px" depth="75px" style="background: green"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="mpadded1" width="50px" height="75px" depth="25px" style="background: blue"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="mpadded2" width="75px" height="25px" depth="50px" style="background: green"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ </math>
+ </p>
+ <div>
+ <div id="containerForPreferredWidth" class="shrink-wrap">
+ <math><mpadded width="75px" height="25px" depth="50px" style="background: green"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded></math>
+ </div>
+ </div>
+ <p>
+ <span id="baseline3" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mpadded id="dynamic-attach" style="background: lightgreen"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="dynamic-remove" width="10px" height="20px" depth="30px" style="background: lightyellow"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ <mpadded id="dynamic-modify" width="100px" height="200px" depth="300px" style="background: pink"><mspace width="100px" depth="125px" height="150px" style="background: black; opacity: .5"/></mpadded>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-003.html
new file mode 100644
index 00000000000..0e34280b61d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-003.html
@@ -0,0 +1,230 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>mpadded</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<meta name="assert" content="Verify metrics of mpadded element with voffset and lspace">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ const contentWidth = 10;
+ const contentDepth = 15;
+ const contentHeight = 20;
+ const epsilon = 1;
+
+ test(function() {
+ Array.from(document.getElementsByClassName("shrink-wrap")).forEach(container => {
+ assert_approx_equals(container.getBoundingClientRect().width, contentWidth, epsilon);
+ });
+ }, "lspace/voffset shifts don't affect mpadded preferred width");
+
+ function GetShifts(mpadded) {
+ let mpadded_box = mpadded.getBoundingClientRect();
+ let mspace_box = mpadded.firstElementChild.getBoundingClientRect();
+ return { lspace: mspace_box.left - mpadded_box.left,
+ voffset: mpadded_box.top - mspace_box.top };
+ }
+
+ let mpaddeds = document.getElementById("static_tests").getElementsByTagName("mpadded");
+ test(function() {
+ let baseline = document.getElementById("baseline").getBoundingClientRect().bottom;
+ Array.from(mpaddeds).forEach(e => {
+ let mpadded = e.getBoundingClientRect();
+ assert_approx_equals(mpadded.width, contentWidth, epsilon);
+ assert_approx_equals(baseline - mpadded.top, contentHeight, epsilon);
+ assert_approx_equals(mpadded.bottom - baseline, contentDepth, epsilon);
+
+ });
+ }, "lspace/voffset shifts don't affect mpadded size");
+
+
+ test(function() {
+ let shifts = GetShifts(mpaddeds[0]);
+ assert_approx_equals(shifts.lspace, 5, epsilon, "positive lspace");
+ assert_approx_equals(shifts.voffset, 0, epsilon);
+
+ shifts = GetShifts(mpaddeds[1]);
+ assert_approx_equals(shifts.lspace, 0, epsilon, "negative lspace is clmaped to zero");
+ assert_approx_equals(shifts.voffset, 0, epsilon);
+
+ shifts = GetShifts(mpaddeds[2]);
+ assert_approx_equals(shifts.lspace, 0, epsilon, "positive lspace percentage");
+ assert_approx_equals(shifts.voffset, 0, epsilon);
+
+ shifts = GetShifts(mpaddeds[3]);
+ assert_approx_equals(shifts.lspace, 0, epsilon, "negative lspace percentage");
+ assert_approx_equals(shifts.voffset, 0, epsilon);
+
+ shifts = GetShifts(mpaddeds[4]);
+ assert_approx_equals(shifts.lspace, 0, epsilon);
+ assert_approx_equals(shifts.voffset, 10, epsilon, "positive voffset");
+
+ shifts = GetShifts(mpaddeds[5]);
+ assert_approx_equals(shifts.lspace, 0, epsilon);
+ assert_approx_equals(shifts.voffset, -10, epsilon, "negative voffset");
+
+ shifts = GetShifts(mpaddeds[6]);
+ assert_approx_equals(shifts.lspace, 0, epsilon);
+ assert_approx_equals(shifts.voffset, 0, epsilon, "positive voffset percentage");
+
+ shifts = GetShifts(mpaddeds[7]);
+ assert_approx_equals(shifts.lspace, 0, epsilon);
+ assert_approx_equals(shifts.voffset, 0, epsilon, "negative voffset percentage");
+
+ shifts = GetShifts(mpaddeds[8]);
+ assert_approx_equals(shifts.lspace, 5, epsilon);
+ assert_approx_equals(shifts.voffset, 10, epsilon);
+
+ shifts = GetShifts(mpaddeds[9]);
+ assert_approx_equals(shifts.lspace, 5, epsilon);
+ assert_approx_equals(shifts.voffset, -10, epsilon);
+ }, "content is shifted by the specified lspace/voffset");
+
+ mpaddeds = document.getElementById("static_tests_rtl").getElementsByTagName("mpadded");
+ test(function() {
+ let shifts = GetShifts(mpaddeds[0]);
+ assert_approx_equals(shifts.lspace, -5, epsilon, "positive lspace");
+ assert_approx_equals(shifts.voffset, 0, epsilon);
+
+ shifts = GetShifts(mpaddeds[1]);
+ assert_approx_equals(shifts.lspace, 0, epsilon, "negative lspace is clmaped to zero");
+ assert_approx_equals(shifts.voffset, 0, epsilon);
+
+ shifts = GetShifts(mpaddeds[2]);
+ assert_approx_equals(shifts.lspace, 0, epsilon);
+ assert_approx_equals(shifts.voffset, 10, epsilon, "positive voffset");
+
+ shifts = GetShifts(mpaddeds[3]);
+ assert_approx_equals(shifts.lspace, 0, epsilon);
+ assert_approx_equals(shifts.voffset, -10, epsilon, "negative voffset");
+
+ shifts = GetShifts(mpaddeds[4]);
+ assert_approx_equals(shifts.lspace, -5, epsilon);
+ assert_approx_equals(shifts.voffset, 10, epsilon);
+
+ shifts = GetShifts(mpaddeds[5]);
+ assert_approx_equals(shifts.lspace, -5, epsilon);
+ assert_approx_equals(shifts.voffset, -10, epsilon);
+ }, "content is shifted by the specified lspace/voffset (RTL)");
+
+ mpaddeds = document.getElementById("dynamic_tests").getElementsByTagName("mpadded");
+ test(function() {
+ mpaddeds[0].setAttribute("lspace", "5px")
+ let shifts = GetShifts(mpaddeds[0]);
+ assert_approx_equals(shifts.lspace, 5, epsilon, "attach lspace");
+ assert_approx_equals(shifts.voffset, 0, epsilon);
+
+ mpaddeds[1].setAttribute("voffset", "10px")
+ shifts = GetShifts(mpaddeds[1]);
+ assert_approx_equals(shifts.lspace, 0, epsilon);
+ assert_approx_equals(shifts.voffset, 10, epsilon, "attach voffset");
+
+ mpaddeds[2].removeAttribute("lspace")
+ shifts = GetShifts(mpaddeds[2]);
+ assert_approx_equals(shifts.lspace, 0, epsilon, "remove lspace");
+ assert_approx_equals(shifts.voffset, 10, epsilon);
+
+ mpaddeds[3].removeAttribute("voffset")
+ shifts = GetShifts(mpaddeds[3]);
+ assert_approx_equals(shifts.lspace, 5, epsilon);
+ assert_approx_equals(shifts.voffset, 0, epsilon, "remove voffset");
+
+ mpaddeds[4].setAttribute("lspace", "15px")
+ shifts = GetShifts(mpaddeds[4]);
+ assert_approx_equals(shifts.lspace, 15, epsilon, "modify lspace");
+ assert_approx_equals(shifts.voffset, 10, epsilon);
+
+ mpaddeds[5].setAttribute("voffset", "-10px")
+ shifts = GetShifts(mpaddeds[5]);
+ assert_approx_equals(shifts.lspace, 5, epsilon);
+ assert_approx_equals(shifts.voffset, -10, epsilon, "modify voffset");
+ }, "dynamic changes of lspace/voffset");
+
+ done();
+ }
+</script>
+<style>
+div.shrink-wrap {
+ background: yellow;
+ display: inline-block;
+ margin-top: 5px;
+ padding-top: 5px;
+}
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <div id="static_tests">
+ <span id="baseline" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mpadded lspace="5px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="-5px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5%" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="-5%" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded voffset="-10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded voffset="10%" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded voffset="-10%" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="-10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div id="static_tests_rtl">
+ <math dir="rtl">
+ <mpadded lspace="5px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="-5px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded voffset="-10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="-10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div id="dynamic_tests">
+ <math>
+ <mpadded style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ <mpadded lspace="5px" voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math>
+ <mpadded lspace="5px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mpadded lspace="-5px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mpadded voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mpadded voffset="-10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mpadded lspace="5px" voffset="10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ <div class="shrink-wrap">
+ <math>
+ <mpadded lspace="5px" voffset="-10px" style="background: black"><mspace width="10px" depth="15px" height="20px" style="background: green; opacity: .5"/></mpadded>
+ </math>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-percentage-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-percentage-002.html
new file mode 100644
index 00000000000..f252eaf8e8a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mpadded/mpadded-percentage-002.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title></title>
+ <link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+ <meta name="assert" content="Percentage values are interpreted as the default value">
+ <script src="../../../resources/testharness.js"></script>
+ <script src="../../../resources/testharnessreport.js"></script>
+ <script src="../../../mathml/support/feature-detection.js"></script>
+ <script src="../../../mathml/support/layout-comparison.js"></script>
+ <style>
+ .testedElement {
+ background: red;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <p>
+ <math>
+ <mpadded id="reference">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mpadded class="testedElement" width="200%">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mpadded class="testedElement" height="200%">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mpadded class="testedElement" depth="200%">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mpadded class="testedElement" lspace="200%">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mpadded class="testedElement" voffset="200%">
+ <mspace width="10px" height="20px" depth="30px"
+ style="background: blue"/>
+ </mpadded>
+ </math>
+ </p>
+ <script type="text/javascript">
+ Array.from(document.getElementsByClassName("testedElement")).forEach(mpadded => {
+ var reference = document.getElementById("reference");
+ const name = ["width", "depth", "height", "lspace", "voffset"].find(attr => mpadded.hasAttribute(attr));
+ const epsilon = 1;
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ compareLayout(mpadded, reference, epsilon);
+ }, `${name}='${mpadded.getAttribute(name)}' is interpreted as the default value`);
+ });
+ </script>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/inferred-mrow-baseline.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/inferred-mrow-baseline.html
new file mode 100644
index 00000000000..d3a5acc988b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/inferred-mrow-baseline.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Baseline of inferred mrows</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#horizontally-group-sub-expressions-mrow">
+<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
+<link rel="help" href="https://w3c.github.io/mathml-core/#style-change-mstyle">
+<link rel="help" href="https://w3c.github.io/mathml-core/#error-message-merror">
+<link rel="help" href="https://w3c.github.io/mathml-core/#making-sub-expressions-invisible-mphantom">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element">
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.menclose">
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<meta name="assert" content="Baseline for mrow-like elements is correct.">
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests()
+ {
+ ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded", "Unknown", "Mtd", "None", "Mprescripts", "Mfenced", "A"].forEach((tag) => {
+ var x = document.getElementById(`above${tag}`).getBoundingClientRect();
+ var y = document.getElementById(`below${tag}`).getBoundingClientRect();
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_equals(x.bottom, y.top);
+ }, `baseline alignment inside ${tag}`);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math><mrow><mspace id="aboveMrow" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMrow" width="10px" depth="30px" style="background: blue"></mspace></mrow></math>
+ <math><msqrt><mspace id="aboveSqrt" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowSqrt" width="10px" depth="30px" style="background: blue"></mspace></msqrt></math>
+ <math><mstyle><mspace id="aboveStyle" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowStyle" width="10px" depth="30px" style="background: blue"></mspace></mstyle></math>
+ <math><merror><mspace id="aboveError" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowError" width="10px" depth="30px" style="background: blue"></mspace></merror></math>
+ <math><mphantom><mspace style="visibility: visible; background: purple" id="abovePhantom" width="10px" height="30px"></mspace><mspace style="visibility: visible; background: blue" id="belowPhantom" width="10px" depth="30px"></mspace></mphantom></math>
+ <math><mspace id="aboveMath" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMath" width="10px" depth="30px" style="background: blue"></mspace></math>
+ <!-- menclose is treated as <unknown> in MathML Core -->
+ <math><menclose notation="box"><mspace id="aboveMenclose" width="10px" height="30px" style="background: purple"
+></mspace><mspace id="belowMenclose" width="10px" depth="30px" style="background: blue"></mspace></menclose></math>
+ <math><mpadded lspace="10px"><mspace id="aboveMpadded" width="10px" height="30px" style="background: purple"
+></mspace><mspace id="belowMpadded" width="10px" depth="30px" style="background: blue"></mspace></mpadded></math>
+ <math><unknown><mspace id="aboveUnknown" width="10px" height="30px" style="background: purple"
+></mspace><mspace id="belowUnknown" width="10px" depth="30px" style="background: blue"></mspace></unknown></math>
+ <math><mtable><mtr><mtd><mspace id="aboveMtd" width="10px" height="30px" style="background: purple"
+></mspace><mspace id="belowMtd" width="10px" depth="30px" style="background: blue"></mspace></mtd></mtr></mtable></math>
+ <math><none><mspace id="aboveNone" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowNone" width="10px" depth="30px" style="background: blue"></mspace></none></math>
+ <math><mprescripts><mspace id="aboveMprescripts" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMprescripts" width="10px" depth="30px" style="background: blue"></mspace></none></math>
+ <math><mfenced><mspace id="aboveMfenced" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMfenced" width="10px" depth="30px" style="background: blue"></mspace></none></math>
+ <math><a><mspace id="aboveA" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowA" width="10px" depth="30px" style="background: blue"></mspace></none></math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.html
new file mode 100644
index 00000000000..905debc3f7b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.html
@@ -0,0 +1,188 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Legacy maction and semantics elements</title>
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.maction">
+<link rel="help" href="https://w3c.github.io/mathml-core/#enlivening-expressions">
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.semantics">
+<link rel="help" href="https://w3c.github.io/mathml-core/#semantics-and-presentation">
+<meta name="assert" content="Legacy maction and semantics elements are handled as mrow with special style">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests()
+ {
+ Array.from(document.getElementsByClassName("TestContainer")).forEach(container => {
+ const id = container.id;
+ const math = container.getElementsByTagName("math");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace(), "<mspace> is supported");
+ const epsilon = 1;
+ compareLayout(math[0], math[1], epsilon);
+ }, `Element is laid out as an mrow with only first child displayed (id=${id})`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace(), "<mspace> is supported");
+ let firstChild = math[0].firstElementChild.firstElementChild;
+ for (var child = firstChild; child; child = child.nextElementSibling) {
+ var style = window.getComputedStyle(child).getPropertyValue("display");
+ if (child == firstChild) {
+ assert_equals(style, "block math", "First child has computed display value 'block math'");
+ } else {
+ assert_equals(style, "none", "Other children have computed display value 'none'");
+ }
+ }
+ }, `Computed display of children (id=${id})`);
+ });
+ done();
+ }
+</script>
+<style>
+ mspace:nth-child(2n) {
+ background: lightblue;
+ }
+ mspace:nth-child(2n+1) {
+ background: lightgreen;
+ }
+ mrow.onlyShowFirstChild > :not(:first-child) {
+ display: none;
+ }
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <p class="TestContainer" id="semantics">
+ <math>
+ <semantics>
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </semantics>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </mrow>
+ </math>
+ </p>
+ <p class="TestContainer" id="semantics-annotations">
+ <math>
+ <semantics>
+ <mspace width="10px" height="10px"></mspace>
+ <annotation>ANNOTATION</annotation>
+ <annotation-xml>ANNOTATION-XML</annotation-xml>
+ </semantics>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ <annotation>ANNOTATION</annotation>
+ <annotation-xml>ANNOTATION-XML</annotation-xml>
+ </mrow>
+ </math>
+ </p>
+ <p class="TestContainer" id="maction">
+ <math>
+ <maction>
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </maction>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </mrow>
+ </math>
+ </p>
+ <p class="TestContainer" id="maction-toggle">
+ <math>
+ <maction actiontype="toggle">
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </maction>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </mrow>
+ </math>
+ </p>
+ <p class="TestContainer" id="maction-toggle-selection">
+ <math>
+ <maction actiontype="toggle" selection="3">
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </maction>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ <mspace width="10px" depth="10px"></mspace>
+ <mspace width="10px" height="15px" depth="5px"></mspace>
+ <mspace width="10px" height="5px" depth="15px"></mspace>
+ </mrow>
+ </math>
+ </p>
+ <p class="TestContainer" id="maction-statusline">
+ <math>
+ <maction actiontype="statusline">
+ <mspace width="10px" height="10px"></mspace>
+ <mtext>MESSAGE</mtext>
+ </maction>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ <mtext>MESSAGE</mtext>
+ </mrow>
+ </math>
+ </p>
+ <p class="TestContainer" id="maction-tooltip">
+ <math>
+ <maction actiontype="tooltip">
+ <mspace width="10px" height="10px"></mspace>
+ <mtext>MESSAGE</mtext>
+ </maction>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ <mtext>MESSAGE</mtext>
+ </mrow>
+ </math>
+ </p>
+ <p class="TestContainer" id="maction-input">
+ <math>
+ <maction actiontype="input">
+ <mspace width="10px" height="10px"></mspace>
+ </maction>
+ </math>
+ <math>
+ <mrow class="onlyShowFirstChild">
+ <mspace width="10px" height="10px"></mspace>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/legacy-mstyle-attributes.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/legacy-mstyle-attributes.html
new file mode 100644
index 00000000000..166c307820b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/legacy-mstyle-attributes.html
@@ -0,0 +1,266 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Legacy mstyle attributes</title>
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.mstyle">
+<link rel="help" href="https://w3c.github.io/mathml-core/#style-change-mstyle">
+<link rel="help" href="https://w3c.github.io/mathml-core/#space-mspace">
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#string-literal-ms">
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.menclose">
+<meta name="assert" content="Legacy mstyle attributes are ignored">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests()
+ {
+ Array.from(document.getElementsByClassName("TestContainer")).forEach(container => {
+ const tag = container.id;
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ const epsilon = 1;
+ const math = container.getElementsByTagName("math");
+ compareLayout(math[0], math[1], epsilon);
+ }, `Legacy mstyle attributes do not apply to ${tag}`);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <!-- Note: In earlier versions of MathML, putting some attributes on the
+ mstyle element was supposed to produce the same rendering as putting them
+ on the all descendants (with some exceptions). In MathML Core, relevant
+ style attributes are implemented as CSS properties and are no longer
+ specific to the mstyle element. The tests below verify that attributes
+ on mstyle that are not mapped to CSS have no effect.
+ -->
+ <p class="TestContainer" id="mspace">
+ <math>
+ <mstyle width="50px" height="50px" depth="50px">
+ <mspace style="background: lightblue"></mspace>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <mspace style="background: lightblue"></mspace>
+ </mstyle>
+ </math>
+ </p>
+ <p class="TestContainer" id="mfrac">
+ <math>
+ <mstyle linethickness="50px">
+ <mfrac>
+ <mn>1</mn>
+ <mn>2</mn>
+ </mfrac>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <mfrac>
+ <mn>1</mn>
+ <mn>2</mn>
+ </mfrac>
+ </mstyle>
+ </math>
+ </p>
+ <p class="TestContainer" id="mo">
+ <math displaystyle="true">
+ <mstyle lspace="50px" rspace="50px">
+ <mn>1</mn>
+ <mo>A</mo>
+ <mn>2</mn>
+ </mstyle>
+ <mstyle movablelimits="false" largeop="false">
+ <munder>
+ <mo>βˆ‘</mo>
+ <mn>3</mn>
+ </munder>
+ </mstyle>
+ <!-- Note: accent was a shared attribute name for mover and mo, so
+ make mstyle an ancestor of mo but not of mover. -->
+ <mover>
+ <mn>4</mn>
+ <mstyle accent="false"><mo>⇀</mo></mstyle>
+ </mover>
+ <mstyle stretchy="false" symmetric="false" maxsize="20px">
+ <mrow>
+ <mo>|</mo>
+ <mspace height="100px"></mspace>
+ </mrow>
+ </mstyle>
+ <mstyle minsize="100px">
+ <mrow>
+ <mo>|</mo>
+ <mn>4</mn>
+ </mrow>
+ </mstyle>
+ <mstyle form="prefix">
+ <mrow>
+ <mn>1</mn>
+ <!-- Infix and prefix forms of βˆ’ do not have the same lspace/rspace
+ values in the operator dictionary -->
+ <mo>βˆ’</mo>
+ <mn>2</mn>
+ </mrow>
+ </mstyle>
+ </math>
+ <math displaystyle="true">
+ <mstyle>
+ <mn>1</mn>
+ <mo>A</mo>
+ <mn>2</mn>
+ </mstyle>
+ <mstyle>
+ <munder>
+ <mo>βˆ‘</mo>
+ <mn>3</mn>
+ </munder>
+ </mstyle>
+ <mover>
+ <mn>4</mn>
+ <mstyle><mo>⇀</mo></mstyle>
+ </mover>
+ <mstyle>
+ <mrow>
+ <mo>|</mo>
+ <mspace height="100px"></mspace>
+ </mrow>
+ </mstyle>
+ <mstyle>
+ <mrow>
+ <mo>|</mo>
+ <mn>4</mn>
+ </mrow>
+ </mstyle>
+ <mstyle>
+ <mrow>
+ <mn>1</mn>
+ <mo>βˆ’</mo>
+ <mn>2</mn>
+ </mrow>
+ </mstyle>
+ </math>
+ </p>
+ <!-- notation attribute is from MathML3's menclose element -->
+ <p class="TestContainer" id="menclose">
+ <math>
+ <mstyle notation="box">
+ <mn>1</mn>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <mn>1</mn>
+ </mstyle>
+ </math>
+ </p>
+ <p class="TestContainer" id="ms">
+ <math>
+ <mstyle lquote="AAAA" rquote="BBBB">
+ <ms>1</ms>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <ms>1</ms>
+ </mstyle>
+ </math>
+ </p>
+ <p class="TestContainer" id="mpadded">
+ <math>
+ <mstyle width="100px" height="50px" depth="50px"
+ lspace="10px" voffset="15px">
+ <mpadded style="background: lightblue">
+ <mspace width="10px" height="10px" style="background: black"></mspace>
+ </mpadded>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <mpadded style="background: lightblue">
+ <mspace width="10px" height="10px" style="background: black"></mspace>
+ </mpadded>
+ </mstyle>
+ </math>
+ </p>
+ <p class="TestContainer" id="mover">
+ <math>
+ <mstyle accent="true">
+ <mover>
+ <mn>1</mn>
+ <mn>2</mn>
+ </mover>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <mover>
+ <mn>1</mn>
+ <mn>2</mn>
+ </mover>
+ </mstyle>
+ </math>
+ </p>
+ <p class="TestContainer" id="munder">
+ <math>
+ <mstyle accentunder="true">
+ <munder>
+ <mn>1</mn>
+ <mn>2</mn>
+ </munder>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <munder>
+ <mn>1</mn>
+ <mn>2</mn>
+ </munder>
+ </mstyle>
+ </math>
+ </p>
+ <p class="TestContainer" id="munderover">
+ <math>
+ <mstyle accent="true">
+ <munderover>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ </munderover>
+ </mstyle>
+ <mstyle accentunder="true">
+ <munderover>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ </munderover>
+ </mstyle>
+ </math>
+ <math>
+ <mstyle>
+ <munderover>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ </munderover>
+ </mstyle>
+ <mstyle>
+ <munderover>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ </munderover>
+ </mstyle>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/merror-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/merror-001.html
new file mode 100644
index 00000000000..3daabffacbc
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/merror-001.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test the merror element</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#error-message-merror">
+<link rel="help" href="https://w3c.github.io/mathml-core/#user-agent-stylesheet">
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<meta name="assert" content="Verify default merror style and size.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+ math {
+ font: 25px/1 Ahem;
+ }
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <div>
+ <math>
+ <mrow id="reference"><mtext>AN ERROR</mtext></mrow>
+ <merror id="merror"><mtext>AN ERROR</mtext></merror>
+ </math>
+ </div>
+ <script>
+ setup({ explicit_done: true });
+ document.fonts.ready.then(() => {
+ test(function () {
+ var style = window.getComputedStyle(document.getElementById("merror"));
+ assert_equals(style.borderWidth, "1px");
+ assert_equals(style.borderColor, "rgb(255, 0, 0)");
+ assert_equals(style.borderStyle, "solid");
+ assert_equals(style.backgroundColor, "rgb(255, 255, 224)");
+ }, "Default CSS properties on merror");
+
+ test(function () {
+ var merrorBox = document.getElementById("merror").getBoundingClientRect();
+ var referenceBox = document.getElementById("reference").getBoundingClientRect();
+ assert_equals(merrorBox.width, referenceBox.width + 2);
+ assert_equals(merrorBox.height, referenceBox.height + 2);
+ }, "Bounding box is the same as mrow + 1px border");
+
+ done();
+ });
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/mrow-fallback-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/mrow-fallback-001.html
new file mode 100644
index 00000000000..b7aa080b5c2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/mrow-fallback-001.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test mrow fallback for some MathML elements</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#script-and-limit-schemata">
+<meta name="assert" content="Verify that invalid markup fallbacks to row layout.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../mathml/support/invalid-markup.js"></script>
+<style>
+ /* Revert style specified in the UA style sheet that changes box size. */
+ mfrac { padding-inline: 0; }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ let container = document.getElementById("container");
+ let invalidMarkup = generateInvalidMarkup();
+ container.appendChild(invalidMarkup);
+ const epsilon = 1;
+
+ for (let math of invalidMarkup.children) {
+ let element = math.firstElementChild;
+ let reference = element.nextElementSibling;
+ let description = element.dataset.description;
+ test(function() {
+ compareLayout(element, reference, epsilon);
+ assert_approx_equals(element.getBoundingClientRect().top, reference.getBoundingClientRect().top, epsilon);
+ }, `Invalid <${element.tagName}> should lay out as an mrow (${description})`);
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <div id="container"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/mrow-preferred-width.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/mrow-preferred-width.html
new file mode 100644
index 00000000000..1aec6848067
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/mrow-preferred-width.html
@@ -0,0 +1,192 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Preferred width of mrow-like elements</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#horizontally-group-sub-expressions-mrow">
+<link rel="help" href="https://w3c.github.io/mathml-core/#style-change-mstyle">
+<link rel="help" href="https://w3c.github.io/mathml-core/#making-sub-expressions-invisible-mphantom">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element">
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<meta name="assert" content="The preferred width of mrow-like elements is the sum of children's width, modulo extra spacing.">
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests()
+ {
+ var epsilon = 1;
+
+ function MrowWidthFromChildren(mrow) {
+ var first = mrow.firstElementChild.getBoundingClientRect();
+ var last = mrow.lastElementChild.getBoundingClientRect();
+ return last.right - first.left;
+ }
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ Array.from(document.getElementById("mspace-tests").getElementsByClassName("shrink-wrap")).forEach((container) => {
+ var containerWidth = container.getBoundingClientRect().width;
+ var mrow = container.getElementsByClassName("mrow-like")[0];
+ var mrowWidth = MrowWidthFromChildren(mrow);
+ assert_approx_equals(containerWidth, mrowWidth, epsilon, mrow.tagName);
+ });
+ }, "Preferred width of mrow with mspace children");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+
+ Array.from(document.getElementById("tokens-tests").getElementsByClassName("shrink-wrap")).forEach((container) => {
+ var containerWidth = container.getBoundingClientRect().width;
+ var mrow = container.getElementsByClassName("mrow-like")[0];
+ var mrowWidth = MrowWidthFromChildren(mrow);
+ assert_approx_equals(containerWidth, mrowWidth, epsilon, mrow.tagName);
+ });
+ }, "Preferred width of mrow with mn and mo children");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+
+ Array.from(document.getElementById("embellished-op-tests").getElementsByClassName("shrink-wrap")).forEach((container) => {
+ var containerWidth = container.getBoundingClientRect().width;
+ var mrow = container.getElementsByClassName("mrow-like")[0];
+ var mrowWidth = MrowWidthFromChildren(mrow);
+ assert_approx_equals(containerWidth, mrowWidth, epsilon, mrow.tagName);
+ });
+ }, "Preferred width of mrow with mn and embellished op children");
+
+ done();
+ }
+</script>
+<style>
+div.shrink-wrap {
+ background: yellow;
+ display: inline-block;
+ margin-top: 5px;
+ padding-top: 5px;
+}
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <div id="mspace-tests">
+ <div><div class="shrink-wrap">
+ <math><mrow class="mrow-like"><mspace width="30px" height="15px" style="background: blue"/><mspace width="20px" depth="30px" style="background: green"/><mspace width="15px" height="5px" depth="10px" style="background: black"/></mrow></math>
+ </div></div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mstyle class="mrow-like"><mspace width="30px" height="15px" style="background: blue"/><mspace width="20px" depth="30px" style="background: green"/><mspace width="15px" height="5px" depth="10px" style="background: black"/></mstyle></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mphantom class="mrow-like"><mspace width="30px" height="15px" style="background: blue"/><mspace width="20px" depth="30px" style="background: green"/><mspace width="15px" height="5px" depth="10px" style="background: black"/></mphantom></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math class="mrow-like"><mspace width="30px" height="15px" style="background: blue"/><mspace width="20px" depth="30px" style="background: green"/><mspace width="15px" height="5px" depth="10px" style="background: black"/></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><unknown class="mrow-like"><mspace width="30px" height="15px" style="background: blue"/><mspace width="20px" depth="30px" style="background: green"/><mspace width="15px" height="5px" depth="10px" style="background: black"/></unknown></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math class="mrow-like"><mspace width="30px" height="15px" style="background: blue"/><mspace width="20px" depth="30px" style="background: green"/><mspace width="15px" height="5px" depth="10px" style="background: black"/></math>
+ </div>
+ </div>
+ </div>
+ <div id="tokens-tests">
+ <div>
+ <div class="shrink-wrap">
+ <math><mrow class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></mrow></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mstyle class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></mstyle></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mphantom class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></mphantom></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><unknown class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></unknown></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mfenced class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></mfenced></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><a class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></a></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math class="mrow-like"><mtext>blah</mtext><mo lspace="30px" rspace="20px">|</mo><mn>2</mn></math>
+ </div>
+ </div>
+ </div>
+ <div id="embellished-op-tests">
+ <div>
+ <div class="shrink-wrap">
+ <math><mrow class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></mrow></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mstyle class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></mstyle></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mphantom class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></mphantom></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><unknown class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></unknown></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><mfenced class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></mfenced></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math><a class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></a></math>
+ </div>
+ </div>
+ <div>
+ <div class="shrink-wrap">
+ <math class="mrow-like"><mtext>blah</mtext><mfrac><msub><mrow><mo lspace="30px" rspace="20px">|</mo></mrow><mn>3</mn></msub><mn>4</mn></mfrac><mn>2</mn></math>
+ </div>
+ </div>
+ </div>
+</p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/no-spacing.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/no-spacing.html
new file mode 100644
index 00000000000..a0aed23ad77
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/no-spacing.html
@@ -0,0 +1,339 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>No spacing in elements</title>
+<meta name="assert" content="Spacing is not added around operators when an element does not use mrow layout. However, when the element is embellished, spacing of the core mo is added around it.">
+<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<link rel="help" href="https://w3c.github.io/mathml-core/#horizontally-group-sub-expressions-mrow">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#prescripts-and-tensor-indices-mmultiscripts">
+<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ function runTests()
+ {
+ Array.from(document.getElementsByClassName("testedElement")).forEach((e) => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ let box = e.getBoundingClientRect();
+ let spacing = 100;
+ assert_less_than_equal(box.width, spacing);
+ }, `Spacing inside an <${e.tagName}> child of <${e.parentNode.tagName}>.`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ let box = e.parentNode.getBoundingClientRect();
+ let spacing = 100;
+ if (e.classList.contains("embellished"))
+ assert_greater_than_equal(box.width, spacing * 2);
+ else
+ assert_less_than_equal(box.width, spacing);
+ }, `Spacing around an <${e.tagName}> child of an <${e.parentNode.tagName}>.`);
+ });
+ done();
+ }
+</script>
+<style>
+ .testedElement {
+ background: lightgreen;
+ }
+ math {
+ background: lightblue;
+ }
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mfrac class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mfrac>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <mfrac class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mfrac>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mfrac class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mfrac>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msub class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msub>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <msub class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msub>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <msub class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msub>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msup class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msup>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <msup class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msup>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <msup class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msup>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msubsup>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <msubsup class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msubsup>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <msubsup class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </msubsup>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mprescripts/>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mmultiscripts>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <mmultiscripts class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mprescripts/>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mmultiscripts>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mmultiscripts class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mprescripts/>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mmultiscripts>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munder class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </munder>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <munder class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </munder>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <munder class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </munder>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mover>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <mover class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mover>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mover class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mover>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </munderover>
+ </math>
+ <math>
+ <mrow>
+ <mn><!-- make sure parent mrow is not an embellished operator --></mn>
+ <munderover class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </munderover>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <munderover class="testedElement embellished">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </munderover>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mroot class="testedElement">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mroot>
+ </math>
+ <math>
+ <mrow>
+ <mroot class="testedElement">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mroot>
+ </mrow>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mroot class="testedElement">
+ <mo lspace="100px" rspace="100px">X</mo>
+ <mo lspace="100px" rspace="100px">X</mo>
+ </mroot>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/spacing-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/spacing-002.html
new file mode 100644
index 00000000000..8fe1d7017bb
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/spacing-002.html
@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<title>Spacing in mrows</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#horizontally-group-sub-expressions-mrow">
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<meta name="assert" content="Spacing properly set around operators inside mrow-like elements, testing various positions.">
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math {
+ font: 25px/1 Ahem;
+ background: lightblue;
+ }
+</style>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ promise_setup(_ => new Promise(resolve =>
+ window.addEventListener("load", _ => loadAllFonts().then(resolve))
+ ));
+
+ const lspace = 100;
+ const rspace = 200;
+ const epsilon = 1;
+
+ promise_test(async function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ let math = document.getElementById("previousAndNextSibling");
+ let mo = math.getElementsByTagName("mo")[0];
+ let moBox = mo.getBoundingClientRect();
+ let previousSiblingBox = mo.previousElementSibling.getBoundingClientRect();
+ let nextSiblingBox = mo.nextElementSibling.getBoundingClientRect();
+ assert_approx_equals(moBox.left - previousSiblingBox.right, lspace, epsilon);
+ assert_approx_equals(nextSiblingBox.left - moBox.right, rspace, epsilon);
+ }, `Spacing properly set for <mo> with a previous sibling and a next sibling..`);
+
+ promise_test(async function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ let math = document.getElementById("nextSiblingOnly");
+ let mo = math.getElementsByTagName("mo")[0];
+ let moBox = mo.getBoundingClientRect();
+ let mrowBox = mo.parentNode.getBoundingClientRect();
+ let nextSiblingBox = mo.nextElementSibling.getBoundingClientRect();
+ assert_approx_equals(moBox.left - mrowBox.left, lspace, epsilon);
+ assert_approx_equals(nextSiblingBox.left - moBox.right, rspace, epsilon);
+ }, `Spacing properly set for <mo> with only a next sibling.`);
+
+ promise_test(async function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ let math = document.getElementById("previousSiblingOnly");
+ let mo = math.getElementsByTagName("mo")[0];
+ let moBox = mo.getBoundingClientRect();
+ let mrowBox = mo.parentNode.getBoundingClientRect();
+ let previousSiblingBox = mo.previousElementSibling.getBoundingClientRect();
+ assert_approx_equals(moBox.left - previousSiblingBox.right, lspace, epsilon);
+ assert_approx_equals(mrowBox.right - moBox.right, rspace, epsilon);
+ }, `Spacing properly set for <mo> with only a previous sibling.`);
+
+ promise_test(async function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ let math = document.getElementById("noPreviousOrNextSiblings");
+ let mo = math.getElementsByTagName("mo")[0];
+ let moBox = mo.getBoundingClientRect();
+ let mrow = mo.parentNode;
+ let mrowBox = mrow.getBoundingClientRect();
+ let previousSiblingBox = mrow.previousElementSibling.getBoundingClientRect();
+ let nextSiblingBox = mrow.nextElementSibling.getBoundingClientRect();
+ assert_approx_equals(moBox.left - mrowBox.left, 0, epsilon);
+ assert_approx_equals(mrowBox.right - moBox.right, 0, epsilon);
+ assert_approx_equals(mrowBox.left - previousSiblingBox.right, lspace, epsilon);
+ assert_approx_equals(nextSiblingBox.left - mrowBox.right, rspace, epsilon);
+ }, `Spacing properly set for <mo> with no previous/next siblings (aka embellished operator).`);
+</script>
+<div id="log"></div>
+<p>
+ <math id="previousAndNextSibling">
+ <mrow>
+ <mn>1</mn>
+ <mo lspace="100px" rspace="200px">X</mo>
+ <mn>2</mn>
+ </mrow>
+ </math>
+</p>
+<p>
+ <math id="nextSiblingOnly">
+ <mrow>
+ <mo lspace="100px" rspace="200px">X</mo>
+ <mn>2</mn>
+ </mrow>
+ </math>
+</p>
+<p>
+ <math id="previousSiblingOnly">
+ <mrow>
+ <mn>1</mn>
+ <mo lspace="100px" rspace="200px">X</mo>
+ </mrow>
+ </math>
+</p>
+<p>
+ <math id="noPreviousOrNextSiblings">
+ <mrow>
+ <mn>1</mn>
+ <mrow>
+ <mo lspace="100px" rspace="200px">X</mo>
+ </mrow>
+ <mn>2</mn>
+ </mrow>
+ </math>
+</p>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/spacing.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/spacing.html
new file mode 100644
index 00000000000..9d80fde8d62
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/mrow/spacing.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Spacing in mrows</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#horizontally-group-sub-expressions-mrow">
+<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
+<link rel="help" href="https://w3c.github.io/mathml-core/#style-change-mstyle">
+<link rel="help" href="https://w3c.github.io/mathml-core/#error-message-merror">
+<link rel="help" href="https://w3c.github.io/mathml-core/#making-sub-expressions-invisible-mphantom">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element">
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.menclose">
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<meta name="assert" content="Spacing is added around operators inside mrow-like elements.">
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ function runTests()
+ {
+ ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded", "Unknown", "Fenced", "A", "Mtd"].forEach((tag) => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var mrow = document.getElementById(tag);
+ var mn1 = mrow.firstElementChild.getBoundingClientRect();
+ var mn2 = mrow.lastElementChild.getBoundingClientRect();
+ assert_greater_than_equal(mn2.left - mn1.right, 50);
+ }, `operator spacing inside ${tag}`);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math><mrow id="Mrow"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mrow></math>
+ <math><msqrt id="Sqrt"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></msqrt></math>
+ <math><mstyle id="Style"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mstyle></math>
+ <math><merror id="Error"><mn>1</mn><mo lspace="50px"></mo><mn>2</mn></merror></math>
+ <math><mphantom id="Phantom"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mphantom></math>
+ <math id="Math"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></math>
+ <!-- menclose is treated as <unknown> in MathML Core -->
+ <math><menclose id="Menclose" notation="box"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></menclose></math>
+ <math><mpadded id="Mpadded" lspace="10px"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mpadded></math>
+ <math><unknown id="Unknown"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></unknown></math>
+ <math><mfenced id="Fenced"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mfenced></math>
+ <math><a id="A"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></a></math>
+ <math><mtable><mtr><mtd id="Mtd"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mtd></mtr></mtable></math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/character-level-mirroring.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/character-level-mirroring.html
new file mode 100644
index 00000000000..d1cf137e092
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/character-level-mirroring.html
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>Character-level mirroring</title>
+ <meta
+ name="assert"
+ content="Operators should be mirrored when using RTL text direction"
+ >
+ <script src="../../../resources/testharness.js"></script>
+ <script src="../../../resources/testharnessreport.js"></script>
+ <script src="../../../mathml/support/feature-detection.js"></script>
+ <script src="../../../mathml/support/fonts.js"></script>
+
+ <style>
+ /* This font contains the characters 0x007B, 0x0029, 0x007D and 0x0028
+ (left and right parentheses and brackets), which respectively have
+ widths of 1em, 2em, 3em and 4em for any stretch size (base glyph,
+ size variants and glyph assemblies). */
+ @font-face {
+ font-family: operators;
+ src: url("../../../fonts/math/stretchy-text-direction-asymetrical.woff");
+ }
+ math {
+ font-family: operators;
+ font-size: 16px;
+ }
+ mspace {
+ width: 1em;
+ background: cornflowerblue;
+ }
+ </style>
+
+ <script>
+ const epsilon = 1;
+ const font_size = 16;
+ const test_cases = [
+ "Base glyph",
+ "Size variant",
+ "Glyph assembly",
+ ];
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => {
+ loadAllFonts().then(runTests);
+ });
+
+ function runTests() {
+ // Test base glyph, size variant and glyph assembly.
+ document.querySelectorAll("p").forEach(
+ (paragraph, i) => {
+ mspace = paragraph.querySelector("mspace");
+ test(function () {
+ paragraph.querySelectorAll("mo").forEach((mo, j) => {
+ box = mo.getBoundingClientRect();
+ // Measure the width of the characters { and ), then the
+ // mirrored } and (.
+ assert_approx_equals(
+ box.width,
+ font_size * (j + 1),
+ epsilon,
+ `operator ${mo.textContent} ${
+ window.getComputedStyle(mo).direction
+ }`,
+ );
+ });
+ }, `${test_cases[i]} (${mspace.getAttribute("height")})`);
+ },
+ );
+
+ done();
+ }
+ </script>
+ </head>
+
+ <body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mrow>
+ <mo>{</mo>
+ <mspace height="0.5em" />
+ <mo>)</mo>
+ </mrow>
+ </math>
+ <math dir="rtl">
+ <mrow>
+ <mo>{</mo>
+ <mspace height="0.5em" />
+ <mo>)</mo>
+ </mrow>
+ </math>
+ </p>
+ <hr />
+ <p>
+ <math>
+ <mrow>
+ <mo>{</mo>
+ <mspace height="1em" />
+ <mo>)</mo>
+ </mrow>
+ </math>
+ <math dir="rtl">
+ <mrow>
+ <mo>{</mo>
+ <mspace height="1em" />
+ <mo>)</mo>
+ </mrow>
+ </math>
+ </p>
+ <hr />
+ <p>
+ <math>
+ <mrow>
+ <mo>{</mo>
+ <mspace height="4em" />
+ <mo>)</mo>
+ </mrow>
+ </math>
+ <math dir="rtl">
+ <mrow>
+ <mo>{</mo>
+ <mspace height="4em" />
+ <mo>)</mo>
+ </mrow>
+ </math>
+ </p>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/display-operator-min-height-no-workaround.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/display-operator-min-height-no-workaround.html
new file mode 100644
index 00000000000..a313e720a4f
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/display-operator-min-height-no-workaround.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>DisplayOperatorMinHeight with custom font</title>
+ <link
+ rel="help"
+ href="https://w3c.github.io/mathml-core/#layout-of-operators"
+ >
+ <meta
+ name="assert"
+ content="Laying out operators should respect the font's DisplayOperatorMinHeight"
+ >
+ <script src="../../../resources/testharness.js"></script>
+ <script src="../../../resources/testharnessreport.js"></script>
+ <script src="../../../mathml/support/feature-detection.js"></script>
+ <script src="../../../mathml/support/fonts.js"></script>
+
+ <style>
+ /* This font has a DisplayOperatorMinHeight of 1.25em and two variants of the 0x2AFF
+ character, one with a height of 1.25em and the other with 2em. */
+ @font-face {
+ font-family: largeop-displayoperatorminheight1250;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight1250.woff");
+ }
+ math {
+ font-family: largeop-displayoperatorminheight1250;
+ font-size: 32px;
+ color: green;
+ }
+ math > mo:first-child {
+ color: blue;
+ }
+ </style>
+
+ <script>
+ const font_size = 32;
+ const small_variant = 1.25 * font_size;
+ // Needs to be less than the difference between the two variants (2em - 1.25em)
+ const epsilon = 0.1 * font_size;
+
+ // Some browser engines had a minimum for DisplayOperatorMinHeight of sqrt(2) times
+ // the base glyph size (~1.41 * 1em in this case).
+ // This test checks that the constant is not modified and the variant measuring 1.25em
+ // is picked instead of the bigger one measuring 2em.
+ var t = async_test("DisplayOperatorMinHeight is not modified");
+ window.addEventListener("load", () => {
+ loadAllFonts().then(
+ t.step_func_done(function () {
+ const math = document.querySelector("math");
+ children = math.children;
+ largeop = children[1].getBoundingClientRect();
+ assert_approx_equals(
+ largeop.height,
+ small_variant,
+ epsilon,
+ "Using the small variant",
+ );
+ }),
+ );
+ });
+ </script>
+ </head>
+
+ <body>
+ <div id="log"></div>
+ <math display="block">
+ <mo largeop="false">&#x2AFF;</mo>
+ <mo largeop="true">&#x2AFF;</mo>
+ </math>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-001.html
new file mode 100644
index 00000000000..dc69b1cd194
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-001.html
@@ -0,0 +1,625 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Embellished operators</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify definition of embellished operators">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/box-navigation.js"></script>
+<style>
+ /* Default spacing of operator 'X' is 0.2777777777777778em so quite different
+ from the measured/specified 0em and 1em. */
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ .testedElement mo {
+ color: yellow !important;
+ }
+ .testedElement, .testedElement * {
+ color: blue !important;
+ background: blue !important;
+ }
+ .oof1 {
+ position: absolute;
+ }
+ .oof2 {
+ position: fixed;
+ }
+ .nobox {
+ display: none;
+ }
+</style>
+<script>
+ function spaceBeforeElement(id) {
+ var element = document.getElementById(id);
+ var mnBefore = previousInFlowSibling(element);
+ return element.getBoundingClientRect().left - mnBefore.getBoundingClientRect().right;
+ }
+
+ function spaceBeforeCoreOperator(id) {
+ var element = document.getElementById(id);
+ var coreMo = element.getElementsByTagName("mo")[0];
+ return coreMo.getBoundingClientRect().left - element.getBoundingClientRect().left;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ ["mrow", "mstyle", "mphantom", "mpadded", "merror", "mprescripts", "none", "unknown", "mfenced", "a"].forEach(tag => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBeforeElement(`${tag}-op-1`), 2 * emToPx, epsilon);
+ assert_approx_equals(spaceBeforeCoreOperator(`${tag}-op-1`), 0, epsilon);
+ }, `${tag} (embellished operator)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBeforeElement(`${tag}-op-2`), 2 * emToPx, epsilon);
+ assert_approx_equals(spaceBeforeCoreOperator(`${tag}-op-2`), 0, epsilon);
+ }, `${tag} (embellished operator, from in-flow children)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBeforeElement(`${tag}-nonop-1`), 0, epsilon);
+ assert_approx_equals(spaceBeforeCoreOperator(`${tag}-nonop-1`), 2 * emToPx, epsilon);
+ }, `${tag} (not embellished operator)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBeforeElement(`${tag}-nonop-2`), 0, epsilon);
+ assert_approx_equals(spaceBeforeCoreOperator(`${tag}-nonop-2`), 2 * emToPx, epsilon);
+ }, `${tag} (not embellished operator, from in-flow children)`);
+ });
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <!-- mrow is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow id="mrow-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mtext class="space-like">X</mtext>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow id="mrow-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow id="mrow-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext class="space-like">X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow id="mrow-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- mstyle is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <mstyle id="mstyle-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mstyle>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mstyle id="mstyle-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </mstyle>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mstyle id="mstyle-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mstyle id="mstyle-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- mphantom is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <mphantom id="mphantom-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mphantom>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mphantom id="mphantom-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </mphantom>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom id="mphantom-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom id="mphantom-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- mpadded is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <mpadded id="mpadded-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mpadded>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mpadded id="mpadded-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </mpadded>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mpadded id="mpadded-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mpadded id="mpadded-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- merror is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <merror id="merror-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </merror>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <merror id="merror-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </merror>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <merror id="merror-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </merror>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <merror id="merror-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </merror>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- mprescripts is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <mprescripts id="mprescripts-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mprescripts>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mprescripts id="mprescripts-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </mprescripts>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mprescripts id="mprescripts-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mprescripts>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mprescripts id="mprescripts-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mprescripts>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- none is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <none id="none-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </none>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <none id="none-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </none>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <none id="none-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </none>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <none id="none-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </none>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- unknown is an embellished operator if its in-flow children consist
+ of one embellished operator and zero or more space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <unknown id="unknown-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </unknown>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <unknown id="unknown-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </unknown>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <unknown id="unknown-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </unknown>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <unknown id="unknown-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </unknown>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- mfenced is unknown to MathML Core so it is considered a grouping element. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <mfenced id="mfenced-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mfenced>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mfenced id="mfenced-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </mfenced>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mfenced id="mfenced-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mfenced>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mfenced id="mfenced-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mfenced>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <!-- a is unknown to MathML Core so it is considered a grouping element. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <a id="a-op-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </a>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <a id="a-nonop-1" class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ </a>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <a id="a-op-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </a>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <a id="a-nonop-2" class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- "mn" is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </a>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-002.html
new file mode 100644
index 00000000000..7cf0a4cad40
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-002.html
@@ -0,0 +1,559 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Embellished operators</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify definition of embellished operators">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/box-navigation.js"></script>
+<style>
+ /* Default spacing of operator 'X' is 0.2777777777777778em so quite different
+ from the measured/specified 0em and 1em. */
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ mtext.space-like {
+ color: lightblue !important;
+ }
+ .testedElement mo {
+ color: yellow !important;
+ }
+ .testedElement, .testedElement * {
+ color: blue !important;
+ background: blue !important;
+ }
+ .oof1 {
+ position: absolute;
+ }
+ .oof2 {
+ position: fixed;
+ }
+ .nobox {
+ display: none;
+ }
+</style>
+<script>
+ function spaceBeforeElement(element) {
+ var mnBefore = previousInFlowSibling(element);
+ return element.getBoundingClientRect().left - mnBefore.getBoundingClientRect().right;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ ["msub", "msup", "msubsup", "munder", "mover", "munderover",
+ "mmultiscripts", "mfrac"].forEach(tag => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[0];
+ assert_approx_equals(spaceBeforeElement(element), 2 * emToPx, epsilon);
+ }, `${tag} (embellished operator)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[1];
+ assert_approx_equals(spaceBeforeElement(element), 2 * emToPx, epsilon);
+ }, `${tag} (embellished operator, from in-flow children)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[2];
+ assert_approx_equals(spaceBeforeElement(element), 0, epsilon);
+ }, `${tag} (not embellished operator)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[3];
+ assert_approx_equals(spaceBeforeElement(element), 0, epsilon);
+ }, `${tag} (not embellished operator, from in-flow children)`);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <!-- <msub>, <msup>, <msubsup>, <munder>, <mover>, <munderover>,
+ <mmultiscripts>, <mfrac> are embellished
+ operators if their first in-flow
+ child exists and is an embellished operator -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <msub class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </msub>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <msup class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </msup>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <msubsup class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msubsup>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <munder class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </munder>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mover class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </mover>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <munderover class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </munderover>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mmultiscripts class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mfrac class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </mfrac>
+ <mn>X</mn>
+ </math>
+ </p>
+
+ <!-- Only in-flow children affect determination of embellished operators. -->
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <msub class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </msub>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <msup class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </msup>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <msubsup class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </msubsup>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <munder class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </munder>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mover class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mover>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <munderover class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </munderover>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mmultiscripts class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mmultiscripts>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mfrac class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mfrac>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+
+ <!-- <msub>, <msup>, <msubsup>, <munder>, <mover>, <munderover>,
+ <mmultiscripts>, <mfrac> are not embellished
+ operators if their first in-flow child is not an embellished operator -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <msub class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </msub>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <msup class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </msup>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <msubsup class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </msubsup>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <munder class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </munder>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mover class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mover>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <munderover class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </munderover>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mmultiscripts class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mfrac class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mfrac>
+ <mn>X</mn>
+ </math>
+ </p>
+
+ <!-- Only in-flow children affect determination of embellished operators. -->
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <msub class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </msub>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <msup class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </msup>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <msubsup class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </msubsup>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <munder class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </munder>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mover class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mover>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <munderover class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </munderover>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mmultiscripts class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mmultiscripts>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mfrac class="testedElement">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mfrac>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-003.html
new file mode 100644
index 00000000000..ee0dd7edefb
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-003.html
@@ -0,0 +1,394 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Embellished operators</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify definition of embellished operators">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/box-navigation.js"></script>
+<style>
+ /* Default spacing of operator 'X' is 0.2777777777777778em so quite different
+ from the measured/specified 0em and 1em. */
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ mtext.space-like {
+ color: lightblue !important;
+ }
+ .testedElement mo {
+ color: yellow !important;
+ }
+ .testedElement, .testedElement * {
+ color: blue !important;
+ background: blue !important;
+ }
+ .oof1 {
+ position: absolute;
+ }
+ .oof2 {
+ position: fixed;
+ }
+ .nobox {
+ display: none;
+ }
+ .allChildrenVisible > *:not(.nobox) {
+ display: inline math;
+ }
+</style>
+<script>
+ function spaceBeforeElement(element) {
+ var mnBefore = previousInFlowSibling(element);
+ return element.getBoundingClientRect().left - mnBefore.getBoundingClientRect().right;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ ["maction", "semantics"].forEach(tag => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[0];
+ assert_approx_equals(spaceBeforeElement(element), 2 * emToPx, epsilon);
+ }, `${tag} (embellished operator)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[1];
+ assert_approx_equals(spaceBeforeElement(element), 2 * emToPx, epsilon);
+ }, `${tag} (embellished operator, from in-flow children)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[2];
+ assert_approx_equals(spaceBeforeElement(element), 0, epsilon);
+ }, `${tag} (not embellished operator)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[3];
+ assert_approx_equals(spaceBeforeElement(element), 0, epsilon);
+ }, `${tag} (not embellished operator, from in-flow children)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[4];
+ assert_approx_equals(spaceBeforeElement(element), 0, epsilon);
+ }, `${tag} (not embellished operator, empty)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[5];
+ assert_approx_equals(spaceBeforeElement(element), 2 * emToPx, epsilon);
+ }, `${tag} (embellished operator, one child)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var element = document.getElementsByTagName(tag)[6];
+ assert_approx_equals(spaceBeforeElement(element), 2 * emToPx, epsilon);
+ }, `${tag} (embellished operator, complex)`);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <!-- <semantics> or <maction> are embellished operators if their children
+ consist (in any order) of one embellished operator and zero or more
+ space-like elements. -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <maction class="testedElement" actiontype="statusline">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>STATUS MESSAGE</mn>
+ </maction>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <semantics class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <annotation>TEXT ANNOTATION</annotation>
+ <mn>X</mn>
+ </semantics>
+ <mn>X</mn>
+ </math>
+ </p>
+
+ <!-- Only in-flow children affect determination of embellished operators. -->
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <maction class="testedElement" actiontype="statusline">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>STATUS MESSAGE</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </maction>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <semantics class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <annotation>TEXT ANNOTATION</annotation>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </semantics>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+
+ <!-- <semantics> or <maction> are not embellished
+ operators if their first in-flow child is not an embellished operator -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <msub class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </msub>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <msup class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </msup>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <msubsup class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ </msubsup>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <munder class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </munder>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mover class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mover>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <munderover class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </munderover>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mmultiscripts class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mfrac class="testedElement">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mfrac>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <maction class="testedElement" actiontype="statusline">
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">STATUS MESSAGE</mo>
+ </maction>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <semantics class="testedElement">
+ <mrow>
+ <mn>X</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ </mrow>
+ <annotation>TEXT ANNOTATION</annotation>
+ </semantics>
+ <mn>X</mn>
+ </math>
+ </p>
+
+ <!-- Only in-flow children affect determination of embellished operators. -->
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <maction class="testedElement" actiontype="statusline">
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">STATUS MESSAGE</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </maction>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <semantics class="testedElement">
+ <mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <annotation>TEXT ANNOTATION</annotation>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </semantics>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+
+ <!-- Empty <maction> and <semantics> (invalid in MathML3). -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <maction class="testedElement">
+ </maction>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <semantics class="testedElement">
+ </semantics>
+ <mn>X</mn>
+ </math>
+ </p>
+
+ <!-- One-child <maction> and <semantics> (invalid in MathML3). -->
+ <p>
+ <math>
+ <mn>X</mn>
+ <maction class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </maction>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <semantics class="testedElement">
+ <mo lspace="2em" rspace="0em">X</mo>
+ </semantics>
+ <mn>X</mn>
+ </math>
+ </p>
+
+ <!-- Complex structure (invalid in MathML3). -->
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <maction class="testedElement allChildrenVisible">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext class="space-like">X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </maction>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <semantics class="testedElement allChildrenVisible">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="2em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext class="space-like">X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </semantics>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-004.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-004.html
new file mode 100644
index 00000000000..0e330e572a2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-004.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Stretching of core operator with various levels of nested mrows</title>
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=236963">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2020658">
+<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element">
+<link rel="help" href="https://w3c.github.io/mathml-core/#algorithm-for-stretching-operators-along-the-block-axis">
+<meta name="assert" content="Operators stretch with various levels of nested mrow.">
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+ mo {
+ font-size: 10px;
+ font-family: axisheight5000-verticalarrow14000;
+ }
+ @font-face {
+ font-family: axisheight5000-verticalarrow14000;
+ src: url("../../../fonts/math/axisheight5000-verticalarrow14000.woff");
+ }
+</style>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ function runTests()
+ {
+ Array.from(document.querySelectorAll("[data-title]")).forEach(mo => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_greater_than_equal(mo.getBoundingClientRect().height, 100);
+ }, `Vertical stretching performed for ${mo.dataset.title}.`);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <!-- The <math> element uses mrow layout. The <mo> child should stretch to
+ at least the size of the <mspace> sibling.
+ -->
+ <math><mo data-title="math > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></math>
+ <math display="block"><mo data-title="Stretching for math[display=block] > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></math>
+
+ <!-- The <mrow> child of the <math> element is an embellished operator. Per
+ the "algorithm for stretching operators along the block axis", it
+ should first be laid out with block stretch constraint (ascent=0,
+ descent=0) and then laid out again with a stretch constraint that
+ includes at least the size of the <mspace> descendant. So again the
+ <mo> descendant should stretch at least to the size of the <mspace>.
+ -->
+ <math><mrow><mo data-title="math > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></math>
+ <math display="block"><mrow><mo data-title="Stretching for math[display=block] > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></math>
+
+ <!-- Same with two nested <mrow>. -->
+ <math><mrow><mrow><mo data-title="math > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></math>
+ <math display="block"><mrow><mrow><mo data-title="Stretching for math[display=block] > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></math>
+
+ <!-- Same with three nested <mrow>. -->
+ <math><mrow><mrow><mrow><mo data-title="math > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></math>
+ <math display="block"><mrow><mrow><mrow><mo data-title="Stretching for math[display=block] > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></math>
+
+ <!-- Same with four nested <mrow>. -->
+ <math><mrow><mrow><mrow><mrow><mo data-title="math > mrow > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></mrow></math>
+ <math display="block"><mrow><mrow><mrow><mrow><mo data-title="Stretching for math[display=block] > mrow > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></mrow></math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-dynamic-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-dynamic-002.html
new file mode 100644
index 00000000000..ae41cdfdc96
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/embellished-operator-dynamic-002.html
@@ -0,0 +1,185 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Embellished operators - tree change and relayout</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<link rel="help" href="https://chromium-review.googlesource.com/c/chromium/src/+/3059456">
+<meta name="assert" content="Verify relayout of an mrow with a child that has a deeply nested <mo> element.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ .relative_positioned_and_fixed_size {
+ position: relative;
+ height: 0px;
+ width: 0px;
+ overflow: scroll;
+ }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ function assertCorrectSpacing(container,
+ zero_size_mrow_is_embellished_op) {
+ // The container should add lspace/rspace around the zero size mrow
+ // if and only if that mrow is an embellished operator.
+ let mnBefore = container.children[0].getBoundingClientRect();
+ let zeroSizeMrow = container.children[1].getBoundingClientRect();
+ let mnAfter = container.children[2].getBoundingClientRect();
+ assert_approx_equals(zeroSizeMrow.left - mnBefore.right,
+ zero_size_mrow_is_embellished_op ?
+ emToPx * 1 : 0, epsilon,
+ "lspace");
+ assert_approx_equals(mnAfter.left - zeroSizeMrow.right,
+ zero_size_mrow_is_embellished_op ?
+ emToPx * 2 : 0, epsilon,
+ "rspace");
+ }
+
+ let container1 = document.getElementById("container1");
+ test(function() {
+ assertCorrectSpacing(container1, true);
+ }, "container1: Initially an embellished operator");
+
+ let container2 = document.getElementById("container2");
+ test(function() {
+ assertCorrectSpacing(container2, false);
+ }, "container2: Initially not an embellished operator");
+
+ test(function() {
+ let mrow1 = document.getElementById("change_to_not_embellished_operator");
+ mrow1.appendChild(FragmentHelper.createElement("mn"));
+ assertCorrectSpacing(container1, false);
+ }, " container1: No longer an embellished operator");
+
+ test(function() {
+ let mrow2 = document.getElementById("change_to_embellished_operator");
+ mrow2.removeChild(mrow2.lastElementChild);
+ assertCorrectSpacing(container2, true);
+ }, "container2: Became an embellished operator");
+
+ let container3 = document.getElementById("container3");
+ test(function() {
+ assertCorrectSpacing(container3, true);
+ }, "container3: Initially an embellished operator (testing space-like)");
+
+ let container4 = document.getElementById("container4");
+ test(function() {
+ assertCorrectSpacing(container4, false);
+ }, "container4/space-like: Initially not an embellished operator (testing space-like)");
+
+ test(function() {
+ let mrow = document.getElementById("change_to_not_space_like");
+ mrow.appendChild(FragmentHelper.createElement("mn"));
+ assertCorrectSpacing(container3, false);
+ }, " container3: No longer an embellished operator (testing space-like)");
+
+ test(function() {
+ let mrow = document.getElementById("change_to_space_like");
+ mrow.removeChild(mrow.lastElementChild);
+ assertCorrectSpacing(container4, true);
+ }, "container4: Became an embellished operator (testing space-like)");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+
+ <div>
+ <math display="block">
+ <mrow id="container1">
+ <mn>1</mn>
+ <mrow class="relative_positioned_and_fixed_size">
+ <mrow id="change_to_not_embellished_operator">
+ <mrow>
+ <mo lspace="1em" rspace="2em"></mo>
+ </mrow>
+ </mrow>
+ </mrow>
+ <mn>2</mn>
+ </mrow>
+ </math>
+ </div>
+
+ <div>
+ <math display="block">
+ <mrow id="container2">
+ <mn>3</mn>
+ <mrow class="relative_positioned_and_fixed_size">
+ <mrow id="change_to_embellished_operator">
+ <mrow>
+ <mo lspace="1em" rspace="2em"></mo>
+ </mrow>
+ <mn></mn>
+ </mrow>
+ </mrow>
+ <mn>4</mn>
+ </mrow>
+ </math>
+ </div>
+
+ <div>
+ <math display="block">
+ <mrow id="container3">
+ <mn>5</mn>
+ <mrow>
+ <mrow>
+ <mrow>
+ <mo lspace="1em" rspace="2em"></mo>
+ </mrow>
+ <mrow class="relative_positioned_and_fixed_size">
+ <mrow id="change_to_not_space_like">
+ <mspace></mspace>
+ <mtext></mtext>
+ </mrow>
+ </mrow>
+ </mrow>
+ </mrow>
+ <mn>6</mn>
+ </mrow>
+ </math>
+ </div>
+
+ <div>
+ <math display="block">
+ <mrow id="container4">
+ <mn>7</mn>
+ <mrow>
+ <mrow>
+ <mrow>
+ <mo lspace="1em" rspace="2em"></mo>
+ </mrow>
+ <mrow class="relative_positioned_and_fixed_size">
+ <mrow id="change_to_space_like">
+ <mspace></mspace>
+ <mtext></mtext>
+ <mn></mn>
+ </mrow>
+ </mrow>
+ </mrow>
+ </mrow>
+ <mn>8</mn>
+ </mrow>
+ </math>
+ </div>
+
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/largeop-hit-testing.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/largeop-hit-testing.html
new file mode 100644
index 00000000000..c6a1af15f66
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/largeop-hit-testing.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test hit testing on large operators</title>
+<meta name="assert" content="Verify that hit testing works on large operators.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ @font-face {
+ font-family: TestFont;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight5000.woff");
+ }
+ mo {
+ font-family: TestFont;
+ font-size: 16px;
+ }
+</style>
+<script>
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+
+ let bbox = getBox("largeop");
+ let hit = document.getElementById("largeop");
+ let reference = getBox("reference");
+ assert_true(bbox.height > reference.height, "height of large op is bigger than the equivalent normal operator");
+ assert_equals(hit, document.elementFromPoint(bbox.left + 1, bbox.top + 1), "hit testing top-left corner of large op works");
+ assert_equals(hit, document.elementFromPoint(bbox.right - 1, bbox.bottom - 1), "hit testing bottom-right corner of large op works");
+ }, "Large op hit testing");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mstyle displaystyle="false">
+ <mo id="reference">&#x2AFF;</mo>
+ </mstyle>
+ </mtd>
+ <mtd>
+ <mstyle displaystyle="true">
+ <mo id="largeop">&#x2AFF;</mo>
+ </mstyle>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-axis-height-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-axis-height-1.html
new file mode 100644
index 00000000000..c45e5052b74
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-axis-height-1.html
@@ -0,0 +1,218 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>mo axis height</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<meta name="assert" content="Element mo correctly uses the axis height parameter from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: axisheight5000-verticalarrow14000;
+ src: url("../../../fonts/math/axisheight5000-verticalarrow14000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 5;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ const AxisHeight = 5000 * emToPx;
+
+ test(function() {
+ var moMiddle = (getBox("mo1").bottom + getBox("mo1").top) / 2;
+ assert_approx_equals(getBox("mo1").height,
+ 14000 * emToPx, epsilon, "mo: size");
+ assert_approx_equals(getBox("baseline1").bottom - moMiddle,
+ AxisHeight, epsilon, "mo: axis height");
+ }, "symmetric stretching with respect to the math axis (size variant)");
+
+ test(function() {
+ var moMiddle = (getBox("mo2").bottom + getBox("mo2").top) / 2;
+ assert_approx_equals(getBox("mo2").height,
+ 2 * (getBox("target2").height - AxisHeight),
+ epsilon, "mo: size");
+ assert_approx_equals(getBox("baseline2").bottom - moMiddle,
+ AxisHeight, epsilon, "mo: axis height");
+ }, "symmetric stretching with respect to the math axis (glyph assembly)");
+
+ test(function() {
+ const minsize = 14000 * emToPx;
+ const Tascent = minsize / 2 + AxisHeight;
+ const Tdescent = minsize - Tascent;
+ assert_approx_equals(getBox("baseline3").bottom - getBox("mo3").top, Tascent, epsilon, "mo ascent");
+ assert_approx_equals(getBox("mo3").bottom - getBox("baseline3").bottom, Tdescent, epsilon, "mo descent");
+ }, "Tascent = Tdescent = 0, minsize = 14em");
+
+ test(function() {
+ const minsize = 14000 * emToPx;
+ var Tascent = getBox("baseline4").bottom - getBox("target4").top;
+ assert_greater_than(Tascent, AxisHeight);
+ var Tdescent = getBox("target4").bottom - getBox("baseline4").bottom;
+ const T = Tascent + Tdescent;
+ Tascent = Math.max(0, Tascent - AxisHeight) * minsize / T + AxisHeight;
+ Tdescent = minsize - Tascent;
+ assert_approx_equals(getBox("baseline4").bottom - getBox("mo4").top, Tascent, epsilon, "mo ascent");
+ assert_approx_equals(getBox("mo4").bottom - getBox("baseline4").bottom, Tdescent, epsilon, "mo descent");
+ }, "Tascent = 6em > AxisHeight, Tdescent = 1em, symmetric = false, minsize = 14em");
+
+ test(function() {
+ const minsize = 14000 * emToPx;
+ var Tascent = getBox("baseline5").bottom - getBox("target5").top;
+ assert_less_than(Tascent, AxisHeight);
+ var Tdescent = getBox("target5").bottom - getBox("baseline5").bottom;
+ const T = Tascent + Tdescent;
+ Tascent = Math.max(0, Tascent - AxisHeight) * minsize / T + AxisHeight;
+ Tdescent = minsize - Tascent;
+ assert_approx_equals(getBox("baseline5").bottom - getBox("mo5").top, Tascent, epsilon, "mo ascent");
+ assert_approx_equals(getBox("mo5").bottom - getBox("baseline5").bottom, Tdescent, epsilon, "mo descent");
+ }, "Tascent = 4em < AxisHeight, Tdescent = 3em, symmetric = false, minsize = 14em");
+
+ test(function() {
+ const maxsize = 14000 * emToPx;
+ var Tascent = getBox("baseline6").bottom - getBox("target6").top;
+ assert_greater_than(Tascent, AxisHeight);
+ var Tdescent = getBox("target6").bottom - getBox("baseline6").bottom;
+ const T = Tascent + Tdescent;
+ Tascent = Math.max(0, Tascent - AxisHeight) * maxsize / T + AxisHeight;
+ Tdescent = maxsize - Tascent;
+ assert_approx_equals(getBox("baseline6").bottom - getBox("mo6").top, Tascent, epsilon, "mo ascent");
+ assert_approx_equals(getBox("mo6").bottom - getBox("baseline6").bottom, Tdescent, epsilon, "mo descent");
+ }, "Tascent = 6em > AxisHeight, Tdescent = 22em, symmetric = false, maxsize = 14em");
+
+ test(function() {
+ const maxsize = 14000 * emToPx;
+ var Tascent = getBox("baseline7").bottom - getBox("target7").top;
+ assert_less_than(Tascent, AxisHeight);
+ var Tdescent = getBox("target7").bottom - getBox("baseline7").bottom;
+ var T = Tascent + Tdescent;
+ Tascent = Math.max(0, Tascent - AxisHeight) * maxsize / T + AxisHeight;
+ Tdescent = maxsize - Tascent;
+ assert_approx_equals(getBox("baseline7").bottom - getBox("mo7").top, Tascent, epsilon, "mo ascent");
+ assert_approx_equals(getBox("mo7").bottom - getBox("baseline7").bottom, Tdescent, epsilon, "mo descent");
+ }, "Tascent = 4em < AxisHeight, Tdescent = 24em, symmetric = false, maxsize = 14em");
+
+ test(function() {
+ const minsize = 14000 * emToPx;
+ const Uascent = getBox("baseline8").bottom - getBox("target8").top;
+ const Udescent = getBox("target8").bottom - getBox("baseline8").bottom;
+ assert_less_than(2 * Math.max(Uascent - AxisHeight, Udescent + AxisHeight), minsize, "Sascent + Sdescent < minsize");
+ assert_approx_equals(getBox("mo8").height, minsize, epsilon, "mo size");
+ const MathAxis = getBox("baseline8").bottom - AxisHeight;
+ assert_approx_equals(MathAxis - getBox("mo8").top, getBox("mo8").bottom - MathAxis, epsilon, "mo is symmetric");
+ }, "symmetric stretching with respect to the math axis (minsize = 14em)");
+
+ test(function() {
+ const maxsize = 14000 * emToPx;
+ const Uascent = getBox("baseline9").bottom - getBox("target9").top;
+ const Udescent = getBox("target9").bottom - getBox("baseline9").bottom;
+ assert_greater_than(2 * Math.max(Uascent - AxisHeight, Udescent + AxisHeight), maxsize, "Sascent + Sdescent > maxsize");
+ assert_approx_equals(getBox("mo9").height, maxsize, epsilon, "mo size");
+ const MathAxis = getBox("baseline9").bottom - AxisHeight;
+ assert_approx_equals(MathAxis - getBox("mo9").top, getBox("mo9").bottom - MathAxis, epsilon, "mo is symmetric");
+ }, "symmetric stretching with respect to the math axis (maxsize = 14em)");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline1" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo1" symmetric="true" style="color: green">&#x21A8;</mo>
+ <mpadded style="background: gray" width="10px" height="50px"><mn>1</mn></mpadded>
+ </mrow>
+ </math>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline2" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo2" symmetric="true" style="color: green">&#x21A8;</mo>
+ <mpadded id="target2" style="background: gray" width="10px" height="200px"><mn>2</mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline3" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo3" minsize="14em" style="color: green">&#x21A8;</mo>
+ <mpadded id="target3" style="background: gray" width="10px" height="0px" depth="0px"><mn>3</mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline4" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo4" minsize="14em" style="color: green">&#x21A8;</mo>
+ <mpadded id="target4" style="background: gray" width="10px" height="6em" depth="1em"><mn>4</mn></mpadded>
+ </mrow>
+ </math>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline5" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo5" minsize="14em" style="color: green">&#x21A8;</mo>
+ <mpadded id="target5" style="background: gray" width="10px" height="4em" depth="3em"><mn>5</mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline6" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo6" maxsize="14em" style="color: green">&#x21A8;</mo>
+ <mpadded id="target6" style="background: gray" width="10px" height="6em" depth="22em"><mn>6</mn></mpadded>
+ </mrow>
+ </math>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline7" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo7" maxsize="14em" style="color: green">&#x21A8;</mo>
+ <mpadded id="target7" style="background: gray" width="10px" height="4em" depth="24em"><mn>7</mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+
+
+ <p>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline8" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo8" symmetric="true" minsize="14em" style="color: green">&#x21A8;</mo>
+ <mpadded id="target8" style="background: gray" width="10px" height="6em" depth="1em"><mn>8</mn></mpadded>
+ </mrow>
+ </math>
+ <math style="font-family: axisheight5000-verticalarrow14000;">
+ <mspace id="baseline9" style="background: blue" width="50px" height="1px"/>
+ <mpadded voffset="50px"><mspace style="background: cyan" width="50px" height="1px"/></mpadded>
+ <mrow>
+ <mo id="mo9" symmetric="true" maxsize="14em" style="color: green">&#x21A8;</mo>
+ <mpadded id="target9" style="background: gray" width="10px" height="6em" depth="24em"><mn>9</mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-font-relative-lengths-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-font-relative-lengths-001.html
new file mode 100644
index 00000000000..a7d980c3496
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-font-relative-lengths-001.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Font-relative lengths on an operator</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify font-relative lengths refer to the core operator, not the embellished operator">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math {
+ font: 100px/1 Ahem;
+ }
+ @font-face {
+ font-family: operators;
+ src: url("../../../fonts/math/operators.woff");
+ }
+ mo {
+ font-family: operators;
+ }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ var epsilon = 1;
+ var baseSizePx = 100;
+
+ test(function() {
+ var beforeRight = document.getElementById("before1").getBoundingClientRect().right;
+ var afterLeft = document.getElementById("after1").getBoundingClientRect().left;
+ var fontScalePercent = .5;
+ var lspaceEm = 1;
+ var moWidthEm = 1;
+ assert_approx_equals(afterLeft - beforeRight, baseSizePx * fontScalePercent * (lspaceEm + moWidthEm), epsilon, "baseSizePx * fontScalePercent * lspaceEm");
+ }, `font-relative lspace refers to the core operator`);
+
+ test(function() {
+ var beforeRight = document.getElementById("before2").getBoundingClientRect().right;
+ var afterLeft = document.getElementById("after2").getBoundingClientRect().left;
+ var fontScalePercent = 2;
+ var rspaceEm = 1;
+ var moWidthEm = 1;
+ assert_approx_equals(afterLeft - beforeRight, baseSizePx * fontScalePercent * (rspaceEm + moWidthEm), epsilon, "baseSizePx * fontScalePercent * rspaceEm");
+ }, `font-relative rspace refers to the core operator`);
+
+ test(function() {
+ var moStretchSize = document.getElementById("operator1").getBoundingClientRect().height;
+ var fontScalePercent = .5;
+ var minsizeEm = 8;
+ var beforeHeight = document.getElementById("before1").getBoundingClientRect().height;
+
+ assert_approx_equals(moStretchSize, baseSizePx * minsizeEm * fontScalePercent, epsilon, "baseSizePx * fontScalePercent * minsizeEm");
+
+ // This is really testing the same thing but do make sure minsize is
+ // applied i.e. the unconstrained target size is less than the actual
+ // stretch size.
+ assert_approx_equals(beforeHeight, moStretchSize / 2, epsilon);
+
+ }, `font-relative minsize refers to the core operator`);
+
+ test(function() {
+ var moStretchSize = document.getElementById("operator2").getBoundingClientRect().height;
+ var fontScalePercent = 2;
+ var maxsizeEm = 1;
+ var afterHeight = document.getElementById("after2").getBoundingClientRect().height;
+
+ assert_approx_equals(moStretchSize, baseSizePx * maxsizeEm * fontScalePercent, epsilon, "baseSizePx * fontScalePercent * maxsizeEm");
+
+ // This is really testing the same thing but do make sure maxsize is
+ // applied i.e. the unconstrained target size is more than the actual
+ // stretch size.
+ assert_approx_equals(afterHeight, 2 * moStretchSize, epsilon);
+
+ }, `font-relative maxsize refers to the core operator`);
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mrow>
+ <mspace id="before1" width="1em" height="1em" depth="1em" style="background: blue"/>
+ <mrow style="font-size: 50%;">
+ <mo id="operator1" lspace="1em" rspace="0em" minsize="8em">β₯―</mo>
+ <mspace id="after1" width="1em" height=".5em" depth=".5em" style="background: green"/>
+ </mrow>
+ <mn><!-- not space like --></mn>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow style="font-size: 200%">
+ <mspace id="before2" width="1em" height=".5em" depth=".5em" style="background: green"/>
+ <mo id="operator2" lspace="0em" rspace="1em" maxsize="1em">β₯―</mo>
+ </mrow>
+ <mspace id="after2" width="1em" height="2em" depth="2em" style="background: blue"/>
+ <mn><!-- not space like --></mn>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-lspace-rspace-5.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-lspace-rspace-5.html
new file mode 100644
index 00000000000..ff8b9ffbc70
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-lspace-rspace-5.html
@@ -0,0 +1,301 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>lspace/rspace attributes</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<meta name="assert" content="lspace/rspace is added around embellished operators">
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ @font-face {
+ font-family: stretchy;
+ src: url("../../../fonts/math/stretchy.woff");
+ }
+ @font-face {
+ font-family: largeop;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight3000-2AFF-axisheight1000.woff");
+ }
+ div {
+ margin-bottom: 50px;
+ }
+ math {
+ font-size: 25px;
+ line-height: 1;
+ font-family: stretchy, largeop, Ahem;
+ }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ const epsilon = 1;
+ const emToPx = 25;
+ function emStringToPx(value) {
+ return parseInt(value.match(/^([0-9]+)em$/)[1]) * emToPx;
+ }
+ function runTests() {
+ Array.from(document.querySelectorAll("[data-title]")).forEach(operator => {
+ test(function() {
+ let operatorBox = operator.getBoundingClientRect();
+ let beforeBox = operator.previousElementSibling.getBoundingClientRect();
+ let afterBox = operator.nextElementSibling.getBoundingClientRect();
+ let mo = operator.getElementsByTagName("mo")[0] || operator;
+ let lspace = emStringToPx(mo.getAttribute("lspace"));
+ let rspace = emStringToPx(mo.getAttribute("rspace"));
+ let isRTL = getComputedStyle(operator.parentNode).direction === "rtl";
+ if (isRTL) {
+ assert_approx_equals(operatorBox.left - afterBox.right, rspace, epsilon);
+ assert_approx_equals(beforeBox.left - operatorBox.right, lspace, epsilon);
+ } else {
+ assert_approx_equals(operatorBox.left - beforeBox.right, lspace, epsilon);
+ assert_approx_equals(afterBox.left - operatorBox.right, rspace, epsilon);
+ }
+ }, `lspace/rspace spacing correctly set around operator (${operator.dataset.title}).`);
+ });
+ done();
+ }
+</script>
+<div id="log"></div>
+<div>
+ <math>
+ <mrow>
+ <mn>22</mn>
+ <mo data-title="child of mrow, not embellished, LTR, normal text"
+ lspace="1em" rspace="2em">+++</mo>
+ <mn>4444</mn>
+ <mo data-title="child of mrow, not embellished, LTR, largeop variant"
+ lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ <mn>55555</mn>
+ <mo data-title="child of mrow, not embellished, LTR, stretchy variant"
+ lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ <mn>666666</mn>
+ <mo data-title="child of mrow, not embellished, LTR, glyph assembly"
+ lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ <mn>7777777</mn>
+ </mrow>
+ </math>
+ <math>
+ <mn>22</mn>
+ <mo data-title="child of math, not embellished, LTR, normal text"
+ lspace="1em" rspace="2em">+++</mo>
+ <mn>4444</mn>
+ <mo data-title="child of math, not embellished, LTR, largeop variant"
+ lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ <mn>55555</mn>
+ <mo data-title="child of math, not embellished, LTR, stretchy variant"
+ lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ <mn>666666</mn>
+ <mo data-title="child of math, not embellished, LTR, glyph assembly"
+ lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ <mn>7777777</mn>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mn>22</mn>
+ <mo data-title="child of mtd, not embellished, LTR, normal text"
+ lspace="1em" rspace="2em">+++</mo>
+ <mn>4444</mn>
+ <mo data-title="child of mtd, not embellished, LTR, largeop variant"
+ lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ <mn>55555</mn>
+ <mo data-title="child of mtd, not embellished, LTR, stretchy variant"
+ lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ <mn>666666</mn>
+ <mo data-title="child of mtd, not embellished, LTR, glyph assembly"
+ lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ <mn>7777777</mn>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ <math>
+ <mrow>
+ <mn>22</mn>
+ <mrow data-title="child of mrow, embellished, LTR, normal text">
+ <mo lspace="1em" rspace="2em">+++</mo>
+ </mrow>
+ <mn>4444</mn>
+ <mrow data-title="child of mrow, embellished, LTR, largeop variant">
+ <mo lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ </mrow>
+ <mn>55555</mn>
+ <mrow data-title="child of mrow, embellished, LTR, stretchy variant">
+ <mo lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ </mrow>
+ <mn>666666</mn>
+ <mrow data-title="child of mrow, embellished, LTR, glyph assembly">
+ <mo lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ </mrow>
+ <mn>7777777</mn>
+ </mrow>
+ </math>
+ <math>
+ <mn>22</mn>
+ <mrow data-title="child of math, embellished, LTR, normal text">
+ <mo lspace="1em" rspace="2em">+++</mo>
+ </mrow>
+ <mn>4444</mn>
+ <mrow data-title="child of math, embellished, LTR, largeop variant">
+ <mo lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ </mrow>
+ <mn>55555</mn>
+ <mrow data-title="child of math, embellished, LTR, stretchy variant">
+ <mo lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ </mrow>
+ <mn>666666</mn>
+ <mrow data-title="child of math, embellished, LTR, glyph assembly">
+ <mo lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ </mrow>
+ <mn>7777777</mn>
+ </math>
+ <math>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mn>22</mn>
+ <mrow data-title="child of mtd, embellished, LTR, normal text">
+ <mo lspace="1em" rspace="2em">+++</mo>
+ </mrow>
+ <mn>4444</mn>
+ <mrow data-title="child of mtd, embellished, LTR, largeop variant">
+ <mo lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ </mrow>
+ <mn>55555</mn>
+ <mrow data-title="child of mtd, embellished, LTR, stretchy variant">
+ <mo lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ </mrow>
+ <mn>666666</mn>
+ <mrow data-title="child of mtd, embellished, LTR, glyph assembly">
+ <mo lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ </mrow>
+ <mn>7777777</mn>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+</div>
+
+
+
+<div>
+ <math dir="rtl">
+ <mrow>
+ <mn>22</mn>
+ <mo data-title="child of mrow, not embellished, RTL, normal text"
+ lspace="1em" rspace="2em">+++</mo>
+ <mn>4444</mn>
+ <mo data-title="child of mrow, not embellished, RTL, largeop variant"
+ lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ <mn>55555</mn>
+ <mo data-title="child of mrow, not embellished, RTL, stretchy variant"
+ lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ <mn>666666</mn>
+ <mo data-title="child of mrow, not embellished, RTL, glyph assembly"
+ lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ <mn>7777777</mn>
+ </mrow>
+ </math>
+ <math dir="rtl">
+ <mn>22</mn>
+ <mo data-title="child of math, not embellished, RTL, normal text"
+ lspace="1em" rspace="2em">+++</mo>
+ <mn>4444</mn>
+ <mo data-title="child of math, not embellished, RTL, largeop variant"
+ lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ <mn>55555</mn>
+ <mo data-title="child of math, not embellished, RTL, stretchy variant"
+ lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ <mn>666666</mn>
+ <mo data-title="child of math, not embellished, RTL, glyph assembly"
+ lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ <mn>7777777</mn>
+ </math>
+ <math dir="rtl">
+ <mtable>
+ <mtr>
+ <mtd>
+ <mn>22</mn>
+ <mo data-title="child of mtd, not embellished, RTL, normal text"
+ lspace="1em" rspace="2em">+++</mo>
+ <mn>4444</mn>
+ <mo data-title="child of mtd, not embellished, RTL, largeop variant"
+ lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ <mn>55555</mn>
+ <mo data-title="child of mtd, not embellished, RTL, stretchy variant"
+ lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ <mn>666666</mn>
+ <mo data-title="child of mtd, not embellished, RTL, glyph assembly"
+ lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ <mn>7777777</mn>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ <math dir="rtl">
+ <mrow>
+ <mn>22</mn>
+ <mrow data-title="child of mrow, embellished, RTL, normal text">
+ <mo lspace="1em" rspace="2em">+++</mo>
+ </mrow>
+ <mn>4444</mn>
+ <mrow data-title="child of mrow, embellished, RTL, largeop variant">
+ <mo lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ </mrow>
+ <mn>55555</mn>
+ <mrow data-title="child of mrow, embellished, RTL, stretchy variant">
+ <mo lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ </mrow>
+ <mn>666666</mn>
+ <mrow data-title="child of mrow, embellished, RTL, glyph assembly">
+ <mo lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ </mrow>
+ <mn>7777777</mn>
+ </mrow>
+ </math>
+ <math dir="rtl">
+ <mn>22</mn>
+ <mrow data-title="child of math, embellished, RTL, normal text">
+ <mo lspace="1em" rspace="2em">+++</mo>
+ </mrow>
+ <mn>4444</mn>
+ <mrow data-title="child of math, embellished, RTL, largeop variant">
+ <mo lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ </mrow>
+ <mn>55555</mn>
+ <mrow data-title="child of math, embellished, RTL, stretchy variant">
+ <mo lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ </mrow>
+ <mn>666666</mn>
+ <mrow data-title="child of math, embellished, RTL, glyph assembly">
+ <mo lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ </mrow>
+ <mn>7777777</mn>
+ </math>
+ <math dir="rtl">
+ <mtable>
+ <mtr>
+ <mtd>
+ <mn>22</mn>
+ <mrow data-title="child of mtd, embellished, RTL, normal text">
+ <mo lspace="1em" rspace="2em">+++</mo>
+ </mrow>
+ <mn>4444</mn>
+ <mrow data-title="child of mtd, embellished, RTL, largeop variant">
+ <mo lspace="3em" rspace="4em" largeop="true">&#x2AFF;</mo>
+ </mrow>
+ <mn>55555</mn>
+ <mrow data-title="child of mtd, embellished, RTL, stretchy variant">
+ <mo lspace="5em" rspace="6em" stretchy="true" minsize="2em">&#x295C;</mo>
+ </mrow>
+ <mn>666666</mn>
+ <mrow data-title="child of mtd, embellished, RTL, glyph assembly">
+ <mo lspace="7em" rspace="8em" stretchy="true" minsize="10em">&#x295C;</mo>
+ </mrow>
+ <mn>7777777</mn>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+</div>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-minsize-maxsize-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-minsize-maxsize-001.html
new file mode 100644
index 00000000000..4010deabb85
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-minsize-maxsize-001.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Edge cases for minsize and maxsize</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<meta name="assert" content="Verify edge cases for minsize and maxsize .">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math {
+ font: 25px/1 Ahem;
+ }
+ @font-face {
+ font-family: operators;
+ src: url("../../../fonts/math/operators.woff"); /* AxisHeight == 0 */
+ }
+ mo {
+ font-family: operators;
+ }
+ @font-face {
+ font-family: stretchy;
+ src: url("../../../fonts/math/stretchy.woff");
+ }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+ test(function() {
+ assert_approx_equals(document.getElementById("negative_minsize").getBoundingClientRect().height, 5 * emToPx, epsilon);
+ }, `minsize < 0 is treated as 0`);
+
+ test(function() {
+ assert_approx_equals(document.getElementById("maxsize_less_than_minsize").getBoundingClientRect().height, 7 * emToPx, epsilon);
+ }, `maxsize < minsize is treated as maxsize = minsize`);
+
+ test(function() {
+ assert_less_than(document.getElementById("minsize_less_than_negative_maxsize").getBoundingClientRect().height, 2 * emToPx);
+ }, `minsize < maxsize < 0 is treated as maxsize = minsize = 0`);
+
+ test(function() {
+ assert_approx_equals(document.getElementById("zero_target_size_with_minsize").getBoundingClientRect().height, 2 * emToPx, epsilon);
+ assert_approx_equals(document.getElementById("zero_target_size_with_minsize").getBoundingClientRect().bottom - document.getElementById("zero_target_size_with_minsize_math_axis").getBoundingClientRect().bottom, emToPx, epsilon);
+ }, `target size = 0 is treated as Tascent = Tdescent = minsize/2`);
+
+ test(function() {
+ assert_approx_equals(document.getElementById("percent_minsize").getBoundingClientRect().height, 12 * emToPx, epsilon, "percent minsize");
+ assert_approx_equals(document.getElementById("percent_maxsize").getBoundingClientRect().height, 3 * emToPx, epsilon, "percent maxsize");
+ }, `minsize/maxsize percentages are relative to the unstretched size`);
+
+ test(function() {
+ // - The unstretched size is a lower bound for the stretched size, so
+ // specifying a lower minsize has no effect. This test only verifies
+ // that the default minsize is at most 100% the unstretched size.
+ const unstretched_size = 1 * emToPx;
+ assert_approx_equals(document.getElementById("default_minsize").getBoundingClientRect().height, unstretched_size, epsilon, "default minsize is 100%");
+
+ // Previous version of MathML Core were defining minsize as 1em rather
+ // than 100% the unstretched size. So try the same test with a .5em
+ // unstretched size.
+ const unstretched_size_2 = .5 * emToPx;
+ assert_approx_equals(document.getElementById("default_minsize_2").getBoundingClientRect().height, unstretched_size_2, epsilon, "default minsize is not 1em");
+
+ // - The target size is an upper bound for the stretched size, so
+ // specifying a larger maxsize has no effect. This test only
+ // verifies that the default maxsize is at least 300 times the
+ // unstretched size.
+ assert_approx_equals(document.getElementById("default_maxsize").getBoundingClientRect().height, 300 * emToPx, epsilon, "default maxsize is infinity");
+ }, `default minsize/maxsize values`);
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height="5em" style="background: blue"/>
+ <mo id="negative_minsize" minsize="-10em" stretchy="true" symmetric="false">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height="5em" style="background: blue"/>
+ <mo id="maxsize_less_than_minsize" minsize="7em" maxsize="2em" stretchy="true" symmetric="false">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height="5em" style="background: blue"/>
+ <mo id="minsize_less_than_negative_maxsize" minsize="-2em" maxsize="-1em" stretchy="true" symmetric="false">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace id="zero_target_size_with_minsize_math_axis" width="1em" height="0em" style="background: blue"/>
+ <mo id="zero_target_size_with_minsize" minsize="2em" stretchy="true" symmetric="true">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height="6em" style="background: blue"/>
+ <mo id="percent_minsize" minsize="1200%" stretchy="true" symmetric="false">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height="6em" style="background: blue"/>
+ <mo id="percent_maxsize" maxsize="300%" stretchy="true" symmetric="false">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height=".5em" style="background: blue"/>
+ <mo id="default_minsize" stretchy="true" symmetric="false">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height=".25em" style="background: blue"/>
+ <mo style="font-family: stretchy" id="default_minsize_2" stretchy="true" symmetric="false">↨</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mspace width="1em" height="300em" style="background: blue"/>
+ <mo id="default_maxsize" stretchy="true" symmetric="false">β₯―</mo>
+ <mpadded height="0" depth="0"><mn><!-- not space like --></mn></mpadded>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-no-vertical-adjustment-for-basic-binary-operators.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-no-vertical-adjustment-for-basic-binary-operators.html
new file mode 100644
index 00000000000..4a146b2661e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/mo-no-vertical-adjustment-for-basic-binary-operators.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>No vertical adjustment for basic binary operators</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1890531" />
+<meta name="assert" content="Verify vertical alignement of basic binary operators is not adjusted to align their centers with the math axis.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ @font-face {
+ font-family: operators;
+ /* AxisHeight == 0, so the math axis matches the baseline */
+ src: url("../../../fonts/math/operators.woff");
+ }
+ math {
+ font: 25px operators;
+ }
+</style>
+<math>
+ <mn id="ref">β†―</mn>
+ <mo>+</mo><mo>=</mo><mo>*</mo><mo>βˆ’</mo><mo>≀</mo><mo>β‰₯</mo><mo>Γ—</mo>
+</math>
+<script>
+ promise_test(async () => {
+ await new Promise(r => { window.addEventListener("DOMContentLoaded", r) });
+ await loadAllFonts();
+ function centerOf(element) {
+ const box = element.getBoundingClientRect();
+ return (box.top + box.bottom) / 2;
+ }
+ const ref = centerOf(document.getElementById("ref"));
+ const epsilon = 1;
+ Array.from(document.getElementsByTagName("mo")).forEach(mo => {
+ assert_approx_equals(centerOf(mo), ref, epsilon,
+ `Position of "${mo.textContent}"`);
+ });
+ }, "Vertical alignment of basic binary operators is not adjusted.");
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining-default.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining-default.html
new file mode 100644
index 00000000000..3a5f86e9f2e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining-default.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary (combining char, default category)</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<meta name="assert" content="Operators with unsupported combining characters or three or more characters fall back to Default category (lspace=rspace=0.2777777777777778em)">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<style>
+ mo {
+ color: blue;
+ }
+ mn {
+ background: black;
+ }
+</style>
+<script>
+ function spaceBetween(element, i, j) {
+ return element.children[j].getBoundingClientRect().left -
+ element.children[i].getBoundingClientRect().right;
+ }
+ window.addEventListener("load", () => {
+ var epsilon = 1;
+ // Default category spacing per https://w3c.github.io/mathml-core/#operator-dictionary-categories-values
+ var defaultSpaceEm = 0.2777777777777778;
+
+ Array.from(document.getElementsByClassName("test-group")).forEach(group => {
+ var ref = group.getElementsByClassName("reference")[0];
+ var def = group.getElementsByClassName("default")[0];
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var fontSize = parseFloat(getComputedStyle(def).fontSize);
+ var expected = 2 * defaultSpaceEm * fontSize;
+ var actual = spaceBetween(def, 0, 2) - spaceBetween(ref, 0, 2);
+ assert_approx_equals(actual, expected, epsilon, "lspace + rspace");
+ }, `Default spacing for ${group.dataset.description}`);
+ });
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <!-- U+0303 COMBINING TILDE is not a recognized combining overlay -->
+ <div class="test-group" data-description="= + unsupported combining char U+0303">
+ <p>
+ <math class="reference">
+ <mn>&nbsp;</mn>
+ <mo lspace="0" rspace="0">=&#x303;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="default">
+ <mn>&nbsp;</mn>
+ <mo>=&#x303;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ </div>
+ <!-- Three characters: base + two combining overlays -->
+ <div class="test-group" data-description="= + U+0338 + U+20D2 (too many characters)">
+ <p>
+ <math class="reference">
+ <mn>&nbsp;</mn>
+ <mo lspace="0" rspace="0">=&#x338;&#x20D2;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="default">
+ <mn>&nbsp;</mn>
+ <mo>=&#x338;&#x20D2;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining.html
new file mode 100644
index 00000000000..e9be8b2decb
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-combining.html
@@ -0,0 +1,159 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary (combining char)</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<meta name="assert" content="Verify special handling of 2-char operator with a combining character">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<style>
+ mo {
+ color: blue;
+ }
+ mn {
+ background: black;
+ }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function spaceBetween(element, i, j) {
+ return element.children[j].getBoundingClientRect().left -
+ element.children[i].getBoundingClientRect().right;
+ }
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ [
+ "equal",
+ "vertical_bar",
+ "left_normal_factor_semidirect_product",
+ "there_exists",
+ ].forEach(id => {
+ var div = document.getElementById(id);
+ var ref = div.getElementsByClassName("reference")[0];
+ var totalSpaceRef = spaceBetween(ref, 0, 2);
+ var lspaceRef = spaceBetween(ref, 0, 1);
+ var rspaceRef = spaceBetween(ref, 1, 2);
+ Array.from(div.getElementsByClassName("combining")).forEach(element => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ var totalSpace = spaceBetween(element, 0, 2);
+ var lspace = spaceBetween(element, 0, 1);
+ var rspace = spaceBetween(element, 1, 2);
+ assert_approx_equals(totalSpace, totalSpaceRef, epsilon);
+ assert_approx_equals(rspace, rspaceRef, epsilon);
+ assert_approx_equals(lspace, lspaceRef, epsilon);
+ }, `Spacing around ${element.children[1].textContent}`);
+ });
+ });
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <div id="equal">
+ <p>
+ <math class="reference">
+ <mn>&nbsp;</mn>
+ <mo>=</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo>=&#x338;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo>=&#x20D2;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ </div>
+ <div id="vertical_bar">
+ <p>
+ <math class="reference">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">|</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">|&#x338;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">|&#x20D2;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ </div>
+ <div id="left_normal_factor_semidirect_product">
+ <p>
+ <math class="reference">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">⋉</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">⋉&#x338;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">⋉&#x20D2;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ </div>
+ <div id="there_exists">
+ <p>
+ <math class="reference">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">βˆƒ</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">βˆƒ&#x338;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ <p>
+ <math class="combining">
+ <mn>&nbsp;</mn>
+ <mo stretchy="false">βˆƒ&#x20D2;</mo>
+ <mn>&nbsp;</mn>
+ </math>
+ </p>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-001.html
new file mode 100644
index 00000000000..237c3837d50
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-001.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "largeop", 0);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-002.html
new file mode 100644
index 00000000000..6cc3dcead9a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-002.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "largeop", 1);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-003.html
new file mode 100644
index 00000000000..a8b9b69a1b9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-003.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "largeop", 2);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-004.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-004.html
new file mode 100644
index 00000000000..850e3acad81
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-004.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "largeop", 3);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-005.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-005.html
new file mode 100644
index 00000000000..475d8a0dea8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-005.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "largeop", 4);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-006.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-006.html
new file mode 100644
index 00000000000..411b5230ec9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-largeop-006.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "largeop", 5);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-001.html
new file mode 100644
index 00000000000..335ba43608d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-001.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "movablelimits", 0);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-002.html
new file mode 100644
index 00000000000..9bc3e8c1caf
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-002.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "movablelimits", 1);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-003.html
new file mode 100644
index 00000000000..3cd45753c66
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-003.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "movablelimits", 2);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-004.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-004.html
new file mode 100644
index 00000000000..68a967061a2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-004.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "movablelimits", 3);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-005.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-005.html
new file mode 100644
index 00000000000..f69ec85acb6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-005.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "movablelimits", 4);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-006.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-006.html
new file mode 100644
index 00000000000..459411621ad
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-movablelimits-006.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "movablelimits", 5);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-multi-char.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-multi-char.html
new file mode 100644
index 00000000000..f6f9a3347aa
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-multi-char.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary: multi-character operators</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dfn-algorithm-to-determine-the-category-of-an-operator">
+<meta name="assert" content="Verify that multi-character operator entries (e.g. '&&', '!=', '->') resolve to their operator-dictionary spacing rather than the default 5/18em.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css"/>
+<style>
+ math { font: 32px/1 Ahem; }
+</style>
+</head>
+<body>
+<div id="log"></div>
+<div id="container"></div>
+<script>
+"use strict";
+
+// Multi-character entries from the MathML Core operator dictionary. The main
+// single-codepoint dictionary does not cover these, so an implementation must
+// perform a string-keyed lookup for the listed (operator, form) pairs.
+// lspace and rspace are in math units (1 unit = 1/18em).
+const MULTI_CHAR_OPERATORS = [
+ { op: "!!", form: "postfix", lspace: 0, rspace: 0 },
+ { op: "!=", form: "infix", lspace: 5, rspace: 5 },
+ { op: "&&", form: "infix", lspace: 4, rspace: 4 },
+ { op: "**", form: "infix", lspace: 3, rspace: 3 },
+ { op: "*=", form: "infix", lspace: 5, rspace: 5 },
+ { op: "++", form: "postfix", lspace: 0, rspace: 0 },
+ { op: "+=", form: "infix", lspace: 5, rspace: 5 },
+ { op: "--", form: "postfix", lspace: 0, rspace: 0 },
+ { op: "-=", form: "infix", lspace: 5, rspace: 5 },
+ { op: "->", form: "infix", lspace: 5, rspace: 5 },
+ { op: "//", form: "infix", lspace: 5, rspace: 5 },
+ { op: "/=", form: "infix", lspace: 5, rspace: 5 },
+ { op: ":=", form: "infix", lspace: 5, rspace: 5 },
+ { op: "<=", form: "infix", lspace: 5, rspace: 5 },
+ { op: "<>", form: "infix", lspace: 3, rspace: 3 },
+ { op: "==", form: "infix", lspace: 5, rspace: 5 },
+ { op: ">=", form: "infix", lspace: 5, rspace: 5 },
+ { op: "||", form: "infix", lspace: 5, rspace: 5 },
+ { op: "||", form: "postfix", lspace: 0, rspace: 0 },
+ { op: "||", form: "prefix", lspace: 0, rspace: 0 },
+];
+
+// Per MathML Core layout, the <mo> element's rendered box width is
+// lspace + glyph_width + rspace, so measuring the <mo> width directly exposes
+// the applied spacing. The gap between sibling bounding rects is 0 regardless
+// of lspace/rspace because the spacing is internal to the <mo>'s box.
+function moWidth(markup) {
+ const container = document.getElementById("container");
+ container.innerHTML = markup;
+ const width = container.querySelector("mo").getBoundingClientRect().width;
+ container.innerHTML = "";
+ return width;
+}
+
+setup({ explicit_done: true });
+
+window.addEventListener("load", () => loadAllFonts().then(runTests));
+
+async function runTests() {
+ const hasOperatorSpacing = await MathMLFeatureDetection.has_operator_spacing();
+ const epsilon = 1;
+ const escape = s => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
+ const toEm = units => (units / 18).toFixed(16) + "em";
+
+ for (const { op, form, lspace, rspace } of MULTI_CHAR_OPERATORS) {
+ test(() => {
+ assert_true(hasOperatorSpacing, "Operator spacing is supported");
+
+ const actual = moWidth(
+ `<math><mrow><mn>1</mn>` +
+ `<mo form="${form}">${escape(op)}</mo>` +
+ `<mn>2</mn></mrow></math>`);
+ const reference = moWidth(
+ `<math><mrow><mn>1</mn>` +
+ `<mo form="${form}" lspace="${toEm(lspace)}" rspace="${toEm(rspace)}">` +
+ `${escape(op)}</mo>` +
+ `<mn>2</mn></mrow></math>`);
+
+ assert_approx_equals(actual, reference, epsilon,
+ `<mo form="${form}">${op}</mo> should apply dictionary spacing lspace=${lspace}/18em, rspace=${rspace}/18em`);
+ }, `Operator dictionary spacing for "${op}" (${form})`);
+ }
+
+ done();
+}
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-001.html
new file mode 100644
index 00000000000..684f2cde7d7
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-001.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "lspace/rspace", 0);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-002.html
new file mode 100644
index 00000000000..d682239f127
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-002.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "lspace/rspace", 1);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-003.html
new file mode 100644
index 00000000000..fd1d6e54573
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-003.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "lspace/rspace", 2);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-004.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-004.html
new file mode 100644
index 00000000000..a7c6bc4392b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-004.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "lspace/rspace", 3);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-005.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-005.html
new file mode 100644
index 00000000000..bcef1c557f8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-005.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "lspace/rspace", 4);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-006.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-006.html
new file mode 100644
index 00000000000..b13801314d3
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-spacing-006.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "lspace/rspace", 5);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-001.html
new file mode 100644
index 00000000000..0bc8d9b7738
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-001.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "symmetric", 0);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-002.html
new file mode 100644
index 00000000000..2608cdf4004
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-002.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "symmetric", 1);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-003.html
new file mode 100644
index 00000000000..6646b7fdadb
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-003.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "symmetric", 2);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-004.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-004.html
new file mode 100644
index 00000000000..b525a2846a3
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-004.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "symmetric", 3);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-005.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-005.html
new file mode 100644
index 00000000000..103840765f2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-005.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "symmetric", 4);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-006.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-006.html
new file mode 100644
index 00000000000..317d6aaf650
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/operator-dictionary-symmetric-006.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Operator dictionary</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dictionary-based-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-dictionary">
+<link rel="help" href="https://w3c.github.io/mathml-core/#stretchy-operator-axis">
+<meta name="assert" content="Verify default properties for characters that are in the operator dictionary, as well as for U+00A0 NO-BREAK SPACE">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/feature-detection-operators.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/operator-dictionary.js"></script>
+<script src="./support/operator-dictionary-tests.js"></script>
+<link rel="stylesheet" href="./support/operator-dictionary-tests.css"/>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ async function runTests() {
+ let json = await fetchOperatorDictionary();
+ await OperatorDictionaryTests.run(json, "symmetric", 5);
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/support/operator-dictionary-tests.css b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/support/operator-dictionary-tests.css
new file mode 100644
index 00000000000..4f80ad7f8dd
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/support/operator-dictionary-tests.css
@@ -0,0 +1,10 @@
+@font-face {
+ font-family: operators;
+ src: url("/fonts/math/operators.woff");
+}
+math, math * {
+ font-family: operators;
+ /* Use large enough font-size so that 1/18em = 2.77px > epsilon and
+ one can really distinguish lspace/rspace values. */
+ font-size: 50px;
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/support/operator-dictionary-tests.js b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/support/operator-dictionary-tests.js
new file mode 100644
index 00000000000..35efc2ecb94
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/support/operator-dictionary-tests.js
@@ -0,0 +1,226 @@
+var OperatorDictionaryTests = {
+ "lspace/rspace": function(json, key) {
+ let parsedKey = splitKey(key);
+ let entry = json.dictionary[key];
+ let epsilon = 1;
+
+ document.body.insertAdjacentHTML("beforeend", `<div>\
+lspace/rspace for "${parsedKey.characters}" (${parsedKey.form}): \
+<math>\
+ <mrow>\
+ <mn>&nbsp;</mn>\
+ <mo form="${parsedKey.form}">${parsedKey.characters}</mo>\
+ <mn>&nbsp;</mn>\
+ </mrow>\
+</math>\
+ VS \
+<math>\
+ <mrow>\
+ <mn>&nbsp;</mn>\
+ <mo form="${parsedKey.form}" lspace="${defaultPropertyValue(entry, 'lspace')}" rspace="${defaultPropertyValue(entry, 'rspace')}">${parsedKey.characters}</mo>\
+ <mn>&nbsp;</mn>\
+ </mrow>\
+</math>\
+</div>`);
+ var div = document.body.lastElementChild;
+ var mrows = div.getElementsByTagName("mrow");
+ function spaceBetween(element, i, j) {
+ return element.children[j].getBoundingClientRect().left -
+ element.children[i].getBoundingClientRect().right;
+ }
+ var lspace = spaceBetween(mrows[0], 0, 1);
+ var rspace = spaceBetween(mrows[0], 1, 2);
+ var lspaceRef = spaceBetween(mrows[1], 0, 1);
+ var rspaceRef = spaceBetween(mrows[1], 1, 2);
+ assert_approx_equals(lspace, lspaceRef, epsilon, `lspace (${key})`);
+ assert_approx_equals(rspace, rspaceRef, epsilon, `rspace (${key})`);
+ div.style.display = "none";
+ },
+
+ "movablelimits": function(json, key) {
+ let parsedKey = splitKey(key);
+ let entry = json.dictionary[key];
+ let epsilon = 1;
+
+ var defaultValue = defaultPropertyValue(entry, "movablelimits");
+ document.body.insertAdjacentHTML("beforeend", `<div>\
+movablelimits for "${parsedKey.characters}" (${parsedKey.form}): \
+<math>\
+ <munder>\
+ <mo stretchy="false" form="${parsedKey.form}">${parsedKey.characters}</mo>\
+ <mn>&nbsp;</mn>\
+ </munder>\
+</math>\
+ VS \
+<math>\
+ <munder>\
+ <mo stretchy="false" form="${parsedKey.form}" movablelimits="${defaultValue}">${parsedKey.characters}</mo>\
+ <mn>&nbsp;</mn>\
+ </munder>\
+</math>\
+</div>`);
+ var div = document.body.lastElementChild;
+ var munders = div.getElementsByTagName("munder");
+ munder = munders[0].getBoundingClientRect()
+ munderRef = munders[1].getBoundingClientRect()
+ assert_approx_equals(munder.height, munderRef.height, epsilon, `Movablelimits property for ${key} should be '${defaultValue}'`);
+ div.style.display = "none";
+ },
+
+ "largeop": function(json, key) {
+ let parsedKey = splitKey(key);
+ let entry = json.dictionary[key];
+ let epsilon = 1;
+
+ var defaultValue = defaultPropertyValue(entry, "largeop");
+ document.body.insertAdjacentHTML("beforeend", `<div>\
+largeop for "${parsedKey.characters}" (${parsedKey.form}): \
+<math displaystyle="true">\
+ <mo form="${parsedKey.form}">${parsedKey.characters}</mo>\
+</math>\
+ VS \
+<math displaystyle="true">\
+ <mo form="${parsedKey.form}" largeop="${defaultValue}">${parsedKey.characters}</mo>\
+</math>\
+</div>`);
+ var div = document.body.lastElementChild;
+ var mos = div.getElementsByTagName("mo");
+ mo = mos[0].getBoundingClientRect()
+ moRef = mos[1].getBoundingClientRect()
+ assert_approx_equals(mo.height, moRef.height, epsilon, `Largeop property for ${key} should be '${defaultValue}'`);
+ div.style.display = "none";
+ },
+
+ "stretchy": function(json, key) {
+ let parsedKey = splitKey(key);
+ let entry = json.dictionary[key];
+ let epsilon = 1;
+
+ if (entry.horizontal) {
+ // FIXME: Should really do a MathMLFeatureDetection to verify
+ // support for *horizontal* stretching.
+ var defaultValue = defaultPropertyValue(entry, "stretchy");
+ document.body.insertAdjacentHTML("beforeend", `<div>\
+stretchy for "${parsedKey.characters}" (${parsedKey.form}): \
+<math>\
+ <munder>\
+ <mn>&nbsp;&nbsp;</mn>\
+ <mo form="${parsedKey.form}">${parsedKey.characters}</mo>\
+ </munder>\
+</math>\
+ VS \
+<math>\
+ <munder>\
+ <mn>&nbsp;&nbsp;</mn>\
+ <mo form="${parsedKey.form}" stretchy="${defaultValue}">${parsedKey.characters}</mo>\
+ </munder>\
+</math>\
+</div>`);
+ var div = document.body.lastElementChild;
+ var mos = div.getElementsByTagName("mo");
+ mo = mos[0].getBoundingClientRect()
+ moRef = mos[1].getBoundingClientRect()
+ assert_approx_equals(mo.width, moRef.width, epsilon, `Stretchy property for ${key} should be '${defaultValue}'`);
+ div.style.display = "none";
+ } else {
+ var defaultValue = defaultPropertyValue(entry, "stretchy");
+ document.body.insertAdjacentHTML("beforeend", `<div>\
+stretchy for "${parsedKey.characters}" (${parsedKey.form}): \
+<math>\
+ <mrow>\
+ <mo form="${parsedKey.form}" symmetric="false">${parsedKey.characters}</mo>\
+ <mspace height="2em"></mspace>\
+ </mrow>\
+</math>\
+ VS \
+<math>\
+ <mrow>\
+ <mo form="${parsedKey.form}" symmetric="false" stretchy="${defaultValue}">${parsedKey.characters}</mo>\
+ <mspace height="2em"></mspace>\
+ </mrow>\
+</math>\
+</div>`);
+ var div = document.body.lastElementChild;
+ var mos = div.getElementsByTagName("mo");
+ mo = mos[0].getBoundingClientRect()
+ moRef = mos[1].getBoundingClientRect()
+ assert_approx_equals(mo.height, moRef.height, epsilon, `Stretchy property for ${key} should be '${defaultValue}'`);
+ div.style.display = "none";
+ }
+ },
+
+ "symmetric": function(json, key) {
+ let parsedKey = splitKey(key);
+ let entry = json.dictionary[key];
+ let epsilon = 1;
+
+ var defaultValue = defaultPropertyValue(entry, "symmetric");
+ document.body.insertAdjacentHTML("beforeend", `<div>\
+symmetric for "${parsedKey.characters}" (${parsedKey.form}): \
+<math>\
+ <mrow>\
+ <mo form="${parsedKey.form}" stretchy="true">${parsedKey.characters}</mo>\
+ <mspace height="1.5em"></mspace>\
+ </mrow>\
+</math>\
+ VS \
+<math>\
+ <mrow>\
+ <mo form="${parsedKey.form}" stretchy="true" symmetric="${defaultValue}">${parsedKey.characters}</mo>\
+ <mspace height="1.5em"></mspace>\
+ </mrow>\
+</math>\
+</div>`);
+ var div = document.body.lastElementChild;
+ var mos = div.getElementsByTagName("mo");
+ mo = mos[0].getBoundingClientRect()
+ moRef = mos[1].getBoundingClientRect()
+ assert_approx_equals(mo.height, moRef.height, epsilon, `Symmetric property for ${key} should be '${defaultValue}'`);
+ div.style.display = "none";
+ },
+
+ run: async function(json, name, fileIndex) {
+ let has_required_feature_for_testing =
+ await MathMLFeatureDetection[`has_operator_${name}`]();
+
+ // The operator dictionary has more than one thousand of entries so the
+ // tests are grouped in chunks so that these don't get much more
+ // importance than other MathML tests. For easy debugging, one can set the
+ // chunk size to 1. Also, note that the test div will remain visible for
+ // failed tests.
+ const entryPerChunk = 50
+ const filesPerProperty = 6
+
+ var counter = 0;
+ var test;
+
+ for (key in json.dictionary) {
+
+ // Skip this key if it does not belong to that test file.
+ if (counter % filesPerProperty != fileIndex) {
+ counter++;
+ continue;
+ }
+
+ var counterInFile = (counter - fileIndex) / filesPerProperty;
+ if (counterInFile % entryPerChunk === 0) {
+ // Start of a new chunk.
+ // Complete current async tests and create new ones for the next chunk.
+ if (test) test.done();
+ test = async_test(`Operator dictionary chunk ${1 + counterInFile / entryPerChunk} - ${name}`);
+
+ test.step(function() {
+ assert_true(has_required_feature_for_testing, `${name} is supported`);
+ });
+ }
+ test.step(function() {
+ OperatorDictionaryTests[name](json, key);
+ });
+
+ counter++;
+ }
+
+ // Complete current async test.
+ if (test) test.done();
+ }
+};
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/symmetric-largeop.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/symmetric-largeop.html
new file mode 100644
index 00000000000..14949f0744c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/operators/symmetric-largeop.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test placement of non-stretchy symmetric/non-symmetric largeops with a block-direction intrinsic stretch axis</title>
+<link rel="help" href="https://issues.chromium.org/issues/40889877">
+<link rel="help" href="https://github.com/w3c/mathml-core/issues/250">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+@font-face {
+ font-family: TestFont;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight3000-2AFF-axisheight1000.woff");
+}
+math {
+ font-family: TestFont;
+ font-size: 30px;
+ margin-bottom: 15px; /* to distinguish the tests visually */
+}
+mspace {
+ background-color: green;
+}
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ // U+2AFF has intrinsic block stretch axis and the symmetric, largeop and movablelimits properties.
+ //
+ // We compare the operator top to the mspace bottom (which will always be the alphabetic baseline).
+ //
+ // The operator should center around the math axis for symmetric largeops.
+ // The ascent of the largeop is:
+ // largeop height / 2 (= 1.5em)
+ // + AxisHeight (= 1em)
+ // = 2.5em (75px).
+ //
+ // The operator should place on the baseline for non-symmetric largeops,
+ // so the ascent of the largeop = 3em (90px).
+
+ function runTests() {
+ test(function() {
+ const container = document.getElementById("container");
+ [
+ [ 75, "symmetric largeop is centered around the math axis" ],
+ [ 90, "non-symmetric largeop is placed on the baseline" ],
+ ].forEach(([ spacing, desc ], i) => {
+ const mrow = container.children[i].firstElementChild;
+ let opBbox = mrow.firstElementChild.getBoundingClientRect();
+ let spaceBbox = mrow.lastElementChild.getBoundingClientRect();
+ assert_equals(spaceBbox.bottom - opBbox.top, spacing, desc);
+ })
+ }, "Placement of operators");
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="container">
+ <math display="block">
+ <mrow>
+ <mo symmetric="true" largeop="true">&#x2AFF;</mo>
+ <mspace height="1em" width="1em"></mspace>
+ </mrow>
+ </math>
+ <math display="block">
+ <mrow>
+ <mo symmetric="false" largeop="true">&#x2AFF;</mo>
+ <mspace height="1em" width="1em"></mspace>
+ </mrow>
+ </math>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/glyph-level-mirroring.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/glyph-level-mirroring.html
new file mode 100644
index 00000000000..cc1538de40c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/glyph-level-mirroring.html
@@ -0,0 +1,139 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>Glyph-level mirroring</title>
+ <link
+ rel="help"
+ href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot"
+ >
+ <meta
+ name="assert"
+ content="Radicals should be mirrored when using RTL text direction"
+ >
+ <script src="../../../resources/testharness.js"></script>
+ <script src="../../../resources/testharnessreport.js"></script>
+ <script src="../../../mathml/support/feature-detection.js"></script>
+ <script src="../../../mathml/support/fonts.js"></script>
+
+ <style>
+ /* This font contains the 0x221A character (radical), and a mirrored
+ version using the rtlm font feature (radical.rtlm). The base,
+ variant and assembly widths of the original character are 4em,
+ while the ones from the rtlm version are 1em. */
+ @font-face {
+ font-family: rtlm;
+ src: url("../../../fonts/math/radical-rtlm.woff");
+ }
+ math {
+ font-family: rtlm;
+ font-size: 16px;
+ }
+ mspace {
+ width: 1em;
+ background: cornflowerblue;
+ }
+ </style>
+
+ <script>
+ const epsilon = 1;
+ const font_size = 16;
+ const test_cases = [
+ "Base glyph",
+ "Size variant",
+ "Glyph assembly",
+ ];
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => {
+ loadAllFonts().then(runTests);
+ });
+
+ function runTests() {
+ test(function () {
+ document.querySelectorAll("math:not([dir='rtl'])").forEach(
+ (math, i) => {
+ msqrt = math.firstElementChild;
+ box = msqrt.getBoundingClientRect();
+ // The box size should be the width of the mspace (1em)
+ // plus the expected glyph width (4em in this case).
+ mspace_width =
+ msqrt.firstElementChild.getBoundingClientRect().width;
+ const glyph_width = 4 * font_size;
+ assert_approx_equals(
+ box.width,
+ glyph_width + mspace_width,
+ epsilon,
+ test_cases[i],
+ );
+ },
+ );
+ }, "LTR Direction");
+
+ test(function () {
+ document.querySelectorAll("math[dir='rtl']").forEach(
+ (math, i) => {
+ msqrt = math.firstElementChild;
+ box = msqrt.getBoundingClientRect();
+ // In this case the expected glyph width is 1em, as it
+ // should be using the rtlm version.
+ mspace_width =
+ msqrt.firstElementChild.getBoundingClientRect().width;
+ const glyph_width = 1 * font_size;
+ assert_approx_equals(
+ box.width,
+ glyph_width + mspace_width,
+ epsilon,
+ test_cases[i],
+ );
+ },
+ );
+ }, "RTL Direction");
+
+ done();
+ }
+ </script>
+ </head>
+
+ <body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <msqrt>
+ <mspace height="0.5em" />
+ </msqrt>
+ </math>
+ <math dir="rtl">
+ <msqrt>
+ <mspace height="0.5em" />
+ </msqrt>
+ </math>
+ </p>
+ <hr />
+ <p>
+ <math>
+ <msqrt>
+ <mspace height="1em" />
+ </msqrt>
+ </math>
+ <math dir="rtl">
+ <msqrt>
+ <mspace height="1em" />
+ </msqrt>
+ </math>
+ </p>
+ <hr />
+ <p>
+ <math>
+ <msqrt>
+ <mspace height="4em" />
+ </msqrt>
+ </math>
+ <math dir="rtl">
+ <msqrt>
+ <mspace height="4em" />
+ </msqrt>
+ </math>
+ </p>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/root-parameters-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/root-parameters-1.html
new file mode 100644
index 00000000000..32f4fda793a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/root-parameters-1.html
@@ -0,0 +1,222 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Radical parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
+<meta name="assert" content="Elements msqrt and mroot correctly use the radical parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: degreebottomraisepercent25-rulethickness1000;
+ src: url("../../../fonts/math/radical-degreebottomraisepercent25-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: displaystyleverticalgap7000-rulethickness1000;
+ src: url("../../../fonts/math/radical-displaystyleverticalgap7000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: extraascender3000-rulethickness1000;
+ src: url("../../../fonts/math/radical-extraascender3000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: kernafterdegreeminus5000-rulethickness1000;
+ src: url("../../../fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: kernbeforedegree4000-rulethickness1000;
+ src: url("../../../fonts/math/radical-kernbeforedegree4000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: verticalgap6000-rulethickness1000;
+ src: url("../../../fonts/math/radical-verticalgap6000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: rulethickness8000;
+ src: url("../../../fonts/math/radical-rulethickness8000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 25;
+ var v2 = 1000 * emToPx;
+ var radicalHeight = getBox("base001").height + v2;
+ assert_approx_equals(getBox("ref001").top - getBox("index001").bottom,
+ v1 * radicalHeight / 100, epsilon,
+ "mroot: vertical position of index");
+ }, "RadicalDegreeBottomRaisePercent");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 7000 * emToPx;
+ var v2 = 1000 * emToPx;
+ assert_approx_equals(getBox("base0021").top - getBox("radical0021").top,
+ v1 + v2, epsilon,
+ "msqrt: vertical gap");
+ assert_approx_equals(getBox("base0022").top - getBox("radical0022").top,
+ v1 + v2, epsilon,
+ "mroot: vertical gap");
+ }, "RadicalDisplayStyleVerticalGap");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 3000 * emToPx;
+ var v2 = 1000 * emToPx;
+ assert_approx_equals(getBox("base0031").top - getBox("radical0031").top,
+ v1 + v2, epsilon,
+ "msqrt: vertical gap");
+ assert_approx_equals(getBox("base0032").top - getBox("radical0032").top,
+ v1 + v2, epsilon,
+ "mroot: vertical gap");
+ }, "RadicalExtraAscender");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ // Note: the size variants of U+221A in this font have width 1000.
+ var v1 = 5000 * emToPx;
+ var radicalSymbolWidth = 1000 * emToPx;
+ var radicalLeft = getBox("base004").left - radicalSymbolWidth;
+ assert_approx_equals(getBox("index004").right - radicalLeft,
+ v1, epsilon,
+ "mroot: kern after degree");
+ }, "RadicalKernAfterDegree");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 4000 * emToPx;
+ assert_approx_equals(getBox("index005").left - getBox("radical005").left,
+ v1, epsilon,
+ "mroot: kern before degree");
+ }, "RadicalKernBeforeDegree");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 8000 * emToPx;
+ assert_approx_equals(getBox("base0061").top - getBox("radical0061").top,
+ v, epsilon,
+ "msqrt: vertical gap");
+ assert_approx_equals(getBox("base0062").top - getBox("radical0062").top,
+ v, epsilon,
+ "msqrt: vertical gap");
+ }, "RadicalRuleThickness");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 6000 * emToPx;
+ var v2 = 1000 * emToPx;
+ assert_approx_equals(getBox("base0071").top - getBox("radical0071").top,
+ v1 + v2, epsilon,
+ "msqrt: vertical gap");
+ assert_approx_equals(getBox("base0072").top - getBox("radical0072").top,
+ v1 + v2, epsilon,
+ "msqrt: vertical gap");
+ }, "RadicalVerticalGap");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: degreebottomraisepercent25-rulethickness1000;">
+ <mspace id="ref001" width="3em" depth="1em" style="background: green"/>
+ <mroot>
+ <mspace id="base001" width="3em" height="10em" style="background: green"/>
+ <mspace id="index001" width="3em" height="1em" style="background: blue"/>
+ </mroot>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math display="block"
+ style="font-family: displaystyleverticalgap7000-rulethickness1000;">
+ <msqrt style="background: green" id="radical0021">
+ <mspace id="base0021" width="3em" height="1em" style="background: blue"/>
+ </msqrt>
+ <mroot style="background: green" id="radical0022">
+ <mspace id="base0022" width="3em" height="1em" style="background: blue"/>
+ <mspace width="3em" height="1em" style="background: black"/>
+ </mroot>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: extraascender3000-rulethickness1000;">
+ <msqrt style="background: green" id="radical0031">
+ <mspace id="base0031" width="3em" height="1em" style="background: blue"/>
+ </msqrt>
+ <mroot style="background: green" id="radical0032">
+ <mspace id="base0032" width="3em" height="1em" style="background: blue"/>
+ <mspace width="3em" height="1em" style="background: black"/>
+ </mroot>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: kernafterdegreeminus5000-rulethickness1000;">
+ <mroot>
+ <mspace id="base004" width="3em" height="2em" style="background: blue"/>
+ <mspace id="index004" width="7em" height="1em" style="background: green"/>
+ </mroot>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: kernbeforedegree4000-rulethickness1000;">
+ <mroot id="radical005" style="background: blue">
+ <mspace width="3em" height="1em"/>
+ <mspace id="index005" width="3em" height="1em" style="background: green"/>
+ </mroot>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: rulethickness8000;">
+ <msqrt style="background: green" id="radical0061">
+ <mspace id="base0061" width="3em" height="1em" style="background: blue"/>
+ </msqrt>
+ <mroot style="background: green" id="radical0062">
+ <mspace id="base0062" width="3em" height="1em" style="background: blue"/>
+ <mspace width="3em" height="1em" style="background: black"/>
+ </mroot>
+ </math>
+ </p>
+ <p>
+ <math style="font-family: verticalgap6000-rulethickness1000;">
+ <msqrt style="background: green" id="radical0071">
+ <mspace id="base0071" width="3em" height="1em" style="background: blue"/>
+ </msqrt>
+ <mroot style="background: green" id="radical0072">
+ <mspace id="base0072" width="3em" height="1em" style="background: blue"/>
+ <mspace width="3em" height="1em" style="background: black"/>
+ </mroot>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/root-parameters-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/root-parameters-2.html
new file mode 100644
index 00000000000..738dacf5287
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/radicals/root-parameters-2.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Radical parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
+<meta name="assert" content="Test edge kerning values for radicals.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ @font-face {
+ font-family: radical-negativekernbeforedegree1000-rulethickness1000;
+ src: url("../../../fonts/math/radical-negativekernbeforedegree1000-rulethickness1000.woff");
+ }
+ @font-face {
+ font-family: radical-kernafterdegreeminus5000-rulethickness1000;
+ src: url("../../../fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff");
+ }
+ math, mspace {
+ font-size: 10px;
+ }
+ mspace {
+ opacity: .5;
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(getBox("index001").left - getBox("mroot001").left,
+ 0, epsilon, "should be clamped to 0");
+ }, "RadicalKernBeforeDegree = -1em < 0");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var radicalSymbolWidth = 1000 * emToPx;
+ var radicalLeft = getBox("base002").left - radicalSymbolWidth;
+ assert_approx_equals(getBox("index002").right - radicalLeft,
+ 30, epsilon, "should be clamped to 3em");
+ }, "RadicalKernBeforeAfterDegree = -5em < -3em = -degree's inline size");
+
+ done();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: radical-negativekernbeforedegree1000-rulethickness1000">
+ <mroot id="mroot001">
+ <mspace id="base001" height="6em" width="6em" style="background: blue"/>
+ <mspace id="index001" height="6em" width="6em" style="background: green"/>
+ </mroot>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: radical-kernafterdegreeminus5000-rulethickness1000">
+ <mroot id="mroot002">
+ <mspace id="base002" height="3em" width="3em" style="background: blue"/>
+ <mspace id="index002" height="3em" width="3em" style="background: green"/>
+ </mroot>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/cramped-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/cramped-001.html
new file mode 100644
index 00000000000..0b3e1f89b2a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/cramped-001.html
@@ -0,0 +1,627 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Cramped elements</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
+<link rel="help" href="https://w3c.github.io/mathml-core/#displaystyle-and-scriptlevel-in-scripts">
+<link rel="help" href="https://w3c.github.io/mathml-core/#user-agent-stylesheet">
+<meta name="assert" content="Verify default calculation of math-shift on MathML elements">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script src="../../../mathml/support/box-navigation.js"></script>
+<style>
+ math {
+ font-family: superscriptshiftupcramped5000;
+ }
+ math, math * {
+ font-size: 10px;
+ background: lightyellow;
+ }
+ @font-face {
+ font-family: superscriptshiftupcramped5000;
+ src: url("../../../fonts/math/scripts-superscriptshiftupcramped5000.woff");
+ }
+ .testedElement *:first-child {
+ background: lightblue;
+ }
+ .testedElement *:last-child {
+ background: pink;
+ }
+</style>
+<script>
+ function assert_cramped(id, expected, name) {
+ const emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ const superscriptshiftupcramped = 5000 * emToPx;
+ var container = document.getElementById(id);
+ var msup = container.getElementsByClassName("testedElement")[0];
+ var base = firstInFlowChild(msup);
+ var script = nextInFlowSibling(base);
+ var shift = base.getBoundingClientRect().bottom - script.getBoundingClientRect().bottom;
+ if (expected)
+ assert_greater_than(shift, superscriptshiftupcramped / 2, `${name || id} should be cramped`);
+ else
+ assert_less_than(shift, superscriptshiftupcramped / 2, `${name || id} should not be cramped`);
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("math-001", false);
+ assert_cramped("mrow-001", false, "mrow");
+ }, "child of non-cramped element");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("mrow-002", true);
+ }, "child of cramped element");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("msqrt-001", true);
+ }, "child of msqrt");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("mroot-001", true);
+ }, "child of mroot");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("mfrac-001", false, "numerator");
+ assert_cramped("mfrac-002", true, "denominator");
+ }, "child of mfrac");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("msub-001", false, "base");
+ assert_cramped("msub-002", true, "subscript");
+ }, "child of msub");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("msup-001", false, "base");
+ assert_cramped("msup-002", false, "superscript");
+ }, "child of msup");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("msubsup-001", false, "base");
+ assert_cramped("msubsup-002", true, "subscript");
+ assert_cramped("msubsup-003", false, "superscript");
+ }, "child of msubsup");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("munder-001", false, "base");
+ assert_cramped("munder-002", false, "underscript");
+ }, "child of munder");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("mover-001", false, "base");
+ assert_cramped("mover-002", false, "overscript");
+ }, "child of mover (non-accent overscript)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("munderover-001", false, "base");
+ assert_cramped("munderover-002", false, "underscript");
+ assert_cramped("munderover-003", false, "overscript");
+ }, "child of munderover (non-accent overscript)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("mover-003", true, "base");
+ assert_cramped("mover-004", false, "overscript");
+ }, "accent child of mover (accent overscript)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("munderover-004", true, "base");
+ assert_cramped("munderover-005", false, "underscript");
+ assert_cramped("munderover-006", false, "overscript");
+ }, "accent child of munderover (accent overscript)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("mmultiscripts-001", false, "base");
+ assert_cramped("mmultiscripts-002", true, "post-subscript");
+ assert_cramped("mmultiscripts-003", false, "post-superscript");
+ assert_cramped("mmultiscripts-004", true, "pre-subscript");
+ assert_cramped("mmultiscripts-005", false, "post-superscript");
+ }, "mmultiscripts");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_cramped("css-001", false);
+ assert_cramped("css-002", true);
+ assert_cramped("css-003", true);
+ assert_cramped("css-004", false);
+ }, "element with specified CSS math-shift");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math id="math-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </math>
+ <math>
+ <mrow id="mrow-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msqrt>
+ <!-- This is a child of a msqrt so it is cramped. As a consequence,
+ all its descendants are cramped too. -->
+ <munderover>
+ <mover>
+ <munder>
+ <msubsup>
+ <msup>
+ <msub>
+ <mfrac>
+ <mrow id="mrow-002">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </mrow>
+ <mspace/>
+ </mfrac>
+ <mspace/>
+ </msub>
+ <mspace/>
+ </msup>
+ <mspace/>
+ <mspace/>
+ </msubsup>
+ <mspace/>
+ </munder>
+ <mspace/>
+ </mover>
+ <mspace/>
+ <mspace/>
+ </munderover>
+ </msqrt>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msqrt id="msqrt-001">
+ <mn>0</mn>
+ <mn>1</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>3</mn>
+ <mn>4</mn>
+ </msqrt>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mroot id="mroot-001">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </mroot>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mroot id="mroot-002">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ </mroot>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mfrac id="mfrac-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mfrac id="mfrac-002">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msub id="msub-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ </msub>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msub id="msub-002">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </msub>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msup id="msup-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ </msup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msup id="msup-002">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </msup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup id="msubsup-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ <mn>2</mn>
+ </msubsup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup id="msubsup-002">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>2</mn>
+ </msubsup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup id="msubsup-003">
+ <mn>0</mn>
+ <mn>1</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </msubsup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munder id="munder-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ </munder>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munder id="munder-002">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </munder>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover id="mover-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover id="mover-002">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover accent="true" id="mover-003">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover accent="true" id="mover-004">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover id="munderover-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ <mn>2</mn>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover id="munderover-002">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>2</mn>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover id="munderover-003">
+ <mn>0</mn>
+ <mn>1</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover accent="true" id="munderover-004">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ <mn>2</mn>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover accent="true" id="munderover-005">
+ <mn>0</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>2</mn>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover accent="true" id="munderover-006">
+ <mn>0</mn>
+ <mn>1</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts id="mmultiscripts-001">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ <mn>4</mn>
+ <mn>5</mn>
+ <mn>6</mn>
+ <mprescripts/>
+ <mn>7</mn>
+ <mn>8</mn>
+ <mn>9</mn>
+ <mn>10</mn>
+ <mn>11</mn>
+ <mn>12</mn>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts id="mmultiscripts-002">
+ <mn>0</mn>
+ <mn>1</mn>
+ <mn>2</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>4</mn>
+ <mn>5</mn>
+ <mn>6</mn>
+ <mprescripts/>
+ <mn>7</mn>
+ <mn>8</mn>
+ <mn>9</mn>
+ <mn>10</mn>
+ <mn>11</mn>
+ <mn>12</mn>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts id="mmultiscripts-003">
+ <mn>0</mn>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>5</mn>
+ <mn>6</mn>
+ <mprescripts/>
+ <mn>7</mn>
+ <mn>8</mn>
+ <mn>9</mn>
+ <mn>10</mn>
+ <mn>11</mn>
+ <mn>12</mn>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts id="mmultiscripts-004">
+ <mn>0</mn>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ <mn>4</mn>
+ <mn>5</mn>
+ <mn>6</mn>
+ <mprescripts/>
+ <mn>7</mn>
+ <mn>8</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>10</mn>
+ <mn>11</mn>
+ <mn>12</mn>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts id="mmultiscripts-005">
+ <mn>0</mn>
+ <mn>1</mn>
+ <mn>2</mn>
+ <mn>3</mn>
+ <mn>4</mn>
+ <mn>5</mn>
+ <mn>6</mn>
+ <mprescripts/>
+ <mn>7</mn>
+ <mn>8</mn>
+ <mn>9</mn>
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ <mn>11</mn>
+ <mn>12</mn>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math id="css-001" style="math-shift: normal">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </math>
+ <math id="css-002" style="math-shift: compact">
+ <msup class="testedElement">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </math>
+ <math id="css-003" style="math-shift: normal">
+ <msup class="testedElement" style="math-shift: compact">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </math>
+ <math id="css-004" style="math-shift: compact">
+ <msup class="testedElement" style="math-shift: normal">
+ <mspace height="2em" width="2em"/>
+ <mspace height="1em" width="1em"/>
+ </msup>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/empty-underover.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/empty-underover.html
new file mode 100644
index 00000000000..09ef79d1c74
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/empty-underover.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test Script and Limit Schemata</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#script-and-limit-schemata">
+<meta name="assert" content="Script and Limit Schemata should not render anything when empty.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script>
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ ["over", "under", "underover", "sub", "sup", "subsup", "multiscripts"].forEach(function(name) {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(getBox(name).width, 0, epsilon, "width of empty " + name);
+ assert_approx_equals(getBox(name).height, 0, epsilon, "height of empty " + name);
+ });
+ }, "Size of empty script elements");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <munderover id="underover">
+ </munderover>
+ </math>
+ <math>
+ <munder id="under">
+ </munder>
+ </math>
+ <math>
+ <mover id="over">
+ </mover>
+ </math>
+ <math>
+ <msub id="sub">
+ </msub>
+ </math>
+ <math>
+ <msup id="sup">
+ </msup>
+ </math>
+ <math>
+ <msubsup id="subsup">
+ </msubsup>
+ </math>
+ <math>
+ <mmultiscripts id="multiscripts">
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-1.html
new file mode 100644
index 00000000000..8a378184268
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-1.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts metrics</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Basic metrics for elements msub, msup and msubsup.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math, mspace {
+ font: 25px/1 Ahem, math;
+ }
+</style>
+<script>
+ /* This test does not use a font with a MATH table and does not verify layout
+ rules in a very strict way. */
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ assert_less_than_equal(getBox("msubBase").right, getBox("msubSub").left, e, "msub: subscript is after base");
+ assert_less_than_equal(getBox("msupBase").right, getBox("msupSup").left, e, "msup: superscript is after base");
+ assert_less_than_equal(getBox("msubsupBase").right, getBox("msubsupSub").left, e, "msubsup: subscript is after base");
+ assert_less_than_equal(getBox("msubsupBase").right, getBox("msubsupSup").left, e, "msubsup: superscript is after base");
+
+ e = 3;
+ assert_approx_equals(getBox("msubBase").right, getBox("msubSub").left, e, "msub: space between base and subscript is small");
+ assert_approx_equals(getBox("msubBase").right, getBox("msubSub").left, e, "msub: subscript is after base");
+ assert_approx_equals(getBox("msupBase").right, getBox("msupSup").left, e, "msup: superscript is after base");
+ assert_approx_equals(getBox("msubsupBase").right, getBox("msubsupSub").left, e, "msubsup: subscript is after base");
+ assert_approx_equals(getBox("msubsupBase").right, getBox("msubsupSup").left, e, "msubsup: superscript is after base");
+ }, "Respective horizontal positions");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ assert_approx_equals(getBox("msubBase").middle, getBox("baseline").bottom, e, "msub: base is placed on the baseline");
+ assert_approx_equals(getBox("msupBase").middle, getBox("baseline").bottom, e, "msup: base is placed on the baseline");
+ assert_approx_equals(getBox("msubsupBase").middle, getBox("baseline").bottom, e, "msubsup: base is placed on the baseline");
+ }, "Alignment of the base on the baseline");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ assert_greater_than(getBox("msubSub").middle, getBox("msubBase").middle, "msub: script is placed at the bottom of the base");
+ assert_less_than(getBox("msupSup").middle, getBox("msupBase").middle, "msup: script is placed at the top of the base");
+ assert_greater_than(getBox("msubsupSub").middle, getBox("msubsupBase").middle, "msubsup: script is placed at the bottom of the base");
+ assert_less_than(getBox("msubsupSup").middle, getBox("msubsupBase").middle, "msubsup: script is placed at the top of the base");
+ }, "Vertical position of scripts");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 5;
+ assert_approx_equals(getBox("msub").width, getBox("msubSub").right - getBox("msubBase").left, e, "msub: width is determined by the left/right sides of base/script (+ some space after script)");
+ assert_approx_equals(getBox("msup").width, getBox("msupSup").right - getBox("msupBase").left, e, "msup: width is determined by the left/right sides of base/script (+ some space after script)");
+ assert_approx_equals(getBox("msubsup").width, Math.max(getBox("msubsupSub").right, getBox("msubsupSup").right) - getBox("msubsupBase").left, e, "msubsup: width is determined by the left/right sides of base/scripts (+ some space after script)");
+ }, "Width of scripted elements");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ assert_greater_than_equal(getBox("msub").height, getBox("msubBase").height, e, "msub: height is at least the one of the base");
+ assert_greater_than_equal(getBox("msup").height, getBox("msupBase").height, e, "msup: height is at least the one of the base");
+ assert_greater_than_equal(getBox("msubsup").height, getBox("msubsupBase").height, e, "msubsup: height is at least the one of the base");
+
+ assert_approx_equals(getBox("msub").height, Math.max(getBox("msubSub").bottom, getBox("msubBase").bottom) - getBox("msubBase").top, e, "msub: height is determined by the top/bottom sides of base/scripts");
+ assert_approx_equals(getBox("msup").height, getBox("msupBase").bottom - Math.min(getBox("msupSup").top, getBox("msupBase").top), e, "msup: height is determined by the top/bottom sides of base/scripts");
+ assert_approx_equals(getBox("msubsup").height, Math.max(getBox("msubSub").bottom, getBox("msubBase").bottom) - Math.min(getBox("msupSup").top, getBox("msupBase").top), e, "msubsup: height is determined by the top/bottom sides of base/scripts");
+ }, "Height of scripted elements");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="baseline" width="30px" height="2px" depth="0px" style="background: blue"/>
+ <msub id="msub" style="background: green">
+ <mspace id="msubBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msubSub" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msub>
+ <msup id="msup" style="background: blue">
+ <mspace id="msupBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msupSup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msup>
+ <msubsup id="msubsup" style="background: green">
+ <mspace id="msubsupBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msubsupSub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="msubsupSup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msubsup>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-2.html
new file mode 100644
index 00000000000..0629a027252
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-2.html
@@ -0,0 +1,173 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts metrics</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Basic metrics for the mmultiscript element.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math, mspace {
+ font: 25px/1 Ahem, math;
+ }
+</style>
+<script>
+ /* This test does not use a font with a MATH table and does not verify layout
+ rules in a very strict way. */
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ assert_less_than_equal(getBox("msubBase").right, getBox("msubSub").left, e, "subscript is after base");
+ assert_less_than_equal(getBox("msupBase").right, getBox("msupSup").left, e, "superscript is after base");
+ assert_less_than_equal(getBox("msubsupBase").right, getBox("msubsupSub").left, e, "subscript is after base");
+ assert_less_than_equal(getBox("msubsupBase").right, getBox("msubsupSup").left, e, "superscript is after base");
+
+ assert_greater_than_equal(getBox("premsubBase").right, getBox("premsubSub").left, e, "subscript is before base");
+ assert_greater_than_equal(getBox("premsupBase").right, getBox("premsupSup").left, e, "superscript is before base");
+ assert_greater_than_equal(getBox("premsubsupBase").right, getBox("premsubsupSub").left, e, "subscript is before base");
+ assert_greater_than_equal(getBox("premsubsupBase").right, getBox("premsubsupSup").left, e, "superscript is before base");
+
+ e = 3;
+ assert_approx_equals(getBox("msubBase").right, getBox("msubSub").left, e, "msub: space between base and subscript is small");
+ assert_approx_equals(getBox("msubBase").right, getBox("msubSub").left, e, "msub: subscript is after base");
+ assert_approx_equals(getBox("msupBase").right, getBox("msupSup").left, e, "msup: superscript is after base");
+ assert_approx_equals(getBox("msubsupBase").right, getBox("msubsupSub").left, e, "msubsup: subscript is after base");
+ assert_approx_equals(getBox("msubsupBase").right, getBox("msubsupSup").left, e, "msubsup: superscript is after base");
+
+ assert_approx_equals(getBox("premsubBase").left, getBox("premsubSub").right, e, "msub: space between base and subscript is small");
+ assert_approx_equals(getBox("premsubBase").left, getBox("premsubSub").right, e, "msub: subscript is after base");
+ assert_approx_equals(getBox("premsupBase").left, getBox("premsupSup").right, e, "msup: superscript is after base");
+ assert_approx_equals(getBox("premsubsupBase").left, getBox("premsubsupSub").right, e, "msubsup: subscript is after base");
+ assert_approx_equals(getBox("premsubsupBase").left, getBox("premsubsupSup").right, e, "msubsup: superscript is after base");
+ }, "Respective horizontal positions");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ assert_approx_equals(getBox("msubBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
+ assert_approx_equals(getBox("msupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
+ assert_approx_equals(getBox("msubsupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
+ assert_approx_equals(getBox("premsubBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
+ assert_approx_equals(getBox("premsupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
+ assert_approx_equals(getBox("premsubsupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
+ }, "Alignment of the base on the baseline");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ assert_greater_than(getBox("msubSub").middle, getBox("msubBase").middle, "script is placed at the bottom of the base");
+ assert_less_than(getBox("msupSup").middle, getBox("msupBase").middle, "script is placed at the top of the base");
+ assert_greater_than(getBox("msubsupSub").middle, getBox("msubsupBase").middle, "script is placed at the bottom of the base");
+ assert_less_than(getBox("msubsupSup").middle, getBox("msubsupBase").middle, "script is placed at the top of the base");
+
+ assert_greater_than(getBox("premsubSub").middle, getBox("premsubBase").middle, "script is placed at the bottom of the base");
+ assert_less_than(getBox("premsupSup").middle, getBox("premsupBase").middle, "script is placed at the top of the base");
+ assert_greater_than(getBox("premsubsupSub").middle, getBox("premsubsupBase").middle, "script is placed at the bottom of the base");
+ assert_less_than(getBox("premsubsupSup").middle, getBox("premsubsupBase").middle, "script is placed at the top of the base");
+ }, "Vertical position of scripts");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 3;
+ assert_approx_equals(getBox("msub").width, getBox("msubSub").right - getBox("msubBase").left, e, "width is determined by the left/right sides of base/script (+ some space after script)");
+ assert_approx_equals(getBox("msup").width, getBox("msupSup").right - getBox("msupBase").left, e, "width is determined by the left/right sides of base/script (+ some space after script)");
+ assert_approx_equals(getBox("msubsup").width, Math.max(getBox("msubsupSub").right, getBox("msubsupSup").right) - getBox("msubsupBase").left, e, "width is determined by the left/right sides of base/scripts (+ some space after script)");
+
+ assert_approx_equals(getBox("premsub").width, getBox("premsubBase").right - getBox("premsubSub").left, e, "width is determined by the right/left sides of base/script (+ some space after script)");
+ assert_approx_equals(getBox("premsup").width, getBox("premsupBase").right - getBox("premsupSup").left, e, "width is determined by the right/left sides of base/script (+ some space after script)");
+ assert_approx_equals(getBox("premsubsup").width, getBox("premsubsupBase").right - Math.min(getBox("premsubsupSub").left, getBox("premsubsupSup").left), e, "width is determined by the right/left sides of base/scripts (+ some space after script)");
+ }, "Width of scripted elements");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 5;
+ assert_greater_than_equal(getBox("msub").height, getBox("msubBase").height, e, "height is at least the one of the base");
+ assert_greater_than_equal(getBox("msup").height, getBox("msupBase").height, e, "height is at least the one of the base");
+ assert_greater_than_equal(getBox("msubsup").height, getBox("msubsupBase").height, e, "height is at least the one of the base");
+ assert_greater_than_equal(getBox("premsub").height, getBox("premsubBase").height, e, "height is at least the one of the base");
+ assert_greater_than_equal(getBox("premsup").height, getBox("premsupBase").height, e, "height is at least the one of the base");
+ assert_greater_than_equal(getBox("premsubsup").height, getBox("premsubsupBase").height, e, "height is at least the one of the base");
+
+ assert_approx_equals(getBox("msub").height, Math.max(getBox("msubSub").bottom, getBox("msubBase").bottom) - getBox("msubBase").top, e, "msub height is determined by the top/bottom sides of base/scripts");
+ assert_approx_equals(getBox("msup").height, getBox("msupBase").bottom - Math.min(getBox("msupSup").top, getBox("msupBase").top), e, "msup height is determined by the top/bottom sides of base/scripts");
+ assert_approx_equals(getBox("msubsup").height, Math.max(getBox("msubSub").bottom, getBox("msubBase").bottom) - Math.min(getBox("msupSup").top, getBox("msupBase").top), e, "msubsup height is determined by the top/bottom sides of base/scripts");
+ assert_approx_equals(getBox("premsub").height, Math.max(getBox("premsubSub").bottom, getBox("premsubBase").bottom) - getBox("premsubBase").top, e, "msub height is determined by the top/bottom sides of base/scripts");
+ assert_approx_equals(getBox("premsup").height, getBox("premsupBase").bottom - Math.min(getBox("premsupSup").top, getBox("premsupBase").top), e, "msup height is determined by the top/bottom sides of base/scripts");
+ assert_approx_equals(getBox("premsubsup").height, Math.max(getBox("premsubSub").bottom, getBox("premsubBase").bottom) - Math.min(getBox("premsupSup").top, getBox("premsupBase").top), e, "msubsup height is determined by the top/bottom sides of base/scripts");
+ }, "Height of scripted elements");
+
+ test(function() {
+ ["none", "mprescripts"].forEach(function(name) {
+ var elements = document.getElementsByTagName(name);
+ for (var i = 0; i < elements.length; i++) {
+ var box = elements[i].getBoundingClientRect();
+ assert_equals(box.height * box.width, 0, "<" + name + "> " + i + " has zero is empty");
+ }
+ });
+ }, "Size of empty elements");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="baseline" width="30px" height="2px" depth="0px" style="background: blue"/>
+ <mmultiscripts id="msub" style="background: green">
+ <mspace id="msubBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msubSub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <none/>
+ </mmultiscripts>
+ <mmultiscripts id="msup" style="background: green">
+ <mspace id="msupBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <none/>
+ <mspace id="msupSup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <mmultiscripts id="msubsup" style="background: green">
+ <mspace id="msubsupBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msubsupSub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="msubsupSup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <mmultiscripts id="premsub" style="background: green">
+ <mspace id="premsubBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="premsubSub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <none/>
+ </mmultiscripts>
+ <mmultiscripts id="premsup" style="background: green">
+ <mspace id="premsupBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <none/>
+ <mspace id="premsupSup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <mmultiscripts id="premsubsup" style="background: green">
+ <mspace id="premsubsupBase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="premsubsupSub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="premsubsupSup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-3.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-3.html
new file mode 100644
index 00000000000..ea20679fefa
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-3.html
@@ -0,0 +1,192 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts metrics</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Basic metrics for the mmultiscript element with many scripts.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math, mspace {
+ font: 25px/1 Ahem, math;
+ }
+</style>
+<script>
+ /* This test does not use a font with a MATH table and does not verify layout
+ rules in a very strict way. */
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ for (var i = 0; i < 5; i++)
+ assert_approx_equals(getBox("multi" + i + "base").middle, getBox("baseline").bottom, e, "base " + i + "is placed on the baseline");
+ }, "Alignment of the base on the baseline");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 5;
+ assert_approx_equals(getBox("multi0").width, 30, e, "width of multi0");
+ assert_approx_equals(getBox("multi0").height, 30, e, "height of multi0");
+ assert_approx_equals(getBox("multi1").width, 30, e, "width of multi1");
+ assert_approx_equals(getBox("multi1").height, 30, e, "height of multi1");
+ for (i = 2; i <= 4; i++) {
+ var scriptedBox = getBox("multi" + i);
+ var lastPostScript = getBox("multi" + i + "postsup" + (i - 1));
+ var firstPreScript = getBox("multi" + i + "presub1");
+ assert_approx_equals(scriptedBox.height, firstPreScript.bottom - lastPostScript.top, e, "height of multiscript" + i);
+ assert_approx_equals(scriptedBox.width, lastPostScript.right - firstPreScript.left, e, "width of multiscript" + i);
+ }
+ }, "Dimensions of the scripted elements");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 3;
+ for (var i = 2; i <= 4; i++) {
+ var base = getBox("multi" + i + "base");
+ for (var j = 1; j < i; j++) {
+ var presup = getBox("multi" + i + "presup" + j);
+ var postsup = getBox("multi" + i + "postsup" + j);
+ var presub = getBox("multi" + i + "presub" + j);
+ var postsub = getBox("multi" + i + "postsub" + j);
+ assert_approx_equals(base.top, presup.middle, e, "multi" + i + " " + j + " presup script");
+ assert_approx_equals(base.top, postsup.middle, e, "multi" + i + " " + j + " postsup script");
+ assert_approx_equals(base.bottom, presub.middle, e, "multi" + i + " " + j + " presub script");
+ assert_approx_equals(base.bottom, postsub.middle, e, "multi" + i + " " + j + " postsub script");
+ }
+ }
+ }, "Vertical positions of scripts");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ for (var i = 2; i <= 4; i++) {
+ var base = getBox("multi" + i + "base");
+ for (var j = 1; j < i; j++) {
+ var presup = getBox("multi" + i + "presup" + j);
+ var postsup = getBox("multi" + i + "postsup" + j);
+ var presub = getBox("multi" + i + "presub" + j);
+ var postsub = getBox("multi" + i + "postsub" + j);
+ assert_approx_equals(presup.right, presub.right, e, "multi" + i + "pre");
+ assert_approx_equals(postsup.left, postsub.left, e, "multi" + i + "post");
+ }
+ }
+ }, "Horizontal alignment of scripts");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ for (var i = 2; i <= 4; i++) {
+ var base = getBox("multi" + i + "base");
+ var firstPostScript = getBox("multi" + i + "postsub1");
+ var lastPreScript = getBox("multi" + i + "presup" + (i - 1));
+ assert_less_than_equal(base.right, firstPostScript.left, 1, "postcripts are after base");
+ assert_less_than_equal(lastPreScript.right, base.left, 1, "prescripts are before base");
+ assert_approx_equals(base.right, firstPostScript.left, 5, "spacing after base is not too large");
+ assert_approx_equals(lastPreScript.right, base.left, 5, "spacing before base is not too large");
+ for (var j = 1; j < i - 1; j++) {
+ var post = getBox("multi" + i + "postsub" + j);
+ var postNext = getBox("multi" + i + "postsub" + (j + 1));
+ var pre = getBox("multi" + i + "presup" + j);
+ var preNext = getBox("multi" + i + "presup" + (j + 1));
+ assert_less_than_equal(post.right, postNext.left, 1, "multi" + i + "order post" + j + " is before its successor");
+ assert_less_than_equal(pre.right, preNext.left, 1, "multi" + i + "order pre" + j + " is before its successor");
+ assert_approx_equals(post.right, postNext.left, 5, "multi" + i + "space after post" + j + " is not too large");
+ assert_approx_equals(pre.right, preNext.left, 5, "multi" + i + "space after pre" + j + " is not too large");
+ }
+ }
+ }, "Horizontal positions of scripts");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="baseline" width="30px" height="2px" depth="0px" style="background: blue"/>
+ <mmultiscripts id="multi0" style="background: green">
+ <mspace id="multi0base" width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ <mmultiscripts id="multi1" style="background: green">
+ <mspace id="multi1base" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ </mmultiscripts>
+ <mmultiscripts id="multi2" style="background: green">
+ <mspace id="multi2base" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="multi2postsub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi2postsup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multi2presub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi2presup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <mmultiscripts id="multi3" style="background: green">
+ <mspace id="multi3base" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="multi3postsub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi3postsup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi3postsub2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi3postsup2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multi3presub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi3presup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi3presub2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi3presup2" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <mmultiscripts id="multi4" style="background: green">
+ <mspace id="multi4base" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="multi4postsub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4postsup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4postsub2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4postsup2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4postsub3" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4postsup3" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multi4presub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4presup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4presub2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4presup2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4presub3" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi4presup3" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <mmultiscripts id="multi5" style="background: green">
+ <mspace id="multi5base" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="multi5postsub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5postsup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5postsub2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5postsup2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5postsub3" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5postsup3" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5postsub4" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5postsup4" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multi5presub1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5presup1" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5presub2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5presup2" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5presub3" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5presup3" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5presub4" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi5presup4" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-4.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-4.html
new file mode 100644
index 00000000000..ba7d20a2038
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-4.html
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts metrics</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Verify metrics of scripted elements for bases of different heights.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+</style>
+<script>
+ /* This test does not use any specific fonts and so the exact rules are not
+ specified precisely. We assume reasonable values for script shifts and
+ spacing. */
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ var sizeArray = [50, 75, 100];
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ sizeArray.forEach(function(size) {
+ assert_approx_equals(getBox("msub" + size + "base").middle, getBox("baseline").bottom, e, "msub base " + size + "is placed on the baseline");
+ assert_approx_equals(getBox("msup" + size + "base").middle, getBox("baseline").bottom, e, "msup base " + size + "is placed on the baseline");
+ assert_approx_equals(getBox("msubsup" + size + "base").middle, getBox("baseline").bottom, e, "msubsup base " + size + "is placed on the baseline");
+ assert_approx_equals(getBox("multi" + size + "base").middle, getBox("baseline").bottom, e, "mmultiscripts base " + size + "is placed on the baseline");
+ });
+ }, "Alignment on the baseline for bases of different heights");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 5;
+ sizeArray.forEach(function(size) {
+ assert_approx_equals(getBox("msub" + size + "sub").middle, getBox("msub" + size + "base").bottom, e, "msub script " + size + "is placed at the top of of the base");
+ });
+ }, "Vertical position of the scripts for bases of different heights");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="baseline" width="30px" height="2px" depth="0px" style="background: blue"/>
+ <msub id="msub50">
+ <mspace id="msub50base" width="30px" height="50px" depth="50px" style="background: black"/>
+ <mspace id="msub50sub" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msub>
+ <msup id="msup50">
+ <mspace id="msup50base" width="30px" height="50px" depth="50px" style="background: black"/>
+ <mspace id="msup50sup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msup>
+ <msubsup id="msubsup50">
+ <mspace id="msubsup50base" width="30px" height="50px" depth="50px" style="background: black"/>
+ <mspace id="msubsup50sub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="msubsup50sup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msubsup>
+ <mmultiscripts id="multi50">
+ <mspace id="multi50base" width="30px" height="50px" depth="50px" style="background: black"/>
+ <mspace id="multi50postsub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi50postsup" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multi50presub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi50presup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <msub id="msub75">
+ <mspace id="msub75base" width="30px" height="75px" depth="75px" style="background: black"/>
+ <mspace id="msub75sub" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msub>
+ <msup id="msup75">
+ <mspace id="msup75base" width="30px" height="75px" depth="75px" style="background: black"/>
+ <mspace id="msup75sup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msup>
+ <msubsup id="msubsup75">
+ <mspace id="msubsup75base" width="30px" height="75px" depth="75px" style="background: black"/>
+ <mspace id="msubsup75sub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="msubsup75sup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msubsup>
+ <mmultiscripts id="multi75">
+ <mspace id="multi75base" width="30px" height="75px" depth="75px" style="background: black"/>
+ <mspace id="multi75postsub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi75postsup" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multi75presub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi75presub" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ <msub id="msub100">
+ <mspace id="msub100base" width="30px" height="100px" depth="100px" style="background: black"/>
+ <mspace id="msub100sub" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msub>
+ <msup id="msup100">
+ <mspace id="msup100base" width="30px" height="100px" depth="100px" style="background: black"/>
+ <mspace id="msup100sup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msup>
+ <msubsup id="msubsup100">
+ <mspace id="msubsup100base" width="30px" height="100px" depth="100px" style="background: black"/>
+ <mspace id="msubsup100sub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="msubsup100sup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </msubsup>
+ <mmultiscripts id="multi100">
+ <mspace id="multi100base" width="30px" height="100px" depth="100px" style="background: black"/>
+ <mspace id="multi100postsub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi100postsup" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multi100presub" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="multi100presup" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-5.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-5.html
new file mode 100644
index 00000000000..ae3e3881229
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-5.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts metrics</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Verify metrics of scripted elements with tall scripts.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+</style>
+<script>
+ /* This test does not use any specific fonts and so the exact rules are not
+ specified precisely. We assume reasonable values for script shifts and
+ spacing. */
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ var sizeArray = [50, 75, 100];
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ assert_approx_equals(getBox("msubbase").middle, getBox("baseline").bottom, e, "msub base is placed on the baseline");
+ assert_approx_equals(getBox("msupbase").middle, getBox("baseline").bottom, e, "msup base is placed on the baseline");
+ assert_approx_equals(getBox("msubsupbase").middle, getBox("baseline").bottom, e, "msubsup base is placed on the baseline");
+ assert_approx_equals(getBox("multibase").middle, getBox("baseline").bottom, e, "mmultiscripts baseis placed on the baseline");
+ }, "Alignment on the baseline with different and large script heights");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ assert_greater_than(getBox("msubsub").top, getBox("msubbase").top, "msub: subscript is below the top of the base");
+ assert_less_than(getBox("msupsup").bottom, getBox("msupbase").bottom, "msup: supscript is above the bottom of the base");
+ assert_greater_than(getBox("msubsupsub").top, getBox("msubsupbase").top, "msubsup: subscript is below the top of the base");
+ assert_less_than(getBox("msubsupsup").bottom, getBox("msubsupbase").bottom, "msubsup: supscript is above the bottom of the base");
+ assert_greater_than(getBox("multipostsub").top, getBox("multibase").top, "mmultiscripts: postsubscript is below the top of the base");
+ assert_less_than(getBox("multipostsup").bottom, getBox("multibase").bottom, "mmultiscripts: postsupscript is above the bottom of the base");
+ assert_greater_than(getBox("multipresub").top, getBox("multibase").top, "mmultiscripts: presubscript is below the top of the base");
+ assert_less_than(getBox("multipresup").bottom, getBox("multibase").bottom, "mmultiscripts: presupscript is above the bottom of the base");
+ }, "Tall subscripts/superscripts are not placed too high/low");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ assert_greater_than(getBox("msubsupsub").top, getBox("msubsupsup").bottom, "msubsup: subscript is below the superscript");
+ assert_greater_than(getBox("multipresub").top, getBox("multipresup").bottom, "mmultiscripts: presubscript is below the presuperscript");
+ assert_greater_than(getBox("multipostsub").top, getBox("multipostsup").bottom, "mmultiscripts: postsubscript is below the postsuperscript");
+ }, "No collisions for tall subscripts and superscripts");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="baseline" width="30px" height="2px" depth="0px" style="background: blue"/>
+ <msub id="msub">
+ <mspace id="msubbase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msubsub" width="10px" height="50px" depth="50px" style="background: black"/>
+ </msub>
+ <msup id="msup">
+ <mspace id="msupbase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msupsup" width="10px" height="75px" depth="75px" style="background: black"/>
+ </msup>
+ <msubsup id="msubsup">
+ <mspace id="msubsupbase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="msubsupsub" width="10px" height="50px" depth="50px" style="background: black"/>
+ <mspace id="msubsupsup" width="10px" height="75px" depth="75px" style="background: black"/>
+ </msubsup>
+ <mmultiscripts id="multi">
+ <mspace id="multibase" width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="multipostsub" width="10px" height="50px" depth="50px" style="background: black"/>
+ <mspace id="multipostsup" width="10px" height="75px" depth="75px" style="background: black"/>
+ <mprescripts/>
+ <mspace id="multipresub" width="10px" height="50px" depth="50px" style="background: black"/>
+ <mspace id="multipresup" width="10px" height="75px" depth="75px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-6-rtl.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-6-rtl.html
new file mode 100644
index 00000000000..5ef3b925eeb
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-6-rtl.html
@@ -0,0 +1,121 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>mprescripts RTL</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Position and size of mprescripts in mmultiscript element with dir=rtl.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math, mspace {
+ font: 25px/1 Ahem;
+ }
+</style>
+<script>
+ /* This test verifies that mprescripts is correctly positioned in RTL
+ mmultiscripts. The right side of mprescripts should align with the
+ right side of the base, and it should be vertically centered. */
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ Array.from(document.getElementsByTagName("mprescripts")).
+ forEach(prescript => {
+ let mmultiscripts = prescript.parentNode;
+ let name = mmultiscripts.getAttribute("data-name");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var e = 1;
+ let base_box = mmultiscripts.firstElementChild.getBoundingClientRect();
+ let prescript_box = prescript.getBoundingClientRect();
+ assert_approx_equals(prescript_box.right, base_box.right, e, `${name}, right`);
+ assert_approx_equals((prescript_box.top + prescript_box.bottom) / 2, (base_box.top + base_box.bottom) / 2, e, `${name}, vertical center`);
+
+ if (name == "rtl prescripts with padding/border/margin") {
+ assert_approx_equals(prescript_box.width, 2*(15 + 25), e, `${name}, width`);
+ assert_approx_equals(prescript_box.height, 2*(10 + 20), e, `${name}, height`);
+ } else {
+ assert_approx_equals(prescript_box.width, 0, e, `${name}, width`);
+ assert_approx_equals(prescript_box.height, 0, e, `${name}, height`);
+ }
+ }, `mprescripts RTL coordinates and sizes (${name})`);
+ });
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math dir="rtl">
+ <mmultiscripts data-name="rtl 2 postscripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mmultiscripts data-name="rtl 2 prescripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mmultiscripts data-name="rtl 2 prescripts, 4 postscripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mmultiscripts data-name="rtl 4 prescripts, 2 postscripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mmultiscripts data-name="rtl prescripts with padding/border/margin">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts style="background: blue;
+ padding-top: 10px; border-top: 20px solid green;
+ padding-bottom: 10px; border-bottom: 20px solid green;
+ padding-left: 15px; border-left: 25px solid green;
+ padding-right: 15px; border-right: 25px solid green;
+ margin-top: 50px;"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-6.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-6.html
new file mode 100644
index 00000000000..5ebf9f8ca12
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-6.html
@@ -0,0 +1,120 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>mprescripts</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Position and size of mprescripts in mmultiscript element.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math, mspace {
+ font: 25px/1 Ahem, math;
+ }
+</style>
+<script>
+ /* This test does not use a font with a MATH table and does not verify layout
+ rules in a very strict way. */
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ Array.from(document.getElementsByTagName("mprescripts")).
+ forEach(prescript => {
+ let mmultiscripts = prescript.parentNode;
+ let name = mmultiscripts.getAttribute("data-name");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var e = 1;
+ let base_box = mmultiscripts.firstElementChild.getBoundingClientRect();
+ let prescript_box = prescript.getBoundingClientRect();
+ assert_approx_equals(prescript_box.left, base_box.left, e, `${name}, left`);
+ assert_approx_equals((prescript_box.top + prescript_box.bottom) / 2, (base_box.top + base_box.bottom) / 2, e, `${name}, top`);
+
+ if (name == "prescripts with padding/border/margin") {
+ assert_approx_equals(prescript_box.width, 2*(15 + 25), e, `${name}, width`);
+ assert_approx_equals(prescript_box.height, 2*(10 + 20), e, `${name}, height`);
+ } else {
+ assert_approx_equals(prescript_box.width, 0, e, `${name}, width`);
+ assert_approx_equals(prescript_box.height, 0, e, `${name}, height`);
+ }
+ }, `mprescripts coordinates and sizes (${name})`);
+ });
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mmultiscripts data-name="2 postscripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-name="2 prescripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-name="2 prescripts, 4 postscripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-name="4 prescripts, 2 postscripts">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-name="prescripts with padding/border/margin">
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mprescripts style="background: blue;
+ padding-top: 10px; border-top: 20px solid green;
+ padding-bottom: 10px; border-bottom: 20px solid green;
+ padding-left: 15px; border-left: 25px solid green;
+ padding-right: 15px; border-right: 25px solid green;
+ margin-top: 50px;"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ <mspace width="30px" height="15px" depth="15px" style="background: black"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-1.html
new file mode 100644
index 00000000000..ed696ed5721
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-1.html
@@ -0,0 +1,354 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Elements msub, msup, subsup and msubsup correctly use the subscript and superscript parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: spaceafterscript3000;
+ src: url("../../../fonts/math/scripts-spaceafterscript3000.woff");
+ }
+ @font-face {
+ font-family: superscriptshiftup7000;
+ src: url("../../../fonts/math/scripts-superscriptshiftup7000.woff");
+ }
+ @font-face {
+ font-family: superscriptshiftupcramped5000;
+ src: url("../../../fonts/math/scripts-superscriptshiftupcramped5000.woff");
+ }
+ @font-face {
+ font-family: subscriptshiftdown6000;
+ src: url("../../../fonts/math/scripts-subscriptshiftdown6000.woff");
+ }
+ @font-face {
+ font-family: subsuperscriptgapmin11000;
+ src: url("../../../fonts/math/scripts-subsuperscriptgapmin11000.woff");
+ }
+ @font-face {
+ font-family: subsuperscriptgapmin11000superscriptbottommaxwithsubscript3000;
+ src: url("../../../fonts/math/scripts-subsuperscriptgapmin11000-superscriptbottommaxwithsubscript3000.woff");
+ }
+ @font-face {
+ font-family: subscripttopmax4000;
+ src: url("../../../fonts/math/scripts-subscripttopmax4000.woff");
+ }
+ @font-face {
+ font-family: superscriptbottommin8000;
+ src: url("../../../fonts/math/scripts-superscriptbottommin8000.woff");
+ }
+ @font-face {
+ font-family: subscriptbaselinedropmin9000;
+ src: url("../../../fonts/math/scripts-subscriptbaselinedropmin9000.woff");
+ }
+ @font-face {
+ font-family: superscriptbaselinedropmax10000;
+ src: url("../../../fonts/math/scripts-superscriptbaselinedropmax10000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("ref001").left - getBox("sub001").right, v, epsilon, "msub: Space after subscript");
+ assert_approx_equals(getBox("ref002").left - getBox("sup002").right, v, epsilon, "msup: Space after superscript");
+ assert_approx_equals(getBox("ref003").left - getBox("sup003").right, v, epsilon, "msubsup: Space after superscript");
+ assert_approx_equals(getBox("sup0042").left - getBox("sup0041").right, v, epsilon, "mmultiscripts: Space after first superscript");
+ assert_approx_equals(getBox("sup0043").left - getBox("sup0042").right, v, epsilon, "mmultiscripts: Space after second superscript");
+ assert_approx_equals(getBox("ref004").left - getBox("sup0043").right, v, epsilon, "mmultiscripts: Space after last superscript");
+ }, "SpaceAfterScript");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 7000 * emToPx;
+ assert_approx_equals(getBox("ref101").bottom - getBox("sup102").bottom, v, epsilon, "msup: Superscript shift");
+ assert_approx_equals(getBox("ref101").bottom - getBox("sup103").bottom, v, epsilon, "msubsup: Superscript shift");
+ assert_approx_equals(getBox("ref101").bottom - getBox("sup1041").bottom, v, epsilon, "mmultiscripts: First superscript shift");
+ assert_approx_equals(getBox("ref101").bottom - getBox("sup1042").bottom, v, epsilon, "mmultiscripts: Second superscript shift");
+ assert_approx_equals(getBox("ref101").bottom - getBox("sup1043").bottom, v, epsilon, "mmultiscripts: Last superscript shift");
+ }, "SuperscriptShiftUp");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("ref201").bottom - getBox("sup202").bottom, v, epsilon, "msup: Superscript shift");
+ assert_approx_equals(getBox("ref201").bottom - getBox("sup203").bottom, v, epsilon, "msubsup: Superscript shift");
+ assert_approx_equals(getBox("ref201").bottom - getBox("sup2041").bottom, v, epsilon, "mmultiscripts: First superscript shift");
+ assert_approx_equals(getBox("ref201").bottom - getBox("sup2042").bottom, v, epsilon, "mmultiscripts: Second superscript shift");
+ assert_approx_equals(getBox("ref201").bottom - getBox("sup2043").bottom, v, epsilon, "mmultiscripts: Last superscript shift");
+ }, "SuperscriptShiftUpCramped");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 6000 * emToPx;
+ assert_approx_equals(getBox("sub301").bottom - getBox("ref300").bottom, v, epsilon, "msup: Subscript shift");
+ assert_approx_equals(getBox("sub302").bottom - getBox("ref300").bottom, v, epsilon, "msubsup: Subscript shift");
+ assert_approx_equals(getBox("sub303").bottom - getBox("ref300").bottom, v, epsilon, "mmultiscripts: First subscript shift");
+ assert_approx_equals(getBox("sub304").bottom - getBox("ref300").bottom, v, epsilon, "mmultiscripts: Second subscript shift");
+ }, "SubscriptShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 11000 * emToPx;
+ assert_approx_equals(getBox("sub4011").top - getBox("sup4012").bottom, v, epsilon, "msubsup: SubSuperscript gap");
+ assert_approx_equals(getBox("sub4021").top - getBox("sup4022").bottom, v, epsilon, "mmultiscripts: SubSuperscript gap");
+ }, "SubSuperscriptGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 11000 * emToPx;
+ var v2 = 3000 * emToPx;
+ assert_approx_equals(getBox("sub501").top - getBox("sup501").bottom, v1, epsilon, "msubsup: SubSuperscript gap");
+ assert_approx_equals(getBox("ref500").bottom - getBox("sup501").bottom, v2, epsilon, "msubsup: Superscript bottom");
+ assert_approx_equals(getBox("sub502").top - getBox("sup502").bottom, v1, epsilon, "mmultiscripts: SubSuperscript gap");
+ assert_approx_equals(getBox("ref500").bottom - getBox("sup502").bottom, v2, epsilon, "mmultiscripts: Superscript bottom");
+ }, "SuperscriptBottomMaxWithSubscript");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 4000 * emToPx;
+ assert_approx_equals(getBox("ref600").bottom - getBox("sub601").top, v, epsilon, "msub: Subscript top");
+ }, "SubscriptTopMax");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 8000 * emToPx;
+ assert_approx_equals(getBox("ref700").bottom - getBox("sub701").bottom, v, epsilon, "msub: Superscript bottom");
+ }, "SuperscriptBottomMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 9000 * emToPx;
+ assert_approx_equals(getBox("sub801").bottom - getBox("base801").bottom, v, epsilon, "msub: Superscript drop");
+ }, "SubscriptBaselineDrop");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 10000 * emToPx;
+ assert_approx_equals(getBox("sup901").bottom - getBox("base901").top, v, epsilon, "msup: Superscript drop");
+ }, "SuperscriptBaselineDrop");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: spaceafterscript3000;">
+ <msub>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub001" height="1em" width="1em" style="background: red"/>
+ </msub>
+ <mspace id="ref001" height="1em" width="1em" style="background: green"/>
+ </math>
+ <math style="font-family: spaceafterscript3000;">
+ <msup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sup002" height="1em" width="1em" style="background: red"/>
+ </msup>
+ <mspace id="ref002" height="1em" width="1em" style="background: green"/>
+ </math>
+ <math style="font-family: spaceafterscript3000;">
+ <msubsup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace/>
+ <mspace id="sup003" height="1em" width="1em" style="background: red"/>
+ </msubsup>
+ <mspace id="ref003" height="1em" width="1em" style="background: green"/>
+ </math>
+ <math style="font-family: spaceafterscript3000;">
+ <mmultiscripts>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <none/>
+ <mspace id="sup0041" height="1em" width="1em" style="background: red"/>
+ <none/>
+ <mspace id="sup0042" height="1em" width="1em" style="background: red"/>
+ <none/>
+ <mspace id="sup0043" height="1em" width="1em" style="background: red"/>
+ </mmultiscripts>
+ <mspace id="ref004" height="1em" width="1em" style="background: green"/>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: superscriptshiftup7000;">
+ <mspace id="ref101" height="1em" width="1em" style="background: green"/>
+ <msup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sup102" height="1em" width="1em" style="background: red"/>
+ </msup>
+ <msubsup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace height="1em" width="1em" style="background: red"/>
+ <mspace id="sup103" height="1em" width="1em" style="background: red"/>
+ </msubsup>
+ <mmultiscripts>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <none/>
+ <mspace id="sup1041" height="1em" width="1em" style="background: red"/>
+ <none/>
+ <mspace id="sup1042" height="1em" width="1em" style="background: red"/>
+ <none/>
+ <mspace id="sup1043" height="1em" width="1em" style="background: red"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: superscriptshiftupcramped5000;">
+ <msqrt>
+ <mspace id="ref201" height="1em" width="1em" style="background: green"/>
+ <msup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sup202" height="1em" width="1em" style="background: red"/>
+ </msup>
+ <msubsup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace height="1em" width="1em" style="background: blue"/>
+ <mspace id="sup203" height="1em" width="1em" style="background: red"/>
+ </msubsup>
+ <mmultiscripts>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <none/>
+ <mspace id="sup2041" height="1em" width="1em" style="background: red"/>
+ <none/>
+ <mspace id="sup2042" height="1em" width="1em" style="background: red"/>
+ <none/>
+ <mspace id="sup2043" height="1em" width="1em" style="background: red"/>
+ </mmultiscripts>
+ </msqrt>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: subscriptshiftdown6000;">
+ <mspace id="ref300" height="1em" width="1em" style="background: green"/>
+ <msub>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub301" height="1em" width="1em" style="background: red"/>
+ </msub>
+ <msubsup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub302" height="1em" width="1em" style="background: red"/>
+ <mspace height="1em" width="1em" style="background: blue"/>
+ </msubsup>
+ <mmultiscripts>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub303" height="1em" width="1em" style="background: red"/>
+ <none/>
+ <mspace id="sub304" height="1em" width="1em" style="background: red"/>
+ <none/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: subsuperscriptgapmin11000;">
+ <msubsup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub4011" height="1em" width="1em" style="background: red"/>
+ <mspace id="sup4012" height="1em" width="1em" style="background: red"/>
+ </msubsup>
+ <mmultiscripts>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <none/>
+ <none/>
+ <mspace id="sub4021" height="1em" width="1em" style="background: red"/>
+ <mspace id="sup4022" height="1em" width="1em" style="background: red"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: subsuperscriptgapmin11000superscriptbottommaxwithsubscript3000;">
+ <mspace id="ref500" height="1em" width="1em" style="background: green"/>
+ <msubsup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub501" height="1em" width="1em" style="background: red"/>
+ <mspace id="sup501" height="1em" width="1em" style="background: red"/>
+ </msubsup>
+ <mmultiscripts>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <none/>
+ <none/>
+ <mspace id="sub502" height="1em" width="1em" style="background: red"/>
+ <mspace id="sup502" height="1em" width="1em" style="background: red"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: subscripttopmax4000;">
+ <mspace id="ref600" height="1em"
+ width="1em" style="background: green"/>
+ <msub>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub601" height="10em"
+ width="1em" style="background: red"/>
+ </msub>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: superscriptbottommin8000;">
+ <mspace id="ref700" height="1em"
+ width="1em" style="background: green"/>
+ <msup>
+ <mspace height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub701" depth="1em"
+ width="1em" style="background: red"/>
+ </msup>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: subscriptbaselinedropmin9000;">
+ <msub>
+ <mspace id="base801" height="2em" width="2em" style="background: blue"/>
+ <mspace id="sub801" height="1em"
+ width="1em" style="background: red"/>
+ </msub>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: superscriptbaselinedropmax10000;">
+ <msup>
+ <mspace id="base901" height="15em" width="2em" style="background: blue"/>
+ <mspace id="sup901" height="1em"
+ width="1em" style="background: red"/>
+ </msup>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-2.html
new file mode 100644
index 00000000000..f2a4bd407f2
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/subsup-parameters-2.html
@@ -0,0 +1,199 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Subscripts and Superscripts parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<meta name="assert" content="Elements msub, msup, subsup and msubsup correctly use the italic correction from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: largeop-displayoperatorminheight5000;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight5000.woff");
+ }
+ @font-face {
+ font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff");
+ }
+ @font-face {
+ font-family: largeop-displayoperatorminheight7000-2AFF-italiccorrection5000;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight7000-2AFF-italiccorrection5000.woff");
+ }
+</style>
+<script>
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ /*
+ These two tests verify that:
+ - In msub, the script is at the right of the base minus the italic correction.
+ - In msup, the script is just at the right of the base.
+ - In msubsup, the scripts are shifted by the italic correction.
+ - In mmultiscripts, postscript pairs are shifted by the italic correction.
+ - In mmultiscripts, prescript pairs are vertically aligned.
+ */
+ var epsilon = 1;
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ let w = 1000 * emToPx;
+ assert_approx_equals(getBox("base001").width, w, epsilon, "msub base width");
+ assert_approx_equals(getBox("base002").width, w, epsilon, "msup base width");
+ assert_approx_equals(getBox("base003").width, w, epsilon, "msubsup base width");
+ assert_approx_equals(getBox("base004").width, w, epsilon, "mmultiscripts base width")
+
+ var v = 0;
+ assert_approx_equals(getBox("base001").right - getBox("sub001").left, v, epsilon, "msub");
+ assert_approx_equals(getBox("sup002").left, getBox("base002").right, epsilon, "msup");
+ assert_approx_equals(getBox("sup003").left - getBox("sub003").left, v, epsilon, "msubsup");
+ assert_approx_equals(getBox("sup004").left - getBox("sub004").left, v, epsilon, "mmultiscripts postscripts");
+ assert_approx_equals(getBox("sup005").left - getBox("sub005").left, 0, epsilon, "mmultiscripts prescripts");
+ }, "Null Italic Correction");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ let w = 4000 * emToPx;
+ assert_approx_equals(getBox("base011").width, w, epsilon, "msub base width");
+ assert_approx_equals(getBox("base012").width, w, epsilon, "msup base width");
+ assert_approx_equals(getBox("base013").width, w, epsilon, "msubsup base width");
+ assert_approx_equals(getBox("base014").width, w, epsilon, "mmultiscripts base width")
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("base011").right - getBox("sub011").left, v, epsilon, "msub");
+ assert_approx_equals(getBox("sup012").left, getBox("base012").right, epsilon, "msup");
+ assert_approx_equals(getBox("sup013").left - getBox("sub013").left, v, epsilon, "msubsup");
+ assert_approx_equals(getBox("sup014").left - getBox("sub014").left, v, epsilon, "mmultiscripts postscripts");
+ assert_approx_equals(getBox("sup015").left - getBox("sub015").left, 0, epsilon, "mmultiscripts prescripts");
+ }, "NonNull Italic Correction (MathGlyphVariantRecord)");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ let w = 7000 * emToPx;
+ assert_approx_equals(getBox("base021").width, w, epsilon, "msub base width");
+ assert_approx_equals(getBox("base022").width, w, epsilon, "msup base width");
+ assert_approx_equals(getBox("base023").width, w, epsilon, "msubsup base width");
+ assert_approx_equals(getBox("base024").width, w, epsilon, "mmultiscripts base width")
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("base021").right - getBox("sub021").left, v, epsilon, "msub");
+ assert_approx_equals(getBox("sup022").left, getBox("base022").right, epsilon, "msup");
+ assert_approx_equals(getBox("sup023").left - getBox("sub023").left, v, epsilon, "msubsup");
+ assert_approx_equals(getBox("sup024").left - getBox("sub024").left, v, epsilon, "mmultiscripts postscripts");
+ assert_approx_equals(getBox("sup025").left - getBox("sub025").left, 0, epsilon, "mmultiscripts prescripts");
+ }, "NonNull Italic Correction (GlyphAssembly)");
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <h2>Null Italic Correction</h2>
+ <p>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+ <msub>
+ <mo id="base001" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub001" height="1em" width="1em" style="background: blue"/>
+ </msub>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+ <msup>
+ <mo id="base002" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sup002" height="1em" width="1em" style="background: blue"/>
+ </msup>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+ <msubsup>
+ <mo id="base003" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub003" height="1em" width="1em" style="background: blue"/>
+ <mspace id="sup003" height="1em" width="1em" style="background: green"/>
+ </msubsup>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
+ <mmultiscripts>
+ <mo id="base004" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub004" height="1em" width="1em" style="background: blue"/>
+ <mspace id="sup004" height="1em" width="1em" style="background: green"/>
+ <mprescripts/>
+ <mspace id="sub005" height="1em" width="1em" style="background: magenta"/>
+ <mspace id="sup005" height="1em" width="1em" style="background: cyan"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <h2>NonNull Italic Correction (MathGlyphVariantRecord)</h2>
+ <p>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+ <msub>
+ <mo id="base011" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub011" height="1em" width="1em" style="background: blue"/>
+ </msub>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+ <msup>
+ <mo id="base012" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sup012" height="1em" width="1em" style="background: blue"/>
+ </msup>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+ <msubsup>
+ <mo id="base013" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub013" height="1em" width="1em" style="background: blue"/>
+ <mspace id="sup013" height="1em" width="1em" style="background: green"/>
+ </msubsup>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
+ <mmultiscripts>
+ <mo id="base014" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub014" height="1em" width="1em" style="background: blue"/>
+ <mspace id="sup014" height="1em" width="1em" style="background: green"/>
+ <mprescripts/>
+ <mspace id="sub015" height="1em" width="1em" style="background: magenta"/>
+ <mspace id="sup015" height="1em" width="1em" style="background: cyan"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <h2>NonNull Italic Correction (GlyphAssembly)</h2>
+ <p>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight7000-2AFF-italiccorrection5000;">
+ <msub>
+ <mo id="base021" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub021" height="1em" width="1em" style="background: blue"/>
+ </msub>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight7000-2AFF-italiccorrection5000;">
+ <msup>
+ <mo id="base022" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sup022" height="1em" width="1em" style="background: blue"/>
+ </msup>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight7000-2AFF-italiccorrection5000;">
+ <msubsup>
+ <mo id="base023" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub023" height="1em" width="1em" style="background: blue"/>
+ <mspace id="sup023" height="1em" width="1em" style="background: green"/>
+ </msubsup>
+ </math>
+ <math displaystyle="true" style="font-family: largeop-displayoperatorminheight7000-2AFF-italiccorrection5000;">
+ <mmultiscripts>
+ <mo id="base024" lspace="0px" rspace="0px">&#x2AFF;</mo>
+ <mspace id="sub024" height="1em" width="1em" style="background: blue"/>
+ <mspace id="sup024" height="1em" width="1em" style="background: green"/>
+ <mprescripts/>
+ <mspace id="sub025" height="1em" width="1em" style="background: magenta"/>
+ <mspace id="sup025" height="1em" width="1em" style="background: cyan"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-1.html
new file mode 100644
index 00000000000..fde6df04826
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-1.html
@@ -0,0 +1,175 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Underscripts and Overscripts parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<meta name="assert" content="Elements munder, mover, munderover correctly .">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+ math, mspace, mo {
+ font-family: Ahem, math;
+ font-size: 10px;
+ }
+</style>
+<script>
+ /* This test does not use any specific fonts and so the exact rules are not
+ specified precisely. We assume reasonable values for script shifts and
+ spacing. */
+
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ box.center = (box.left + box.right) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ for (var i = 0; i <= 3; i++) {
+ assert_approx_equals(getBox("under" + i + "base").middle, getBox("baseline").bottom, e, "munder " + i + ": base is placed on the baseline");
+ assert_approx_equals(getBox("over" + i + "base").middle, getBox("baseline").bottom, e, "mover " + i + ": base is placed on the baseline");
+ }
+ for (var i = 0; i <= 5; i++) {
+ assert_approx_equals(getBox("underover" + i + "base").middle, getBox("baseline").bottom, e, "munderover " + i + ": base is placed on the baseline");
+ }
+ }, "Alignment of the base on the baseline");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ for (var i = 0; i <= 3; i++) {
+ assert_approx_equals(getBox("under" + i + "under").center, getBox("under" + i + "base").center, e, "munder " + i + ": base and script are horizontally centered");
+ assert_approx_equals(getBox("over" + i + "over").center, getBox("over" + i + "base").center, e, "mover " + i + ": base and script are horizontally centered");
+ }
+ for (var i = 0; i <= 5; i++) {
+ assert_approx_equals(getBox("underover" + i + "under").center, getBox("underover" + i + "base").center, e, "munderover " + i + ": base and underscript are horizontally centered");
+ assert_approx_equals(getBox("underover" + i + "over").center, getBox("underover" + i + "base").center, e, "munderover " + i + ": base and overscript are horizontally centered");
+ }
+ }, "Horizontal alignments of base and scripts");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ for (var i = 0; i <= 3; i++) {
+ assert_greater_than_equal(getBox("under" + i + "under").top, getBox("under" + i + "base").bottom, "munder " + i + ": script is under base");
+ assert_less_than_equal(getBox("over" + i + "over").bottom, getBox("over" + i + "base").top, "mover " + i + ": script is over base");
+ }
+ for (var i = 0; i <= 5; i++) {
+ assert_greater_than_equal(getBox("underover" + i + "under").top, getBox("underover" + i + "base").bottom, "munderover " + i + ": underscript is under base");
+ assert_less_than_equal(getBox("underover" + i + "over").bottom, getBox("underover" + i + "base").top, "munderover " + i + ": overscript is over base");
+ }
+ }, "Relative vertical positions of base and scripts");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 1;
+ for (var i = 0; i <= 3; i++) {
+ assert_approx_equals(getBox("under" + i).width, Math.max(getBox("under" + i + "base").width, getBox("under" + i + "under").width), e, "munder " + i + ": width is determined by the maximum of width of base and script");
+ assert_approx_equals(getBox("over" + i).width, Math.max(getBox("over" + i + "base").width, getBox("over" + i + "over").width), e, "mover " + i + ": width is determined by the maximum of width of base and script");
+ }
+ for (var i = 0; i <= 5; i++) {
+ assert_approx_equals(getBox("underover" + i).width, Math.max(getBox("underover" + i + "base").width, getBox("underover" + i + "under").width, getBox("underover" + i + "over").width), e, "munderover " + i + ": width is determined by the maximum of width of base and scripts");
+ }
+ }, "Width of scripted elements");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var e = 4;
+ for (var i = 0; i <= 3; i++) {
+ assert_approx_equals(getBox("under" + i).height, getBox("under" + i + "base").height + getBox("under" + i + "under").height, e, "munder " + i + ": height is determined by the sum of heights of base and script plus some spacing.");
+ assert_approx_equals(getBox("over" + i).height, getBox("over" + i + "base").height + getBox("over" + i + "over").height, e, "mover " + i + ": height is determined by the sum of heights of base and script plus some spacing.");
+ }
+ for (var i = 0; i <= 5; i++) {
+ assert_approx_equals(getBox("underover" + i).height, getBox("underover" + i + "base").height + getBox("underover" + i + "under").height + getBox("underover" + i + "over").height, e, "munderover " + i + ": height is determined by the sum heights of base and scripts");
+ }
+ }, "Height of scripted elements");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="baseline" width="30px" height="2px" depth="0px" style="background: blue"/>
+ <munder id="under0">
+ <mspace id="under0base" width="30px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="under0under" width="10px" height="5px" depth="5px" style="background: black"/>
+ </munder>
+ <munder id="under1">
+ <mspace id="under1base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="under1under" width="30px" height="5px" depth="5px" style="background: black"/>
+ </munder>
+ <munder id="under2">
+ <mspace id="under2base" width="10px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="under2under" width="10px" height="5px" depth="5px" style="background: black"/>
+ </munder>
+ <munder id="under3">
+ <mspace id="under3base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="under3under" width="10px" height="15px" depth="15px" style="background: black"/>
+ </munder>
+ <mover id="over0">
+ <mspace id="over0base" width="30px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="over0over" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mover>
+ <mover id="over1">
+ <mspace id="over1base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="over1over" width="30px" height="5px" depth="5px" style="background: black"/>
+ </mover>
+ <mover id="over2">
+ <mspace id="over2base" width="10px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="over2over" width="10px" height="5px" depth="5px" style="background: black"/>
+ </mover>
+ <mover id="over3">
+ <mspace id="over3base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="over3over" width="10px" height="15px" depth="15px" style="background: black"/>
+ </mover>
+ <munderover id="underover0">
+ <mspace id="underover0base" width="30px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover0under" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover0over" width="10px" height="5px" depth="5px" style="background: black"/>
+ </munderover>
+ <munderover id="underover1">
+ <mspace id="underover1base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover1under" width="30px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover1over" width="10px" height="5px" depth="5px" style="background: black"/>
+ </munderover>
+ <munderover id="underover2">
+ <mspace id="underover2base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover2under" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover2over" width="30px" height="5px" depth="5px" style="background: black"/>
+ </munderover>
+ <munderover id="underover3">
+ <mspace id="underover3base" width="10px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="underover3under" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover3over" width="10px" height="5px" depth="5px" style="background: black"/>
+ </munderover>
+ <munderover id="underover4">
+ <mspace id="underover4base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover4under" width="10px" height="15px" depth="15px" style="background: black"/>
+ <mspace id="underover4over" width="10px" height="5px" depth="5px" style="background: black"/>
+ </munderover>
+ <munderover id="underover5">
+ <mspace id="underover5base" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover5under" width="10px" height="5px" depth="5px" style="background: black"/>
+ <mspace id="underover5over" width="10px" height="15px" depth="15px" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-1.html
new file mode 100644
index 00000000000..7eb55c0abfc
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-1.html
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Underscripts and Overscripts parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<meta name="assert" content="Elements munder, mover, munderover correctly use the limit parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace, mo {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: lowerlimitbaselinedropmin3000;
+ src: url("../../../fonts/math/limits-lowerlimitbaselinedropmin3000.woff");
+ }
+ @font-face {
+ font-family: lowerlimitgapmin11000;
+ src: url("../../../fonts/math/limits-lowerlimitgapmin11000.woff");
+ }
+ @font-face {
+ font-family: upperlimitbaselinerisemin5000;
+ src: url("../../../fonts/math/limits-upperlimitbaselinerisemin5000.woff");
+ }
+ @font-face {
+ font-family: upperlimitgapmin7000;
+ src: url("../../../fonts/math/limits-upperlimitgapmin7000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("under00011").top - getBox("ref0001").bottom,
+ v, epsilon, "munder: under shift");
+ assert_approx_equals(getBox("under00012").top - getBox("ref0001").bottom,
+ v, epsilon, "munderover: under shift");
+ }, "LowerLimitBaselineDropMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 11000 * emToPx;
+ assert_approx_equals(getBox("under00021").top - getBox("ref0002").bottom,
+ v, epsilon, "munder: under gap");
+ assert_approx_equals(getBox("under00022").top - getBox("ref0002").bottom,
+ v, epsilon, "munderover: under gap");
+ }, "LowerLimitGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("ref0003").top - getBox("over00031").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0003").top - getBox("over00032").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "UpperLimitBaselineRiseMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 7000 * emToPx;
+ assert_approx_equals(getBox("ref0004").top - getBox("over00041").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0004").top - getBox("over00042").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "UpperLimitGapMin");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: lowerlimitbaselinedropmin3000;">
+ <mspace id="ref0001" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace id="under00011" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace id="under00012" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: lowerlimitgapmin11000;">
+ <mspace id="ref0002" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace id="under00021" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace id="under00022" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: upperlimitbaselinerisemin5000;">
+ <mspace id="ref0003" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace id="over00031" height="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00032" height="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: upperlimitgapmin7000;">
+ <mspace id="ref0004" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace id="over00041" depth="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mo movablelimits="false">&#x2211;</mo>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00042" depth="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-2.html
new file mode 100644
index 00000000000..4b07571b0fc
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-2.html
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Underscripts and Overscripts parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<meta name="assert" content="Elements munder, mover, munderover correctly use the stretch stack parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace, mo {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: bottomshiftdown3000;
+ src: url("../../../fonts/math/stretchstack-bottomshiftdown3000.woff");
+ }
+ @font-face {
+ font-family: gapbelowmin11000;
+ src: url("../../../fonts/math/stretchstack-gapbelowmin11000.woff");
+ }
+ @font-face {
+ font-family: topshiftup5000;
+ src: url("../../../fonts/math/stretchstack-topshiftup5000.woff");
+ }
+ @font-face {
+ font-family: gapabovemin7000;
+ src: url("../../../fonts/math/stretchstack-gapabovemin7000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("under00011").top - getBox("ref0001").bottom,
+ v, epsilon, "munder: under shift");
+ assert_approx_equals(getBox("under00012").top - getBox("ref0001").bottom,
+ v, epsilon, "munderover: under shift");
+ }, "StretchStackBottomShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 11000 * emToPx;
+ assert_approx_equals(getBox("under00021").top - getBox("ref0002").bottom,
+ v, epsilon, "munder: under gap");
+ assert_approx_equals(getBox("under00022").top - getBox("ref0002").bottom,
+ v, epsilon, "munderover: under gap");
+ }, "StretchStackGapBelowMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("ref0003").top - getBox("over00031").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0003").top - getBox("over00032").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "StretchStackTopShiftUp");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 7000 * emToPx;
+ assert_approx_equals(getBox("ref0004").top - getBox("over00041").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0004").top - getBox("over00042").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "StretchStackGapAboveMin");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: bottomshiftdown3000;">
+ <mspace id="ref0001" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mo>&#x2192;</mo>
+ <mspace id="under00011" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mo>&#x2192;</mo>
+ <mspace id="under00012" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: gapbelowmin11000;">
+ <mspace id="ref0002" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mo>&#x2192;</mo>
+ <mspace id="under00021" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mo>&#x2192;</mo>
+ <mspace id="under00022" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: topshiftup5000;">
+ <mspace id="ref0003" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mo>&#x2192;</mo>
+ <mspace id="over00031" height="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mo>&#x2192;</mo>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00032" height="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: gapabovemin7000;">
+ <mspace id="ref0004" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mo>&#x2192;</mo>
+ <mspace id="over00041" depth="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mo>&#x2192;</mo>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00042" depth="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-3.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-3.html
new file mode 100644
index 00000000000..c6f2ca34a94
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-3.html
@@ -0,0 +1,452 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Underscripts and Overscripts parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<meta name="assert" content="Elements munder, mover, munderover correctly use underbar/overbar and AccentBaseHeight parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace, mo {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: accentbaseheight4000underbarextradescender5000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-underbarextradescender5000.woff");
+ }
+ @font-face {
+ font-family: accentbaseheight4000underbarverticalgap7000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-underbarverticalgap7000.woff");
+ }
+ @font-face {
+ font-family: accentbaseheight4000overbarextraascender3000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-overbarextraascender3000.woff");
+ }
+ @font-face {
+ font-family: accentbaseheight4000overbarverticalgap11000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-overbarverticalgap11000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 2;
+ var axisBaseHeight = 4000 * emToPx;
+ var shortBaseHeight = 3000 * emToPx; // shortBaseHeight < axisBaseHeight
+ var tallBaseHeight = 5000 * emToPx; // tallBaseHeight > axisBaseHeight
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function getBooleanValue(element, name) {
+ return (element.getAttribute(name) || "").toLowerCase() === "true";
+ }
+ let dynamicBooleanAttributeChanges = {
+ "Invert boolean value using absent attribute": function(element, name) {
+ if (getBooleanValue(element, name)) {
+ element.removeAttribute(name);
+ } else {
+ element.setAttribute(name, "true");
+ }
+ },
+
+ "Invert boolean value using invalid attribute": function(element, name) {
+ if (getBooleanValue(element, name)) {
+ element.setAttribute(name, "invalid");
+ } else {
+ element.setAttribute(name, "true");
+ }
+ },
+
+ "Change case of boolean attribute": function(element, name) {
+ if (getBooleanValue(element, name)) {
+ element.setAttribute(name, "TrUe");
+ } else {
+ element.setAttribute(name, "FaLsE");
+ }
+ }
+ };
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ for (var i = 1; i <= 4; i++) {
+ for (var j = 1; j <= 6; j++) {
+ var baseId = ("base00" + i) + j;
+ assert_approx_equals(getBox("ref00" + i).bottom,
+ getBox(baseId).bottom,
+ epsilon,
+ "alignment of " + baseId);
+ }
+ }
+ }, "Baseline alignment");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ for (var i = 1; i <= 4; i++) {
+ for (var j = 1; j <= 6; j++) {
+ var baseId = ("base00" + i) + j;
+ assert_approx_equals(getBox(baseId).height,
+ j == 2 || j == 5 ?
+ tallBaseHeight :shortBaseHeight,
+ epsilon,
+ "height of " + baseId);
+ }
+ }
+ }, "Heights of bases");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("ref001").bottom - getBox("over0014").bottom,
+ shortBaseHeight, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref001").bottom - getBox("over0015").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref001").bottom - getBox("over0016").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 1; j <= 6; j++) {
+ var elId = "el001" + j;
+ var baseId = "base001" + j;
+ var underId = "under001" + j;
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ 0, epsilon,
+ "gap between " + baseId + " and " + underId);
+ assert_approx_equals(getBox(elId).bottom - getBox(underId).bottom,
+ v, epsilon,
+ "extra descender below " + underId);
+ }
+ }, "AccentBaseHeight, UnderbarExtraDescender");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 7000 * emToPx;
+ assert_approx_equals(getBox("ref002").bottom - getBox("over0024").bottom,
+ shortBaseHeight, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref002").bottom - getBox("over0025").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref002").bottom - getBox("over0026").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 1; j <= 6; j++) {
+ var elId = "el002" + j;
+ var baseId = "base002" + j;
+ var underId = "under002" + j;
+ var gap = (j == 2 || j == 3 ? 0 : v);
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ gap, epsilon,
+ "gap between " + baseId + " and " + underId);
+ }
+ }, "AccentBaseHeight, UnderbarVerticalGap");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0031").bottom,
+ shortBaseHeight, epsilon,
+ "mover: nonaccent over short base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0032").bottom,
+ tallBaseHeight, epsilon,
+ "mover: accent over tall base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0033").bottom,
+ axisBaseHeight, epsilon,
+ "mover: accent over short base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0034").bottom,
+ shortBaseHeight, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0035").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0036").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 1; j <= 6; j++) {
+ var elId = "el003" + j;
+ var baseId = "base003" + j;
+ if (j >= 4) {
+ var underId = "under003" + j;
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ 0, epsilon,
+ "gap between " + baseId + " and " + underId);
+ }
+ var overId = "over003" + j;
+ assert_approx_equals(getBox(overId).top - getBox(elId).top,
+ v, epsilon,
+ "extra ascender below " + overId);
+ }
+ }, "AccentBaseHeight, OverbarExtraAscender");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ v = 11000 * emToPx;
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0041").bottom,
+ shortBaseHeight + v, epsilon,
+ "mover: nonaccent over short base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0042").bottom,
+ tallBaseHeight, epsilon,
+ "mover: accent over tall base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0043").bottom,
+ axisBaseHeight, epsilon,
+ "mover: accent over short base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0044").bottom,
+ shortBaseHeight + v, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0045").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0046").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 4; j <= 6; j++) {
+ var baseId = "base004" + j;
+ var underId = "under004" + j;
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ 0, epsilon,
+ "gap between " + baseId + " and " + underId);
+ }
+ }, "AccentBaseHeight, OverbarVerticalGap");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var v = 7000 * emToPx;
+
+ for (var j = 1; j <= 4; j++) {
+ var elId = `el005${j}`;
+ var baseId = `base005${j}`;
+ var underId = `under005${j}`;
+
+ for (name in dynamicBooleanAttributeChanges) {
+ let element = document.getElementById(elId);
+ dynamicBooleanAttributeChanges[name](element, "accentunder");
+ var value = getBooleanValue(element, "accentunder");
+ var gap = value ? 0 : v;
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ gap, epsilon,
+ `${elId}: gap between base and underscript ; ${name}`);
+ };
+ }
+ }, "Dynamic change of accentunder attribute");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ v = 11000 * emToPx;
+ for (var j = 1; j <= 4; j++) {
+ var elId = `el006${j}`;
+ var refId = `base006${j}`;
+ var overId = `over006${j}`;
+ for (name in dynamicBooleanAttributeChanges) {
+ let element = document.getElementById(elId);
+ dynamicBooleanAttributeChanges[name](element, "accent");
+ var value = getBooleanValue(element, "accent");
+ assert_approx_equals(getBox(refId).bottom - getBox(overId).bottom,
+ value ? axisBaseHeight : shortBaseHeight + v,
+ epsilon,
+ `${elId}: accent=${value} ; short base ; ${name}`);
+ }
+ }
+ }, "Dynamic change of accent attribute");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: accentbaseheight4000underbarextradescender5000;">
+ <mspace id="ref001" height="1em" width="3em" style="background: green"/>
+ <munder style="background: cyan" id="el0011">
+ <mspace id="base0011" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0011" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munder style="background: cyan" id="el0012" accentunder="true">
+ <mspace id="base0012" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0012" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munder style="background: cyan" id="el0013" accentunder="true">
+ <mspace id="base0013" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0013" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover style="background: cyan" id="el0014">
+ <mspace id="base0014" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0014" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0014" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0015" accent="true">
+ <mspace id="base0015" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0015" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0015" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0016" accent="true">
+ <mspace id="base0016" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0016" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0016" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000underbarverticalgap7000;">
+ <mspace id="ref002" height="1em" width="3em" style="background: green"/>
+ <munder style="background: cyan" id="el0021">
+ <mspace id="base0021" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0021" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munder style="background: cyan" id="el0022" accentunder="true">
+ <mspace id="base0022" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0022" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munder style="background: cyan" id="el0023" accentunder="true">
+ <mspace id="base0023" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0023" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover style="background: cyan" id="el0024">
+ <mspace id="base0024" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0024" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0024" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0025" accent="true">
+ <mspace id="base0025" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0025" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0025" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0026" accent="true">
+ <mspace id="base0026" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0026" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0026" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000overbarextraascender3000;">
+ <mspace id="ref003" height="1em" width="3em" style="background: green"/>
+ <mover style="background: cyan" id="el0031">
+ <mspace id="base0031" height="3em" width="1em" style="background: black"/>
+ <mspace id="over0031" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <mover style="background: cyan" id="el0032" accent="true">
+ <mspace id="base0032" height="5em" width="1em" style="background: black"/>
+ <mspace id="over0032" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <mover style="background: cyan" id="el0033" accent="true">
+ <mspace id="base0033" height="3em" width="1em" style="background: black"/>
+ <mspace id="over0033" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <munderover style="background: cyan" id="el0034">
+ <mspace id="base0034" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0034" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0034" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0035" accent="true">
+ <mspace id="base0035" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0035" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0035" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0036" accent="true">
+ <mspace id="base0036" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0036" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0036" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000overbarverticalgap11000;">
+ <mspace id="ref004" height="1em" width="3em" style="background: green"/>
+ <mover style="background: cyan" id="el0041">
+ <mspace id="base0041" height="3em" width="1em" style="background: black"/>
+ <mspace id="over0041" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <mover style="background: cyan" id="el0042" accent="true">
+ <mspace id="base0042" height="5em" width="1em" style="background: black"/>
+ <mspace id="over0042" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <mover style="background: cyan" id="el0043" accent="true">
+ <mspace id="base0043" height="3em" width="1em" style="background: black"/>
+ <mspace id="over0043" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <munderover style="background: cyan" id="el0044">
+ <mspace id="base0044" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0044" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0044" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0045" accent="true">
+ <mspace id="base0045" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0045" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0045" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0046" accent="true">
+ <mspace id="base0046" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0046" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0046" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000underbarverticalgap7000;">
+ <mspace id="ref005" height="1em" width="3em" style="background: green"/>
+ <munder style="background: cyan" id="el0051">
+ <mspace id="base0051" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0051" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munder style="background: cyan" id="el0052" accentunder="true">
+ <mspace id="base0052" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0052" height="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover style="background: cyan" id="el0053">
+ <mspace id="base0053" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0053" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0053" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0054" accentunder="true">
+ <mspace id="base0054" height="5em" width="1em" style="background: black"/>
+ <mspace id="under0054" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0054" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000overbarverticalgap11000;">
+ <mspace id="ref006" height="1em" width="3em" style="background: green"/>
+ <mover style="background: cyan" id="el0061">
+ <mspace id="base0061" height="3em" width="1em" style="background: black"/>
+ <mspace id="over0061" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <mover style="background: cyan" id="el0062" accent="true">
+ <mspace id="base0062" height="3em" width="1em" style="background: black"/>
+ <mspace id="over0062" height="1em" width="3em" style="background: red"/>
+ </mover>
+ <munderover style="background: cyan" id="el0063">
+ <mspace id="base0063" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0063" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0063" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ <munderover style="background: cyan" id="el0064" accent="true">
+ <mspace id="base0064" height="3em" width="1em" style="background: black"/>
+ <mspace id="under0064" height="1em" width="3em" style="background: blue"/>
+ <mspace id="over0064" height="1em" width="3em" style="background: red"/>
+ </munderover>
+ </math>
+ </p>
+
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-4.tentative.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-4.tentative.html
new file mode 100644
index 00000000000..fc54664ebe3
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-4.tentative.html
@@ -0,0 +1,335 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Underscripts and Overscripts parameters</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.mo.attrs">
+<meta name="assert" content="Elements munder, mover, munderover correctly use underbar/overbar and AccentBaseHeight parameters from the MATH table ; interaction with MathML3 mo@accent.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace, mo {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: accentbaseheight4000underbarextradescender5000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-underbarextradescender5000.woff");
+ }
+ @font-face {
+ font-family: accentbaseheight4000underbarverticalgap7000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-underbarverticalgap7000.woff");
+ }
+ @font-face {
+ font-family: accentbaseheight4000overbarextraascender3000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-overbarextraascender3000.woff");
+ }
+ @font-face {
+ font-family: accentbaseheight4000overbarverticalgap11000;
+ src: url("../../../fonts/math/underover-accentbaseheight4000-overbarverticalgap11000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 2;
+ var axisBaseHeight = 4000 * emToPx;
+ var shortBaseHeight = 3000 * emToPx; // shortBaseHeight < axisBaseHeight
+ var tallBaseHeight = 5000 * emToPx; // tallBaseHeight > axisBaseHeight
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ for (var i = 1; i <= 4; i++) {
+ for (var j = 1; j <= 6; j++) {
+ var baseId = ("base00" + i) + j;
+ assert_approx_equals(getBox("ref00" + i).bottom,
+ getBox(baseId).bottom,
+ epsilon,
+ "alignment of " + baseId);
+ }
+ }
+ }, "Baseline alignment");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ for (var i = 1; i <= 4; i++) {
+ for (var j = 1; j <= 6; j++) {
+ var baseId = ("base00" + i) + j;
+ assert_approx_equals(getBox(baseId).height,
+ j == 2 || j == 5 ?
+ tallBaseHeight :shortBaseHeight,
+ epsilon,
+ "height of " + baseId);
+ }
+ }
+ }, "Heights of bases");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("ref001").bottom - getBox("over0014").bottom,
+ shortBaseHeight, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref001").bottom - getBox("over0015").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref001").bottom - getBox("over0016").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 1; j <= 6; j++) {
+ var elId = "el001" + j;
+ var baseId = "base001" + j;
+ var underId = "under001" + j;
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ 0, epsilon,
+ "gap between " + baseId + " and " + underId);
+ assert_approx_equals(getBox(elId).bottom - getBox(underId).bottom,
+ v, epsilon,
+ "extra descender below " + underId);
+ }
+ }, "AccentBaseHeight, UnderbarExtraDescender");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 7000 * emToPx;
+ assert_approx_equals(getBox("ref002").bottom - getBox("over0024").bottom,
+ shortBaseHeight, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref002").bottom - getBox("over0025").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref002").bottom - getBox("over0026").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 1; j <= 6; j++) {
+ var elId = "el002" + j;
+ var baseId = "base002" + j;
+ var underId = "under002" + j;
+ var gap = (j == 2 || j == 3 ? 0 : v);
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ gap, epsilon,
+ "gap between " + baseId + " and " + underId);
+ }
+ }, "AccentBaseHeight, UnderbarVerticalGap");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0031").bottom,
+ shortBaseHeight, epsilon,
+ "mover: nonaccent over short base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0032").bottom,
+ tallBaseHeight, epsilon,
+ "mover: accent over tall base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0033").bottom,
+ axisBaseHeight, epsilon,
+ "mover: accent over short base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0034").bottom,
+ shortBaseHeight, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0035").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref003").bottom - getBox("over0036").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 1; j <= 6; j++) {
+ var elId = "el003" + j;
+ var baseId = "base003" + j;
+ if (j >= 4) {
+ var underId = "under003" + j;
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ 0, epsilon,
+ "gap between " + baseId + " and " + underId);
+ }
+ var overId = "over003" + j;
+ assert_approx_equals(getBox(overId).top - getBox(elId).top,
+ v, epsilon,
+ "extra ascender below " + overId);
+ }
+ }, "AccentBaseHeight, OverbarExtraAscender");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ v = 11000 * emToPx;
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0041").bottom,
+ shortBaseHeight + v, epsilon,
+ "mover: nonaccent over short base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0042").bottom,
+ tallBaseHeight, epsilon,
+ "mover: accent over tall base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0043").bottom,
+ axisBaseHeight, epsilon,
+ "mover: accent over short base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0044").bottom,
+ shortBaseHeight + v, epsilon,
+ "munderover: nonaccent over short base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0045").bottom,
+ tallBaseHeight, epsilon,
+ "munderover: accent over tall base");
+ assert_approx_equals(getBox("ref004").bottom - getBox("over0046").bottom,
+ axisBaseHeight, epsilon,
+ "munderover: accent over short base");
+ for (var j = 4; j <= 6; j++) {
+ var baseId = "base004" + j;
+ var underId = "under004" + j;
+ assert_approx_equals(getBox(underId).top - getBox(baseId).bottom,
+ 0, epsilon,
+ "gap between " + baseId + " and " + underId);
+ }
+ }, "AccentBaseHeight, OverbarVerticalGap");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: accentbaseheight4000underbarextradescender5000;">
+ <mspace id="ref001" height="1em" width="3em" style="background: green"/>
+ <munder style="background: cyan" id="el0011">
+ <mspace id="base0011" height="3em" width="1em" style="background: black"/>
+ <mo id="under0011" style="color: blue">&#xB0;</mo>
+ </munder>
+ <munder style="background: cyan" id="el0012">
+ <mspace id="base0012" height="5em" width="1em" style="background: black"/>
+ <mo id="under0012" style="color: blue">&#x2D8;</mo>
+ </munder>
+ <munder style="background: cyan" id="el0013">
+ <mspace id="base0013" height="3em" width="1em" style="background: black"/>
+ <mo id="under0013" style="color: blue">&#x2D8;</mo>
+ </munder>
+ <munderover style="background: cyan" id="el0014">
+ <mspace id="base0014" height="3em" width="1em" style="background: black"/>
+ <mo id="under0014" style="color: blue">&#xB0;</mo>
+ <mo id="over0014" style="color: red">&#xB0;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0015" accent="true">
+ <mspace id="base0015" height="5em" width="1em" style="background: black"/>
+ <mo id="under0015" style="color: blue">&#x2D8;</mo>
+ <mo id="over0015" style="color: red">&#x2D8;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0016" accent="true">
+ <mspace id="base0016" height="3em" width="1em" style="background: black"/>
+ <mo id="under0016" style="color: blue">&#x2D8;</mo>
+ <mo id="over0016" style="color: red">&#x2D8;</mo>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000underbarverticalgap7000;">
+ <mspace id="ref002" height="1em" width="3em" style="background: green"/>
+ <munder style="background: cyan" id="el0021" accentunder="false">
+ <mspace id="base0021" height="3em" width="1em" style="background: black"/>
+ <mo id="under0021" style="color: blue">&#x2D8;</mo>
+ </munder>
+ <munder style="background: cyan" id="el0022">
+ <mspace id="base0022" height="5em" width="1em" style="background: black"/>
+ <mo id="under0022" style="color: blue" accent="true">&#x2D8;</mo>
+ </munder>
+ <munder style="background: cyan" id="el0023">
+ <mspace id="base0023" height="3em" width="1em" style="background: black"/>
+ <mo id="under0023" style="color: blue" accent="true">&#xB0;</mo>
+ </munder>
+ <munderover style="background: cyan" id="el0024">
+ <mspace id="base0024" height="3em" width="1em" style="background: black"/>
+ <mo id="under0024" style="color: blue" accent="false">&#x2D8;</mo>
+ <mo id="over0024" style="color: red" accent="false">&#x2D8;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0025">
+ <mspace id="base0025" height="5em" width="1em" style="background: black"/>
+ <mo id="under0025" style="color: blue" accent="false">&#x2D8;</mo>
+ <mo id="over0025" style="color: red">&#x2D8;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0026">
+ <mspace id="base0026" height="3em" width="1em" style="background: black"/>
+ <mo id="under0026" style="color: blue" accent="false">&#x2D8;</mo>
+ <mo id="over0026" style="color: red">&#x2D8;</mo>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000overbarextraascender3000;">
+ <mspace id="ref003" height="1em" width="3em" style="background: green"/>
+ <mover style="background: cyan" id="el0031">
+ <mspace id="base0031" height="3em" width="1em" style="background: black"/>
+ <mo id="over0031" style="color: red">&#xB0;</mo>
+ </mover>
+ <mover style="background: cyan" id="el0032" accent="true">
+ <mspace id="base0032" height="5em" width="1em" style="background: black"/>
+ <mo id="over0032" style="color: red">&#xB0;</mo>
+ </mover>
+ <mover style="background: cyan" id="el0033">
+ <mspace id="base0033" height="3em" width="1em" style="background: black"/>
+ <mo id="over0033" style="color: red">&#x2D8;</mo>
+ </mover>
+ <munderover style="background: cyan" id="el0034">
+ <mspace id="base0034" height="3em" width="1em" style="background: black"/>
+ <mo id="under0034" style="color: blue">&#xB0;</mo>
+ <mo id="over0034" style="color: red" accent="false">&#x2D8;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0035" accent="true">
+ <mspace id="base0035" height="5em" width="1em" style="background: black"/>
+ <mo id="under0035" style="color: blue">&#x2D8;</mo>
+ <mo id="over0035" style="color: red">&#x2D8;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0036" accent="true">
+ <mspace id="base0036" height="3em" width="1em" style="background: black"/>
+ <mo id="under0036" style="color: blue">&#x2D8;</mo>
+ <mo id="over0036" style="color: red">&#x2D8;</mo>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: accentbaseheight4000overbarverticalgap11000;">
+ <mspace id="ref004" height="1em" width="3em" style="background: green"/>
+ <mover style="background: cyan" id="el0041">
+ <mspace id="base0041" height="3em" width="1em" style="background: black"/>
+ <mo id="over0041" style="color: red">&#xB0;</mo>
+ </mover>
+ <mover style="background: cyan" id="el0042" accent="true">
+ <mspace id="base0042" height="5em" width="1em" style="background: black"/>
+ <mo id="over0042" style="color: red">&#xB0;</mo>
+ </mover>
+ <mover style="background: cyan" id="el0043">
+ <mspace id="base0043" height="3em" width="1em" style="background: black"/>
+ <mo id="over0043" style="color: red">&#x2D8;</mo>
+ </mover>
+ <munderover style="background: cyan" id="el0044">
+ <mspace id="base0044" height="3em" width="1em" style="background: black"/>
+ <mo id="under0044" style="color: blue">&#xB0;</mo>
+ <mo id="over0044" style="color: red" accent="false">&#x2D8;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0045" accent="true">
+ <mspace id="base0045" height="5em" width="1em" style="background: black"/>
+ <mo id="under0045" style="color: blue">&#x2D8;</mo>
+ <mo id="over0045" style="color: red">&#x2D8;</mo>
+ </munderover>
+ <munderover style="background: cyan" id="el0046" accent="true">
+ <mspace id="base0046" height="3em" width="1em" style="background: black"/>
+ <mo id="under0046" style="color: blue">&#x2D8;</mo>
+ <mo id="over0046" style="color: red">&#x2D8;</mo>
+ </munderover>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-1.html
new file mode 100644
index 00000000000..47c719cfce8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-1.html
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Underscripts and Overscripts parameters (embellished operators)</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<meta name="assert" content="Elements munder, mover, munderover (with an embelished operator base) correctly use the limit parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace, mo {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: lowerlimitbaselinedropmin3000;
+ src: url("../../../fonts/math/limits-lowerlimitbaselinedropmin3000.woff");
+ }
+ @font-face {
+ font-family: lowerlimitgapmin11000;
+ src: url("../../../fonts/math/limits-lowerlimitgapmin11000.woff");
+ }
+ @font-face {
+ font-family: upperlimitbaselinerisemin5000;
+ src: url("../../../fonts/math/limits-upperlimitbaselinerisemin5000.woff");
+ }
+ @font-face {
+ font-family: upperlimitgapmin7000;
+ src: url("../../../fonts/math/limits-upperlimitgapmin7000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("under00011").top - getBox("ref0001").bottom,
+ v, epsilon, "munder: under shift");
+ assert_approx_equals(getBox("under00012").top - getBox("ref0001").bottom,
+ v, epsilon, "munderover: under shift");
+ }, "LowerLimitBaselineDropMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 11000 * emToPx;
+ assert_approx_equals(getBox("under00021").top - getBox("ref0002").bottom,
+ v, epsilon, "munder: under gap");
+ assert_approx_equals(getBox("under00022").top - getBox("ref0002").bottom,
+ v, epsilon, "munderover: under gap");
+ }, "LowerLimitGapMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("ref0003").top - getBox("over00031").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0003").top - getBox("over00032").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "UpperLimitBaselineRiseMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 7000 * emToPx;
+ assert_approx_equals(getBox("ref0004").top - getBox("over00041").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0004").top - getBox("over00042").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "UpperLimitGapMin");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: lowerlimitbaselinedropmin3000;">
+ <mspace id="ref0001" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace id="under00011" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace id="under00012" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: lowerlimitgapmin11000;">
+ <mspace id="ref0002" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace id="under00021" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace id="under00022" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: upperlimitbaselinerisemin5000;">
+ <mspace id="ref0003" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace id="over00031" height="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00032" height="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: upperlimitgapmin7000;">
+ <mspace id="ref0004" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace id="over00041" depth="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mrow><mrow><mo movablelimits="false">&#x2211;</mo></mrow></mrow>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00042" depth="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-2.html
new file mode 100644
index 00000000000..a6c1edf199d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/scripts/underover-parameters-and-embellished-operator-2.html
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Underscripts and Overscripts parameters (embellished operators)</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<meta name="assert" content="Elements munder, mover, munderover (with an embelished operator base) correctly use the stretch stack parameters from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace, mo {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: bottomshiftdown3000;
+ src: url("../../../fonts/math/stretchstack-bottomshiftdown3000.woff");
+ }
+ @font-face {
+ font-family: gapbelowmin11000;
+ src: url("../../../fonts/math/stretchstack-gapbelowmin11000.woff");
+ }
+ @font-face {
+ font-family: topshiftup5000;
+ src: url("../../../fonts/math/stretchstack-topshiftup5000.woff");
+ }
+ @font-face {
+ font-family: gapabovemin7000;
+ src: url("../../../fonts/math/stretchstack-gapabovemin7000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 3000 * emToPx;
+ assert_approx_equals(getBox("under00011").top - getBox("ref0001").bottom,
+ v, epsilon, "munder: under shift");
+ assert_approx_equals(getBox("under00012").top - getBox("ref0001").bottom,
+ v, epsilon, "munderover: under shift");
+ }, "StretchStackBottomShiftDown");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 11000 * emToPx;
+ assert_approx_equals(getBox("under00021").top - getBox("ref0002").bottom,
+ v, epsilon, "munder: under gap");
+ assert_approx_equals(getBox("under00022").top - getBox("ref0002").bottom,
+ v, epsilon, "munderover: under gap");
+ }, "StretchStackGapBelowMin");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 5000 * emToPx;
+ assert_approx_equals(getBox("ref0003").top - getBox("over00031").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0003").top - getBox("over00032").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "StretchStackTopShiftUp");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v = 7000 * emToPx;
+ assert_approx_equals(getBox("ref0004").top - getBox("over00041").bottom,
+ v, epsilon, "mover: over shift");
+ assert_approx_equals(getBox("ref0004").top - getBox("over00042").bottom,
+ v, epsilon, "munderover: over shift");
+ }, "StretchStackGapAboveMin");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: bottomshiftdown3000;">
+ <mspace id="ref0001" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace id="under00011" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace id="under00012" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: gapbelowmin11000;">
+ <mspace id="ref0002" height="1em" width="3em" style="background: green"/>
+ <munder>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace id="under00021" depth="1em" width="3em" style="background: blue"/>
+ </munder>
+ <munderover>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace id="under00022" depth="1em" width="3em" style="background: blue"/>
+ <mspace height="1em" width="3em" style="background: black"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: topshiftup5000;">
+ <mspace id="ref0003" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace id="over00031" height="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00032" height="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math style="font-family: gapabovemin7000;">
+ <mspace id="ref0004" height="1em" width="3em" style="background: green"/>
+ <mover>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace id="over00041" depth="1em" width="3em" style="background: blue"/>
+ </mover>
+ <munderover>
+ <mrow><mrow><mo>&#x2192;</mo></mrow></mrow>
+ <mspace height="1em" width="3em" style="background: black"/>
+ <mspace id="over00042" depth="1em" width="3em" style="background: blue"/>
+ </munderover>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/mspace-width-height-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/mspace-width-height-001.html
new file mode 100644
index 00000000000..2f1aa17ea7e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/mspace-width-height-001.html
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Space</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#space-mspace">
+<meta name="assert" content="Verify mspace metrics for different values of height, depth and width">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function getMetrics(aId) {
+ let baseline = document.getElementById("baseline").getBoundingClientRect();
+ let mspace = document.getElementById(aId).getBoundingClientRect();
+ return {
+ width: mspace.width,
+ height: mspace.height,
+ line_ascent: (baseline.top + baseline.bottom)/2 - mspace.top
+ };
+ }
+
+ function runTests() {
+ test(function() {
+ let metrics = getMetrics("widthAttributePlusWidthProperty");
+ assert_approx_equals(metrics.width, 200, epsilon,
+ "mspace width overridden by inline style");
+ assert_approx_equals(metrics.height, 200, epsilon,
+ "mspace height as specified by height attribute");
+ assert_approx_equals(metrics.line_ascent, 200, epsilon,
+ "mspace line-ascent as specified by height attribute");
+ }, "width attribute + width property");
+
+ test(function() {
+ let metrics = getMetrics("heightAndDepthAttributesPlusHeightProperty");
+ assert_approx_equals(metrics.width, 200, epsilon,
+ "mspace width as specified by attribute");
+ assert_approx_equals(metrics.height, 200, epsilon,
+ "mspace height overridden by inline style");
+ assert_approx_equals(metrics.line_ascent, 100, epsilon,
+ "mspace line-ascent as specified by height attribute");
+ }, "height/depth attributes + height property");
+
+ test(function() {
+ let metrics = getMetrics("heightAttributePlusHeightProperty");
+ assert_approx_equals(metrics.width, 200, epsilon,
+ "mspace width as specified by attribute");
+ assert_approx_equals(metrics.height, 200, epsilon,
+ "mspace height overridden by inline style");
+ assert_approx_equals(metrics.line_ascent, 300, epsilon,
+ "mspace line-ascent as specified by height attribute");
+ }, "height attribute + height property");
+
+ test(function() {
+ let metrics = getMetrics("depthAttributePlusHeightProperty");
+ assert_approx_equals(metrics.width, 200, epsilon,
+ "mspace width as specified by attribute");
+ assert_approx_equals(metrics.height, 200, epsilon,
+ "mspace height overridden by inline style");
+ assert_approx_equals(metrics.line_ascent, 0, epsilon,
+ "mspace line-ascent defaults to 0");
+ }, "depth attribute + height property");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+
+ <math>
+ <!-- Reference baseline -->
+ <mspace id="baseline" style="background: black"
+ width="10px" height="100px" depth="100px"/>
+
+ <!-- width="500px" is a presentational hint
+ setting the element's width property to the corresponding value,
+ overridden by the inline style width: 200px.
+ height="200px" sets the height/line-ascent to 200px. -->
+ <mspace id="widthAttributePlusWidthProperty"
+ width="500px" height="200px"
+ style="width: 200px; background: green"/>
+
+ <!-- height="100px" + depth="200px" are used as a presentational hint
+ setting the element's height property to calc(100px + 200px),
+ overridden by inline style height: 200px.
+ height="100px" sets the line-ascent to 100px. -->
+ <mspace id="heightAndDepthAttributesPlusHeightProperty"
+ width="200px" height="100px" depth="200px"
+ style="height: 200px; background: blue"/>
+
+ <!-- height="300px" is used as a presentational hint
+ setting the element's height property to the corresponding value,
+ overridden by inline style height: 200px.
+ height="300px" sets the line-ascent to 300px. -->
+ <mspace id="heightAttributePlusHeightProperty"
+ width="200px" height="300px"
+ style="height: 200px; background: magenta"/>
+
+ <!-- depth="300px" is used as a presentational hint
+ setting the element's height property to the corresponding value,
+ overridden by inline style height: 200px.
+ The line-ascent defaults to 0. -->
+ <mspace id="depthAttributePlusHeightProperty"
+ width="200px" depth="300px"
+ style="height: 200px; background: yellow"/>
+ </math>
+
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-1.html
new file mode 100644
index 00000000000..737f834cf91
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-1.html
@@ -0,0 +1,150 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Space</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#space-mspace">
+<meta name="assert" content="Verify mspace metrics for different values of height, depth and width">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+ var epsilon = 1;
+ function getBox(aId) {
+ var box = document.getElementById(aId).getBoundingClientRect();
+ box.middle = (box.bottom + box.top) / 2;
+ box.center = (box.left + box.right) / 2;
+ return box;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ test(function() {
+ var empty = getBox("empty");
+ assert_equals(empty.width, 0, "zero width");
+ assert_approx_equals(getBox("baseline").bottom - empty.top, 0, epsilon, "zero depth");
+ assert_approx_equals(empty.bottom - getBox("baseline").bottom, 0, epsilon, "zero depth");
+ }, "Empty mspace");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var space = getBox("width" + i);
+ assert_approx_equals(space.width, 25*(i+1), epsilon, "width " + i);
+ assert_approx_equals(getBox("baseline").bottom - space.top, 0, epsilon, "height" + i);
+ assert_approx_equals(space.bottom - getBox("baseline").bottom, 0, epsilon, "depth" + i);
+ }
+ }, "Different widths");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var space = getBox("height" + i);
+ assert_equals(space.width, 0, "width" + i);
+ assert_approx_equals(getBox("baseline").bottom - space.top, 25*(i+1), epsilon, "height" + i);
+ assert_approx_equals(space.bottom - getBox("baseline").bottom, 0, epsilon, "depth" + i);
+ }
+ }, "Different heights");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var space = getBox("depth" + i);
+ assert_equals(space.width, 0, "width" + i);
+ assert_approx_equals(getBox("baseline").bottom - space.top, 0, epsilon, "height" + i);
+ assert_approx_equals(space.bottom - getBox("baseline").bottom, 25*(i+1), epsilon, "depth" + i);
+ }
+ }, "Different depths");
+
+ test(function() {
+ for (var i = 0; i <= 2; i++) {
+ var space = getBox("mspace" + i);
+ assert_approx_equals(space.width, 25*(1+i%3), epsilon, "width" + i);
+ assert_approx_equals(getBox("baseline").bottom - space.top, 25*(1+(i+1)%3), epsilon, "height" + i);
+ assert_approx_equals(space.bottom - getBox("baseline").bottom, 25*(1+(i+2)%3), epsilon, "depth" + i);
+ }
+ }, "Various combinations of height, depth and width.");
+
+ test(function() {
+ var container = document.getElementById("containerForPreferredWidth");
+ var mspace = container.getElementsByTagName("mspace")[0];
+ var containerWidth = container.getBoundingClientRect().width;
+ var mspaceWidth = mspace.getBoundingClientRect().width;
+ assert_approx_equals(containerWidth, mspaceWidth, epsilon);
+ }, "Preferred width");
+
+ // Dynamically set attributes.
+ ["width", "height", "depth"].forEach(function (name, index) {
+ document.getElementById("dynamic-remove").removeAttribute(name);
+ let length = `${50 + index * 10}px`;
+ document.getElementById("dynamic-attach").setAttribute(name, length);
+ document.getElementById("dynamic-modify").setAttribute(name, length);
+ });
+ let baseline = getBox("baseline2").bottom;
+
+ test(function() {
+ let remove = getBox("dynamic-remove");
+ assert_approx_equals(remove.width, 0, epsilon);
+ assert_approx_equals(remove.height, 0, epsilon);
+ assert_approx_equals(remove.top, baseline, epsilon);
+ }, "dynamic attributes (remove)");
+
+ test(function() {
+ let attach = getBox("dynamic-attach");
+ assert_approx_equals(attach.width, 50, epsilon);
+ assert_approx_equals(attach.height, 60 + 70, epsilon);
+ assert_approx_equals(baseline - attach.top, 60, epsilon);
+ }, "dynamic attributes (attach)");
+
+ test(function() {
+ let modify = getBox("dynamic-modify");
+ assert_approx_equals(modify.width, 50, epsilon);
+ assert_approx_equals(modify.height, 60 + 70, epsilon);
+ assert_approx_equals(baseline - modify.top, 60, epsilon);
+ }, "dynamic attributes (modify)");
+
+ done();
+ }
+</script>
+<style>
+div.shrink-wrap {
+ background: yellow;
+ display: inline-block;
+ margin-top: 5px;
+ padding-top: 5px;
+}
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <span id="baseline" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mspace id="empty"/>
+ <mspace id="width0" width="25px"/>
+ <mspace id="width1" width="50px"/>
+ <mspace id="width2" width="75px"/>
+ <mspace id="height0" height="25px"/>
+ <mspace id="height1" height="50px"/>
+ <mspace id="height2" height="75px"/>
+ <mspace id="depth0" depth="25px"/>
+ <mspace id="depth1" depth="50px"/>
+ <mspace id="depth2" depth="75px"/>
+ <mspace id="mspace0" width="25px" height="50px" depth="75px" style="background: green"/>
+ <mspace id="mspace1" width="50px" height="75px" depth="25px" style="background: blue"/>
+ <mspace id="mspace2" width="75px" height="25px" depth="50px" style="background: green"/>
+ </math>
+ </p>
+ <div>
+ <div id="containerForPreferredWidth" class="shrink-wrap">
+ <math><mspace width="75px" height="25px" depth="50px" style="background: green"/></math>
+ </div>
+ </div>
+ <p>
+ <span id="baseline2" style="display: inline-block; width: 30px; height: 5px; background: blue"></span>
+ <math>
+ <mspace id="dynamic-attach" style="background: lightgreen"/>
+ <mspace id="dynamic-remove" width="10px" height="20px" depth="30px" style="background: lightyellow"/>
+ <mspace id="dynamic-modify" width="100px" height="200px" depth="300px" style="background: pink"/>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-001.html
new file mode 100644
index 00000000000..a2e24ec134b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-001.html
@@ -0,0 +1,340 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Space-like elements</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify definition of space-like elements">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<style>
+ /* Default spacing of operator 'X' is 0.2777777777777778em so quite different
+ from the measured/specified 0em and 1em. */
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ mo {
+ color: yellow;
+ }
+ .testedElement, .testedElement * {
+ color: blue !important;
+ background: blue !important;
+ }
+</style>
+<script>
+ function spaceBefore(id) {
+ var element = document.getElementById(id);
+ var mnBeforeParent = element.parentNode.previousElementSibling;
+ return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
+ }
+
+ function spaceAfter(id) {
+ var element = document.getElementById(id);
+ var mnAfterParent = element.parentNode.nextElementSibling;
+ return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mtext"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("mtext"), emToPx, epsilon);
+ }, "mtext is space-like");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mspace"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("mspace"), emToPx, epsilon);
+ }, "mspace is space-like");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mrow1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("mrow1"), emToPx, epsilon);
+ }, "space-like mrow");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mrow2"), 0, epsilon);
+ assert_approx_equals(spaceAfter("mrow2"), 2 * emToPx, epsilon);
+ }, "non-space-like mrow");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mstyle1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("mstyle1"), emToPx, epsilon);
+ }, "space-like mstyle");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mstyle2"), 0, epsilon);
+ assert_approx_equals(spaceAfter("mstyle2"), 2 * emToPx, epsilon);
+ }, "non-space-like mstyle");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mphantom1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("mphantom1"), emToPx, epsilon);
+ }, "space-like mphantom");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mphantom2"), 0, epsilon);
+ assert_approx_equals(spaceAfter("mphantom2"), 2 * emToPx, epsilon);
+ }, "non-space-like mphantom");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mpadded1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("mpadded1"), emToPx, epsilon);
+ }, "space-like mpadded");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("mpadded2"), 0, epsilon);
+ assert_approx_equals(spaceAfter("mpadded2"), 2 * emToPx, epsilon);
+ }, "non-space-like mpadded");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("merror1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("merror1"), emToPx, epsilon);
+ }, "space-like merror");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("merror2"), 0, epsilon);
+ assert_approx_equals(spaceAfter("merror2"), 2 * emToPx, epsilon);
+ }, "non-space-like merror");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("menclose1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("menclose1"), emToPx, epsilon);
+ }, "space-like menclose");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("menclose2"), 0, epsilon);
+ assert_approx_equals(spaceAfter("menclose2"), 2 * emToPx, epsilon);
+ }, "non-space-like menclose");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mtext is space-like. -->
+ <mtext class="testedElement" id="mtext">X</mtext>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mspace is space-like. -->
+ <mspace class="testedElement" id="mspace" width="25px" height="10px"></mspace>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mrow is space-like when it contains only space-like elements. -->
+ <mrow id="mrow1" class="testedElement">
+ <mtext>X</mtext>
+ <mspace width="25px" height="10px"></mspace>
+ </mrow>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mrow is not space-like when it contains a non space-like element
+ such as "mn". -->
+ <mrow id="mrow2" class="testedElement">
+ <mn>X</mn>
+ <mspace width="25px" height="10px"></mspace>
+ </mrow>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mstyle is space-like when it contains only space-like elements. -->
+ <mstyle id="mstyle1" class="testedElement">
+ <mtext>X</mtext>
+ <mspace width="25px" height="10px"></mspace>
+ </mstyle>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mstyle is not space-like when it contains a non space-like element
+ such as "mn". -->
+ <mstyle id="mstyle2" class="testedElement">
+ <mn>X</mn>
+ <mspace width="25px" height="10px"></mspace>
+ </mstyle>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mphantom is space-like when it contains only space-like elements.
+ -->
+ <mphantom id="mphantom1" class="testedElement">
+ <mtext>X</mtext>
+ <mspace width="25px" height="10px"></mspace>
+ </mphantom>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mphantom is not space-like when it contains a non space-like
+ element such as "mn". -->
+ <mphantom id="mphantom2" class="testedElement">
+ <mn>X</mn>
+ <mspace width="25px" height="10px"></mspace>
+ </mphantom>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mpadded is space-like when it contains only space-like elements. -->
+ <mpadded id="mpadded1" class="testedElement">
+ <mtext>X</mtext>
+ <mspace width="25px" height="10px"></mspace>
+ </mpadded>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- mpadded is not space-like when it contains a non space-like element
+ such as "mn". -->
+ <mpadded id="mpadded2" class="testedElement">
+ <mn>X</mn>
+ <mspace width="25px" height="10px"></mspace>
+ </mpadded>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- merror is space-like when it contains only space-like elements. -->
+ <merror id="merror1" class="testedElement">
+ <mtext>X</mtext>
+ <mspace width="25px" height="10px"></mspace>
+ </merror>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- merror is not space-like when it contains a non space-like element
+ such as "mn". -->
+ <merror id="merror2" class="testedElement">
+ <mn>X</mn>
+ <mspace width="25px" height="10px"></mspace>
+ </merror>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- menclose is space-like when it contains only space-like
+ elements. -->
+ <menclose id="menclose1" class="testedElement">
+ <mtext>X</mtext>
+ <mspace width="25px" height="10px"></mspace>
+ </menclose>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- menclose is not space-like when it contains a non space-like
+ element such as "mn". -->
+ <menclose id="menclose2" class="testedElement">
+ <mn>X</mn>
+ <mspace width="25px" height="10px"></mspace>
+ </menclose>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-002.html
new file mode 100644
index 00000000000..e6711253ed4
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-002.html
@@ -0,0 +1,174 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Space-like elements</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify definition of space-like elements">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<style>
+ /* Default spacing of operator 'X' is 0.2777777777777778em so quite different
+ from the measured/specified 0em and 1em. */
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ mo {
+ color: yellow;
+ }
+ .testedElement, .testedElement * {
+ color: blue !important;
+ background: blue !important;
+ }
+</style>
+<script>
+ function spaceBefore(id) {
+ var element = document.getElementById(id);
+ var mnBeforeParent = element.parentNode.previousElementSibling;
+ return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
+ }
+
+ function spaceAfter(id) {
+ var element = document.getElementById(id);
+ var mnAfterParent = element.parentNode.nextElementSibling;
+ return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("maction1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("maction1"), emToPx, epsilon);
+ }, "space-like maction");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("maction2"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("maction2"), emToPx, epsilon);
+ }, "space-like maction (no first child)");
+
+ test(function() {
+ assert_approx_equals(spaceBefore("maction3"), 0, epsilon);
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceAfter("maction3"), 2 * emToPx, epsilon);
+ }, "non-space like maction (first child not space-like)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("semantics1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("semantics1"), emToPx, epsilon);
+ }, "space-like semantics");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("semantics2"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("semantics2"), emToPx, epsilon);
+ }, "space-like semantics (no first child)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("semantics3"), 0, epsilon);
+ assert_approx_equals(spaceAfter("semantics3"), 2 * emToPx, epsilon);
+ }, "non-space like semantics (first child not space-like)");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- maction is space-like when its first child exists and is space-like -->
+ <maction id="maction1" class="testedElement" actiontype="statusline">
+ <mtext>X</mtext>
+ <mtext>STATUS MESSAGE</mtext>
+ </maction>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- maction is not space-like when its first does not exist-like -->
+ <maction id="maction2" class="testedElement" actiontype="statusline">
+ </maction>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- maction is not space-like when its first is not space-like -->
+ <maction id="maction3" class="testedElement" actiontype="statusline">
+ <mn>1</mn>
+ <mtext>STATUS MESSAGE</mtext>
+ </maction>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- semantics is space-like when its first child exists and is space-like -->
+ <semantics id="semantics1" class="testedElement" actiontype="statusline">
+ <mtext>X</mtext>
+ <annotation>TEXT ANNOTATION</annotation>
+ </semantics>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- semantics is not space-like when its first does not exist-like -->
+ <semantics id="semantics2" class="testedElement" actiontype="statusline">
+ </semantics>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- semantics is not space-like when its first is not space-like -->
+ <semantics id="semantics3" class="testedElement" actiontype="statusline">
+ <mn>1</mn>
+ <annotation>TEXT ANNOTATION</annotation>
+ </semantics>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-003.html
new file mode 100644
index 00000000000..333aedb50e1
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-003.html
@@ -0,0 +1,252 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Non space-like elements</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify definition of space-like elements">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<style>
+ /* Default spacing of operator 'X' is 0.2777777777777778em so quite different
+ from the measured/specified 0em and 1em. */
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ mo {
+ color: yellow;
+ }
+ .testedElement, .testedElement * {
+ color: blue !important;
+ background: blue !important;
+ }
+</style>
+<script>
+ function spaceBefore(element) {
+ var mnBeforeParent = element.parentNode.previousElementSibling;
+ return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
+ }
+
+ function spaceAfter(element) {
+ var mnAfterParent = element.parentNode.nextElementSibling;
+ return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ Array.from(document.querySelectorAll(".testedElement")).forEach(el => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore(el), 0, epsilon);
+ assert_approx_equals(spaceAfter(el), 2 * emToPx, epsilon);
+ }, `${el.tagName} is not space-like`);
+ });
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mroot class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mroot>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mfrac class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mfrac>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mi class="testedElement" mathvariant="normal">X</mi>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mmultiscripts class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mmultiscripts>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mn class="testedElement">X</mn>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mo class="testedElement" lspace="0" rspace="0">X</mo>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mover class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mover>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <munder class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </munder>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <ms class="testedElement">X</ms>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <munderover class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </munderover>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <msup class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </msup>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <msub class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </msub>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <msubsup class="testedElement">
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </msubsup>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <msqrt class="testedElement">
+ <mtext>X</mtext>
+ </msqrt>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <mtable class="testedElement">
+ <mtr>
+ <mtd>
+ <mtext>X</mtext>
+ </mtd>
+ </mtr>
+ </mtable>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-004.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-004.html
new file mode 100644
index 00000000000..a8bec1f062c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/spaces/space-like-004.html
@@ -0,0 +1,446 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Space-like elements</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#definition-of-space-like-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
+<meta name="assert" content="Verify definition of space-like elements">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/box-navigation.js"></script>
+<style>
+ /* Default spacing of operator 'X' is 0.2777777777777778em so quite different
+ from the measured/specified 0em and 1em. */
+ math, math * {
+ font: 25px/1 Ahem;
+ }
+ mn {
+ color: black;
+ }
+ mo {
+ color: yellow;
+ }
+ .testedElement, .testedElement * {
+ color: blue !important;
+ background: blue !important;
+ }
+ .oof1 {
+ position: absolute;
+ }
+ .oof2 {
+ position: fixed;
+ }
+ .nobox {
+ display: none;
+ }
+</style>
+<script>
+ function spaceBefore(id) {
+ var element = document.getElementById(id);
+ var mnBeforeParent = previousInFlowSibling(element.parentNode);
+ return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
+ }
+
+ function spaceAfter(id) {
+ var element = document.getElementById(id);
+ var mnAfterParent = nextInFlowSibling(element.parentNode);
+ return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var epsilon = 1;
+ var emToPx = 25;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("complex1"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("complex1"), emToPx, epsilon);
+ }, "complex space-like subtree");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("complex1-bis"), emToPx, epsilon);
+ assert_approx_equals(spaceAfter("complex1-bis"), emToPx, epsilon);
+ }, "complex space-like subtree, from in-flow children");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("complex2"), 0, epsilon);
+ assert_approx_equals(spaceAfter("complex2"), 2 * emToPx, epsilon);
+ }, "complex non-space-like subtree");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_operator_spacing());
+ assert_approx_equals(spaceBefore("complex2-bis"), 0, epsilon);
+ assert_approx_equals(spaceAfter("complex2-bis"), 2 * emToPx, epsilon);
+ }, "complex non-space-like subtree, from in-flow children");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- This element is space-like because it is made of nested
+ mrow, mstyle, mpadded, mphantom, mtext, mspace
+ -->
+ <mrow class="testedElement" id="complex1">
+ <mtext>X</mtext>
+ <mstyle>
+ <mstyle>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mstyle>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mpadded>
+ <mtext>X</mtext>
+ <mrow></mrow>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mphantom>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ </mphantom>
+ <mrow>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mrow>
+ <mspace width="25px"></mspace>
+ </mpadded>
+ <mspace width="25px"></mspace>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mpadded>
+ <mphantom>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ </mphantom>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mphantom>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ </mphantom>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ </mpadded>
+ </mstyle>
+ <mspace width="25px"></mspace>
+ </mrow>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow>
+ <!-- This element is space-like because it is made of nested
+ mrow, mstyle, mpadded, mphantom, mtext, mspace
+ -->
+ <mrow class="testedElement" id="complex1-bis">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow></mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="1em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn>X</mn>
+ <mrow>
+ <!-- This element is not space-like. It is made of nested
+ mrow, mstyle, mpadded, mphantom, mtext, mspace but contains
+ one non-space like descendant (an mn element).
+ -->
+ <mrow class="testedElement" id="complex2">
+ <mtext>X</mtext>
+ <mstyle>
+ <mstyle>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mstyle>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mpadded>
+ <mtext>X</mtext>
+ <mrow></mrow>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mphantom>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ </mphantom>
+ <mrow>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </mrow>
+ <mspace width="25px"></mspace>
+ </mpadded>
+ <mspace width="25px"></mspace>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mpadded>
+ <mphantom>
+ <mn>X</mn> <!-- mn is not space-like -->
+ <mspace width="25px"></mspace>
+ </mphantom>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ <mphantom>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ </mphantom>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ <mspace width="25px"></mspace>
+ </mpadded>
+ </mstyle>
+ <mspace width="25px"></mspace>
+ </mrow>
+ <mo lspace="1em" rspace="0em">X</mo>
+ </mrow>
+ <mn>X</mn>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow>
+ <!-- This element is not space-like. It is made of nested
+ mrow, mstyle, mpadded, mphantom, mtext, mspace but contains
+ one non-space like descendant (an mn element).
+ -->
+ <mrow class="testedElement" id="complex2-bis">
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow></mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn> <!-- mn is not space-like -->
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mphantom>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mtext>X</mtext>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mpadded>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mstyle>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mspace width="25px"></mspace>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mo lspace="1em" rspace="0em">X</mo>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </mrow>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ <mn>X</mn>
+ <mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/dynamic-table-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/dynamic-table-001.html
new file mode 100644
index 00000000000..7603de81208
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/dynamic-table-001.html
@@ -0,0 +1,301 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Dynamic tabular elements</title>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<link rel="help" href="https://w3c.github.io/mathml-core/#table-or-matrix-mtable">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript">
+<meta name="assert" content="Dynamically modify DOM tree of mtables">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script>
+ function forceCells(mtable, rows, cols) {
+ while (mtable.children.length > rows)
+ mtable.removeChild(mtable.lastElementChild);
+ while (mtable.children.length < rows)
+ mtable.appendChild(FragmentHelper.createElement("mtr"));
+ for (let i = 0; i < rows; i++) {
+ let mtr = mtable.children[i];
+ while (mtr.children.length > cols)
+ mtr.removeChild(mtr.lastElementChild);
+ while (mtr.children.length < cols)
+ mtr.appendChild(FragmentHelper.createElement("mtd"));
+
+ for (let j = 0; j < cols; j++) {
+ let mtd = mtr.children[j];
+ while (mtd.children.length > 0)
+ mtd.removeChild(mtd.lastElementChild);
+ let mspace = FragmentHelper.createElement("mspace");
+ mspace.setAttribute("height", `${10*(i+1)}px`);
+ mspace.setAttribute("width", `${10*(j+1)}px`);
+ mspace.setAttribute("style", `background: black;`);
+ mtd.appendChild(mspace);
+ }
+ }
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", function() {
+ // force initial layout so we're sure what we're testing against
+ document.documentElement.getBoundingClientRect();
+
+ let reference = document.getElementById("reference");
+
+ Array.from(document.querySelectorAll("[data-title]")).forEach(mtable => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ forceCells(mtable, 4, 3);
+ const epsilon = 1;
+ compareLayout(mtable, reference, epsilon);
+ }, `${mtable.getAttribute("data-title")}`);
+ });
+ done();
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mtable id="reference">
+ <mtr>
+ <mtd><mspace height="10px" width="10px" style="background: blue;"/></mtd>
+ <mtd><mspace height="10px" width="20px" style="background: blue;"/></mtd>
+ <mtd><mspace height="10px" width="30px" style="background: blue;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="20px" width="10px" style="background: blue;"/></mtd>
+ <mtd><mspace height="20px" width="20px" style="background: blue;"/></mtd>
+ <mtd><mspace height="20px" width="30px" style="background: blue;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="30px" width="10px" style="background: blue;"/></mtd>
+ <mtd><mspace height="30px" width="20px" style="background: blue;"/></mtd>
+ <mtd><mspace height="30px" width="30px" style="background: blue;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="40px" width="10px" style="background: blue;"/></mtd>
+ <mtd><mspace height="40px" width="20px" style="background: blue;"/></mtd>
+ <mtd><mspace height="40px" width="30px" style="background: blue;"/></mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Filling an empty mtable element"></mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Filling empty mtr elements">
+ <mtr></mtr>
+ <mtr></mtr>
+ <mtr></mtr>
+ <mtr></mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Filling empty mtd elements">
+ <mtr>
+ <mtd></mtd>
+ <mtd></mtd>
+ <mtd></mtd>
+ </mtr>
+ <mtr>
+ <mtd></mtd>
+ <mtd></mtd>
+ <mtd></mtd>
+ </mtr>
+ <mtr>
+ <mtd></mtd>
+ <mtd></mtd>
+ <mtd></mtd>
+ </mtr>
+ <mtr>
+ <mtd></mtd>
+ <mtd></mtd>
+ <mtd></mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Filling an empty mtr element">
+ <mtr>
+ <mtd><mspace height="10px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <!-- Empty mtr -->
+ </mtr>
+ <mtr>
+ <mtd><mspace height="30px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="40px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Filling an empty mtd element">
+ <mtr>
+ <mtd><mspace height="10px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="20px" width="10px" style="background: black;"/></mtd>
+ <mtd><!-- Empty --></mtd>
+ <mtd><mspace height="20px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="30px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="40px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Adding missing elements">
+ <mtr>
+ <mtd><mspace height="10px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="20px" style="background: black;"/></mtd>
+ <!-- Cell missing -->
+ </mtr>
+ <mtr>
+ <mtd><mspace height="20px" width="10px" style="background: black;"/></mtd>
+ <mtd><!-- Empty --></mtd>
+ <mtd><mspace height="20px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="30px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <!-- Row missing -->
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Removing a row">
+ <mtr>
+ <mtd><mspace height="10px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="20px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="30px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="40px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="30px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="50px" width="10px" style="background: red;"/></mtd>
+ <mtd><mspace height="50px" width="20px" style="background: red;"/></mtd>
+ <mtd><mspace height="50px" width="30px" style="background: red;"/></mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Removing a column">
+ <mtr>
+ <mtd><mspace height="10px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="40px" style="background: red;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="20px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="40px" style="background: red;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="30px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="40px" style="background: red;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="40px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="40px" style="background: red;"/></mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable data-title="Removing extra elements">
+ <mtr>
+ <mtd><mspace height="10px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="40px" style="background: black;"/></mtd>
+ <mtd><mspace height="10px" width="50px" style="background: red;"/></mtd><!-- extra mtd -->
+ </mtr>
+ <mtr>
+ <mtd><mspace height="20px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="20px" width="40px" style="background: black;"/><mspace height="20px" width="40px" style="background: red;"/><!-- extra child--></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="30px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="30px" width="40px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="40px" width="10px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="20px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="30px" style="background: black;"/></mtd>
+ <mtd><mspace height="40px" width="40px" style="background: black;"/></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mspace height="50px" width="10px" style="background: red;"/></mtd>
+ <mtd><mspace height="50px" width="20px" style="background: red;"/></mtd>
+ <mtd><mspace height="50px" width="30px" style="background: red;"/></mtd>
+ <mtd><mspace height="50px" width="40px" style="background: red;"/></mtd>
+ </mtr> <!-- extra row -->
+ </mtable>
+ </math>
+ </p>
+
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-001.html
new file mode 100644
index 00000000000..a5300f74879
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-001.html
@@ -0,0 +1,286 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Basic table layout</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#table-or-matrix-mtable">
+<meta name="assert" content="Verify position of cells in basic 2x2, 4x3 and 3x4 math tables.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests() {
+ Array.from(document.getElementsByTagName("mtable")).forEach(table => {
+ const id = table.getAttribute("id");
+ const rtl = window.getComputedStyle(table).direction === "rtl";
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ const rows = Array.from(table.getElementsByTagName("mtr"));
+ for (var j = 0; j < rows.length; j++) {
+ var cells = Array.from(rows[j].getElementsByTagName("mtd"));
+ for (var i = 0; i < cells.length - 1; i++) {
+ var space1 = cells[i].firstElementChild.getBoundingClientRect();
+ var space2 = cells[i + 1].firstElementChild.getBoundingClientRect();
+ assert_equals(space1.top, space2.top,
+ `Cells (${i},${j}) and (${i + 1},${j}) should have same vertical position`);
+ if (rtl) {
+ assert_greater_than(space1.left, space2.right,
+ `Cell (${i},${j}) should be on the right of (${i + 1},${j})`);
+ } else {
+ assert_less_than(space1.right, space2.left,
+ `Cell (${i},${j}) should be on the left of (${i + 1},${j})`);
+ }
+ }
+ }
+
+ for (var j = 0; j < rows.length - 1; j++) {
+ var cells1 = Array.from(rows[j].getElementsByTagName("mtd"));
+ var cells2 = Array.from(rows[j + 1].getElementsByTagName("mtd"));
+ for (var i = 0; i < cells1.length; i++) {
+ var space1 = cells1[i].firstElementChild.getBoundingClientRect();
+ var space2 = cells2[i].firstElementChild.getBoundingClientRect();
+ assert_equals(space1.left, space2.left,
+ `Cells (${i},${j}) and (${i},${j + 1}) should have same horizontal position`);
+ assert_less_than(space1.bottom, space2.top,
+ `Cell (${i},${j}) should be above (${i},${j + 1})`);
+ }
+ }
+ }, `Layout of ${id}`);
+
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mtable id="table-001">
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightblue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightgreen;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: blue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: green;"></mspace>
+ </mtd>
+ </mtr>
+ </mtable>
+ <mtable id="table-002">
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightblue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightgreen;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: cyan;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: purple;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: blue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: green;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: yellow;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: orange;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: black;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: red;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: gray;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: maroon;"></mspace>
+ </mtd>
+ </mtr>
+ </mtable>
+ <mtable id="table-003">
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightblue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightgreen;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: cyan;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: blue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: green;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: orange;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: black;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: maroon;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: gray;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: red;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: purple;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: yellow;"></mspace>
+ </mtd>
+
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mtable id="table-011">
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightblue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightgreen;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: blue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: green;"></mspace>
+ </mtd>
+ </mtr>
+ </mtable>
+ <mtable id="table-012">
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightblue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightgreen;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: cyan;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: purple;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: blue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: green;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: yellow;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: orange;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: black;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: red;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: gray;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: maroon;"></mspace>
+ </mtd>
+ </mtr>
+ </mtable>
+ <mtable id="table-013">
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightblue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: lightgreen;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: cyan;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: blue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: green;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: orange;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: black;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: maroon;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: gray;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: red;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: purple;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: yellow;"></mspace>
+ </mtd>
+
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-002.html
new file mode 100644
index 00000000000..5bc4c2bc396
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-002.html
@@ -0,0 +1,146 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Basic table alignment</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#table-or-matrix-mtable">
+<meta name="assert" content="Verify alignment of cells with inline elements in basic 2x2, 4x3 and 3x4 math tables.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests() {
+ var epsilon = 1;
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ const ascents = [40, 0, 20, 30, 10, 80, 0, 40, 70, 30];
+ const row = document.getElementById("vertical").firstElementChild;
+ const cells = Array.from(row.getElementsByTagName("mtd"));
+ for (var i = 0; i < cells.length - 1; i++) {
+ var space1 = cells[i].firstElementChild.getBoundingClientRect();
+ var space2 = cells[i + 1].firstElementChild.getBoundingClientRect();
+ assert_approx_equals(space1.top + ascents[i],
+ space2.top + ascents[i + 1],
+ epsilon,
+ `Baselines of cells ${i} and ${i + 1} should be aligned.`);
+ }
+ }, `Vertical alignment of cells`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ const table = document.getElementById("horizontal");
+ const rows = Array.from(table.getElementsByTagName("mtr"));
+ for (var j = 0; j < rows.length - 1; j++) {
+ var space1 = rows[j].firstElementChild.firstElementChild.getBoundingClientRect();
+ var space2 = rows[j + 1].firstElementChild.firstElementChild.getBoundingClientRect();
+ assert_approx_equals((space1.left + space1.right) / 2,
+ (space2.left + space2.right) / 2,
+ epsilon,
+ `Baselines of cells ${j} and ${j + 1} should be aligned.`);
+ }
+ }, `Horizontal alignment of cells`);
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mtable id="vertical">
+ <mtr>
+ <mtd>
+ <mspace width="10px" height="40px" depth="0px" style="background: lightblue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="0px" depth="40px" style="background: lightgreen;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="20px" depth="20px" style="background: cyan;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="30px" depth="10px" style="background: purple;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="10px" depth="30px" style="background: orange;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="80px" depth="0px" style="background: blue;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="0px" depth="80px" style="background: green;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="40px" depth="40px" style="background: yellow;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="70px" depth="30px" style="background: red;"></mspace>
+ </mtd>
+ <mtd>
+ <mspace width="10px" height="30px" depth="70px" style="background: black;"></mspace>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable id="horizontal">
+ <mtr>
+ <mtd>
+ <mspace width="10px" height="10px" style="background: lightblue;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="40px" height="10px" style="background: lightgreen;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="30px" height="10px" style="background: cyan;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="20px" height="10px" style="background: purple;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="50px" height="10px" style="background: orange;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="100px" height="10px" style="background: blue;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="90px" height="10px" style="background: green;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="70px" height="10px" style="background: yellow;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="80px" height="10px" style="background: red;"></mspace>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mspace width="40px" height="10px" style="background: black;"></mspace>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-003.html
new file mode 100644
index 00000000000..ae72936b0e4
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-003.html
@@ -0,0 +1,146 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Basic table alignment</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#table-or-matrix-mtable">
+<meta name="assert" content="Verify alignment of cells with block elements in basic 2x2, 4x3 and 3x4 math tables.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests() {
+ var epsilon = 1;
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ const ascents = [40, 0, 20, 30, 10, 80, 0, 40, 70, 30];
+ const row = document.getElementById("vertical").firstElementChild;
+ const cells = Array.from(row.getElementsByTagName("mtd"));
+ for (var i = 0; i < cells.length - 1; i++) {
+ var space1 = cells[i].firstElementChild.firstElementChild.getBoundingClientRect();
+ var space2 = cells[i + 1].firstElementChild.firstElementChild.getBoundingClientRect();
+ assert_approx_equals(space1.top + ascents[i],
+ space2.top + ascents[i + 1],
+ epsilon,
+ `Baselines of cells ${i} and ${i + 1} should be aligned.`);
+ }
+ }, `Vertical alignment of cells`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ const table = document.getElementById("horizontal");
+ const rows = Array.from(table.getElementsByTagName("mtr"));
+ for (var j = 0; j < rows.length - 1; j++) {
+ var space1 = rows[j].firstElementChild.firstElementChild.firstElementChild.getBoundingClientRect();
+ var space2 = rows[j + 1].firstElementChild.firstElementChild.firstElementChild.getBoundingClientRect();
+ assert_approx_equals((space1.left + space1.right) / 2,
+ (space2.left + space2.right) / 2,
+ epsilon,
+ `Baselines of cells ${j} and ${j + 1} should be aligned.`);
+ }
+ }, `Horizontal alignment of cells`);
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mtable id="vertical">
+ <mtr>
+ <mtd>
+ <mrow><mspace width="10px" height="40px" depth="0px" style="background: lightblue;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="0px" depth="40px" style="background: lightgreen;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="20px" depth="20px" style="background: cyan;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="30px" depth="10px" style="background: purple;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="10px" depth="30px" style="background: orange;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="80px" depth="0px" style="background: blue;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="0px" depth="80px" style="background: green;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="40px" depth="40px" style="background: yellow;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="70px" depth="30px" style="background: red;"></mspace></mrow>
+ </mtd>
+ <mtd>
+ <mrow><mspace width="10px" height="30px" depth="70px" style="background: black;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable id="horizontal">
+ <mtr>
+ <mtd>
+ <mrow><mspace width="10px" height="10px" style="background: lightblue;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="40px" height="10px" style="background: lightgreen;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="30px" height="10px" style="background: cyan;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="20px" height="10px" style="background: purple;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="50px" height="10px" style="background: orange;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="100px" height="10px" style="background: blue;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="90px" height="10px" style="background: green;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="70px" height="10px" style="background: yellow;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="80px" height="10px" style="background: red;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mrow><mspace width="40px" height="10px" style="background: black;"></mspace></mrow>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-axis-height.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-axis-height.html
new file mode 100644
index 00000000000..c568d879fd0
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-axis-height.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>table axis height</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#table-or-matrix-mtable">
+<meta name="assert" content="Element mtable correctly uses the axis height parameter from the MATH table.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ math, mspace {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: axisheight5000-verticalarrow14000;
+ src: url("../../../fonts/math/axisheight5000-verticalarrow14000.woff");
+ }
+</style>
+<script>
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 1;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+
+ var v1 = 5000 * emToPx;
+ var tableMiddle = (getBox("table").bottom + getBox("table").top) / 2;
+ assert_approx_equals(getBox("baseline").bottom - tableMiddle,
+ v1, epsilon, "mtable: axis height");
+ }, "AxisHeight");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math style="font-family: axisheight5000-verticalarrow14000">
+ <mspace id="baseline" style="background: green" width="50px" height="1px"/>
+ <mtable id="table" style="background: blue"><mtr><mtd><mspace width="100px" height="1px"/></mtd></mtr></mtable>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-cell-mrow-layout.html b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-cell-mrow-layout.html
new file mode 100644
index 00000000000..eb0ede36f50
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/presentation-markup/tables/table-cell-mrow-layout.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Table cell mrow layout</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#table-or-matrix-mtable">
+<meta name="assert" content="Table cell relies on the mrow layout for their children.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<style>
+ /* Remove default padding, since there is none on reference mrow element. */
+ mtd { padding: 0; }
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mtable id="mtable">
+ <mtr>
+ <mtd id="mtd">
+ <mspace width="10px" depth="20px" height="20px" style="background: blue"/>
+ <mspace width="10px" depth="10px" height="30px" style="background: lightblue"/>
+ <mspace width="10px" depth="30px" height="10px" style="background: black"/>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow id="mtd-reference">
+ <mspace width="10px" depth="20px" height="20px" style="background: blue"/>
+ <mspace width="10px" depth="10px" height="30px" style="background: lightblue"/>
+ <mspace width="10px" depth="30px" height="10px" style="background: black"/>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mtable id="mtable-reference">
+ <mtr>
+ <mtd>
+ <mrow>
+ <mspace width="10px" depth="20px" height="20px" style="background: blue"/>
+ <mspace width="10px" depth="10px" height="30px" style="background: lightblue"/>
+ <mspace width="10px" depth="30px" height="10px" style="background: black"/>
+ </mrow>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ </p>
+ <script>
+ const epsilon = 1;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ let mtd = document.getElementById("mtd");
+ let reference = document.getElementById("mtd-reference");
+ compareLayout(mtd, reference, epsilon);
+ }, "<mtd> relies on mrow algorithm to layout its children");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ let mtable = document.getElementById("mtable");
+ let reference = document.getElementById("mtable-reference");
+ compareLayout(mtable, reference, epsilon);
+ }, "<mtable> layout does not change if children of <mtd> elements are wrapped in an explicit <mrow>");
+ </script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/attribute-mapping-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/attribute-mapping-002.html
new file mode 100644
index 00000000000..9859972f2fd
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/attribute-mapping-002.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Attribute mapping</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-mathvariant-attribute">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
+<meta name="assert" content="Verify that mathvariant, scriptlevel, displaystyle are mapped to CSS">
+<link rel="stylesheet" href="../../../fonts/ahem.css">
+<style>
+ #container {
+ /* Ahem font does not have a MATH table so the font-size scale factor
+ is always 0.71^{computed - inherited math script level} */
+ font: 100px/1 Ahem;
+ }
+</style>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function fontSize(style) {
+ return parseFloat((/(.+)px/).exec(style.getPropertyValue("font-size"))[1]);
+ }
+ function runTests() {
+ var container = document.getElementById("container");
+ for (tag in MathMLFragments) {
+ container.insertAdjacentHTML("beforeend", `<math><mrow>${MathMLFragments[tag]}</mrow></math>`);
+ }
+ Array.from(document.getElementsByClassName("element")).forEach(element => {
+ var tag = element.tagName;
+ var style = window.getComputedStyle(element);
+
+ test(function() {
+ assert_equals(style.getPropertyValue("text-transform"),
+ tag === "mi" ? "math-auto" : "none",
+ "no attribute");
+ element.parentNode.setAttribute("style", "text-transform: uppercase");
+ assert_equals(style.getPropertyValue("text-transform"),
+ tag === "mi" ? "math-auto" : "uppercase",
+ "text-transform on parent");
+ element.setAttribute("mathvariant", "normal");
+ assert_equals(style.getPropertyValue("text-transform"),
+ tag === "mi" ? "none" : "uppercase", "attribute specified");
+ element.setAttribute("mathvariant", "NoRmAl");
+ assert_equals(style.getPropertyValue("text-transform"),
+ tag === "mi" ? "none" : "uppercase", "case insensitive");
+ }, `mathvariant on the ${tag} element is ${tag === "mi" ? "" : "not"} mapped to CSS text-transform`)
+
+ test(function() {
+ // none and mprescripts appear as scripts
+ assert_equals(style.getPropertyValue("math-depth"), tag === "none" || tag === "mprescripts" ? "1" : "0", "no attribute");
+
+ var absoluteScriptlevel = 2;
+ element.setAttribute("scriptlevel", absoluteScriptlevel);
+ assert_equals(style.getPropertyValue("math-depth"), "" + absoluteScriptlevel, "attribute specified <U>");
+
+ var positiveScriptlevelDelta = 1;
+ element.setAttribute("scriptlevel", `+${positiveScriptlevelDelta}`);
+ assert_equals(style.getPropertyValue("math-depth"), "" + positiveScriptlevelDelta, "attribute specified +<U>");
+
+ var negativeScriptlevelDelta = -3;
+ element.setAttribute("scriptlevel", `${negativeScriptlevelDelta}`);
+ assert_equals(style.getPropertyValue("math-depth"), "" + negativeScriptlevelDelta, "attribute specified -<U>");
+
+ element.setAttribute("scriptlevel", absoluteScriptlevel);
+ element.setAttribute("mathsize", "42px");
+ assert_approx_equals(fontSize(style), 42, 1, "mathsize wins over scriptlevel");
+
+ }, `scriptlevel on the ${tag} element is mapped to math-depth(...)`);
+
+ test(function() {
+ element.removeAttribute("scriptlevel");
+ // none and mprescripts appear as scripts
+ let expected = `${tag === "none" || tag === "mprescripts" ? "1" : "0"}`;
+ assert_equals(style.getPropertyValue("math-depth"), expected, "no attribute");
+
+ // FIXME: Should we test values " +1" and "+1 " here?
+ // See https://github.com/w3c/mathml/issues/122
+ ["+-1", "--1", "+z1", "+ 1", "2.0", "-3\"", "200px", "add(2)"].forEach(invalid_value => {
+ element.setAttribute("scriptlevel", invalid_value);
+ assert_equals(style.getPropertyValue("math-depth"), expected, `invalid scriptlevel value '${invalid_value}'`);
+ });
+ }, `invalid scriptlevel values on the ${tag} element are not mapped to math-depth(...)`);
+
+ test(function() {
+ assert_equals(style.getPropertyValue("math-style"), "compact", "no attribute");
+ element.setAttribute("displaystyle", "true");
+ assert_equals(style.getPropertyValue("math-style"), "normal", "attribute specified");
+ element.setAttribute("displaystyle", "TrUe");
+ assert_equals(style.getPropertyValue("math-style"), "normal", "case insensitive");
+ }, `displaystyle on the ${tag} element is mapped to CSS math-style`);
+ });
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <div id="container">
+ <div><math class="element"></math></div>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-1.html
new file mode 100644
index 00000000000..39122dfdf67
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-1.html
@@ -0,0 +1,136 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>displaystyle</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-math-style-property">
+<meta name="assert" content="Verify that the correct inheritance of the displaystyle value by measuring the size of large operators.">
+<style>
+ @font-face {
+ font-family: TestFont;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight5000.woff");
+ }
+ math {
+ font-family: TestFont;
+ font-size: 10px;
+ }
+</style>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/attribute-values.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script>
+ setup({ explicit_done: true });
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 5;
+ function verify_displaystyle(elementId, displaystyle, description) {
+ var expectedSize = (displaystyle ? 5000 : 1000) * emToPx;
+ var elementSize = document.getElementById(elementId).
+ getBoundingClientRect().height;
+ assert_approx_equals(elementSize, expectedSize, epsilon, description);
+ }
+
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ for (transform in AttributeValueTransforms) {
+ TransformAttributeValues(transform, ["display", "displaystyle"]);
+ test(function() {
+ verify_displaystyle("math_default", false, "default");
+ verify_displaystyle("math_false", false, "explicit displaystyle false");
+ verify_displaystyle("math_true", true, "explicit displaystyle true");
+ }, `math element (${transform})`);
+ test(function() {
+ verify_displaystyle("math_inline", false, "explicit display inline");
+ verify_displaystyle("math_block", true, "explicit display block");
+ verify_displaystyle("math_block_false", false, "explicit display block and displaystyle false");
+ verify_displaystyle("math_block_true", true, "explicit display block and displaystyle true");
+ verify_displaystyle("math_inline_false", false, "explicit display inline and displaystyle false");
+ verify_displaystyle("math_inline_true", true, "explicit display inline and displaystyle true");
+ }, `math element (explicit display, ${transform})`);
+ test(function() {
+ verify_displaystyle("mstyle_false", false, "explicit displaystyle false");
+ verify_displaystyle("mstyle_true", true, "explicit displaystyle true");
+ }, `mstyle element (${transform})`);
+ test(function() {
+ verify_displaystyle("mtable_default", false, "default");
+ verify_displaystyle("mtable_false", false, "explicit displaystyle false");
+ verify_displaystyle("mtable_true", true, "explicit displaystyle true");
+ }, `mtable element (${transform})`);
+ test(function() {
+ verify_displaystyle("mfrac_sibling", true, "sibling");
+ verify_displaystyle("mfrac_numerator", false, "numerator");
+ verify_displaystyle("mfrac_denominator", false, "denominator");
+ }, `mfrac element (${transform})`);
+ test(function() {
+ verify_displaystyle("mroot_base", true, "base");
+ verify_displaystyle("mroot_index", false, "index");
+ }, `mroot element (${transform})`);
+ test(function() {
+ verify_displaystyle("msub_base", true, "base");
+ verify_displaystyle("msub_subscript", false, "subscript");
+ }, `msub element (${transform})`);
+ test(function() {
+ verify_displaystyle("msup_base", true, "base");
+ verify_displaystyle("msup_supscript", false, "supscript");
+ }, `msup element (${transform})`);
+ test(function() {
+ verify_displaystyle("msubsup_base", true, "base");
+ verify_displaystyle("msubsup_subscript", false, "subscript");
+ verify_displaystyle("msubsup_supscript", false, "supscript");
+ }, `msubsup element (${transform})`);
+ test(function() {
+ verify_displaystyle("munder_base", true, "base");
+ verify_displaystyle("munder_underscript", false, "underscript");
+ }, `munder element (${transform})`);
+ test(function() {
+ verify_displaystyle("mover_base", true, "base");
+ verify_displaystyle("mover_overscript", false, "overscript");
+ }, `mover element (${transform})`);
+ test(function() {
+ verify_displaystyle("munderover_base", true, "base");
+ verify_displaystyle("munderover_underscript", false, "underscript");
+ verify_displaystyle("munderover_overscript", false, "overscript");
+ }, `munderover element (${transform})`);
+ }
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <math><mo id="math_default">&#x2AFF;</mo></math>
+ <math display="inline"><mo id="math_inline">&#x2AFF;</mo></math>
+ <math display="block"><mo id="math_block">&#x2AFF;</mo></math>
+ <math displaystyle="false"><mo id="math_false">&#x2AFF;</mo></math>
+ <math displaystyle="true"><mo id="math_true">&#x2AFF;</mo></math>
+ <math display="block" displaystyle="false">
+ <mo id="math_block_false">&#x2AFF;</mo>
+ </math>
+ <math display="block" displaystyle="true">
+ <mo id="math_block_true">&#x2AFF;</mo>
+ </math>
+ <math display="inline" displaystyle="false">
+ <mo id="math_inline_false">&#x2AFF;</mo>
+ </math>
+ <math display="inline" displaystyle="true">
+ <mo id="math_inline_true">&#x2AFF;</mo>
+ </math>
+ <math><mstyle displaystyle="false"><mo id="mstyle_false">&#x2AFF;</mo></mstyle></math>
+ <math><mstyle displaystyle="true"><mo id="mstyle_true">&#x2AFF;</mo></mstyle></math>
+ <math displaystyle="true"><mtable><mtr><mtd><mo id="mtable_default">&#x2AFF;</mo></mtd></mtr></mtable></math>
+ <math><mtable displaystyle="true"><mtr><mtd><mo id="mtable_true">&#x2AFF;</mo></mtd></mtr></mtable></math>
+ <math displaystyle="true"><mtable displaystyle="false"><mtr><mtd><mo id="mtable_false">&#x2AFF;</mo></mtd></mtr></mtable></math>
+ <math displaystyle="true"><mo id="mfrac_sibling">&#x2AFF;</mo><mfrac><mo id="mfrac_numerator">&#x2AFF;</mo><mo id="mfrac_denominator">&#x2AFF;</mo></mfrac></math>
+ <math displaystyle="true"><mroot><mo id="mroot_base">&#x2AFF;</mo><mo id="mroot_index">&#x2AFF;</mo></mroot></math>
+ <math displaystyle="true"><msub><mo id="msub_base">&#x2AFF;</mo><mo id="msub_subscript">&#x2AFF;</mo></msub></math>
+ <math displaystyle="true"><msup><mo id="msup_base">&#x2AFF;</mo><mo id="msup_supscript">&#x2AFF;</mo></msup></math>
+ <math displaystyle="true"><msubsup><mo id="msubsup_base">&#x2AFF;</mo><mo id="msubsup_subscript">&#x2AFF;</mo><mo id="msubsup_supscript">&#x2AFF;</mo></msubsup></math>
+ <math displaystyle="true"><mmultiscripts><mo id="mmultiscripts_base">&#x2AFF;</mo><mo id="mmultiscripts_subscript">&#x2AFF;</mo><mo id="mmultiscripts_supscript">&#x2AFF;</mo><mprescripts/><mo id="mmultiscripts_presubscript">&#x2AFF;</mo><mo id="mmultiscripts_presupscript">&#x2AFF;</mo></mmultiscripts></math>
+ <math displaystyle="true"><munder><mo id="munder_base">&#x2AFF;</mo><mo id="munder_underscript">&#x2AFF;</mo></munder></math>
+ <math displaystyle="true"><mover><mo id="mover_base">&#x2AFF;</mo><mo id="mover_overscript">&#x2AFF;</mo></mover></math>
+ <math displaystyle="true"><munderover><mo id="munderover_base">&#x2AFF;</mo><mo id="munderover_underscript">&#x2AFF;</mo><mo id="munderover_overscript">&#x2AFF;</mo></munderover></math>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-2.html
new file mode 100644
index 00000000000..cb3f230126a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-2.html
@@ -0,0 +1,208 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>displaystyle</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-math-style-property">
+<meta name="assert" content="Verify interaction between automatic displaystyle and specified displaystyle on descendants.">
+<style>
+ @font-face {
+ font-family: TestFont;
+ src: url("../../../fonts/math/largeop-displayoperatorminheight5000.woff");
+ }
+ math, math * {
+ font-family: TestFont;
+ font-size: 10px;
+ }
+</style>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/attribute-values.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script>
+ setup({ explicit_done: true });
+ var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
+ var epsilon = 5;
+ function verify_displaystyle(elementId, displaystyle, description) {
+ var expectedSize = (displaystyle ? 5000 : 1000) * emToPx;
+ var elementSize = document.getElementById(elementId).
+ getBoundingClientRect().height;
+ assert_approx_equals(elementSize, expectedSize, epsilon, description);
+ }
+
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ for (transform in AttributeValueTransforms) {
+ TransformAttributeValues(transform, ["display", "displaystyle"]);
+ test(function() {
+ verify_displaystyle("cell_false", false, "cell with displaystyle false");
+ verify_displaystyle("cell_true", true, "cell with displaystyle true");
+ }, `mtable element (${transform})`);
+ test(function() {
+ verify_displaystyle("mfrac_numerator", true, "numerator");
+ verify_displaystyle("mfrac_denominator", true, "denominator");
+ }, `mfrac element (${transform})`);
+ test(function() {
+ verify_displaystyle("mroot_base", false, "base");
+ verify_displaystyle("mroot_index", true, "index");
+ }, `mroot element (${transform})`);
+ test(function() {
+ verify_displaystyle("msub_base", false, "base");
+ verify_displaystyle("msub_subscript", true, "subscript");
+ }, `msub element (${transform})`);
+ test(function() {
+ verify_displaystyle("msup_base", false, "base");
+ verify_displaystyle("msup_superscript", true, "superscript");
+ }, `msup element (${transform})`);
+ test(function() {
+ verify_displaystyle("msubsup_base", false, "base");
+ verify_displaystyle("msubsup_subscript", true, "subscript");
+ verify_displaystyle("msubsup_superscript", true, "superscript");
+ }, `msubsup element (${transform})`);
+ test(function() {
+ verify_displaystyle("munder_base", false, "base");
+ verify_displaystyle("munder_underscript", true, "underscript");
+ }, `munder element (${transform})`);
+ test(function() {
+ verify_displaystyle("mover_base", false, "base");
+ verify_displaystyle("mover_overscript", true, "overscript");
+ }, `mover element (${transform})`);
+ test(function() {
+ verify_displaystyle("munderover_base", false, "base");
+ verify_displaystyle("munderover_underscript", true, "underscript");
+ verify_displaystyle("munderover_overscript", true, "overscript");
+ }, `munderover element (${transform})`);
+ }
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <math displaystyle="true">
+ <mtable>
+ <mtr>
+ <mtd>
+ <mstyle displaystyle="false">
+ <mo id="cell_false">&#x2AFF;</mo>
+ </mstyle>
+ </mtd>
+ <mtd>
+ <mstyle displaystyle="true">
+ <mo id="cell_true">&#x2AFF;</mo>
+ </mstyle>
+ </mtd>
+ </mtr>
+ </mtable>
+ </math>
+ <math>
+ <mfrac>
+ <mstyle displaystyle="true">
+ <mo id="mfrac_numerator">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="mfrac_denominator">&#x2AFF;</mo>
+ </mstyle>
+ </mfrac>
+ </math>
+ <math displaystyle="true">
+ <mroot>
+ <mstyle displaystyle="false">
+ <mo id="mroot_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="mroot_index">&#x2AFF;</mo>
+ </mstyle>
+ </mroot>
+ </math>
+ <math displaystyle="true">
+ <msub>
+ <mstyle displaystyle="false">
+ <mo id="msub_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="msub_subscript">&#x2AFF;</mo>
+ </mstyle>
+ </msub>
+ </math>
+ <math displaystyle="true">
+ <msup>
+ <mstyle displaystyle="false">
+ <mo id="msup_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="msup_superscript">&#x2AFF;</mo>
+ </mstyle>
+ </msup>
+ </math>
+ <math displaystyle="true">
+ <msubsup>
+ <mstyle displaystyle="false">
+ <mo id="msubsup_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="msubsup_subscript">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="msubsup_superscript">&#x2AFF;</mo>
+ </mstyle>
+ </msubsup>
+ </math>
+ <math displaystyle="true">
+ <mmultiscripts>
+ <mstyle displaystyle="false">
+ <mo id="mmultiscripts_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="mmultiscripts_subscript">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="mmultiscripts_superscript">&#x2AFF;</mo>
+ </mstyle>
+ <mprescripts/>
+ <mstyle displaystyle="true">
+ <mo id="mmultiscripts_presubscript">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="mmultiscripts_presuperscript">&#x2AFF;</mo>
+ </mstyle>
+ </mmultiscripts>
+ </math>
+ <math displaystyle="true">
+ <munder>
+ <mstyle displaystyle="false">
+ <mo id="munder_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="munder_underscript">&#x2AFF;</mo>
+ </mstyle>
+ </munder>
+ </math>
+ <math displaystyle="true">
+ <mover>
+ <mstyle displaystyle="false">
+ <mo id="mover_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="mover_overscript">&#x2AFF;</mo>
+ </mstyle>
+ </mover>
+ </math>
+ <math displaystyle="true">
+ <munderover>
+ <mstyle displaystyle="false">
+ <mo id="munderover_base">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="munderover_underscript">&#x2AFF;</mo>
+ </mstyle>
+ <mstyle displaystyle="true">
+ <mo id="munderover_overscript">&#x2AFF;</mo>
+ </mstyle>
+ </munderover>
+ </math>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-3.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-3.html
new file mode 100644
index 00000000000..f8bdc01c39b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/displaystyle-3.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>displaystyle</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-math-style-property">
+<meta name="assert" content="Verify the displaystyle of the underover element is considered (not the one of its base) to determine whether to move limits.">
+<link rel="stylesheet" href="../../../fonts/ahem.css">
+<style>
+ math, math * {
+ font-family: Ahem;
+ font-size: 20px;
+ }
+</style>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+ function runTests() {
+ ["munder", "mover", "munderover"].forEach((tag) => {
+ Array.from(document.getElementsByTagName(tag)).forEach(e => {
+ var displaystyle = e.getAttribute('displaystyle') === "true";
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_movablelimits());
+ var elementRight = e.getBoundingClientRect().right;
+ var baseRight = e.firstElementChild.getBoundingClientRect().right;
+ if (displaystyle)
+ assert_approx_equals(elementRight, baseRight, 1);
+ else
+ assert_greater_than(elementRight, baseRight + 10);
+ }, `movablelimits for ${tag} element (displaystyle=${displaystyle})`);
+ });
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <math>
+ <munder displaystyle="false">
+ <mo displaystyle="true" movablelimits="true">XX</mo>
+ <mtext>X</mtext>
+ </munder>
+ </math>
+ <math>
+ <mover displaystyle="false">
+ <mo displaystyle="true" movablelimits="true">XX</mo>
+ <mtext>X</mtext>
+ </mover>
+ </math>
+ <math>
+ <munderover displaystyle="false">
+ <mo displaystyle="true" movablelimits="true">XX</mo>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </munderover>
+ </math>
+ <math>
+ <munder displaystyle="true">
+ <mo displaystyle="false" movablelimits="true">XX</mo>
+ <mtext>X</mtext>
+ </munder>
+ </math>
+ <math>
+ <mover displaystyle="true">
+ <mo displaystyle="false" movablelimits="true">XX</mo>
+ <mtext>X</mtext>
+ </mover>
+ </math>
+ <math>
+ <munderover displaystyle="true">
+ <mo displaystyle="false" movablelimits="true">XX</mo>
+ <mtext>X</mtext>
+ <mtext>X</mtext>
+ </munderover>
+ </math>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/floats/not-floating-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/floats/not-floating-001.html
new file mode 100644
index 00000000000..d297c547c5a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/floats/not-floating-001.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>float property in math layout</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#user-agent-stylesheet">
+<meta name="assert" content="Assert that float property is ignored for most math layout">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../../mathml/support/layout-comparison.js"></script>
+<style>
+ /* .element class defined in mathml-fragments.js */
+ .element > * {
+ padding: 10px;
+ background: black;
+ }
+ /* override display: none on children of maction/semantics */
+ maction > *, semantics > * {
+ display: math;
+ }
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <div id="container"></div>
+
+ <script>
+ let container = document.getElementById("container");
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag) ||
+ FragmentHelper.isEmpty(tag))
+ continue;
+
+ // Skip mtable since it does not use display: math.
+ if (tag == "mtable")
+ continue;
+
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+</div>`);
+ let div = document.body.lastElementChild;
+ let element =
+ FragmentHelper.element(div.firstElementChild);
+ let reference =
+ FragmentHelper.element(div.lastElementChild);
+ [element, reference].forEach(parent => {
+ if (parent.classList.contains("mathml-container") ||
+ parent.classList.contains("foreign-container")) {
+ FragmentHelper.appendChild(parent);
+ FragmentHelper.appendChild(parent);
+ FragmentHelper.appendChild(parent);
+ }
+ });
+
+ // Try to use float to invert the order in which children are normally
+ // laid out.
+ function layoutChildrenFromLeftToRight(tag) { tag != 'mroot'; }
+ element.firstElementChild.style =
+ `float: ${layoutChildrenFromLeftToRight(tag) ? 'right' : 'left'};`;
+ element.lastElementChild.style =
+ `float: ${layoutChildrenFromLeftToRight(tag) ? 'left' : 'right'};`;
+
+ test(function () {
+ let epsilon = 1;
+ compareLayout(element, reference, epsilon);
+ }, `float child ignored in ${tag}`);
+
+ div.style = "display: none;"; // Hide the div after measurement.
+ }
+ </script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/ignored-properties-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/ignored-properties-001.html
new file mode 100644
index 00000000000..298ed307062
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/ignored-properties-001.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Ignored CSS properties</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
+<meta name="assert" content="Verify style with ignored properties does not affect MathML layout.">
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag))
+ continue;
+
+ var ignoredProperties = [
+ "writing-mode: vertical-rl;",
+ "white-space: normal;",
+ "float: right;",
+ "align-content: end; justify-content: end;",
+ "align-self: end; justify-self: end;",
+ ];
+
+ ignoredProperties.forEach(ignoredStyle => {
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+</div>`);
+ var div = document.body.lastElementChild;
+
+ // Create MathML structure with ignored style properties.
+ var elementContainer = div.firstElementChild;
+ var elementContainerWidth = elementContainer.getBoundingClientRect().width;
+ var element = FragmentHelper.element(elementContainer);
+ if (!FragmentHelper.isEmpty(tag))
+ FragmentHelper.forceNonEmptyDescendants(element);
+ element.setAttribute("style", ignoredStyle);
+ Array.from(element.getElementsByTagNameNS("*", FragmentHelper.mathml_namespace)).forEach(descendant => {
+ descendant.setAttribute("style", ignoredStyle);
+ });
+
+ var referenceContainer = div.lastElementChild;
+ var referenceContainerWidth = referenceContainer.getBoundingClientRect().width;
+ var reference = FragmentHelper.element(referenceContainer);
+ if (!FragmentHelper.isEmpty(tag))
+ FragmentHelper.forceNonEmptyDescendants(reference);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ assert_approx_equals(elementContainerWidth, referenceContainerWidth, epsilon);
+ }, `${tag} preferred width calculation is not affected by ${ignoredStyle}`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ compareLayout(element, reference, epsilon);
+ }, `${tag} layout is not affected by ${ignoredStyle}`);
+
+ div.style = "display: none;"; // Hide the div after measurement.
+ });
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/lengths-2.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/lengths-2.html
new file mode 100644
index 00000000000..72a5389dcda
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/lengths-2.html
@@ -0,0 +1,322 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1">
+<title>MathML lengths</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
+<link rel="help" href="https://w3c.github.io/mathml-core/#types-for-mathml-attribute-values">
+<link rel="help" href="https://w3c.github.io/mathml-core/#legacy-mathml-style-attributes">
+<link rel="help" href="https://w3c.github.io/mathml-core/#space-mspace">
+<link rel="help" href="https://www.w3.org/TR/css-values-4/#relative-lengths">
+<meta name="assert" content="Verify various cases of the MathML length syntax.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ @font-face {
+ font-family: TestFont;
+ src: url("../../../fonts/math/css-units.woff");
+ }
+ math {
+ font-family: TestFont;
+ font-size: 10px;
+ }
+ /* For rlh. */
+ html {
+ line-height: 17px;
+ }
+</style>
+<script>
+ // Omitted units: vi, vb
+
+ var epsilon = .5;
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_equals(getBox("unitCm").width, 96, "cm");
+ assert_equals(getBox("unitEm").width, 120, "em");
+ assert_equals(getBox("unitEx").width, 500, "ex");
+ assert_equals(getBox("unitIn").width, 288, "in");
+ assert_equals(getBox("unitMm").width, 576, "mm");
+ assert_equals(getBox("unitPc").width, 96, "pc");
+ assert_equals(getBox("unitPercentage").width, 60, "%");
+ assert_equals(getBox("unitPt").width, 96, "pt");
+ assert_equals(getBox("unitPx").width, 123, "px");
+ assert_equals(getBox("unitQ").width, 192, "q");
+ assert_equals(getBox("unitCh").width, 100, "ch");
+ assert_equals(getBox("unitCap").width, 140, "cap");
+ assert_equals(getBox("unitIc").width, 90, "ic");
+ assert_approx_equals(getBox("unitVw").width, window.innerWidth*0.35, epsilon, "vw");
+ assert_approx_equals(getBox("unitVh").width, window.innerHeight*0.54, epsilon, "vh");
+ assert_approx_equals(getBox("unitVmin").width, Math.min(window.innerWidth, window.innerHeight)*0.27, epsilon, "vmin");
+ assert_approx_equals(getBox("unitVmax").width, Math.max(window.innerWidth, window.innerHeight)*0.34, epsilon, "vmax");
+ assert_equals(getBox("unitRem").width, 128, "rem");
+ assert_equals(getBox("unitLh").width, 60, "lh");
+ assert_equals(getBox("unitRlh").width, 102, "rlh");
+ }, "Units");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_equals(getBox("spaceCm").width, 96, "cm");
+ assert_equals(getBox("spaceEm").width, 120, "em");
+ assert_equals(getBox("spaceEx").width, 500, "ex");
+ assert_equals(getBox("spaceIn").width, 288, "in");
+ assert_equals(getBox("spaceMm").width, 576, "mm");
+ assert_equals(getBox("spacePc").width, 96, "pc");
+ assert_equals(getBox("spacePercentage").width, 60, "%");
+ assert_equals(getBox("spacePt").width, 96, "pt");
+ assert_equals(getBox("spacePx").width, 123, "px");
+ assert_equals(getBox("spaceQ").width, 192, "q");
+ assert_equals(getBox("spaceCh").width, 100, "ch");
+ assert_equals(getBox("spaceCap").width, 140, "cap");
+ assert_equals(getBox("spaceIc").width, 90, "ic");
+ assert_approx_equals(getBox("spaceVw").width, window.innerWidth*0.35, epsilon, "vw");
+ assert_approx_equals(getBox("spaceVh").width, window.innerHeight*0.54, epsilon, "vh");
+ assert_approx_equals(getBox("spaceVmin").width, Math.min(window.innerWidth, window.innerHeight)*0.27, epsilon, "vmin");
+ assert_approx_equals(getBox("spaceVmax").width, Math.max(window.innerWidth, window.innerHeight)*0.34, epsilon, "vmax");
+ assert_equals(getBox("spaceRem").width, 128, "rem");
+ assert_equals(getBox("spaceLh").width, 60, "lh");
+ assert_equals(getBox("spaceRlh").width, 102, "rlh");
+ }, "Trimming of space");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(getBox("n0").width, 0, epsilon, "n0");
+ assert_approx_equals(getBox("n1").width, 90, epsilon, "n1");
+ assert_approx_equals(getBox("n2").width, 8, epsilon, "n2");
+ assert_approx_equals(getBox("n4").width, 650, epsilon, "n4");
+ assert_approx_equals(getBox("n5").width, 4320, epsilon, "n5");
+ assert_approx_equals(getBox("n6").width, 1, epsilon, "n6");
+ assert_approx_equals(getBox("n7").width, 8, epsilon, "n7");
+ assert_approx_equals(getBox("n8").width, 65, epsilon, "n8");
+ assert_approx_equals(getBox("n9").width, 432, epsilon, "n9");
+ assert_approx_equals(getBox("n10").width, 123, epsilon, "n10");
+ }, "Non-negative numbers");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var topRef = getBox("ref").top;
+ assert_approx_equals(getBox("N0").top - topRef, -0, epsilon, "N0");
+ assert_approx_equals(topRef - getBox("N1").top, -90, epsilon, "N1");
+ assert_approx_equals(topRef - getBox("N2").top, -8, epsilon, "N2");
+ assert_approx_equals(topRef - getBox("N4").top, -650, epsilon, "N4");
+ assert_approx_equals(topRef - getBox("N5").top, -4320, epsilon, "N5");
+ assert_approx_equals(topRef - getBox("N6").top, -1, epsilon, "N6");
+ assert_approx_equals(topRef - getBox("N7").top, -8, epsilon, "N7");
+ assert_approx_equals(topRef - getBox("N8").top, -65, epsilon, "N8");
+ assert_approx_equals(topRef - getBox("N9").top, -432, epsilon, "N9");
+ assert_approx_equals(topRef - getBox("N10").top, -123, epsilon, "N10");
+ }, "Non-positive numbers");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ // Namedspace values are invalid in MathML Core.
+ ["veryverythinmathspace",
+ "verythinmathspace",
+ "thinmathspace",
+ "mediummathspace",
+ "thickmathspace",
+ "verythickmathspace",
+ "veryverythickmathspace",
+ "negativeveryverythinmathspace",
+ "negativeverythinmathspace",
+ "negativethinmathspace",
+ "negativemediummathspace",
+ "negativethickmathspace",
+ "negativeverythickmathspace",
+ "negativeveryverythickmathspace"
+ ].forEach(function(space) {
+ var mrow = document.getElementById(space);
+ var boxBefore = mrow.firstElementChild.getBoundingClientRect();
+ var boxAfter = mrow.lastElementChild.getBoundingClientRect();
+ assert_equals(boxAfter.left - boxBefore.right, 0, space);
+ });
+ }, "Legacy namedspaces");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ // These values are invalid in MathML Core.
+ assert_equals(getBox("unitNone").width, 30, "Unitless");
+ assert_approx_equals(getBox("n3").width, 0, epsilon, "n3");
+ var topRef = getBox("ref").top;
+ assert_approx_equals(topRef - getBox("N3").top, 0, epsilon, "N3");
+ }, "Legacy numbers");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="unitCm" width="2.54cm"/>
+ <mspace id="unitEm" width="12em"/>
+ <mspace id="unitEx" width="100ex"/>
+ <mspace id="unitIn" width="3in"/>
+ <mspace id="unitMm" width="152.4mm"/>
+ <mspace id="unitPc" width="6pc"/>
+ <mstyle mathsize="200%"><mspace id="unitPercentage" width="3em"/></mstyle>
+ <mspace id="unitPt" width="72pt"/>
+ <mspace id="unitPx" width="123px"/>
+ <mspace id="unitQ" width="203.2q"/>
+ <mspace id="unitCh" width="10ch"/>
+ <mspace id="unitCap" width="14ch"/>
+ <mspace id="unitIc" width="9ic"/>
+ <mspace id="unitVw" width="35vw"/>
+ <mspace id="unitVh" width="54vh"/>
+ <mspace id="unitVi" width="11vi"/>
+ <mspace id="unitVb" width="4vb"/>
+ <mspace id="unitVmin" width="27vmin"/>
+ <mspace id="unitVmax" width="34vmax"/>
+ <mspace id="unitRem" width="8rem" style="font-size: 3px;"/>
+ <mspace id="unitLh" width="5lh" style="line-height: 12px;"/>
+ <mspace id="unitRlh" width="6rlh" style="line-height: 12px;"/>
+ <mstyle mathsize="5"><mspace id="unitNone" width="3em"/></mstyle>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mspace id="spaceCm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;2.54cm&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceEm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;12em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceEx" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;100ex&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceIn" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3in&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceMm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;152.4mm&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spacePc" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;6pc&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mstyle mathsize="200%"><mspace id="spacePercentage" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/></mstyle>
+ <mspace id="spacePt" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;72pt&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spacePx" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;123px&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceQ" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;203.2q&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceCh" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;10ch&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceCap" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;14ch&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceIc" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;9ic&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceVw" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;35vw&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceVh" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;54vh&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceVi" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;11vi&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceVb" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;4vb&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceVmin" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;27vmin&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceVmax" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;34vmax&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
+ <mspace id="spaceRem" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;8rem&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;" style="font-size: 3px;"/>
+ <mspace id="spaceLh" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;5lh&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;" style="line-height: 12px;"/>
+ <mspace id="spaceRlh" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;6rlh&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;" style="line-height: 12px;"/>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mspace id="n0" width="0em"/>
+ <mspace id="n1" width="9em"/>
+ <mspace id="n2" width=".8em"/>
+ <mspace id="n3" width="7.em"/>
+ <mspace id="n4" width="65em"/>
+ <mspace id="n5" width="432em"/>
+ <mspace id="n6" width=".10em"/>
+ <mspace id="n7" width=".789em"/>
+ <mspace id="n8" width="6.5em"/>
+ <mspace id="n9" width="43.21em"/>
+ <mspace id="n10" width="012.345em"/>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mspace id="ref"></mspace>
+ <mpadded voffset="-0em"><mspace id="N0"/></mpadded>
+ <mpadded voffset="-9em"><mspace id="N1"/></mpadded>
+ <mpadded voffset="-.8em"><mspace id="N2"/></mpadded>
+ <mpadded voffset="-7.em"><mspace id="N3"/></mpadded>
+ <mpadded voffset="-65em"><mspace id="N4"/></mpadded>
+ <mpadded voffset="-432em"><mspace id="N5"/></mpadded>
+ <mpadded voffset="-.10em"><mspace id="N6"/></mpadded>
+ <mpadded voffset="-.789em"><mspace id="N7"/></mpadded>
+ <mpadded voffset="-6.5em"><mspace id="N8"/></mpadded>
+ <mpadded voffset="-43.21em"><mspace id="N9"/></mpadded>
+ <mpadded voffset="-012.345em"><mspace id="N10"/></mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow id="veryverythinmathspace">
+ <mspace width="1em"/>
+ <mspace width="veryverythinmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="verythinmathspace">
+ <mspace width="1em"/>
+ <mspace width="verythinmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="thinmathspace">
+ <mspace width="1em"/>
+ <mspace width="thinmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="mediummathspace">
+ <mspace width="1em"/>
+ <mspace width="mediummathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="thickmathspace">
+ <mspace width="1em"/>
+ <mspace width="thickmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="verythickmathspace">
+ <mspace width="1em"/>
+ <mspace width="verythickmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="veryverythickmathspace">
+ <mspace width="1em"/>
+ <mspace width="veryverythickmathspace"/>
+ <mspace/>
+ </mrow>
+ </math>
+ <math>
+ <mrow id="negativeveryverythinmathspace">
+ <mspace width="1em"/>
+ <mspace width="veryverythinmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="negativeverythinmathspace">
+ <mspace width="1em"/>
+ <mspace width="verythinmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="negativethinmathspace">
+ <mspace width="1em"/>
+ <mspace width="thinmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="negativemediummathspace">
+ <mspace width="1em"/>
+ <mspace width="mediummathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="negativethickmathspace">
+ <mspace width="1em"/>
+ <mspace width="thickmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="negativeverythickmathspace">
+ <mspace width="1em"/>
+ <mspace width="verythickmathspace"/>
+ <mspace/>
+ </mrow>
+ <mrow id="negativeveryverythickmathspace">
+ <mspace width="1em"/>
+ <mspace width="veryverythickmathspace"/>
+ <mspace/>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/multi-column-layout.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/multi-column-layout.html
new file mode 100644
index 00000000000..e0e6ec2c5a6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/multi-column-layout.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>MathML inside multi-column</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#html-and-svg">
+<meta name="assert" content="Verify that putting MathML inside a multi-column list shouldn't affect its layout.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("DOMContentLoaded", function() {
+ var epsilon = 1;
+ var mfrac = document.getElementById("mfrac");
+ var num = mfrac.firstElementChild.getBoundingClientRect();
+ var denom = mfrac.lastElementChild.getBoundingClientRect();
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(num.width, 30, epsilon, "numerator width");
+ assert_approx_equals(num.height, 40, epsilon, "numerator height");
+ assert_approx_equals(denom.width, 50, epsilon, "numerator width");
+ assert_approx_equals(denom.height, 60, epsilon, "numerator height");
+ }, "mspace layout in multicol");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mfrac());
+ assert_greater_than_equal(denom.bottom - num.top,
+ (40 + 60),
+ "numerator is above the denominator");
+ assert_approx_equals((num.left + num.right) / 2,
+ (denom.left + denom.right) / 2,
+ epsilon, "numerator and denominator are horizontally aligned");
+ }, "mfrac layout in multicol");
+ done();
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <div style="column-width: 10em; list-style-type: decimal;">
+ <ol>
+ <li>blah</li>
+ <li>
+ <math>
+ <mfrac id="mfrac">
+ <mspace width="30px" height="40px" style="background: cyan"></mspace>
+ <mspace width="50px" height="60px" style="background: yellow"></mspace>
+ </mfrac>
+ </li>
+ <li>blah</li>
+ <li>blah</li>
+ <li>blah</li>
+ </ol>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/not-participating-to-parent-layout.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/not-participating-to-parent-layout.html
new file mode 100644
index 00000000000..71abbd8f751
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/not-participating-to-parent-layout.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Elements not participating to the layout of their parent</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that display: none and out-of-flow positioned elements do not participate to layout of their parent.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag) ||
+ FragmentHelper.isEmpty(tag))
+ continue;
+ ["display: none",
+ "display: contents",
+ "position: absolute",
+ "position: fixed"
+ ].forEach(style => {
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+</div>`);
+ var div = document.body.lastElementChild;
+
+ var elementContainer = div.firstElementChild;
+ var elementContainerWidth = elementContainer.getBoundingClientRect().width;
+ var element = FragmentHelper.element(elementContainer);
+ if (style === "display: contents" &&
+ !element.classList.contains("mathml-container")) {
+ // A "display: contents" MathML child is not participating to
+ // parent layout because its computed style is "display: none".
+ // If we cannot append a MathML child then skip that test.
+ return;
+ }
+ FragmentHelper.forceNonEmptyElement(element);
+ var allowInvalid = true;
+ var child = FragmentHelper.appendChild(element, allowInvalid);
+ child.setAttribute("style", style);
+
+ var referenceContainer = div.lastElementChild;
+ var referenceContainerWidth = referenceContainer.getBoundingClientRect().width;
+ var reference = FragmentHelper.element(referenceContainer);
+ FragmentHelper.forceNonEmptyElement(reference);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ assert_approx_equals(elementContainerWidth, referenceContainerWidth, epsilon);
+ }, `${tag} preferred width calculation is not affected by children with "${style}" style`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ compareLayout(element, reference, epsilon);
+ }, `${tag} layout is not affected by children with "${style}" style`);
+
+ div.style = "display: none;"; // Hide the div after measurement.
+ });
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.html
new file mode 100644
index 00000000000..9135198b5e0
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Absolutely positioned MathML elements</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
+<meta name="assert" content="Verify that position:absolute with top/left works on MathML elements themselves.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<style>
+ /* override display: none on children of maction/semantics */
+ maction > *, semantics > * {
+ display: math;
+ }
+</style>
+<script>
+
+ window.addEventListener("DOMContentLoaded", _ => {
+ var targetTop = 200;
+ var targetLeft = 300;
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag))
+ continue;
+
+ // Create a positioned container.
+ var container = document.createElement("div");
+ container.style.position = "absolute";
+ container.style.left = "0";
+ container.style.top = "0";
+ document.body.appendChild(container);
+
+ // Insert the MathML fragment inside a <math> element.
+ container.insertAdjacentHTML("beforeend", `<math>${MathMLFragments[tag]}</math>`);
+ var element = FragmentHelper.element(container.querySelector("math"));
+
+ // Give the element content so it has a nonzero size.
+ if (tag === "mspace") {
+ element.setAttribute("width", "50px");
+ element.setAttribute("height", "50px");
+ } else {
+ FragmentHelper.forceNonEmptyDescendants(element);
+ }
+
+ // Make the element itself absolutely positioned.
+ element.setAttribute("style",
+ `position: absolute; top: ${targetTop}px; left: ${targetLeft}px`);
+
+ var box = element.getBoundingClientRect();
+ var containerBox = container.getBoundingClientRect();
+ var epsilon = 1;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ assert_greater_than(box.width, 0, "element has nonzero width");
+ assert_greater_than(box.height, 0, "element has nonzero height");
+ assert_approx_equals(box.left - containerBox.left, targetLeft, epsilon,
+ "left position");
+ assert_approx_equals(box.top - containerBox.top, targetTop, epsilon,
+ "top position");
+ }, `position: absolute on <${tag}> element itself`);
+
+ container.style.display = "none";
+ }
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/out-of-flow/all-mathml-containers.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/out-of-flow/all-mathml-containers.html
new file mode 100644
index 00000000000..7fd578c73be
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/out-of-flow/all-mathml-containers.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>absolutely positioned in all MathML elements</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that absolutely positioned node works in all MathML elements.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<style>
+ /* override display: none on children of maction/semantics */
+ maction > *, semantics > * {
+ display: math;
+ }
+</style>
+<script>
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ ["absolute", "fixed"].forEach(positionValue => {
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag) ||
+ FragmentHelper.isEmpty(tag))
+ continue;
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<math>${MathMLFragments[tag]}</math>\
+</div>`);
+ let div = document.body.lastElementChild;
+ let element = FragmentHelper.element(div.firstElementChild);
+ FragmentHelper.forceNonEmptyElement(element);
+ if (element.classList.contains("mathml-container") ||
+ element.classList.contains("foreign-container")) {
+ for (let i = 0; i < 5; i++) {
+ FragmentHelper.appendChild(element);
+ }
+ }
+
+ let middleChild;
+ if (element.children.length >= 2) {
+ middleChild = FragmentHelper.appendChild(element, true /*allowInvalid*/);
+ middleChild.setAttribute("style", `position: ${positionValue}; left: 300px; top: 400px`);
+ let middlePosition = Math.floor(element.children.length/2);
+ element.insertBefore(middleChild, element.children[middlePosition]);
+ }
+
+ let firstChild = FragmentHelper.appendChild(element, true /*allowInvalid*/);
+ firstChild.setAttribute("style", `position: ${positionValue}; left: 100px; top: 200px`);
+ element.insertBefore(firstChild, element.firstElementChild);
+
+ let lastChild = FragmentHelper.appendChild(element, true /*allowInvalid*/);
+ lastChild.setAttribute("style", `position: ${positionValue}; left: 500px; top: 600px`);
+
+ let referenceBox;
+ switch (positionValue) {
+ case "absolute":
+ // Use the absolutely positioned div ancestor.
+ referenceBox = div.getBoundingClientRect();
+ break
+ case "fixed":
+ // Use the viewport.
+ referenceBox = {left: 0, top: 0};
+ break;
+ default:
+ throw "reference box not defined";
+ }
+
+ let firstChildBox = firstChild.getBoundingClientRect();
+ let lastChildBox = lastChild.getBoundingClientRect();
+ let middleChildBox;
+ if (middleChild) {
+ middleChildBox = middleChild.getBoundingClientRect();
+ }
+
+ let epsilon = 1;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ assert_approx_equals(firstChildBox.left - referenceBox.left, 100, epsilon);
+ assert_approx_equals(firstChildBox.top - referenceBox.top, 200, epsilon);
+ if (middleChildBox) {
+ assert_approx_equals(middleChildBox.left - referenceBox.left, 300, epsilon);
+ assert_approx_equals(middleChildBox.top - referenceBox.top, 400, epsilon);
+ }
+ assert_approx_equals(lastChildBox.left - referenceBox.left, 500, epsilon);
+ assert_approx_equals(lastChildBox.top - referenceBox.top, 600, epsilon);
+ }, `position: ${positionValue}; children in ${tag}`);
+
+ div.style = "display: none;"; // Hide the div after measurement.
+ }
+ });
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/border-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/border-001.html
new file mode 100644
index 00000000000..e72cf280b10
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/border-001.html
@@ -0,0 +1,179 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>border</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that border is taken into account.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/box-comparison.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-border")
+ assert_approx_equals(s.left, 20, epsilon, "left border");
+ assert_approx_equals(s.right, 30, epsilon, "right border");
+ assert_approx_equals(s.top, 40, epsilon, "top border");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom border");
+ var b = document.getElementById("mrow-border").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Border properties on mrow");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection.has_dir());
+ var s = measureSpaceAround("mrow-border-rtl")
+ assert_approx_equals(s.left, 20, epsilon, "left border");
+ assert_approx_equals(s.right, 30, epsilon, "right border");
+ assert_approx_equals(s.top, 40, epsilon, "top border");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom border");
+ var b = document.getElementById("mrow-border-rtl").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Border properties on mrow (rtl)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-border-shorthand")
+ assert_approx_equals(s.left, 20, epsilon, "left border");
+ assert_approx_equals(s.right, 20, epsilon, "right border");
+ assert_approx_equals(s.top, 20, epsilon, "top border");
+ assert_approx_equals(s.bottom, 20, epsilon, "bottom border");
+ var b = document.getElementById("mrow-border-shorthand").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 20, epsilon, "element width");
+ assert_approx_equals(b.height, 20 + 50 + 20, epsilon, "element height");
+ }, "Border properties on mrow (shorthand)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-border-logical")
+ assert_approx_equals(s.left, 20, epsilon, "left border");
+ assert_approx_equals(s.right, 30, epsilon, "right border");
+ assert_approx_equals(s.top, 40, epsilon, "top border");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom border");
+ var b = document.getElementById("mrow-border-logical").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Border properties on mrow (logical)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection.has_dir());
+ var s = measureSpaceAround("mrow-border-logical-rtl")
+ assert_approx_equals(s.left, 30, epsilon, "left border");
+ assert_approx_equals(s.right, 20, epsilon, "right border");
+ assert_approx_equals(s.top, 40, epsilon, "top border");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom border");
+ var b = document.getElementById("mrow-border-logical-rtl").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Border properties on mrow (logical, rtl)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-border-logical-shorthand")
+ assert_approx_equals(s.left, 20, epsilon, "left border");
+ assert_approx_equals(s.right, 20, epsilon, "right border");
+ assert_approx_equals(s.top, 30, epsilon, "top border");
+ assert_approx_equals(s.bottom, 30, epsilon, "bottom border");
+ var b = document.getElementById("mrow-border-logical-shorthand").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 20, epsilon, "element width");
+ assert_approx_equals(b.height, 30 + 50 + 30, epsilon, "element height");
+ }, "Border properties on mrow (logical, shorthand)");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-border"
+ style="border-left: 20px solid transparent;
+ border-right: 30px solid transparent;
+ border-top: 40px solid transparent;
+ border-bottom: 50px solid transparent;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mrow>
+ <mrow id="mrow-border-rtl"
+ style="border-left: 20px solid transparent;
+ border-right: 30px solid transparent;
+ border-top: 40px solid transparent;
+ border-bottom: 50px solid transparent;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-border-shorthand"
+ style="border: 20px solid transparent;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-border-logical"
+ style="border-inline-start: 20px solid transparent;
+ border-inline-end: 30px solid transparent;
+ border-block-start: 40px solid transparent;
+ border-block-end: 50px solid transparent;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mrow>
+ <mrow id="mrow-border-logical-rtl"
+ style="border-inline-start: 20px solid transparent;
+ border-inline-end: 30px solid transparent;
+ border-block-start: 40px solid transparent;
+ border-block-end: 50px solid transparent;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-border-logical-shorthand"
+ style="border-inline: 20px solid transparent;
+ border-block: 30px solid transparent;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/border-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/border-002.html
new file mode 100644
index 00000000000..2928f79e219
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/border-002.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>border</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that border is taken into account.">
+<link rel="stylesheet" type="text/css" href="../../../../fonts/ahem.css" />
+<style>
+ math {
+ font: 25px/1 Ahem;
+ }
+</style>
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../../mathml/support/box-comparison.js"></script>
+<script src="../../../../mathml/support/fonts.js"></script>
+<script>
+ var epsilon = 2;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag))
+ continue;
+
+ var style = "border-left: 30px solid; border-right: 40px solid; border-top: 50px solid; border-bottom: 60px solid;";
+
+ if (FragmentHelper.isEmpty(tag)) {
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSizeWithAndWithoutStyle(tag, style);
+ assert_approx_equals(s.element_width_delta, 30 + 40, epsilon, "left/right border");
+ assert_approx_equals(s.element_height_delta, 50 + 60, epsilon, "top/bottom border");
+ assert_approx_equals(s.preferred_width_delta, 30 + 40, epsilon, "preferred width");
+ }, `Border properties on ${tag}`);
+ continue;
+ }
+
+ var default_border = tag === "merror" ? 1 : 0;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSpaceWithAndWithoutStyle(tag, style);
+ assert_approx_equals(s.left_delta + default_border, 30, epsilon, "left border");
+ assert_approx_equals(s.right_delta + default_border, 40, epsilon, "right border");
+ assert_approx_equals(s.top_delta + default_border, 50, epsilon, "top border");
+ assert_approx_equals(s.bottom_delta + default_border, 60, epsilon, "bottom border");
+ assert_approx_equals(s.element_width_delta + 2 * default_border, 30 + 40, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta + 2 * default_border, 50 + 60, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta + 2 * default_border, 30 + 40, epsilon, "element preferred width");
+ }, `Border properties on ${tag}`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSpaceWithAndWithoutStyle(tag, style, null, "rtl");
+ assert_approx_equals(s.left_delta + default_border, 30, epsilon, "left border");
+ assert_approx_equals(s.right_delta + default_border, 40, epsilon, "right border");
+ assert_approx_equals(s.top_delta + default_border, 50, epsilon, "top border");
+ assert_approx_equals(s.bottom_delta + default_border, 60, epsilon, "bottom border");
+ assert_approx_equals(s.element_width_delta + 2 * default_border, 30 + 40, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta + 2 * default_border, 50 + 60, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta + 2 * default_border, 30 + 40, epsilon, "element preferred width");
+ }, `Border properties on ${tag} (rtl)`);
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-001.html
new file mode 100644
index 00000000000..14a408fdfec
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-001.html
@@ -0,0 +1,179 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>margin</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that margin is taken into account.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/box-comparison.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-margin")
+ assert_approx_equals(s.left, 20, epsilon, "left margin");
+ assert_approx_equals(s.right, 30, epsilon, "right margin");
+ assert_approx_equals(s.top, 40, epsilon, "top margin");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom margin");
+ var b = document.getElementById("mrow-margin").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 50, epsilon, "element width");
+ assert_approx_equals(b.height, 50, epsilon, "element height");
+ }, "Margin properties on mrow");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection.has_dir());
+ var s = measureSpaceAround("mrow-margin-rtl")
+ assert_approx_equals(s.left, 20, epsilon, "left margin");
+ assert_approx_equals(s.right, 30, epsilon, "right margin");
+ assert_approx_equals(s.top, 40, epsilon, "top margin");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom margin");
+ var b = document.getElementById("mrow-margin-rtl").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 50, epsilon, "element width");
+ assert_approx_equals(b.height, 50, epsilon, "element height");
+ }, "Margin properties on mrow (rtl)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-margin-shorthand")
+ assert_approx_equals(s.left, 20, epsilon, "left margin");
+ assert_approx_equals(s.right, 20, epsilon, "right margin");
+ assert_approx_equals(s.top, 20, epsilon, "top margin");
+ assert_approx_equals(s.bottom, 20, epsilon, "bottom margin");
+ var b = document.getElementById("mrow-margin-shorthand").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 50, epsilon, "element width");
+ assert_approx_equals(b.height, 50, epsilon, "element height");
+ }, "Margin properties on mrow (shorthand)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-margin-logical")
+ assert_approx_equals(s.left, 20, epsilon, "left margin");
+ assert_approx_equals(s.right, 30, epsilon, "right margin");
+ assert_approx_equals(s.top, 40, epsilon, "top margin");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom margin");
+ var b = document.getElementById("mrow-margin-logical").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 50, epsilon, "element width");
+ assert_approx_equals(b.height, 50, epsilon, "element height");
+ }, "Margin properties on mrow (logical)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection.has_dir());
+ var s = measureSpaceAround("mrow-margin-logical-rtl")
+ assert_approx_equals(s.left, 30, epsilon, "left margin");
+ assert_approx_equals(s.right, 20, epsilon, "right margin");
+ assert_approx_equals(s.top, 40, epsilon, "top margin");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom margin");
+ var b = document.getElementById("mrow-margin-logical-rtl").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 50, epsilon, "element width");
+ assert_approx_equals(b.height, 50, epsilon, "element height");
+ }, "Margin properties on mrow (logical, rtl)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-margin-logical-shorthand")
+ assert_approx_equals(s.left, 20, epsilon, "left margin");
+ assert_approx_equals(s.right, 20, epsilon, "right margin");
+ assert_approx_equals(s.top, 30, epsilon, "top margin");
+ assert_approx_equals(s.bottom, 30, epsilon, "bottom margin");
+ var b = document.getElementById("mrow-margin-logical-shorthand").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 50, epsilon, "element width");
+ assert_approx_equals(b.height, 50, epsilon, "element height");
+ }, "Margin properties on mrow (logical, shorthand)");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-margin"
+ style="margin-left: 20px;
+ margin-right: 30px;
+ margin-top: 40px;
+ margin-bottom: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mrow>
+ <mrow id="mrow-margin-rtl"
+ style="margin-left: 20px;
+ margin-right: 30px;
+ margin-top: 40px;
+ margin-bottom: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-margin-shorthand"
+ style="margin: 20px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-margin-logical"
+ style="margin-inline-start: 20px;
+ margin-inline-end: 30px;
+ margin-block-start: 40px;
+ margin-block-end: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mrow>
+ <mrow id="mrow-margin-logical-rtl"
+ style="margin-inline-start: 20px;
+ margin-inline-end: 30px;
+ margin-block-start: 40px;
+ margin-block-end: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-margin-logical-shorthand"
+ style="margin-inline: 20px;
+ margin-block: 30px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-002.html
new file mode 100644
index 00000000000..68d4d7dd181
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-002.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>margin</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that margin is taken into account.">
+<link rel="stylesheet" type="text/css" href="../../../../fonts/ahem.css" />
+<style>
+ math {
+ font: 25px/1 Ahem;
+ }
+</style>
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../../mathml/support/box-comparison.js"></script>
+<script src="../../../../mathml/support/fonts.js"></script>
+<script>
+ var epsilon = 2;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag))
+ continue;
+
+ var style = "margin-left: 30px; margin-right: 40px; margin-top: 50px; margin-bottom: 60px;";
+
+ if (FragmentHelper.isEmpty(tag)) {
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSizeWithAndWithoutStyle(tag, style);
+ assert_approx_equals(s.width_delta, 30 + 40, epsilon, "left/right margin");
+ assert_approx_equals(s.height_delta, 50 + 60, epsilon, "top/bottom margin");
+ assert_approx_equals(s.element_width_delta, 0, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta, 0, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta, 30 + 40, epsilon, "preferred width");
+ }, `Margin properties on ${tag}`);
+ continue;
+ }
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSpaceWithAndWithoutStyle(tag, style);
+ assert_approx_equals(s.left_delta, 30, epsilon, "left margin");
+ assert_approx_equals(s.right_delta, 40, epsilon, "right margin");
+ assert_approx_equals(s.top_delta, 50, epsilon, "top margin");
+ assert_approx_equals(s.bottom_delta, 60, epsilon, "bottom margin");
+ assert_approx_equals(s.element_width_delta, 0, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta, 0, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta, 30 + 40, epsilon, "preferred width");
+ }, `Margin properties on ${tag}`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSpaceWithAndWithoutStyle(tag, style, null, "rtl");
+ assert_approx_equals(s.left_delta, 30, epsilon, "left margin");
+ assert_approx_equals(s.right_delta, 40, epsilon, "right margin");
+ assert_approx_equals(s.top_delta, 50, epsilon, "top margin");
+ assert_approx_equals(s.bottom_delta, 60, epsilon, "bottom margin");
+ assert_approx_equals(s.element_width_delta, 0, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta, 0, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta, 30 + 40, epsilon, "preferred width");
+ }, `Margin properties on ${tag} (rtl)`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ // Apply the same margin style on the parent mrow.
+ // The margins are not collapsed so they should be added twice.
+ var s = compareSpaceWithAndWithoutStyle(tag, style, style);
+ assert_approx_equals(s.left_delta, 30 * 2, epsilon, "left margin");
+ assert_approx_equals(s.right_delta, 40 * 2, epsilon, "right margin");
+ assert_approx_equals(s.top_delta, 50 * 2, epsilon, "top margin");
+ assert_approx_equals(s.bottom_delta, 60 * 2, epsilon, "bottom margin");
+ assert_approx_equals(s.element_width_delta, 0, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta, 0, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta, (30 + 40) * 2, epsilon, "preferred width");
+ }, `Margin properties on ${tag} (no margin-collapsing)`);
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-003.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-003.html
new file mode 100644
index 00000000000..faf79e92cd4
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/margin-003.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>margin</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that margin is taken into account on children.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../../mathml/support/layout-comparison.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag) ||
+ FragmentHelper.isEmpty(tag) ||
+ FragmentHelper.isTokenElement(tag) ||
+ tag == "semantics" ||
+ tag == "maction" ||
+ tag == "mtable")
+ continue;
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+
+ document.body.insertAdjacentHTML("beforeend", `<hr/><div>\
+<div style="display: inline-block; border: 1px dashed blue;"><math>${MathMLFragments[tag]}</math></div><br/>\
+<div style="display: inline-block; border: 1px dashed green;"><math>${MathMLFragments[tag]}</math></div>\
+</div>`);
+
+ var div = document.body.lastElementChild;
+ var elementShrinkWrapContainer = div.firstElementChild;
+ var element = elementShrinkWrapContainer.firstElementChild.firstElementChild;
+ var elementContainer = div.firstElementChild;
+ var referenceShrinkWrapContainer = div.lastElementChild;
+ var reference = referenceShrinkWrapContainer.firstElementChild.firstElementChild;
+
+ FragmentHelper.forceNonEmptyElement(element);
+ FragmentHelper.forceNonEmptyElement(reference);
+
+ var mspaceWidth = 20, mspaceHeight = 40, mspaceDepth = 30;
+ var marginLeft = 10, marginRight = 15, marginTop = 20, marginBottom = 25;
+ Array.from(element.children).forEach(mrow => {
+ mrow.outerHTML = `<mspace width="${mspaceWidth}px" height="${mspaceHeight}px" depth='${mspaceDepth}px' style='background: blue; margin-left: ${marginLeft}px; margin-right: ${marginRight}px; margin-top: ${marginTop}px; margin-bottom: ${marginBottom}px;'></mspace>`;
+ });
+
+ Array.from(reference.children).forEach(mrow => {
+ mrow.outerHTML = `<mspace width="${marginLeft+mspaceWidth+marginRight}px" height="${mspaceHeight+marginTop}px" depth='${mspaceDepth+marginBottom}px' style='background: green;'></mspace>`;
+ });
+
+ // Compare sizes.
+ compareSize(element, reference, epsilon);
+
+ // Compare children positions.
+ var elementBox = element.getBoundingClientRect();
+ var referenceBox = reference.getBoundingClientRect();
+ for (var i = 0; i < element.children.length; i++) {
+ var childBox = element.children[i].getBoundingClientRect();
+ var referenceChildBox = reference.children[i].getBoundingClientRect();
+ assert_approx_equals(childBox.width + marginLeft + marginRight, referenceChildBox.width, epsilon, `inline size (child ${i})`);
+ assert_approx_equals(childBox.height + marginTop + marginBottom, referenceChildBox.height, epsilon, `block size (child ${i})`);
+
+ assert_approx_equals(childBox.left - marginLeft - elementBox.left,
+ referenceChildBox.left - referenceBox.left,
+ epsilon,
+ `inline position (child ${i})`);
+ assert_approx_equals(childBox.top - marginTop - elementBox.top,
+ referenceChildBox.top - referenceBox.top,
+ epsilon,
+ `block position (child ${i})`);
+ }
+
+ // Compare preferred widths.
+ assert_approx_equals(elementShrinkWrapContainer.offsetWidth, referenceShrinkWrapContainer.offsetWidth, epsilon, "preferred width");
+
+ }, `Margin properties on the children of ${tag}`);
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-001.html
new file mode 100644
index 00000000000..1fda75a59d8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-001.html
@@ -0,0 +1,179 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>padding</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that padding is taken into account.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/box-comparison.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-padding")
+ assert_approx_equals(s.left, 20, epsilon, "left padding");
+ assert_approx_equals(s.right, 30, epsilon, "right padding");
+ assert_approx_equals(s.top, 40, epsilon, "top padding");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom padding");
+ var b = document.getElementById("mrow-padding").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Padding properties on mrow");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection.has_dir());
+ var s = measureSpaceAround("mrow-padding-rtl")
+ assert_approx_equals(s.left, 20, epsilon, "left padding");
+ assert_approx_equals(s.right, 30, epsilon, "right padding");
+ assert_approx_equals(s.top, 40, epsilon, "top padding");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom padding");
+ var b = document.getElementById("mrow-padding-rtl").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Padding properties on mrow (rtl)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-padding-shorthand")
+ assert_approx_equals(s.left, 20, epsilon, "left padding");
+ assert_approx_equals(s.right, 20, epsilon, "right padding");
+ assert_approx_equals(s.top, 20, epsilon, "top padding");
+ assert_approx_equals(s.bottom, 20, epsilon, "bottom padding");
+ var b = document.getElementById("mrow-padding-shorthand").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 20, epsilon, "element width");
+ assert_approx_equals(b.height, 20 + 50 + 20, epsilon, "element height");
+ }, "Padding properties on mrow (shorthand)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-padding-logical")
+ assert_approx_equals(s.left, 20, epsilon, "left padding");
+ assert_approx_equals(s.right, 30, epsilon, "right padding");
+ assert_approx_equals(s.top, 40, epsilon, "top padding");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom padding");
+ var b = document.getElementById("mrow-padding-logical").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Padding properties on mrow (logical)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection.has_dir());
+ var s = measureSpaceAround("mrow-padding-logical-rtl")
+ assert_approx_equals(s.left, 30, epsilon, "left padding");
+ assert_approx_equals(s.right, 20, epsilon, "right padding");
+ assert_approx_equals(s.top, 40, epsilon, "top padding");
+ assert_approx_equals(s.bottom, 50, epsilon, "bottom padding");
+ var b = document.getElementById("mrow-padding-logical-rtl").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 30, epsilon, "element width");
+ assert_approx_equals(b.height, 40 + 50 + 50, epsilon, "element height");
+ }, "Padding properties on mrow (logical, rtl)");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var s = measureSpaceAround("mrow-padding-logical-shorthand")
+ assert_approx_equals(s.left, 20, epsilon, "left padding");
+ assert_approx_equals(s.right, 20, epsilon, "right padding");
+ assert_approx_equals(s.top, 30, epsilon, "top padding");
+ assert_approx_equals(s.bottom, 30, epsilon, "bottom padding");
+ var b = document.getElementById("mrow-padding-logical-shorthand").
+ getBoundingClientRect();
+ assert_approx_equals(b.width, 20 + 50 + 20, epsilon, "element width");
+ assert_approx_equals(b.height, 30 + 50 + 30, epsilon, "element height");
+ }, "Padding properties on mrow (logical, shorthand)");
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-padding"
+ style="padding-left: 20px;
+ padding-right: 30px;
+ padding-top: 40px;
+ padding-bottom: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mrow>
+ <mrow id="mrow-padding-rtl"
+ style="padding-left: 20px;
+ padding-right: 30px;
+ padding-top: 40px;
+ padding-bottom: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-padding-shorthand"
+ style="padding: 20px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-padding-logical"
+ style="padding-inline-start: 20px;
+ padding-inline-end: 30px;
+ padding-block-start: 40px;
+ padding-block-end: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math dir="rtl">
+ <mrow>
+ <mrow id="mrow-padding-logical-rtl"
+ style="padding-inline-start: 20px;
+ padding-inline-end: 30px;
+ padding-block-start: 40px;
+ padding-block-end: 50px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mrow>
+ <mrow id="mrow-padding-logical-shorthand"
+ style="padding-inline: 20px;
+ padding-block: 30px;">
+ <mspace width="50px" height="50px"></mspace>
+ </mrow>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-002.html
new file mode 100644
index 00000000000..e368a55b8af
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-002.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>padding</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that padding is taken into account.">
+<link rel="stylesheet" type="text/css" href="../../../../fonts/ahem.css" />
+<style>
+ math {
+ font: 25px/1 Ahem;
+ }
+</style>
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../../mathml/support/box-comparison.js"></script>
+<script src="../../../../mathml/support/fonts.js"></script>
+<script>
+ var epsilon = 2;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag))
+ continue;
+
+ var defaultInlinePadding = (tag === "mfrac" ? 1 : 0);
+ var style = `padding-left: ${defaultInlinePadding + 30}px; padding-right: ${defaultInlinePadding + 40}px; padding-top: 50px; padding-bottom: 60px;`;
+
+ if (FragmentHelper.isEmpty(tag)) {
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSizeWithAndWithoutStyle(tag, style);
+ assert_approx_equals(s.element_width_delta, 30 + 40, epsilon, "left/right padding");
+ assert_approx_equals(s.element_height_delta, 50 + 60, epsilon, "top/bottom padding");
+ assert_approx_equals(s.preferred_width_delta, 30 + 40, epsilon, "preferred width");
+ }, `Padding properties on ${tag}`);
+ continue;
+ }
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSpaceWithAndWithoutStyle(tag, style);
+ assert_approx_equals(s.left_delta, 30, epsilon, "left padding");
+ assert_approx_equals(s.right_delta, 40, epsilon, "right padding");
+ assert_approx_equals(s.top_delta, 50, epsilon, "top padding");
+ assert_approx_equals(s.bottom_delta, 60, epsilon, "bottom padding");
+ assert_approx_equals(s.element_width_delta, 30 + 40, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta, 50 + 60, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta, 30 + 40, epsilon, "preferred width");
+ }, `Padding properties on ${tag}`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var s = compareSpaceWithAndWithoutStyle(tag, style, "rtl");
+ assert_approx_equals(s.left_delta, 30, epsilon, "left padding");
+ assert_approx_equals(s.right_delta, 40, epsilon, "right padding");
+ assert_approx_equals(s.top_delta, 50, epsilon, "top padding");
+ assert_approx_equals(s.bottom_delta, 60, epsilon, "bottom padding");
+ assert_approx_equals(s.element_width_delta, 30 + 40, epsilon, "element width");
+ assert_approx_equals(s.element_height_delta, 50 + 60, epsilon, "element height");
+ assert_approx_equals(s.preferred_width_delta, 30 + 40, epsilon, "preferred width");
+ }, `Padding properties on ${tag} (rtl)`);
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-border-mpadded-baseline.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-border-mpadded-baseline.html
new file mode 100644
index 00000000000..c118548d966
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/padding-border-margin/padding-border-mpadded-baseline.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Baseline of mpadded with padding and border</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#inner-box-and-requested-parameters">
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that padding and border are taken into account for the baseline of an mpadded element, including when it is empty.">
+<style>
+ math {
+ font-size: 20px;
+ }
+ mpadded {
+ border: 0 solid black;
+ }
+</style>
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function check(id, paddingTop, borderTop, paddingBottom, borderBottom) {
+ var baseline = document.getElementById(`${id}-ref`).getBoundingClientRect().bottom;
+ var box = document.getElementById(id).getBoundingClientRect();
+ assert_approx_equals(box.top, baseline - (20 + paddingTop + borderTop), epsilon, "top of border box");
+ assert_approx_equals(box.bottom, baseline + 10 + paddingBottom + borderBottom, epsilon, "bottom of border box");
+ }
+
+ function runTests() {
+ test(() => check("empty-top", 10, 5, 0, 0), "Empty mpadded with padding-top and border-top");
+ test(() => check("empty-all", 7, 4, 11, 6), "Empty mpadded with padding and border on all sides");
+ test(() => check("nonempty-top", 10, 5, 0, 0), "Non-empty mpadded with padding-top and border-top");
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mspace id="empty-top-ref" width="10px" height="50px"/>
+ <mpadded id="empty-top" width="10px" height="20px" depth="10px" style="padding-top: 10px; border-top-width: 5px;"></mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mspace id="empty-all-ref" width="10px" height="50px"/>
+ <mpadded id="empty-all" width="10px" height="20px" depth="10px" style="padding: 7px 3px 11px 3px; border-width: 4px 2px 6px 2px;"></mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mspace id="nonempty-top-ref" width="10px" height="50px"/>
+ <mpadded id="nonempty-top" width="10px" height="20px" depth="10px" style="padding-top: 10px; border-top-width: 5px;"><mspace width="10px" height="10px" depth="5px"/></mpadded>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/size-containment-001.tentative.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/size-containment-001.tentative.html
new file mode 100644
index 00000000000..7201769c670
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/size-containment-001.tentative.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>MathML and size containment</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<style>
+ /* Revert style specified in the UA style sheet that changes box size. */
+ merror { border: 0; }
+ mfrac { padding: 0; }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag) ||
+ FragmentHelper.isEmpty(tag))
+ continue;
+
+ // TODO(https://github.com/w3c/mathml-core/issues/199): Check/decide how
+ // size containment behave for these cases:
+ // - table layout.
+ // - radical layout.
+ // - contain-intrinsic-block-size.
+ // - operators width special drawing (stretchy/largop).
+ if (tag == "mroot" || tag == "msqrt" || tag == "mtable") {
+ continue;
+ }
+
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block;"><math>${MathMLFragments[tag]}</math></div>\
+</div>`);
+ let div = document.body.lastElementChild;
+
+ let elementContainer = div.firstElementChild;
+ let element = FragmentHelper.element(elementContainer);
+ FragmentHelper.forceNonEmptyDescendants(element);
+
+ const style = `contain: size; contain-intrinsic-inline-size: 111px;`;
+ element.setAttribute("style", style)
+
+ if (tag === "mo") {
+ element.setAttribute("lspace", "0");
+ element.setAttribute("rspace", "0");
+ }
+
+ const elementContainerWidth = elementContainer.getBoundingClientRect().width;
+ const elementBox = element.getBoundingClientRect();
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ assert_equals(elementContainerWidth, 111);
+ }, `intrinsic size of ${tag} with ${style}`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ assert_equals(elementBox.width, 111);
+ }, `inline-size of ${tag} with ${style}`);
+
+ div.style = "display: none;"; // Hide the div after measurement.
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/width-height-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/width-height-001.html
new file mode 100644
index 00000000000..dd5b6ca3da5
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/width-height-001.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>width, height, inline-size and block-size</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify that width, height, inline-size and block-size properties set the size of the content box.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../mathml/support/box-comparison.js"></script>
+<style>
+ /* Revert style specified in the UA style sheet that changes box size. */
+ merror { border: 0; }
+ mfrac { padding: 0; }
+</style>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag))
+ continue;
+
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;"><math><mrow>${MathMLFragments[tag]}</mrow></math></div>`);
+ let div = document.body.lastElementChild;
+ let element = FragmentHelper.element(div.firstElementChild);
+ FragmentHelper.forceNonEmptyDescendants(element);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var style = `width: 500px; height: 400px;`;
+ element.setAttribute("style", style);
+ let box = element.getBoundingClientRect();
+ assert_approx_equals(box.width, 500, epsilon, "width");
+ assert_approx_equals(box.height, 400, epsilon, "height");
+ }, `width and height properties on ${tag}`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var style = `inline-size: 600px; block-size: 700px;`;
+ element.setAttribute("style", style);
+ let box = element.getBoundingClientRect();
+ assert_approx_equals(box.width, 600, epsilon, "width");
+ assert_approx_equals(box.height, 700, epsilon, "height");
+ }, `inline-size and block-size properties on ${tag}`);
+
+ // Test that if we specify a size smaller than the content, then
+ // it is used too. Note that we skip mtable, which follows CSS
+ // tables rules and behave differently in that case.
+ if (tag != "mtable") {
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var style = `width: 2px; height: 1px;`;
+ element.setAttribute("style", style);
+ let box = element.getBoundingClientRect();
+ assert_approx_equals(box.width, 2, epsilon, "width");
+ assert_approx_equals(box.height, 1, epsilon, "height");
+ }, `width and height properties on ${tag} (content overflowing)`);
+ }
+
+ div.style = "display: none;"; // Hide the div after measurement.
+
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;"><div style="display: inline-block"><math><mrow>${MathMLFragments[tag]}</mrow></math></div></div>`);
+ let shrinkWrapDiv = document.body.lastElementChild.firstElementChild;
+ element = FragmentHelper.element(shrinkWrapDiv.firstElementChild);
+ FragmentHelper.forceNonEmptyDescendants(element);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
+ var style = `width: 300px;`;
+ element.setAttribute("style", style);
+ let refPreferredWidth = 300;
+
+ // In the case of mo, spacing is added around the element so that it is included
+ // in the preferred width calculation, which should be the sum of lspace, rspace and width.
+ if (tag === "mo") {
+ element.setAttribute("lspace", "50px");
+ element.setAttribute("rspace", "30px");
+ refPreferredWidth = 380;
+ }
+
+ let box = shrinkWrapDiv.getBoundingClientRect();
+ assert_approx_equals(box.width, refPreferredWidth, epsilon);
+ }, `width property on ${tag} (preferred width)`);
+
+ div.style = "display: none;"; // Hide the div after measurement.
+ }
+
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/width-height-005.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/width-height-005.html
new file mode 100644
index 00000000000..e577eefcfd6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/width-height-005.html
@@ -0,0 +1,541 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>content position with width/height</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify the inline-start of the children of the misc layout algorithms."/>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<script src="../../../mathml/support/fonts.js"></script>
+<style>
+ mn, .text {
+ font: 25px/1 Ahem;
+ color: black;
+ }
+ .test {
+ margin: .5em;
+ }
+ .reference, [data-name] {
+ border: 1px solid blue;
+ margin: 1em;
+ }
+</style>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("load", () => { loadAllFonts().then(runTests); });
+
+ function runTests() {
+ Array.from(document.getElementsByClassName("test")).forEach(div => {
+ const reference = div.getElementsByClassName("reference")[0];
+ Array.from(div.querySelectorAll("[data-name]")).forEach(element => {
+ test(() => {
+ const rtl = getComputedStyle(element).direction == 'ltr';
+ const referenceBox = reference.getBoundingClientRect();
+ const elementBox = element.getBoundingClientRect();
+ const epsilon = 1;
+ assert_greater_than(Math.abs(elementBox.width - referenceBox.width), epsilon, `width is modified`);
+ assert_approx_equals(elementBox.height, referenceBox.height, epsilon, `height is preserved`);
+ for (let i = 0; i < element.children.length; i++) {
+ const referenceChildBox = reference.children[i].getBoundingClientRect();
+ const childBox = element.children[i].getBoundingClientRect();
+ const description = `horizontal position of child ${i}`;
+ if (rtl) {
+ assert_approx_equals(childBox.left - elementBox.left, referenceChildBox.left - referenceBox.left, epsilon, description);
+ } else {
+ assert_approx_equals(childBox.right - elementBox.right, referenceChildBox.right - referenceBox.right, epsilon, description);
+ }
+ }
+ }, element.dataset.name);
+ });
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+
+ <div class="test">
+ <math>
+ <mrow class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mrow>
+ </math>
+ <math>
+ <mrow data-name="mrow" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mrow>
+ </math>
+ <math>
+ <mrow data-name="mrow (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mrow>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <mrow class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mrow>
+ </math>
+ <math dir="rtl">
+ <mrow data-name="RTL mrow" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mrow>
+ </math>
+ <math dir="rtl">
+ <mrow data-name="RTL mrow (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mrow>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <mpadded lspace=".5em" voffset="-1em" class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mpadded>
+ </math>
+ <math>
+ <mpadded lspace=".5em" voffset="-1em" data-name="mpadded" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mpadded>
+ </math>
+ <math>
+ <mpadded lspace=".5em" voffset="-1em" data-name="mpadded (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mpadded>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <mpadded lspace=".5em" voffset="-1em" class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mpadded>
+ </math>
+ <math dir="rtl">
+ <mpadded lspace=".5em" voffset="-1em" data-name="RTL mpadded" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mpadded>
+ </math>
+ <math dir="rtl">
+ <mpadded lspace=".5em" voffset="-1em" data-name="RTL mpadded (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mpadded>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <msqrt class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msqrt>
+ </math>
+ <math>
+ <msqrt data-name="msqrt" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msqrt>
+ </math>
+ <math>
+ <msqrt data-name="msqrt (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msqrt>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <msqrt class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msqrt>
+ </math>
+ <math dir="rtl">
+ <msqrt data-name="RTL msqrt" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msqrt>
+ </math>
+ <math dir="rtl">
+ <msqrt data-name="RTL msqrt (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msqrt>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <mroot class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ </mroot>
+ </math>
+ <math>
+ <mroot data-name="mroot" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </mroot>
+ </math>
+ <math>
+ <mroot data-name="mroot (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </mroot>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <mroot class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ </mroot>
+ </math>
+ <math dir="rtl">
+ <mroot data-name="RTL mroot" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </mroot>
+ </math>
+ <math dir="rtl">
+ <mroot data-name="RTL mroot (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </mroot>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <msub class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msub>
+ </math>
+ <math>
+ <msub data-name="msub" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msub>
+ </math>
+ <math>
+ <msub data-name="msub (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msub>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <msub class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msub>
+ </math>
+ <math dir="rtl">
+ <msub data-name="RTL msub" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msub>
+ </math>
+ <math dir="rtl">
+ <msub data-name="RTL msub (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msub>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <msup class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msup>
+ </math>
+ <math>
+ <msup data-name="msup" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msup>
+ </math>
+ <math>
+ <msup data-name="msup (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msup>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <msup class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msup>
+ </math>
+ <math dir="rtl">
+ <msup data-name="RTL msup" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msup>
+ </math>
+ <math dir="rtl">
+ <msup data-name="RTL msup (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ </msup>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <msubsup class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msubsup>
+ </math>
+ <math>
+ <msubsup data-name="msubsup" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msubsup>
+ </math>
+ <math>
+ <msubsup data-name="msubsup (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msubsup>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <msubsup class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msubsup>
+ </math>
+ <math dir="rtl">
+ <msubsup data-name="RTL msubsup" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msubsup>
+ </math>
+ <math dir="rtl">
+ <msubsup data-name="RTL msubsup (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </msubsup>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <mmultiscripts class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mprescripts/>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ </math>
+ <math>
+ <mmultiscripts data-name="mmultiscripts" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mprescripts/>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ </math>
+ <math>
+ <mmultiscripts data-name="mmultiscripts (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mprescripts/>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <mmultiscripts class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mprescripts/>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ </math>
+ <math dir="rtl">
+ <mmultiscripts data-name="RTL mmultiscripts" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mprescripts/>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ </math>
+ <math dir="rtl">
+ <mmultiscripts data-name="RTL mmultiscripts (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ <mprescripts/>
+ <mn>X</mn>
+ <mn>X</mn>
+ </mmultiscripts>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <mtext class="reference">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ </mtext>
+ </math>
+ <math>
+ <mtext data-name="mtext" style="width: 10em">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ </mtext>
+ </math>
+ <math>
+ <mtext data-name="mtext (horizontal overflow)" style="width: 1em">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ </mtext>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <mtext class="reference">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ </mtext>
+ </math>
+ <math dir="rtl">
+ <mtext data-name="RTL mtext" style="width: 10em">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ </mtext>
+ </math>
+ <math dir="rtl">
+ <mtext data-name="RTL mtext (horizontal overflow)" style="width: 1em">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ <span class="text">X</span class="text">
+ </mtext>
+ </math>
+ </div>
+
+ <div class="test">
+ <math>
+ <menclose class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </menclose>
+ </math>
+ <math>
+ <menclose data-name="legacy menclose" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </menclose>
+ </math>
+ <math>
+ <menclose data-name="legacy menclose (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </menclose>
+ </math>
+ </div>
+
+ <div class="test" dir="rtl">
+ <math dir="rtl">
+ <menclose class="reference">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </menclose>
+ </math>
+ <math dir="rtl">
+ <menclose data-name="RTL legacy menclose" style="width: 10em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </menclose>
+ </math>
+ <math dir="rtl">
+ <menclose data-name="RTL legacy menclose (horizontal overflow)" style="width: 1em">
+ <mn>X</mn>
+ <mn>X</mn>
+ <mn>X</mn>
+ </menclose>
+ </math>
+ </div>
+
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-001.html
new file mode 100644
index 00000000000..1f4af5374d8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-001.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>writing mode</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify CSS writing mode (writing-mode and directionproperties) for mrow.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/layout-comparison.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ var reference = document.getElementById("horizontal-tb_ltr");
+
+ ["horizontal-tb_rtl"].forEach(id => {
+ var element = document.getElementById(id);
+
+ test(function() {
+ var style = window.getComputedStyle(element);
+ var writingMode = id.split("_");
+ assert_equals(style.getPropertyValue("writing-mode"),
+ writingMode[0], "writing-mode");
+ assert_equals(style.getPropertyValue("direction"),
+ writingMode[1], "direction");
+ }, `Inheritance of CSS writing-mode and direction (id='${id}')`);
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ compareLayout(element, reference, epsilon);
+ }, `Layout of mrow (id='${id}')`);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mrow id="horizontal-tb_ltr">
+ <mspace style="background: blue"
+ width="20px" height="30px" depth="40px"></mspace>
+ <mspace style="background: black"
+ width="50px" depth="60px"></mspace>
+ <mspace style="background: yellow"
+ width="70px" height="80px"></mspace>
+ </mrow>
+ </math>
+ </p>
+ <p>
+ <math style="direction: rtl;">
+ <mrow id="horizontal-tb_rtl">
+ <mspace style="background: blue"
+ width="20px" height="30px" depth="40px"></mspace>
+ <mspace style="background: black"
+ width="50px" depth="60px"></mspace>
+ <mspace style="background: yellow"
+ width="70px" height="80px"></mspace>
+ </mrow>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-002.html
new file mode 100644
index 00000000000..fd3425a0602
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/css-styling/writing-mode/writing-mode-002.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>writing mode</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
+<meta name="assert" content="Verify CSS writing mode (writing-mode and direction properties) for mrow.">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../mathml/support/feature-detection.js"></script>
+<script src="../../../../mathml/support/layout-comparison.js"></script>
+<script src="../../../../mathml/support/mathml-fragments.js"></script>
+<script>
+ var epsilon = 1;
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+
+ function runTests() {
+ for (tag in MathMLFragments) {
+ if (tag == "annotation" || tag == "annotation-xml")
+ continue; // These tags have display: none.
+
+ ["horizontal-tb_rtl"].forEach(id => {
+ var writingMode = id.split("_");
+ var writingModeString = `writing-mode: ${writingMode[0]}; direction: ${writingMode[1]};`;
+
+ document.body.insertAdjacentHTML("beforeend", `<div>\
+<math>${MathMLFragments[tag]}</math>\
+<math>${MathMLFragments[tag]}</math>\
+</div>`);
+ var div = document.body.lastElementChild;
+
+ var styleMath = div.firstElementChild;
+ styleMath.setAttribute("style", writingModeString);
+ var styleElement = FragmentHelper.element(styleMath);
+
+ var referenceMath = div.lastElementChild;
+ var referenceElement = FragmentHelper.element(referenceMath);
+
+ [styleMath, referenceMath].forEach(math => {
+ Array.from(math.getElementsByClassName("mathml-container")).forEach(container => {
+ container.insertAdjacentHTML("beforeend", "\
+<mspace style='background: blue'\
+ width='20px' height='30px' depth='40px'></mspace>\
+<mspace style='background: black'\
+ width='50px' depth='60px'></mspace>\
+<mspace style='background: yellow'\
+ width='70px' height='80px'></mspace>");
+ });
+ Array.from(math.getElementsByClassName("foreign-container")).forEach(container => {
+ container.insertAdjacentHTML("beforeend", "\
+<span style='display: inline-block; background: lightblue;\
+ inline-size: 20px; block-size: 30px;\
+ vertical-align: bottom;'></span>\
+<span style='display: inline-block; background: pink;\
+ inline-size: 40px; block-size: 50px;\
+ vertical-align: bottom;'></span>");
+ });
+ });
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ var style = window.getComputedStyle(styleElement);
+ assert_equals(style.getPropertyValue("writing-mode"),
+ writingMode[0], "writing-mode");
+ assert_equals(style.getPropertyValue("direction"),
+ writingMode[1], "direction");
+ compareLayout(styleElement, referenceElement, epsilon);
+ }, `Layout of ${tag} (${writingModeString})`);
+
+ div.style = "display: none;"; // Hide the div after testing.
+ });
+ }
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/canvas-visited-privacy.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/canvas-visited-privacy.html
new file mode 100644
index 00000000000..a2b510f9efb
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/canvas-visited-privacy.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+
+<meta charset="utf-8">
+<title>MathML 'a' element inside SVG to Canvas: :visited pixel leak enforcement</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#privacy-considerations">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+
+<canvas id="canvas" width="200" height="50"></canvas>
+
+<script>
+ promise_test(async t => {
+ const canvas = document.getElementById('canvas');
+ const ctx = canvas.getContext('2d');
+
+ const svgString = `
+ <svg xmlns="http://www.w3.org/2000/svg" width="200" height="50">
+ <foreignObject width="100%" height="100%">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <style>
+ a:any-link > mspace { background: rgb(0, 255, 0); }
+ a:visited > mspace { background: rgb(255, 0, 0); }
+ </style>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <!-- The empty string means the current page, so it's :visited -->
+ <a href=""><mspace width="200px" height="50px"/></a>
+ </math>
+ </div>
+ </foreignObject>
+ </svg>
+`;
+
+ const svgBlob = new Blob([svgString], { type: 'image/svg+xml;charset=utf-8' });
+ const url = URL.createObjectURL(svgBlob);
+ const img = new Image();
+
+ await new Promise((resolve, reject) => {
+ img.onload = resolve;
+ img.onerror = () => reject(new Error("SVG image failed to load."));
+ img.src = url;
+ });
+
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.drawImage(img, 0, 0);
+ URL.revokeObjectURL(url);
+
+ function tryGetImgData(sx, sy, sw, sh) {
+ try {
+ return ctx.getImageData(sx, sy, sw, sh).data;
+ } catch (e) {
+ return null;
+ }
+ }
+
+ let imgData = tryGetImgData(100, 25, 1, 1);
+ if (imgData) {
+ // For browsers returning the data, check pixel color does not reveal :visited.
+ const expectedRGBA = [0, 255, 0, 255];
+ assert_array_equals(imgData, expectedRGBA, "Background color should apply style from :any-link but not from :visited.");
+ } else {
+ // For browsers throwing, verify this is a security error.
+ assert_throws_dom("SecurityError", _ => ctx.getImageData(100, 25, 1, 1)
+ , "If an exception is thrown, it must be a SecurityError due to a tainted canvas.");
+ }
+ }, "Ensure MathML 'a' elements inside SVG drawn to canvas do not leak :visited styles via getImageData");
+</script>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/clipboard-event-handlers.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/clipboard-event-handlers.html
new file mode 100644
index 00000000000..0341f5aa3b6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/clipboard-event-handlers.html
@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+<title>clipboard event handlers for MathML</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript"/>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers"/>
+<link rel="help" href="https://w3c.github.io/clipboard-apis/#clipboard-event-copy"/>
+<link rel="help" href="https://w3c.github.io/clipboard-apis/#clipboard-event-cut"/>
+<link rel="help" href="https://w3c.github.io/clipboard-apis/#clipboard-event-paste"/>
+<meta
+ name="assert"
+ content="MathMLElements incorporates oncopy / oncut / onpaste event handlers"
+/>
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<div id="log"></div>
+<math
+ oncopy="window.copyHappened1 = true"
+ oncut="window.cutHappened1 = true"
+ onpaste="window.pasteHappened1 = true"
+>
+ <mi>E</mi>
+</math>
+<script>
+ const EVENTS = ["copy", "cut", "paste"];
+ const el = document.querySelector("math");
+
+ function dispatchEventTest(name) {
+ const mathEl = document.createElementNS(
+ "http://www.w3.org/1998/Math/MathML",
+ "math"
+ );
+ test(() => {
+ let target = undefined;
+ mathEl[`on${name}`] = (e) => { target = e.currentTarget; }
+ const event = new ClipboardEvent(name, {
+ bubbles: true,
+ cancellable: true
+ });
+ mathEl.dispatchEvent(event);
+ assert_equals(target, mathEl, "The event must be fired at the <math> element");
+ }, `${name}: dispatching an Event at a <math> element must trigger element.on${name}`);
+ }
+
+ function evaluatedHandlerTest(name) {
+ const handlerName = "on" + name;
+
+ test(() => {
+ const compiledHandler = el[handlerName];
+
+ assert_equals(
+ typeof compiledHandler,
+ "function",
+ `The ${handlerName} property must be a function`
+ );
+ compiledHandler();
+ assert_true(
+ window[`${name}Happened1`],
+ "Calling the handler must run the code"
+ );
+ }, `${handlerName}: the content attribute must be compiled into a function as the corresponding property`);
+
+ test(() => {
+ const mathEl = document.createElementNS(
+ "http://www.w3.org/1998/Math/MathML",
+ "math"
+ );
+ assert_equals(mathEl[handlerName], null, `The ${handlerName} property must be null (no attribute)`);
+
+ mathEl.setAttribute(handlerName, `window.${handlerName}Happened2 = true;`);
+ const compiledHandler = mathEl[handlerName];
+ assert_equals(
+ typeof compiledHandler,
+ "function",
+ `The ${handlerName} property must be a function (set attribute)`
+ );
+ compiledHandler();
+ assert_true(
+ window[`${handlerName}Happened2`],
+ "Calling the handler must run the code (set attribute)"
+ );
+
+ window[`${handlerName}Happened2`] = false;
+ const clonedMathEl = mathEl.cloneNode(true);
+ const clonedCompiledHandler = clonedMathEl[handlerName];
+ assert_equals(
+ typeof clonedCompiledHandler,
+ "function",
+ `The ${handlerName} property must be a function (clone node)`
+ );
+ clonedCompiledHandler();
+ assert_true(
+ window[`${handlerName}Happened2`],
+ "Calling the handler must run the code (clone node)"
+ );
+
+ mathEl.setAttribute(handlerName, `window.${handlerName}Happened3 = true;`);
+ const newCompiledHandler = mathEl[handlerName];
+ assert_equals(
+ typeof newCompiledHandler,
+ "function",
+ `The ${handlerName} property must be a function (modify attribute)`
+ );
+ newCompiledHandler();
+ assert_true(
+ window[`${handlerName}Happened3`],
+ "Calling the handler must run the code (modify attribute)"
+ );
+
+ mathEl.removeAttribute(handlerName);
+ assert_equals(mathEl[handlerName], null, `The ${handlerName} property must be null (remove attribute)`);
+ }, `${handlerName}: dynamic changes on the attribute`);
+
+ }
+
+ EVENTS.forEach(name => {
+ dispatchEventTest(name);
+ evaluatedHandlerTest(name);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/content-editable.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/content-editable.html
new file mode 100644
index 00000000000..268d5c7cb62
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/content-editable.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>MathML inside content-editable</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#html-and-svg">
+<meta name="assert" content="Verify that putting MathML inside a content-editable div shouldn't affect its layout.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("DOMContentLoaded", function() {
+ var epsilon = 1;
+ var mfrac = document.getElementById("mfrac");
+ var num = mfrac.firstElementChild.getBoundingClientRect();
+ var denom = mfrac.lastElementChild.getBoundingClientRect();
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(num.width, 30, epsilon, "numerator width");
+ assert_approx_equals(num.height, 40, epsilon, "numerator height");
+ assert_approx_equals(denom.width, 50, epsilon, "denominator width");
+ assert_approx_equals(denom.height, 60, epsilon, "denominator height");
+ }, "mspace layout in content-editable div");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mfrac());
+ assert_greater_than_equal(denom.bottom - num.top,
+ (40 + 60),
+ "numerator is above the denominator");
+ assert_approx_equals((num.left + num.right) / 2,
+ (denom.left + denom.right) / 2,
+ epsilon, "numerator and denominator are horizontally aligned");
+ }, "mfrac layout in content-editable div");
+ done();
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <div contenteditable="true">
+ This is
+ <math>
+ <mfrac id="mfrac">
+ <mspace width="30px" height="40px" style="background: cyan"></mspace>
+ <mspace width="50px" height="60px" style="background: yellow"></mspace>
+ </mfrac>
+ </math>
+ a content editable div
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/display-1.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/display-1.html
new file mode 100644
index 00000000000..4bffab2f16b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/display-1.html
@@ -0,0 +1,175 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>MathML display attribute</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
+<link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript">
+<meta name="assert" content="Verify that the display attribute on the math element is supported and impacts centering and line breaking with surrounding content.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/attribute-values.js"></script>
+<script>
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+ window.addEventListener("DOMContentLoaded", function() {
+ for (transform in AttributeValueTransforms) {
+ TransformAttributeValues(transform, ["display"]);
+ var content = getBox("content");
+
+ var before_block = getBox("before_block");
+ var mspace_block = getBox("mspace_block");
+ var after_block = getBox("after_block");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(before_block.left, content.left, 1,
+ "content before must be left aligned");
+ assert_approx_equals((mspace_block.left + mspace_block.right) / 2,
+ (content.left + content.right) / 2,
+ 1,
+ "math must be centered.");
+ assert_approx_equals(after_block.left, content.left, 1,
+ "content after must be left aligned");
+ assert_less_than_equal(before_block.bottom, mspace_block.top,
+ "new line before math");
+ assert_less_than_equal(mspace_block.bottom, after_block.top,
+ "new line after math");
+ }, `Test display math ${transform}`);
+
+ var before_inline = getBox("before_inline");
+ var mspace_inline = getBox("mspace_inline");
+ var after_inline = getBox("after_inline");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals((before_inline.top + before_inline.bottom) / 2,
+ (mspace_inline.top + mspace_inline.bottom) / 2,
+ 1,
+ "content before must be horizontally aligned with math");
+ assert_approx_equals((after_inline.top + after_inline.bottom) / 2,
+ (mspace_inline.top + mspace_inline.bottom) / 2,
+ 1,
+ "content after must be horizontally aligned with math");
+ assert_less_than_equal(before_inline.right, mspace_inline.left,
+ "content before must be on the left of math");
+ assert_less_than_equal(mspace_inline.right, after_inline.left,
+ "content after must be on the right of math");
+ }, `Test inline math ${transform}`);
+
+ var before_block_and_specified_width = getBox("before_block_and_specified_width");
+ var mspace_width = getBox("mspace_width");
+ var after_block_and_specified_width = getBox("after_block_and_specified_width");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ let math = getBox("math_with_specified_width");
+ assert_approx_equals(before_block_and_specified_width.left, math.left, 1,
+ "content before must be left aligned");
+ assert_approx_equals(math.width, 100, 1,
+ "math uses specified width.");
+ assert_approx_equals((mspace_width.left + mspace_width.right) / 2,
+ (math.left + math.right) / 2,
+ 1,
+ "math must be centered.");
+ assert_approx_equals(after_block_and_specified_width.left, math.left, 1,
+ "content after must be left aligned");
+ assert_less_than_equal(before_block_and_specified_width.bottom, mspace_width.top,
+ "new line before math");
+ assert_less_than_equal(mspace_width.bottom, after_block_and_specified_width.top,
+ "new line after math");
+ }, `Test width on display=block math ${transform}`);
+ }
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ document.getElementById("mspace_dynamic_block").parentNode.
+ setAttribute("display", "block");
+ var before_block = getBox("before_dynamic_block");
+ var mspace_block = getBox("mspace_dynamic_block");
+ var after_block = getBox("after_dynamic_block");
+
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(before_block.left, content.left, 1,
+ "content before must be left aligned");
+ assert_approx_equals((mspace_block.left + mspace_block.right) / 2,
+ (content.left + content.right) / 2,
+ 1,
+ "math must be centered.");
+ assert_approx_equals(after_block.left, content.left, 1,
+ "content after must be left aligned");
+ assert_less_than_equal(before_block.bottom, mspace_block.top,
+ "new line before math");
+ assert_less_than_equal(mspace_block.bottom, after_block.top,
+ "new line after math");
+ }, "Test dynamically setting display=block");
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ document.getElementById("mspace_dynamic_inline").parentNode.
+ removeAttribute("display");
+ var before_inline = getBox("before_dynamic_inline");
+ var mspace_inline = getBox("mspace_dynamic_inline");
+ var after_inline = getBox("after_dynamic_inline");
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals((before_inline.top + before_inline.bottom) / 2,
+ (mspace_inline.top + mspace_inline.bottom) / 2,
+ 1,
+ "content before must be horizontally aligned with math");
+ assert_approx_equals((after_inline.top + after_inline.bottom) / 2,
+ (mspace_inline.top + mspace_inline.bottom) / 2,
+ 1,
+ "content after must be horizontally aligned with math");
+ assert_less_than_equal(before_inline.right, mspace_inline.left,
+ "content before must be on the left of math");
+ assert_less_than_equal(mspace_inline.right, after_inline.left,
+ "content after must be on the right of math");
+ }, "Test dynamically setting display=inline");
+
+ done();
+ });
+</script>
+<style>
+ #content {
+ width: 600px;
+ background: #ccc;
+ }
+ span.square {
+ display: inline-block;
+ width: 50px;
+ height: 50px;
+ background: black;
+ }
+ mspace {
+ background: blue;
+ }
+</style>
+</head>
+<body>
+ <div id="log"></div>
+ <div id="content">
+ <span id="before_block" class="square"></span>
+ <math display="block"><mspace id="mspace_block" width="50px" height="50px"/></math>
+ <span id="after_block" class="square"></span>
+ <br/>
+ <span id="before_inline" class="square"></span>
+ <math display="inline"><mspace id="mspace_inline" width="50px" height="50px"/></math>
+ <span id="after_inline" class="square"></span>
+ <br/>
+ <span id="before_block_and_specified_width" class="square"></span>
+ <math display="block" id="math_with_specified_width" style="background: pink; width:100px"><mspace id="mspace_width" width="50px" height="50px"/></math>
+ <span id="after_block_and_specified_width" class="square"></span>
+ <br/>
+ <div>
+ <span id="before_dynamic_block" class="square"></span>
+ <math><mspace id="mspace_dynamic_block" width="50px" height="50px"/></math>
+ <span id="after_dynamic_block" class="square"></span>
+ </div>
+ <div>
+ <span id="before_dynamic_inline" class="square"></span>
+ <math display="block"><mspace id="mspace_dynamic_inline" width="50px" height="50px"/></math>
+ <span id="after_dynamic_inline" class="square"></span>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/dynamic-childlist-001.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/dynamic-childlist-001.html
new file mode 100644
index 00000000000..f6ee0873630
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/dynamic-childlist-001.html
@@ -0,0 +1,630 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Dynamic childlist of MathML elements</title>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript">
+<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
+<link rel="help" href="https://w3c.github.io/mathml-core/#prescripts-and-tensor-indices-mmultiscripts">
+<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
+<link rel="help" href="https://w3c.github.io/mathml-core/#space-mspace">
+<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
+<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
+<meta name="assert" content="Dynamically modify DOM tree of some MathML elements by adding or removing children.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script>
+ function forceNumberOfChildren(element, count) {
+ while (element.children.length > count)
+ element.removeChild(element.lastElementChild);
+ for (let i = element.children.length; i < count; i++) {
+ if (element.tagName === "mmultiscripts" && i === 5) {
+ element.appendChild(FragmentHelper.createElement("mprescripts"));
+ } else {
+ let mspace = FragmentHelper.createElement("mspace");
+ mspace.setAttribute("width", `10px`);
+ mspace.setAttribute("height", `${10*(i+1)}px`);
+ mspace.setAttribute("style", `background: black;`);
+ element.appendChild(mspace);
+ }
+ }
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", function() {
+ // force initial layout so we're sure what we're testing against
+ document.documentElement.getBoundingClientRect();
+
+ let reference = document.getElementById("reference");
+
+ Array.from(document.querySelectorAll("[data-title]")).forEach(element => {
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ let reference = document.getElementById(`${element.getAttribute("data-reference")}`);
+ forceNumberOfChildren(element, reference.children.length);
+ const epsilon = 1;
+ if (element.tagName == "mspace") {
+ compareSize(element, reference, epsilon);
+ childrenHaveEmptyBoundingClientRects(element);
+ childrenHaveEmptyBoundingClientRects(reference);
+ } else {
+ compareLayout(element, reference, epsilon);
+ }
+ }, `${element.getAttribute("data-title")}`);
+ });
+ done();
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math>
+ <mfrac id="mfrac-reference-1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </mfrac>
+ <mfrac id="mfrac-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mfrac>
+ <mfrac id="mfrac-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mfrac data-reference="mfrac-reference-2" data-title="Adding missing children to mfrac">
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mfrac data-reference="mfrac-reference-1" data-title="Removing child from valid mfrac">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mfrac data-reference="mfrac-reference-3" data-title="Adding child to valid mfrac">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mfrac>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mfrac data-reference="mfrac-reference-2" data-title="Removing extra child from mfrac">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mfrac>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <munder id="munder-reference-1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </munder>
+ <munder id="munder-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </munder>
+ <munder id="munder-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </munder>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munder data-reference="munder-reference-2" data-title="Adding missing children to munder">
+ </munder>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munder data-reference="munder-reference-1" data-title="Removing child from valid munder">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </munder>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munder data-reference="munder-reference-3" data-title="Adding child to valid munder">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </munder>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munder data-reference="munder-reference-2" data-title="Removing extra child from munder">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </munder>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <mover id="mover-reference-1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </mover>
+ <mover id="mover-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mover>
+ <mover id="mover-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover data-reference="mover-reference-2" data-title="Adding missing children to mover">
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover data-reference="mover-reference-1" data-title="Removing child from valid mover">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover data-reference="mover-reference-3" data-title="Adding child to valid mover">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mover data-reference="mover-reference-2" data-title="Removing extra child from mover">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <munderover id="munderover-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </munderover>
+ <munderover id="munderover-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </munderover>
+ <munderover id="munderover-reference-4">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ <mspace width="10px" height="40px" style="background: black;"/>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover data-reference="munderover-reference-3" data-title="Adding missing children to munderover">
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover data-reference="munderover-reference-2" data-title="Removing child from valid munderover">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover data-reference="munderover-reference-4" data-title="Adding child to valid munderover">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </munderover>
+ </math>
+ </p>
+ <p>
+ <math>
+ <munderover data-reference="munderover-reference-3" data-title="Removing extra child from munderover">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ <mspace width="10px" height="40px" style="background: black;"/>
+ </munderover>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <msub id="msub-reference-1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </msub>
+ <msub id="msub-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msub>
+ <msub id="msub-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msub>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msub data-reference="msub-reference-2" data-title="Adding missing children to msub">
+ </msub>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msub data-reference="msub-reference-1" data-title="Removing child from valid msub">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msub>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msub data-reference="msub-reference-3" data-title="Adding child to valid msub">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msub>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msub data-reference="msub-reference-2" data-title="Removing extra child from msub">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msub>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <msup id="msup-reference-1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </msup>
+ <msup id="msup-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msup>
+ <msup id="msup-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msup data-reference="msup-reference-2" data-title="Adding missing children to msup">
+ </msup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msup data-reference="msup-reference-1" data-title="Removing child from valid msup">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msup data-reference="msup-reference-3" data-title="Adding child to valid msup">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msup data-reference="msup-reference-2" data-title="Removing extra child from msup">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msup>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <msubsup id="msubsup-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msubsup>
+ <msubsup id="msubsup-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msubsup>
+ <msubsup id="msubsup-reference-4">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ <mspace width="10px" height="40px" style="background: black;"/>
+ </msubsup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup data-reference="msubsup-reference-3" data-title="Adding missing children to msubsup">
+ </msubsup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup data-reference="msubsup-reference-2" data-title="Removing child from valid msubsup">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msubsup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup data-reference="msubsup-reference-4" data-title="Adding child to valid msubsup">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msubsup>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msubsup data-reference="msubsup-reference-3" data-title="Removing extra child from msubsup">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ <mspace width="10px" height="40px" style="background: black;"/>
+ </msubsup>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <mroot id="mroot-reference-1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </mroot>
+ <mroot id="mroot-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mroot>
+ <mroot id="mroot-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mroot>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mroot data-reference="mroot-reference-2" data-title="Adding missing children to mroot">
+ </mroot>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mroot data-reference="mroot-reference-1" data-title="Removing child from valid mroot">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mroot>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mroot data-reference="mroot-reference-3" data-title="Adding child to valid mroot">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mroot>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mroot data-reference="mroot-reference-2" data-title="Removing extra child from mroot">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mroot>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <msqrt id="msqrt-reference-0">
+ </msqrt>
+ <msqrt id="msqrt-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </msqrt>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msqrt data-reference="msqrt-reference-0" data-title="Removing children from msqrt">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </msqrt>
+ </math>
+ </p>
+ <p>
+ <math>
+ <msqrt data-reference="msqrt-reference-2" data-title="Adding children to msqrt">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </msqrt>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <mpadded id="mpadded-reference-0">
+ </mpadded>
+ <mpadded id="mpadded-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mpadded data-reference="mpadded-reference-0" data-title="Removing children from mpadded">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mpadded>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mpadded data-reference="mpadded-reference-2" data-title="Adding children to mpadded">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </mpadded>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <mspace id="mspace-reference-0" width="30px" height="70px" style="background: blue">
+ </mspace>
+ <mspace id="mspace-reference-2" width="30px" height="70px" style="background: green">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mspace>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mspace data-reference="mspace-reference-0" data-title="Removing children from mspace" width="30px" height="70px" style="background: lightblue">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mspace>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mspace data-reference="mspace-reference-2" data-title="Adding children to mspace" width="30px" height="70px" style="background: lightgreen">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </mspace>
+ </math>
+ </p>
+ <hr/>
+ <p>
+ <math>
+ <mmultiscripts id="mmultiscripts-reference-0">
+ </mmultiscripts>
+ <mmultiscripts id="mmultiscripts-reference-1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ </mmultiscripts>
+ <mmultiscripts id="mmultiscripts-reference-2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ </mmultiscripts>
+ <mmultiscripts id="mmultiscripts-reference-3">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mmultiscripts>
+ <mmultiscripts id="mmultiscripts-reference-6">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ <mspace width="10px" height="40px" style="background: black;"/>
+ <mspace width="10px" height="50px" style="background: black;"/>
+ <mprescripts/>
+ </mmultiscripts>
+ <mmultiscripts id="mmultiscripts-reference-8">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ <mspace width="10px" height="40px" style="background: black;"/>
+ <mspace width="10px" height="50px" style="background: black;"/>
+ <mprescripts/>
+ <mspace width="10px" height="70px" style="background: black;"/>
+ <mspace width="10px" height="80px" style="background: black;"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-reference="mmultiscripts-reference-0" data-title="multiscripts child count from 3 to 0">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-reference="mmultiscripts-reference-1" data-title="multiscripts child count from 3 to 1">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-reference="mmultiscripts-reference-2" data-title="multiscripts child count from 3 to 2">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-reference="mmultiscripts-reference-3" data-title="multiscripts child count from 0 to 3">
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-reference="mmultiscripts-reference-6" data-title="multiscripts child count from 3 to 6">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mmultiscripts>
+ </math>
+ </p>
+ <p>
+ <math>
+ <mmultiscripts data-reference="mmultiscripts-reference-8" data-title="multiscripts child count from 3 to 8">
+ <mspace width="10px" height="10px" style="background: black;"/>
+ <mspace width="10px" height="20px" style="background: black;"/>
+ <mspace width="10px" height="30px" style="background: black;"/>
+ </mmultiscripts>
+ </math>
+ </p>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/dynamic-childlist-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/dynamic-childlist-002.html
new file mode 100644
index 00000000000..c33ce96497b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/dynamic-childlist-002.html
@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Dynamic childlist of MathML elements</title>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript">
+<meta name="assert" content="Dynamically modify DOM tree of some MathML elements by adding or removing children.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script src="../../../mathml/support/layout-comparison.js"></script>
+<script>
+ function generateMathForTag(tag, childCount) {
+ let math = FragmentHelper.createElement("math");
+ let element = FragmentHelper.createElement(tag);
+ // Add the children with different sizes at odd positions and OOF
+ // mrow at even position.
+ for (let i = 0; i < childCount; i++) {
+ if (i % 2) {
+ let mspace = FragmentHelper.createElement("mspace");
+ mspace.setAttribute("width", `10px`);
+ mspace.setAttribute("height", `${10*(i+1)}px`);
+ mspace.setAttribute("style", `background: black;`);
+ element.appendChild(mspace);
+ } else {
+ let mrow = FragmentHelper.createElement("mrow");
+ mrow.setAttribute("style", "position: absolute");
+ element.appendChild(mrow);
+ }
+ }
+ if (FragmentHelper.isValidChildOfMrow(tag)) {
+ math.appendChild(element);
+ } else if (tag === "mtd") {
+ let mtr = FragmentHelper.createElement("mtr");
+ mtr.appendChild(element);
+ let mtable = FragmentHelper.createElement("mtable");
+ mtable.appendChild(mtr);
+ math.appendChild(mtable);
+ } else {
+ throw `Invalid argument: ${tag}`;
+ }
+ return math;
+ }
+
+ setup({ explicit_done: true });
+ window.addEventListener("load", function() {
+
+ for (tag in MathMLFragments) {
+ if (!FragmentHelper.isValidChildOfMrow(tag) || tag === "mtd")
+ continue;
+
+ document.body.insertAdjacentHTML("beforeend", `<div style='display: none; background: pink;'>${tag}: <div></div><div></div><div></div></div>`);
+
+ let container = document.body.lastElementChild;
+ let referenceDiv = container.children[0];
+ const maxChild = 10;
+ const epsilon = 1;
+
+ // Create the references for different number of children as well
+ // as the element that will get the children added / removed.
+ for (let i = 0; i <= maxChild; i++)
+ referenceDiv.append(generateMathForTag(tag, i));
+ let fullReferenceMath = referenceDiv.lastElementChild;
+ let fullReferenceTag = fullReferenceMath.firstElementChild;
+
+ let removeChildrenMath = generateMathForTag(tag, maxChild);
+ container.children[1].append(removeChildrenMath);
+ let removeChildrenTag = removeChildrenMath.firstElementChild;
+
+ let appendChildrenMath = generateMathForTag(tag, 0);
+ container.children[2].append(appendChildrenMath);
+ let appendChildrenTag = appendChildrenMath.firstElementChild;
+
+ // Make content visible after the DOM is ready so that the layout
+ // only happens now.
+ container.style.display = "block";
+
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_true(MathMLFeatureDetection[`has_${tag}`]());
+
+ for (let i = 0; i < maxChild; i++) {
+ // append and remove children.
+ appendChildrenTag.append(fullReferenceTag.children[i].cloneNode(true));
+ removeChildrenTag.removeChild(removeChildrenTag.lastElementChild);
+
+ // force layout so we're sure what we're testing against
+ container.getBoundingClientRect();
+
+ let appendCount = appendChildrenTag.children.length;
+ let removeCount = removeChildrenTag.children.length;
+ if (tag == "mspace") {
+ compareSize(appendChildrenTag, referenceDiv.children[appendCount].firstElementChild, epsilon);
+ childrenHaveEmptyBoundingClientRects(appendChildrenTag);
+ childrenHaveEmptyBoundingClientRects(referenceDiv.children[appendCount].firstElementChild);
+ childrenHaveEmptyBoundingClientRects(removeChildrenTag);
+ childrenHaveEmptyBoundingClientRects(referenceDiv.children[removeCount].firstElementChild);
+ } else {
+ compareLayout(appendChildrenTag, referenceDiv.children[appendCount].firstElementChild, epsilon, `appending ${appendCount}-th child`);
+ compareLayout(removeChildrenTag, referenceDiv.children[removeCount].firstElementChild, epsilon, `removing ${appendCount + 1}-th child`);
+ }
+ }
+
+ // Hide back the div after successful testing.
+ container.style.display = "none";
+
+ }, `Appending and removing children to ${tag}`);
+ }
+
+ done();
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/href-click-004.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/href-click-004.html
new file mode 100644
index 00000000000..d27879e73be
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/href-click-004.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>href click</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript">
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/testdriver.js"></script>
+<script src="../../../resources/testdriver-vendor.js"></script>
+<style>
+ annotation, annotation-xml { display: initial; }
+ mphantom { visibility: visible; }
+ .element, mtr.element > mtd { background: lightblue; padding: 50px; }
+</style>
+</head>
+<body>
+ <div id="container"></div>
+ <script>
+ for (tag in MathMLFragments) {
+ if (tag === "a" || FragmentHelper.isEmpty(tag)) continue;
+ container.insertAdjacentHTML("beforeend", `<math>${MathMLFragments[tag]}</math>`);
+ let element = FragmentHelper.element(container.lastElementChild);
+ element.setAttribute("href", "badHandler()");
+ }
+ Array.from(document.getElementsByClassName("element")).forEach(element => {
+ promise_test(t => {
+ t.add_cleanup = _ => window.badHandler = undefined;
+ window.badHandler = t.unreached_func("Bad handler executed");
+ return test_driver.click(element);
+ }, `${element.tagName} with href attribute does not react to click.`);
+ });
+ </script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/integration-point-4.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/integration-point-4.html
new file mode 100644
index 00000000000..e286ee4b3f7
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/integration-point-4.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>MathML inside foreignObject</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#html-and-svg">
+<meta name="assert" content="Verify that MathML can be used inside a foreignObject element.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("DOMContentLoaded", function() {
+ var scale = 2;
+ var epsilon = 1;
+ var mfrac = document.getElementById("mfrac");
+ var num = mfrac.firstElementChild.getBoundingClientRect();
+ var denom = mfrac.lastElementChild.getBoundingClientRect();
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ // The values of width and height are inverted (because of the
+ // rotation) and multiplied by the scale factor.
+ assert_approx_equals(num.height, 30 * scale, epsilon, "numerator width");
+ assert_approx_equals(num.width, 40 * scale, epsilon, "numerator height");
+ assert_approx_equals(denom.height, 50 * scale, epsilon, "numerator width");
+ assert_approx_equals(denom.width, 60 * scale, epsilon, "numerator height");
+ }, "mspace layout in SVG foreignObject");
+ test(function() {
+ // The horizontal/vertical metrics are inverted (because of the
+ // rotation) and multiplied by the scale factor.
+ assert_true(MathMLFeatureDetection.has_mfrac());
+ assert_greater_than_equal(num.right - denom.left,
+ (40 + 60) * scale,
+ "numerator is on the right of denominator");
+ assert_approx_equals((num.top + num.bottom) / 2,
+ (denom.top + denom.bottom) / 2,
+ epsilon, "numerator and denominator are vertically aligned");
+ }, "mfrac layout in SVG foreignObject");
+ done();
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <svg width="400px" height="400px">
+ <g transform="rotate(90, 200, 200) scale(2)">
+ <foreignObject width="400px" height="400px"
+ requiredExtensions="http://www.w3.org/1998/Math/MathML">
+ <math>
+ <mfrac id="mfrac">
+ <mspace width="30px" height="40px" style="background: cyan"></mspace>
+ <mspace width="50px" height="60px" style="background: yellow"></mspace>
+ </mfrac>
+ </math>
+ </foreignObject>
+ </g>
+ </svg>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/integration-point-5.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/integration-point-5.html
new file mode 100644
index 00000000000..fb95e890eed
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/integration-point-5.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>MathML sibling of SVG with foreignObject[overflow=visible]</title>
+<link rel="help" href="https://w3c.github.io/mathml-core/#html-and-svg">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=989920">
+<meta name="assert" content="Verify that an SVG containing a foreignObject with visible overflow does not affect layout of MathML siblings.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../mathml/support/feature-detection.js"></script>
+<script>
+ setup({ explicit_done: true });
+ window.addEventListener("DOMContentLoaded", function() {
+ var scale = 2;
+ var epsilon = 1;
+ var mfrac = document.getElementById("mfrac");
+ var num = mfrac.firstElementChild.getBoundingClientRect();
+ var denom = mfrac.lastElementChild.getBoundingClientRect();
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mspace());
+ assert_approx_equals(num.width, 30, epsilon, "numerator width");
+ assert_approx_equals(num.height, 40, epsilon, "numerator height");
+ assert_approx_equals(denom.width, 50, epsilon, "denonimator width");
+ assert_approx_equals(denom.height, 60, epsilon, "denonimator height");
+ }, "mspace layout in sibling of SVG foreignObject[overflow=visible]");
+ test(function() {
+ assert_true(MathMLFeatureDetection.has_mfrac());
+ assert_greater_than_equal(denom.bottom - num.top,
+ (40 + 60),
+ "numerator above denominator");
+ assert_approx_equals((num.left + num.right) / 2,
+ (denom.left + denom.right) / 2,
+ epsilon, "numerator and denominator are horizontally aligned");
+ }, "mfrac layout in sibling of SVG with foreignObject[overflow=visible]");
+ done();
+ });
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <math>
+ <mfrac id="mfrac">
+ <mspace width="30px" height="40px" style="background: cyan"></mspace>
+ <mspace width="50px" height="60px" style="background: yellow"></mspace>
+ </mfrac>
+ </math>
+ <svg width="200px" height="200px" style="background: lightblue">
+ <foreignObject width="200px" height="200px"
+ overflow="visible">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ This is a foreignObject
+ </div>
+ </foreignObject>
+ </svg>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/math-global-event-handlers.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/math-global-event-handlers.html
new file mode 100644
index 00000000000..68b1bb14f74
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/math-global-event-handlers.html
@@ -0,0 +1,155 @@
+<!DOCTYPE html>
+<title>MathMLElement GlobalEventHandlers</title>
+<link rel="author" title="Brian Kardell" href="mailto:[email protected]" />
+<link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript"/>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#event-handler-idl-attributes"/>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#event-handler-content-attributes"/>
+<meta name="timeout" content="long">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/WebIDLParser.js"></script>
+
+<script>
+ "use strict";
+
+ // The prefixed animation events are special; their event types are
+ // camel-case.
+ const prefixedAnimationAttributeToEventType = new Map([
+ ["webkitanimationend", "webkitAnimationEnd"],
+ ["webkitanimationiteration", "webkitAnimationIteration"],
+ ["webkitanimationstart", "webkitAnimationStart"],
+ ["webkittransitionend", "webkitTransitionEnd"],
+ ]);
+
+ // basic pattern lifted from /html/webappapis/scripting/events/event-handler-all-global-events.html
+ promise_setup(async function() {
+ const res = await fetch("../../../interfaces/html.idl");
+ const htmlIDL = await res.text();
+ // Parsing the whole IDL file is slow, so use a small regexp to extract only
+ // the part that is relevant for this test.
+ const parsedHTMLIDL = WebIDL2.parse(htmlIDL.
+ match(/^interface mixin GlobalEventHandlers {[^{}]*};$/m)[0]);
+ const globalEventHandlers = parsedHTMLIDL.find(
+ idl => idl.name === "GlobalEventHandlers"
+ );
+
+ // onerror is too special
+ const names = globalEventHandlers.members
+ .map(member => member.name)
+ .filter(name => name !== "onerror");
+
+ for (const name of names) {
+ const withoutOn = name.substring(2);
+
+ promise_test(async () => {
+ const location = MathMLElement.prototype;
+ assert_true(
+ location.hasOwnProperty(name),
+ `${location.constructor.name} has an own property named "${name}"`
+ );
+
+ assert_false(
+ name in Element.prototype,
+ `Element.prototype must not contain a "${name}" property`
+ );
+ }, `${name}: must be on the appropriate locations for GlobalEventHandlers`);
+
+ promise_test(async () => {
+ const location = document.createElementNS(
+ "http://www.w3.org/1998/Math/MathML",
+ "math"
+ );
+
+ assert_equals(
+ location[name],
+ null,
+ `The default value of the property is null for a ${
+ location.constructor.name
+ } instance`
+ );
+ }, `${name}: the default value must be null`);
+
+ promise_test(async () => {
+ const div = document.createElement("div");
+ div.insertAdjacentHTML("beforeend", `<math ${name}="window.${name}Happened1 = true;"></math>`);
+ const compiledHandler = div.firstElementChild[name];
+ assert_equals(
+ typeof compiledHandler,
+ "function",
+ `The ${name} property must be a function`
+ );
+ compiledHandler();
+ assert_true(
+ window[`${name}Happened1`],
+ "Calling the handler must run the code"
+ );
+ }, `${name}: the content attribute must be compiled into a function as the corresponding property`);
+
+ promise_test(async () => {
+ const el = document.createElementNS(
+ "http://www.w3.org/1998/Math/MathML",
+ "math"
+ );
+ assert_equals(el[name], null, `The ${name} property must be null (no attribute)`);
+
+ el.setAttribute(name, `window.${name}Happened2 = true;`);
+ const compiledHandler = el[name];
+ assert_equals(
+ typeof compiledHandler,
+ "function",
+ `The ${name} property must be a function (set attribute)`
+ );
+ compiledHandler();
+ assert_true(
+ window[`${name}Happened2`],
+ "Calling the handler must run the code (set attribute)"
+ );
+
+ window[`${name}Happened2`] = false;
+ const clonedEl = el.cloneNode(true);
+ const clonedCompiledHandler = clonedEl[name];
+ assert_equals(
+ typeof clonedCompiledHandler,
+ "function",
+ `The ${name} property must be a function (clone node)`
+ );
+ clonedCompiledHandler();
+ assert_true(
+ window[`${name}Happened2`],
+ "Calling the handler must run the code (clone node)"
+ );
+
+ el.setAttribute(name, `window.${name}Happened3 = true;`);
+ const newCompiledHandler = el[name];
+ assert_equals(
+ typeof newCompiledHandler,
+ "function",
+ `The ${name} property must be a function (modify attribute)`
+ );
+ newCompiledHandler();
+ assert_true(
+ window[`${name}Happened3`],
+ "Calling the handler must run the code (modify attribute)"
+ );
+
+ el.removeAttribute(name);
+ assert_equals(el[name], null, `The ${name} property must be null (remove attribute)`);
+ }, `${name}: dynamic changes on the attribute`);
+
+ promise_test(async () => {
+ const element = document.createElementNS(
+ "http://www.w3.org/1998/Math/MathML",
+ "math"
+ );
+ let target = undefined;
+ element[name] = (e) => { target = e.currentTarget; }
+ let eventType = withoutOn;
+ if (prefixedAnimationAttributeToEventType.has(eventType)) {
+ eventType = prefixedAnimationAttributeToEventType.get(eventType);
+ }
+ element.dispatchEvent(new Event(eventType));
+ assert_equals(target, element, "The event must be fired at the <math> element");
+ }, `${name}: dispatching an Event at a <math> element must trigger element.${name}`);
+ }
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/style-src-attr-meta.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/style-src-attr-meta.html
new file mode 100644
index 00000000000..4faa3c8777a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/style-src-attr-meta.html
@@ -0,0 +1,110 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>MathML CSP: style-src-attr and style-src syntax enforcement</title>
+
+<meta name="variant" content="?1-72">
+<meta name="variant" content="?73-144">
+<meta name="variant" content="?145-216">
+<meta name="variant" content="?217-last">
+
+<link rel="help" href="https://w3c.github.io/webappsec-csp/#directive-style-src-attr">
+<link rel="help" href="https://w3c.github.io/webappsec-csp/#directive-style-src">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/dom.html#the-style-attribute">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../common/subset-tests.js"></script>
+<script src="../../../mathml/support/mathml-fragments.js"></script>
+<script src="../../../mathml/support/csp-test-helper.js"></script>
+
+<body>
+ <script>
+ for (const tag in MathMLFragments) {
+ // Group 1: style-src-attr Directives
+ // 1. 'none' -> Block inline style attribute
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: "style-src-attr 'none'",
+ shouldApply: false,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src-attr 'none' blocks inline style on <${tag}>`);
+
+ // 2. Absent / 'unsafe-inline' -> Allow inline style attribute
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: null,
+ shouldApply: true,
+ styleApplication: "styleAttribute",
+ });
+ }, `CSP absent allows inline style on <${tag}>`);
+
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: "style-src-attr 'unsafe-inline'",
+ shouldApply: true,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src-attr 'unsafe-inline' allows inline style on <${tag}>`);
+
+ // 3a. 'unsafe-hashes' + Matching Hash -> Allow
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: `style-src-attr 'unsafe-hashes' '${CSS_TEXT_HASH}'`,
+ shouldApply: true,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src-attr 'unsafe-hashes' with matching hash allows inline style on <${tag}>`);
+
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: `style-src-attr 'unsafe-hashes' 'sha256-mismatching='`,
+ shouldApply: false,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src-attr 'unsafe-hashes' with mismatching hash blocks inline style on <${tag}>`);
+
+ // Group 2: style-src Directive (Fallback behavior)
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: "style-src 'none'",
+ shouldApply: false,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src 'none' fallback blocks inline style on <${tag}>`);
+
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: "style-src 'unsafe-inline'",
+ shouldApply: true,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src 'unsafe-inline' fallback allows inline style on <${tag}>`);
+
+ // Group 3: Precedence (style-src-attr overrides style-src)
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: "style-src-attr 'unsafe-inline'; style-src 'none'",
+ shouldApply: true,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src-attr 'unsafe-inline' overrides style-src 'none' on <${tag}>`);
+
+ subsetTest(test, t => {
+ runMathMLStyleCSPTest(t, {
+ tag,
+ policy: "style-src-attr 'none'; style-src 'unsafe-inline'",
+ shouldApply: false,
+ styleApplication: "styleAttribute",
+ });
+ }, `style-src-attr 'none' overrides style-src 'unsafe-inline' on <${tag}>`);
+ }
+ </script>
+</body>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/tabindex-002.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/tabindex-002.html
new file mode 100644
index 00000000000..74c7d8d0943
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/html5-tree/tabindex-002.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>MathML tabindex attribute</title>
+<meta name="timeout" content="long">
+<link rel="help" href="https://w3c.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<meta assert="flag" content="interact">
+<meta assert="assert" content="Check the sequential focus navigation order for MathML">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/testdriver.js"></script>
+<script src="../../../resources/testdriver-vendor.js"></script>
+<div id="log"></div>
+<a href="#link">tabindex(html,href)</a>
+<math>
+ <mtext id="text1">tabindex(omitted)</mtext>
+ <mtext id="text2" tabindex="">tabindex(empty)</mtext>
+ <mtext id="text3" tabindex="a">tabindex(a)</mtext>
+ <mtext id="text4" tabindex="-1">tabindex(-1)</mtext>
+ <mtext id="text5" tabindex="0">tabindex(0)</mtext>
+ <mtext id="text6" href="#link"><mtext>tabindex(mtext href)</mtext>
+ <a id="text7" href="#link"><mtext>tabindex(a href)</mtext></a>
+ <mtext id="text8" tabindex="3">tabindex(3)</mtext>
+ <mtext id="text9" tabindex="2">tabindex(2)</mtext>
+ <mtext id="text10" tabindex="2">tabindex(2)</mtext>
+ <mtext id="text11" tabindex="2">tabindex(2)</mtext>
+ <mtext id="text12" tabindex="1">tabindex(1)</mtext>
+</math>
+<script>
+
+var i = 0,
+ expectation = ["text12", "text9", "text10", "text11", "text8", "text5"],
+ results = [],
+ t = async_test("Elements with different tabindex must be focused sequentially when pressing 'Tab' keys");
+
+setup(function () {
+ document.body.focus();
+});
+
+document.querySelector("a").addEventListener("focus", function (evt) {
+ // Links are tab-navigable on that platform.
+ expectation.push("text7");
+ // TAB = '\ue004'
+ test_driver.send_keys(document.body, "\ue004");
+}, true);
+
+document.querySelector("math").addEventListener("focus", function (evt) {
+ results.push(evt.target.id);
+ i++;
+ if (i >= expectation.length) {
+ t.step(function () {
+ assert_array_equals(results, expectation);
+ });
+ t.done();
+ } else {
+ t.step(function () {
+ // TAB = '\ue004'
+ test_driver.send_keys(document.body, "\ue004");
+ });
+ }
+}, true);
+
+document.addEventListener("keydown", function (evt) {
+ t.step(function () {
+ assert_equals(evt.keyCode, 9, "Please press 'Tab' key.");
+ });
+}, true);
+
+t.step(function () {
+ // TAB = '\ue004'
+ test_driver.send_keys(document.body, "\ue004");
+});
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/relations/text-and-math/basic-mathematical-alphanumeric-symbols-with-default-font.html b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/text-and-math/basic-mathematical-alphanumeric-symbols-with-default-font.html
new file mode 100644
index 00000000000..18bcba21845
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/relations/text-and-math/basic-mathematical-alphanumeric-symbols-with-default-font.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Basic mathematical alphanumeric symbols with default font</title>
+ <meta name="assert" content="Verify whether the default font contains italic/bold/bold-italic characters from the Mathematical Alphanumeric Symbols block.">
+ <script src="../../../resources/testharness.js"></script>
+ <script src="../../../resources/testharnessreport.js"></script>
+ <style>
+ span[data-name] {
+ font-size: 100px;
+ background: lightblue;
+ display: inline-block;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="log"></div>
+ <p><span id="frakturL" data-name="U+1D529 MATHEMATICAL FRAKTUR SMALL L">𝔩</span></p>
+ <p><span id="emSpace" data-name="U+2003 EM SPACE">&#x2003;</span></p>
+ <p><span data-test="Bold" data-name="U+1D416 MATHEMATICAL BOLD CAPITAL W">𝐖</span></p>
+ <p><span data-test="Italic" data-name="U+1D44A MATHEMATICAL ITALIC CAPITAL W">π‘Š</span></p>
+ <p><span data-test="Bold-italic" data-name="U+1D47E MATHEMATICAL BOLD ITALIC CAPITAL">𝑾</span></p>
+ <script>
+ const frakturLWidth = document.getElementById("frakturL").getBoundingClientRect().width;
+ const emSpaceWidth = document.getElementById("emSpace").getBoundingClientRect().width;
+ Array.from(document.querySelectorAll('span[data-test]')).forEach(span => {
+ test(function() {
+ let spanWidth = span.getBoundingClientRect().width;
+ // This test expects the default font to provide a fraktur l than is much thiner than a bold/italic/bold-italic W.
+ // If the font lacks bold/italic/bold-italic W then a fortiori it is likely that its lacks fraktur l, so browsers
+ // will display "Tofu characters" for all of them (e.g. gray boxes or boxes containing the Unicode code points)
+ // with very similar widths, so the test is likely to fail.
+ assert_greater_than(spanWidth, frakturLWidth + emSpaceWidth / 4, `Width of '${span.dataset.name}' is much larger than '${frakturL.dataset.name}'`);
+ }, `${span.dataset.test} mathematical alphanumeric symbol with the default font`);
+ });
+ </script>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/attribute-values.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/attribute-values.js
new file mode 100644
index 00000000000..8408124f49a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/attribute-values.js
@@ -0,0 +1,31 @@
+AttributeValueTransforms = {
+ lowercase: function(value) { return value.toLowerCase(); },
+ uppercase: function(value) { return value.toUpperCase(); },
+ alternate_case: function(value) {
+ var transformedValue = "";
+ for (var i = 0; i < value.length; i++) {
+ transformedValue += i % 2 ?
+ value.charAt(i).toLowerCase() :
+ value.charAt(i).toUpperCase();
+ }
+ return transformedValue;
+ },
+ // TODO: Should we perform this transform too?
+ // https://github.com/mathml-refresh/mathml/issues/122
+ // add_leading_and_trimming_whitespace: function(value) {
+ // var space = "\0020\0009\000A\000D";
+ // return `${space}${space}${value}${space}${space}`;
+ // },
+};
+
+function TransformAttributeValues(transform, attributeNames) {
+ if (typeof attributeNames === "string")
+ attributeNames = [attributeNames];
+ attributeNames.forEach(name => {
+ Array.from(document.querySelectorAll(`[${name}]`)).forEach(element => {
+ var value = element.getAttribute(name);
+ var transformedValue = AttributeValueTransforms[transform](value);
+ element.setAttribute(name, transformedValue);
+ });
+ });
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/box-comparison.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/box-comparison.js
new file mode 100644
index 00000000000..056d305da60
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/box-comparison.js
@@ -0,0 +1,109 @@
+function spaceBetween(childBox, parentBox) {
+ return {
+ left: childBox.left - parentBox.left,
+ right: parentBox.right - childBox.right,
+ top: childBox.top - parentBox.top,
+ bottom: parentBox.bottom - childBox.bottom
+ };
+}
+
+function measureSpaceAround(id) {
+ var mrow = document.getElementById(id);
+ var mrowBox = mrow.getBoundingClientRect();
+ var parentBox = mrow.parentNode.getBoundingClientRect();
+ var childBox = mrow.firstElementChild.getBoundingClientRect();
+ return spaceBetween(childBox, parentBox);
+}
+
+function compareSpaceWithAndWithoutStyle(tag, style, parentStyle, direction) {
+ if (!FragmentHelper.isValidChildOfMrow(tag) ||
+ FragmentHelper.isEmpty(tag))
+ throw `Invalid argument: ${tag}`;
+
+ if (!direction)
+ direction = "ltr";
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block"><math display="block"><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
+<div style="display: inline-block"><math display="block"><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
+</div>`);
+ var div = document.body.lastElementChild;
+
+ var styleDiv = div.firstElementChild;
+ var styleMath = styleDiv.firstElementChild;
+ var styleParent = styleMath.firstElementChild;
+ if (parentStyle)
+ styleParent.setAttribute("style", parentStyle);
+ var styleElement = FragmentHelper.element(styleMath);
+ styleElement.setAttribute("style", style);
+ var styleChild = FragmentHelper.forceNonEmptyElement(styleElement);
+ FragmentHelper.forceNonEmptyDescendants(styleElement);
+ var styleMathBox = styleMath.getBoundingClientRect();
+ var styleElementBox = styleElement.getBoundingClientRect();
+ var styleChildBox = styleChild.getBoundingClientRect();
+ var styleSpace = spaceBetween(styleChildBox, styleMathBox);
+
+ var noStyleDiv = div.lastElementChild;
+ var noStyleMath = noStyleDiv.firstElementChild;
+ var noStyleElement = FragmentHelper.element(noStyleMath);
+ var noStyleChild = FragmentHelper.forceNonEmptyElement(noStyleElement);
+ FragmentHelper.forceNonEmptyDescendants(noStyleElement);
+ var noStyleMathBox = noStyleMath.getBoundingClientRect();
+ var noStyleElementBox = noStyleElement.getBoundingClientRect();
+ var noStyleChildBox = noStyleChild.getBoundingClientRect();
+ var noStyleSpace = spaceBetween(noStyleChildBox, noStyleMathBox);
+
+ var preferredWidthDelta =
+ styleDiv.getBoundingClientRect().width -
+ noStyleDiv.getBoundingClientRect().width;
+
+ div.style = "display: none;"; // Hide the div after measurement.
+
+ return {
+ preferred_width_delta: preferredWidthDelta,
+ left_delta: styleSpace.left - noStyleSpace.left,
+ right_delta: styleSpace.right - noStyleSpace.right,
+ top_delta: styleSpace.top - noStyleSpace.top,
+ bottom_delta: styleSpace.bottom - noStyleSpace.bottom,
+ element_width_delta: styleElementBox.width - noStyleElementBox.width,
+ element_height_delta: styleElementBox.height - noStyleElementBox.height
+ };
+}
+
+function compareSizeWithAndWithoutStyle(tag, style) {
+ if (!FragmentHelper.isValidChildOfMrow(tag))
+ throw `Invalid argument: ${tag}`;
+
+ // FIXME <mrow> only needed as workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1658135
+ document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block"><math><mrow>${MathMLFragments[tag]}</mrow></math></div>\
+<div style="display: inline-block"><math><mrow>${MathMLFragments[tag]}</mrow></math></div>\
+</div>`);
+ var div = document.body.lastElementChild;
+
+ var styleDiv = div.firstElementChild;
+ var styleParent = styleDiv.firstElementChild.firstElementChild;
+ var styleElement = FragmentHelper.element(styleParent);
+ styleElement.setAttribute("style", style);
+ var styleParentBox = styleParent.getBoundingClientRect();
+ var styleElementBox = styleElement.getBoundingClientRect();
+
+ var noStyleDiv = div.lastElementChild;
+ var noStyleParent = noStyleDiv.firstElementChild.firstElementChild;
+ var noStyleElement = FragmentHelper.element(noStyleParent);
+ var noStyleParentBox = noStyleParent.getBoundingClientRect();
+ var noStyleElementBox = noStyleElement.getBoundingClientRect();
+
+ var preferredWidthDelta =
+ styleDiv.getBoundingClientRect().width -
+ noStyleDiv.getBoundingClientRect().width;
+
+ div.style = "display: none;"; // Hide the div after measurement.
+
+ return {
+ preferred_width_delta: preferredWidthDelta,
+ width_delta: styleParentBox.width - noStyleParentBox.width,
+ height_delta: styleParentBox.height - noStyleParentBox.height,
+ element_width_delta: styleElementBox.width - noStyleElementBox.width,
+ element_height_delta: styleElementBox.height - noStyleElementBox.height
+ };
+};
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/box-navigation.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/box-navigation.js
new file mode 100644
index 00000000000..f4897cfe999
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/box-navigation.js
@@ -0,0 +1,29 @@
+function IsInFlow(element) {
+ var style = window.getComputedStyle(element);
+ return style.getPropertyValue("display") !== "none" &&
+ style.getPropertyValue("position") !== "absolute" &&
+ style.getPropertyValue("position") !== "fixed";
+}
+
+function firstInFlowChild(element) {
+ var child = element.firstElementChild;
+ if (!child || IsInFlow(child))
+ return child;
+ return nextInFlowSibling(child);
+}
+
+function nextInFlowSibling(element) {
+ var child = element;
+ do {
+ child = child.nextElementSibling;
+ } while (child && !IsInFlow(child));
+ return child;
+}
+
+function previousInFlowSibling(element) {
+ var child = element;
+ do {
+ child = child.previousElementSibling;
+ } while (child && !IsInFlow(child));
+ return child;
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/csp-test-helper.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/csp-test-helper.js
new file mode 100644
index 00000000000..c06f2f0a854
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/csp-test-helper.js
@@ -0,0 +1,88 @@
+'use strict';
+
+// Dependency Notice: This helper relies on 'mathml-fragments.js'
+// to be loaded prior to this script in the test HTML file.
+
+const APPLIED_COLOR_RGB = 'rgb(0, 128, 0)';
+const TEST_CSS_TEXT = `color: ${APPLIED_COLOR_RGB}`;
+const CSS_TEXT_HASH = 'sha256-cgrWcJeXGgvsbzqeXr9ARPkciN38f5Rd6u0ahueqhkU=';
+
+const ELEM_CSS_TEXT = `math { ${TEST_CSS_TEXT}; }`;
+const ELEM_CSS_HASH = 'sha256-/n1LY0Mb4Hs1ejsIuf7bVyNgdFVUEPsG/esgnIQgikY=';
+
+/**
+ * Executes a single CSP style test on a MathML element inside an isolated
+ * iframe.
+ *
+ * @param {Object} t - WPT test instance (provides add_cleanup).
+ * @param {Object} options - Test execution configuration.
+ * @param {string} options.tag - MathML element tag name present in
+ * MathMLFragments.
+ * @param {string} options.policy - CSP directive header (e.g.,
+ * "style-src-attr 'unsafe-inline'").
+ * @param {boolean} options.shouldApply - True if the style is expected to be
+ * allowed & applied; false if blocked.
+ * @param {'styleAttribute' | 'styleElement'} [options.styleApplication] -
+ * Manner in which style is applied:
+ * - 'styleAttribute': Tests inline `style` attribute (governed by
+ * style-src-attr / style-src).
+ * - 'styleElement': Tests `<style>` element inside the document (governed by
+ * style-src-elem / style-src).
+ * @example
+ * // Testing inline style attribute with a policy
+ * runMathMLStyleCSPTest(t, {
+ * tag: 'mspace',
+ * policy: "style-src-attr 'none'",
+ * shouldApply: false,
+ * styleApplication: 'styleAttribute'
+ * });
+ */
+function runMathMLStyleCSPTest(t, {
+ tag,
+ policy,
+ shouldApply,
+ styleApplication,
+}) {
+ const iframe = document.createElement('iframe');
+ document.body.appendChild(iframe);
+ t.add_cleanup(() => iframe.remove());
+
+ const win = iframe.contentWindow;
+ const doc = iframe.contentDocument;
+ const metaHtml = policy ?
+ `<meta http-equiv="Content-Security-Policy" content="${policy}">` :
+ '';
+
+ doc.open();
+ doc.write(`<!doctype html><html><head>${metaHtml}</head><body><math>${
+ MathMLFragments[tag]}</math></body></html>`);
+ doc.close();
+
+ const mathEl = FragmentHelper.element(doc.body.firstElementChild);
+ assert_true(!!mathEl, `MathML element <${tag}> should exist in iframe DOM.`);
+
+ if (styleApplication === 'styleAttribute') {
+ // Test inline style attribute
+ mathEl.setAttribute('style', TEST_CSS_TEXT);
+ } else if (styleApplication === 'styleElement') {
+ // Test <style> element injected inside MathML fragment
+ const styleEl = doc.createElement('style');
+ styleEl.textContent = ELEM_CSS_TEXT;
+ doc.head.appendChild(styleEl);
+ } else {
+ throw new Error(`[runMathMLStyleCSPTest] Invalid styleApplication: '${
+ styleApplication}'. Expected 'styleAttribute' or 'styleElement'.`);
+ }
+
+ const computedColor = win.getComputedStyle(mathEl).color;
+ const description = `Inline style (${styleApplication}) on <${
+ tag}> with policy [${policy || 'none'}]`;
+
+ if (shouldApply) {
+ assert_equals(computedColor, APPLIED_COLOR_RGB,
+ `${description} should be APPLIED.`);
+ } else {
+ assert_not_equals(computedColor, APPLIED_COLOR_RGB,
+ `${description} should be BLOCKED.`);
+ }
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/feature-detection-operators.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/feature-detection-operators.js
new file mode 100644
index 00000000000..25dae40258f
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/feature-detection-operators.js
@@ -0,0 +1,86 @@
+// This is a helper for MathML feature detection.
+// It is indented to be used to prevent false negative test results.
+// This adds operator-specific feature detections.
+
+Object.assign(MathMLFeatureDetection, {
+ "has_operator_lspace/rspace": async function() {
+ return this.has_operator_spacing();
+ },
+
+ "has_operator_movablelimits": async function() {
+ return this.has_movablelimits();
+ },
+
+ "has_operator_largeop": async function() {
+ if (!this.hasOwnProperty("_has_operator_largeop")) {
+ document.body.insertAdjacentHTML("beforeend", "\
+<math style='font: 10px HasOperatorLargeopTestFont;'\
+ displaystyle='true'>\
+ <mo largeop='false' stretchy='false' symmetric='false'>&#x2AFF;</mo>\
+ <mo largeop='true' stretchy='false' symmetric='false'>&#x2AFF;</mo>\
+</math>");
+ let font_face = new FontFace('HasOperatorLargeopTestFont',
+ 'url(/fonts/math/largeop-displayoperatorminheight5000.woff)');
+ document.fonts.add(font_face);
+ await font_face.load();
+ var math = document.body.lastElementChild;
+ var mo = math.getElementsByTagName("mo");
+ this._has_operator_largeop =
+ (mo[1].getBoundingClientRect().height >
+ mo[0].getBoundingClientRect().height);
+ document.body.removeChild(math);
+ document.fonts.delete(font_face);
+ }
+ return this._has_operator_largeop;
+ },
+
+ "has_operator_stretchy": async function() {
+ if (!this.hasOwnProperty("_has_operator_stretchy")) {
+ document.body.insertAdjacentHTML("beforeend", "\
+<math style='font: 10px HasOperatorStretchyTestFont;'>\
+ <mrow>\
+ <mo stretchy='false' largeop='false' symmetric='false'>&#x2AFF;</mo>\
+ <mo stretchy='true' largeop='false' symmetric='false'>&#x2AFF;</mo>\
+ <mspace style='background: black;' width='1px' height='2em'></mspace>\
+ </mrow>\
+</math>");
+ let font_face = new FontFace('HasOperatorLargeopTestFont',
+ 'url(/fonts/math/largeop-displayoperatorminheight5000.woff)');
+ document.fonts.add(font_face);
+ await font_face.load();
+ var math = document.body.lastElementChild;
+ var mo = math.getElementsByTagName("mo");
+ this._has_operator_stretchy =
+ (mo[1].getBoundingClientRect().height >
+ mo[0].getBoundingClientRect().height);
+ document.body.removeChild(math);
+ document.fonts.delete(font_face);
+ }
+ return this._has_operator_stretchy;
+ },
+
+ "has_operator_symmetric": async function() {
+ if (!this.hasOwnProperty("_has_operator_symmetric")) {
+ document.body.insertAdjacentHTML("beforeend", "\
+<math style='font: 10px HasOperatorSymmetricTestFont;'>\
+ <mrow>\
+ <mo stretchy='true' largeop='false' symmetric='false'>&#x2AFF;</mo>\
+ <mo stretchy='true' largeop='false' symmetric='true'>&#x2AFF;</mo>\
+ <mspace style='background: black;' width='1px' height='2em'></mspace>\
+ </mrow>\
+</math>");
+ let font_face = new FontFace('HasOperatorLargeopTestFont',
+ 'url(/fonts/math/largeop-displayoperatorminheight5000.woff)');
+ document.fonts.add(font_face);
+ await font_face.load();
+ var math = document.body.lastElementChild;
+ var mo = math.getElementsByTagName("mo");
+ this._has_operator_symmetric =
+ (mo[1].getBoundingClientRect().height >
+ mo[0].getBoundingClientRect().height);
+ document.body.removeChild(math);
+ document.fonts.delete(font_face);
+ }
+ return this._has_operator_symmetric;
+ },
+});
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/feature-detection.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/feature-detection.js
new file mode 100644
index 00000000000..bc69be46bc1
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/feature-detection.js
@@ -0,0 +1,330 @@
+// This is a helper for MathML feature detection.
+// It is indented to be used to prevent false negative test results.
+
+var MathMLFeatureDetection = {
+
+ "has_a": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mrow();
+ },
+
+ "has_annotation": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_annotation-xml": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_maction": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_math": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_menclose": function() {
+ // Just check whether <mrow> is supported because discussion on this is
+ // still open ( https://github.com/mathml-refresh/mathml/issues/105 )
+ // and it would have to behave at least like an mrow, even if it becomes
+ // an unknown element at the end.
+ return this.has_mrow();
+ },
+
+ "has_merror": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mfrac": function() {
+ if (!this.hasOwnProperty("_has_mfrac")) {
+ // Use tall enough fraction to avoid side effect of min num/denum shifts.
+ document.body.insertAdjacentHTML("beforeend", "<math>\
+<mfrac>\
+ <mspace height='50px' depth='50px'></mspace>\
+ <mspace height='50px' depth='50px'></mspace>\
+</mfrac>\
+<mfrac>\
+ <mspace height='60px' depth='60px'></mspace>\
+ <mspace height='60px' depth='60px'></mspace>\
+</mfrac>\
+</math>");
+ var math = document.body.lastElementChild;
+ var mfrac = math.getElementsByTagName("mfrac");
+ // height/depth will add 40px per MathML, 20px if mfrac does not stack its children and none if mspace is not supported.
+ this._has_mfrac =
+ mfrac[1].getBoundingClientRect().height -
+ mfrac[0].getBoundingClientRect().height > 30;
+ document.body.removeChild(math);
+ }
+ return this._has_mfrac;
+ },
+
+ "has_mi": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mmultiscripts": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mn": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mo": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mover": function() {
+ // FIXME: Improve feature detection.
+ return this.has_munderover();
+ },
+
+ "has_mpadded": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mphantom": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mprescripts": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mroot": function() {
+ // FIXME: Improve feature detection.
+ return this.has_msqrt();
+ },
+
+ "has_mrow": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_ms": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mspace": function() {
+ // https://w3c.github.io/mathml-core/#space-mspace
+ if (!this.hasOwnProperty("_has_mspace")) {
+ document.body.insertAdjacentHTML("beforeend", "<math>\
+<mspace></mspace>\
+<mspace width='20px'></mspace>\
+</math>");
+ var math = document.body.lastElementChild;
+ // The width attribute will add 20px per MathML and none if not supported.
+ this._has_mspace =
+ math.lastChild.getBoundingClientRect().width -
+ math.firstChild.getBoundingClientRect().width > 10;
+ document.body.removeChild(math);
+ }
+ return this._has_mspace;
+ },
+
+ "has_msqrt": function() {
+ if (!this.hasOwnProperty("_has_msqrt")) {
+ document.body.insertAdjacentHTML("beforeend", "<math>\
+<mrow style='font-size: 20px !important'>\
+ <mtext>A</mtext>\
+</mrow>\
+<msqrt style='font-size: 20px !important'>\
+ <mtext>A</mtext>\
+</msqrt>\
+</math>");
+ var math = document.body.lastElementChild;
+ // The radical symbol will make msqrt wider than mrow, if the former is supported.
+ this._has_msqrt =
+ math.lastElementChild.getBoundingClientRect().width -
+ math.firstElementChild.getBoundingClientRect().width > 5;
+ document.body.removeChild(math);
+ }
+ return this._has_msqrt;
+ },
+
+ "has_mstyle": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_msub": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_msubsup": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_msup": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mtable": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mtd": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mtext": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_mtr": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_munder": function() {
+ // FIXME: Improve feature detection.
+ return this.has_munderover();
+ },
+
+ "has_munderover": function() {
+ if (!this.hasOwnProperty("_has_munderover")) {
+ document.body.insertAdjacentHTML("beforeend", "<math>\
+<munderover>\
+ <mspace width='20px'></mspace>\
+ <mspace width='20px'></mspace>\
+ <mspace width='20px'></mspace>\
+</munderover>\
+<munderover>\
+ <mspace width='40px'></mspace>\
+ <mspace width='40px'></mspace>\
+ <mspace width='40px'></mspace>\
+</munderover>\
+</math>");
+ var math = document.body.lastElementChild;
+ var munderover = math.getElementsByTagName("munderover");
+ // width_delta will be 20px per MathML, 3 * 20 = 60px if mundeover does not stack its children and 0px if mspace is not supported.
+ var width_delta =
+ munderover[1].getBoundingClientRect().width -
+ munderover[0].getBoundingClientRect().width;
+ this._has_munderover = width_delta > 10 && width_delta < 30;
+ document.body.removeChild(math);
+ }
+ return this._has_munderover;
+ },
+
+ "has_none": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_semantics": function() {
+ // FIXME: Improve feature detection.
+ return this.has_mspace();
+ },
+
+ "has_dir": function() {
+ if (!this.hasOwnProperty("_has_dir")) {
+ document.body.insertAdjacentHTML("beforeend", "<math style='direction: ltr !important;'>\
+<mtext dir='rtl'></mtext>\
+</math>");
+ var math = document.body.lastElementChild;
+ this._has_dir =
+ window.getComputedStyle(math.firstElementChild).
+ getPropertyValue('direction') === 'rtl';
+ document.body.removeChild(math);
+ }
+ return this._has_dir;
+ },
+
+ "has_mathsize": function() {
+ if (!this.hasOwnProperty("_has_mathsize")) {
+ document.body.insertAdjacentHTML("beforeend", "<math style='font-size: 64px !important;'>\
+<mtext mathsize='32px'></mtext>\
+</math>");
+ var math = document.body.lastElementChild;
+ this._has_mathsize =
+ window.getComputedStyle(math.firstElementChild).
+ getPropertyValue('font-size') === '32px';
+ document.body.removeChild(math);
+ }
+ return this._has_mathsize;
+ },
+
+ "has_movablelimits": function() {
+ if (!this.hasOwnProperty("_has_movablelimits")) {
+ document.body.insertAdjacentHTML("beforeend", "<math>\
+<munder>\
+ <mo style='font-size: 30px !important' movablelimits='false'>A</mo>\
+ <mspace width='100px'></mspace>\
+</munder>\
+<munder>\
+ <mo style='font-size: 30px !important' movablelimits='true'>A</mo>\
+ <mspace width='100px'></mspace>\
+</munder>\
+</math>");
+ var math = document.body.lastElementChild;
+ var munder = math.getElementsByTagName("munder");
+ // If movablelimits is supported, the <mspace> will be placed next
+ // to <mo> rather than below it, so width_delta is about the width
+ // of the <mo>.
+ var width_delta =
+ munder[1].getBoundingClientRect().width -
+ munder[0].getBoundingClientRect().width;
+ this._has_movablelimits = this.has_munder() && width_delta > 20;
+ document.body.removeChild(math);
+ }
+ return this._has_movablelimits;
+ },
+
+ "has_operator_spacing": function() {
+ // https://w3c.github.io/mathml-core/#dfn-lspace
+ // https://w3c.github.io/mathml-core/#layout-of-mrow
+ if (!this.hasOwnProperty("_has_operator_spacing")) {
+ document.body.insertAdjacentHTML("beforeend", "<math>\
+<mrow>\
+ <mn>1</mn><mo lspace='0px' rspace='0px'>+</mo><mn>2</mn>\
+</mrow>\
+<mrow>\
+ <mn>1</mn><mo lspace='20px' rspace='20px'>+</mo><mn>2</mn>\
+</mrow>\
+</math>");
+ var math = document.body.lastElementChild;
+ var mrow = math.getElementsByTagName("mrow");
+ // lspace/rspace will add 40px per MathML and none if not supported.
+ this._has_operator_spacing =
+ mrow[1].getBoundingClientRect().width -
+ mrow[0].getBoundingClientRect().width > 30;
+ document.body.removeChild(math);
+ }
+ return this._has_operator_spacing;
+ },
+
+ ensure_for_match_reftest: function(has_function) {
+ if (!document.querySelector("link[rel='match']"))
+ throw "This function must only be used for match reftest";
+ // Add a little red square at the top left corner if the feature is not supported in order to make match reftest fail.
+ if (!this[has_function]()) {
+ document.body.insertAdjacentHTML("beforeend", "\
+<div style='width: 10px !important; height: 10px !important;\
+ position: absolute !important;\
+ left: 0 !important; top: 0 !important;\
+ background: red !important; z-index: 1000 !important;'></div>");
+ }
+ }
+};
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/fonts.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/fonts.js
new file mode 100644
index 00000000000..f05d7278adb
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/fonts.js
@@ -0,0 +1,9 @@
+function loadAllFonts() {
+ // Use this to wait for all fonts in a testcase to load rather than just using
+ // `document.fonts.ready.then(...)` in the load event, since there are compat
+ // issues between browsers as to whether content initiated font loads are
+ // guaranteed to have been started by this point.
+
+ // FIXME: Use Promise.all() to cause an obvious failure when a font fails to load.
+ return Promise.allSettled([...document.fonts].map(f => f.load()));
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/invalid-markup.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/invalid-markup.js
new file mode 100644
index 00000000000..451033ce076
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/invalid-markup.js
@@ -0,0 +1,96 @@
+// This is a helper for generating invalid MathML markup.
+// Depends on ./mathml-fragments.js
+
+function isValid(tagName, mspaceCount) {
+ switch (tagName) {
+ case "mfrac":
+ case "mroot":
+ case "munder":
+ case "mover":
+ case "msub":
+ case "msup":
+ return mspaceCount == 2;
+ case "munderover":
+ case "msubsup":
+ return mspaceCount == 3;
+ case "mmultiscripts":
+ return mspaceCount % 2 == 1;
+ }
+}
+
+function generateInvalidMarkup() {
+ let container = document.createElement("div");
+ ["mfrac", "mroot", "munder", "mover", "munderover", "msub", "msup", "msubsup", "mmultiscripts"].forEach(tag => {
+ let math = FragmentHelper.createElement("math");
+ let element = FragmentHelper.createElement(tag);
+ let reference = FragmentHelper.createElement("mrow");
+ math.appendChild(element);
+ math.appendChild(reference);
+ let maxCount = tag == "mmultiscripts" ? 10 : 5;
+ let mspaceCount = 0;
+ for (let count = 0; count <= maxCount; count++) {
+ element.dataset.description = `count == ${count}`;
+ if (!isValid(tag, mspaceCount)) {
+ container.appendChild(math.cloneNode(true));
+ }
+ if (tag == "mmultiscripts" && count == maxCount / 2) {
+ [element, reference].forEach(el => {
+ el.insertAdjacentHTML("beforeend", `<mprescripts/>`);
+ });
+ } else {
+ let width = (count + 1) * 10;
+ let height = (count + 1) * (count % 2 ? 15 : 5);
+ let depth = (count + 1) * (count % 2 ? 5 : 15);
+ [element, reference].forEach(el => {
+ el.insertAdjacentHTML("beforeend", `<mspace height="${height}px" depth="${depth}px" width="${width}px" style="background: black"/>`);
+ });
+ mspaceCount++;
+ }
+ }
+ });
+
+ container.insertAdjacentHTML("beforeend", `
+<math>
+ <mmultiscripts data-description="first in-flow child is an <mprescripts>">
+ <mprescripts/>
+ <mspace height="5px" depth="15px" width="10px" style="background: black"/>
+ <mspace height="30px" depth="10px" width="20px" style="background: black"/>
+ <mspace height="15px" depth="45px" width="30px" style="background: black"/>
+ <mspace height="60px" depth="20px" width="40px" style="background: black"/>
+
+ </mmultiscripts>
+ <mrow>
+ <mprescripts/>
+ <mspace height="5px" depth="15px" width="10px" style="background: black"/>
+ <mspace height="30px" depth="10px" width="20px" style="background: black"/>
+ <mspace height="15px" depth="45px" width="30px" style="background: black"/>
+ <mspace height="60px" depth="20px" width="40px" style="background: black"/>
+
+ </mrow>
+</math>
+<math>
+ <mmultiscripts data-description="one of the even number of children after the first <mprescripts> is an <mprescripts>">
+ <mspace height="5px" depth="15px" width="10px" style="background: black"/>
+ <mspace height="30px" depth="10px" width="20px" style="background: black"/>
+ <mspace height="15px" depth="45px" width="30px" style="background: black"/>
+ <mprescripts/>
+ <mspace height="60px" depth="20px" width="40px" style="background: black"/>
+ <mprescripts/>
+ <mspace height="25px" depth="75px" width="50px" style="background: black"/>
+ <mspace height="35px" depth="105px" width="70px" style="background: black"/>
+ </mmultiscripts>
+ <mrow>
+ <mspace height="5px" depth="15px" width="10px" style="background: black"/>
+ <mspace height="30px" depth="10px" width="20px" style="background: black"/>
+ <mspace height="15px" depth="45px" width="30px" style="background: black"/>
+ <mprescripts/>
+ <mspace height="60px" depth="20px" width="40px" style="background: black"/>
+ <mprescripts/>
+ <mspace height="25px" depth="75px" width="50px" style="background: black"/>
+ <mspace height="35px" depth="105px" width="70px" style="background: black"/>
+ </mrow>
+</math>
+ `);
+
+ return container;
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/layout-comparison.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/layout-comparison.js
new file mode 100644
index 00000000000..452b45006e4
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/layout-comparison.js
@@ -0,0 +1,112 @@
+function getWritingMode(element, reference) {
+ var style = window.getComputedStyle(reference);
+ if (style.getPropertyValue("writing-mode") !== "horizontal-tb" ||
+ style.getPropertyValue("direction") !== "ltr")
+ throw "Reference should have writing mode horizontal-tb and ltr";
+
+ style = window.getComputedStyle(element);
+ var param = {
+ rtl: style.getPropertyValue("direction") === "rtl",
+ mode: style.getPropertyValue("writing-mode")
+ };
+
+ return param;
+}
+
+function compareSize(element, reference, epsilon) {
+ var param = getWritingMode(element, reference);
+ var elementBox = element.getBoundingClientRect();
+ var referenceBox = reference.getBoundingClientRect();
+
+ switch(param.mode) {
+ case "horizontal-tb":
+ assert_approx_equals(elementBox.width, referenceBox.width, epsilon,
+ "inline size");
+ assert_approx_equals(elementBox.height, referenceBox.height, epsilon,
+ "block size");
+ break;
+ case "vertical-lr":
+ case "vertical-rl":
+ assert_approx_equals(elementBox.width, referenceBox.height, epsilon,
+ "inline size");
+ assert_approx_equals(elementBox.height, referenceBox.width, epsilon,
+ "block size");
+ break;
+ default:
+ throw "compareSize: Unrecognized writing-mode value";
+ }
+}
+
+function childrenHaveEmptyBoundingClientRects(element) {
+ Array.from(element.children).forEach(child => {
+ var childBox = child.getBoundingClientRect();
+ assert_true(childBox.left == 0 && childBox.right == 0 && childBox.top == 0 && childBox.bottom == 0);
+ })
+}
+
+function participateToParentLayout(child) {
+ var style = window.getComputedStyle(child);
+ return style.getPropertyValue("display") !== "none" &&
+ style.getPropertyValue("position") !== "absolute" &&
+ style.getPropertyValue("position") !== "fixed";
+}
+
+function childrenParticipatingToLayout(element) {
+ var children = [];
+ Array.from(element.children).forEach(child => {
+ if (participateToParentLayout(child))
+ children.push(child);
+ })
+ return children;
+}
+
+function compareLayout(element, reference, epsilon) {
+ // Compare sizes of elements and children.
+ var param = getWritingMode(element, reference);
+
+ compareSize(element, reference, epsilon);
+ var elementBox = element.getBoundingClientRect();
+ var referenceBox = reference.getBoundingClientRect();
+
+ var elementChildren = childrenParticipatingToLayout(element);
+ var referenceChildren = childrenParticipatingToLayout(reference);
+ if (elementChildren.length != referenceChildren.length)
+ throw "Reference should have the same number of children participating to layout."
+
+ for (var i = 0; i < elementChildren.length; i++) {
+ compareSize(elementChildren[i], referenceChildren[i], epsilon);
+
+ var childBox = elementChildren[i].getBoundingClientRect();
+ var referenceChildBox = referenceChildren[i].getBoundingClientRect();
+
+ switch(param.mode) {
+ case "horizontal-tb":
+ assert_approx_equals(param.rtl ?
+ elementBox.right - childBox.right :
+ childBox.left - elementBox.left,
+ referenceChildBox.left - referenceBox.left,
+ epsilon,
+ `inline position (child ${i})`);
+ assert_approx_equals(childBox.top - elementBox.top,
+ referenceChildBox.top - referenceBox.top,
+ epsilon,
+ `block position (child ${i})`);
+ break;
+ case "vertical-lr":
+ case "vertical-rl":
+ assert_approx_equals(param.rtl ?
+ elementBox.bottom - childBox.bottom :
+ childBox.top - elementBox.top,
+ referenceChildBox.left - referenceBox.left,
+ epsilon,
+ `inline position (child ${i})`);
+ assert_approx_equals(elementBox.right - childBox.right,
+ referenceChildBox.top - referenceBox.top,
+ epsilon,
+ `block position (child ${i})`);
+ break;
+ default:
+ throw "compareLayout: Unrecognized writing-mode value";
+ }
+ }
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/mathml/support/operator-dictionary.js b/Tests/LibWeb/Text/input/wpt-import/mathml/support/operator-dictionary.js
new file mode 100644
index 00000000000..ee1de102fe9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/mathml/support/operator-dictionary.js
@@ -0,0 +1,42 @@
+async function fetchOperatorDictionary() {
+ let response = await fetch(`/mathml/support/operator-dictionary.json`);
+ return response.json();
+}
+
+function splitKey(key) {
+ var value = key.split(" ")
+ return {
+ characters: value[0],
+ form: value[1]
+ };
+}
+
+function spaceIndexToLength(index) {
+ // See https://w3c.github.io/mathml-core/#operator-dictionary
+ return ["0",
+ "0.05555555555555555em",
+ "0.1111111111111111em",
+ "0.16666666666666666em",
+ "0.2222222222222222em",
+ "0.2777777777777778em",
+ "0.3333333333333333em",
+ "0.3888888888888889em"
+ ][index];
+}
+
+function defaultPropertyValue(entry, name) {
+ switch (name) {
+ case "lspace":
+ case "rspace":
+ return spaceIndexToLength(entry.hasOwnProperty(name) ? entry[name] : 5);
+ break
+ case "largeop":
+ case "movablelimits":
+ case "stretchy":
+ case "symmetric":
+ case "accent":
+ return entry[name];
+ default:
+ throw `Unknown property ${name}`;
+ }
+}