Skip to content

Truly independent web browser

LibWeb: Add operator spacing to MathML rows

Andreas Kling10b722c669fa
diff --git a/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs
index bffca7a1efe..05d54cbee91 100644
--- a/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs
@@ -68,6 +68,25 @@ impl MathLayoutKind {
pub(crate) fn uses_math_layout(self) -> bool {
!matches!(self, Self::NotMathML | Self::Token | Self::Mo | Self::Mtext)
}
+
+ // https://w3c.github.io/mathml-core/#dfn-grouping-elements
+ fn is_grouping_element(self) -> bool {
+ matches!(self, Self::Mrow | Self::Math | Self::Mprescripts)
+ }
+
+ // https://w3c.github.io/mathml-core/#dfn-scripted-elements
+ fn is_scripted_element(self) -> bool {
+ matches!(
+ self,
+ Self::Mmultiscripts
+ | Self::Mover
+ | Self::Msub
+ | Self::Msubsup
+ | Self::Msup
+ | Self::Munder
+ | Self::Munderover
+ )
+ }
}
/// The unit of a MathML attribute value that is a `<length-percentage>`. Mirrors the C++ `MathLengthUnit`, where 0
@@ -136,6 +155,363 @@ pub struct FfiMathAttributeFacts {
pub accentunder: u8,
}
+// https://w3c.github.io/mathml-core/#dfn-form
+#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
+enum OperatorForm {
+ Infix,
+ Prefix,
+ Postfix,
+}
+
+impl OperatorForm {
+ fn from_attribute(value: u8) -> Option<Self> {
+ match value {
+ 1 => Some(Self::Infix),
+ 2 => Some(Self::Prefix),
+ 3 => Some(Self::Postfix),
+ _ => Option::None,
+ }
+ }
+}
+
+// https://w3c.github.io/mathml-core/#operator-dictionary-categories-values
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+enum OperatorCategory {
+ Default,
+ ForceDefault,
+ A,
+ B,
+ C,
+ D,
+ E,
+ F,
+ G,
+ H,
+ I,
+ J,
+ K,
+ L,
+ M,
+}
+
+impl OperatorCategory {
+ /// The lspace and rspace of the category, in eighteenths of an em.
+ fn spacing_in_eighteenths_of_em(self) -> (u8, u8) {
+ match self {
+ Self::Default | Self::ForceDefault | Self::A => (5, 5),
+ Self::B => (4, 4),
+ Self::C | Self::H | Self::J => (3, 3),
+ Self::D | Self::E | Self::F | Self::G | Self::I | Self::K => (0, 0),
+ Self::L => (3, 0),
+ Self::M => (0, 3),
+ }
+ }
+}
+
+// https://w3c.github.io/mathml-core/#operator-dictionary-compact-special-tables
+// Operators_2_ascii_chars
+const OPERATORS_2_ASCII_CHARS: [&[u8; 2]; 18] = [
+ b"!!", b"!=", b"&&", b"**", b"*=", b"++", b"+=", b"--", b"-=", b"->", b"//", b"/=", b":=", b"<=", b"<>", b"==",
+ b">=", b"||",
+];
+
+// https://w3c.github.io/mathml-core/#operator-dictionary-compact-dictionary
+// The (Content, Form) keys of each category, as ranges of characters sorted by form and range start.
+static OPERATOR_CATEGORIES: [(OperatorForm, u32, u32, OperatorCategory); 234] = [
+ (OperatorForm::Infix, 0x0025, 0x0025, OperatorCategory::C),
+ (OperatorForm::Infix, 0x002A, 0x002A, OperatorCategory::C),
+ (OperatorForm::Infix, 0x002B, 0x002B, OperatorCategory::B),
+ (OperatorForm::Infix, 0x002C, 0x002C, OperatorCategory::M),
+ (OperatorForm::Infix, 0x002D, 0x002D, OperatorCategory::B),
+ (OperatorForm::Infix, 0x002E, 0x002E, OperatorCategory::C),
+ (OperatorForm::Infix, 0x002F, 0x002F, OperatorCategory::K),
+ (OperatorForm::Infix, 0x003A, 0x003A, OperatorCategory::M),
+ (OperatorForm::Infix, 0x003B, 0x003B, OperatorCategory::M),
+ (OperatorForm::Infix, 0x003F, 0x0040, OperatorCategory::C),
+ (OperatorForm::Infix, 0x005C, 0x005C, OperatorCategory::K),
+ (OperatorForm::Infix, 0x005E, 0x005E, OperatorCategory::C),
+ (OperatorForm::Infix, 0x005F, 0x005F, OperatorCategory::K),
+ (OperatorForm::Infix, 0x00B1, 0x00B1, OperatorCategory::B),
+ (OperatorForm::Infix, 0x00B7, 0x00B7, OperatorCategory::C),
+ (OperatorForm::Infix, 0x00D7, 0x00D7, OperatorCategory::C),
+ (OperatorForm::Infix, 0x00F7, 0x00F7, OperatorCategory::B),
+ (OperatorForm::Infix, 0x0322, 0x0322, OperatorCategory::B),
+ (OperatorForm::Infix, 0x0323, 0x0323, OperatorCategory::C),
+ (OperatorForm::Infix, 0x032E, 0x032E, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2022, 0x2022, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2043, 0x2043, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2044, 0x2044, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2061, 0x2064, OperatorCategory::K),
+ (OperatorForm::Infix, 0x2190, 0x2195, OperatorCategory::A),
+ (OperatorForm::Infix, 0x219A, 0x21AE, OperatorCategory::A),
+ (OperatorForm::Infix, 0x21B0, 0x21B5, OperatorCategory::A),
+ (OperatorForm::Infix, 0x21B9, 0x21B9, OperatorCategory::A),
+ (OperatorForm::Infix, 0x21BC, 0x21D5, OperatorCategory::A),
+ (OperatorForm::Infix, 0x21DA, 0x21F0, OperatorCategory::A),
+ (OperatorForm::Infix, 0x21F3, 0x21FF, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2206, 0x2206, OperatorCategory::K),
+ (OperatorForm::Infix, 0x2212, 0x2216, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2217, 0x2219, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2227, 0x222A, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2236, 0x2236, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2238, 0x2238, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2240, 0x2240, OperatorCategory::C),
+ (OperatorForm::Infix, 0x228C, 0x228E, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2293, 0x2296, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2297, 0x2297, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2298, 0x2298, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2299, 0x229B, OperatorCategory::C),
+ (OperatorForm::Infix, 0x229D, 0x229F, OperatorCategory::B),
+ (OperatorForm::Infix, 0x22A0, 0x22A1, OperatorCategory::C),
+ (OperatorForm::Infix, 0x22BA, 0x22BA, OperatorCategory::C),
+ (OperatorForm::Infix, 0x22BB, 0x22BD, OperatorCategory::B),
+ (OperatorForm::Infix, 0x22C4, 0x22C7, OperatorCategory::C),
+ (OperatorForm::Infix, 0x22C9, 0x22CC, OperatorCategory::C),
+ (OperatorForm::Infix, 0x22CE, 0x22CF, OperatorCategory::B),
+ (OperatorForm::Infix, 0x22D2, 0x22D3, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2305, 0x2306, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2794, 0x2794, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2795, 0x2797, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2799, 0x2799, OperatorCategory::A),
+ (OperatorForm::Infix, 0x279B, 0x27A1, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27A5, 0x27A6, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27A8, 0x27AF, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27B1, 0x27B1, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27B3, 0x27B3, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27B5, 0x27B5, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27B8, 0x27B8, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27BA, 0x27BE, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27CB, 0x27CB, OperatorCategory::C),
+ (OperatorForm::Infix, 0x27CD, 0x27CD, OperatorCategory::C),
+ (OperatorForm::Infix, 0x27F0, 0x27F1, OperatorCategory::A),
+ (OperatorForm::Infix, 0x27F4, 0x27FF, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2900, 0x2920, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2934, 0x2937, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2942, 0x2975, OperatorCategory::A),
+ (OperatorForm::Infix, 0x297C, 0x297F, OperatorCategory::A),
+ (OperatorForm::Infix, 0x29B8, 0x29B8, OperatorCategory::B),
+ (OperatorForm::Infix, 0x29BC, 0x29BC, OperatorCategory::B),
+ (OperatorForm::Infix, 0x29C4, 0x29C5, OperatorCategory::B),
+ (OperatorForm::Infix, 0x29C6, 0x29C8, OperatorCategory::C),
+ (OperatorForm::Infix, 0x29D4, 0x29D7, OperatorCategory::C),
+ (OperatorForm::Infix, 0x29E2, 0x29E2, OperatorCategory::C),
+ (OperatorForm::Infix, 0x29F5, 0x29FB, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2A1D, 0x2A1E, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2A1F, 0x2A2E, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2A2F, 0x2A37, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2A38, 0x2A3A, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2A3B, 0x2A3D, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2A3E, 0x2A3E, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2A3F, 0x2A3F, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2A40, 0x2A4F, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2A50, 0x2A50, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2A51, 0x2A63, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2A64, 0x2A65, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2ADB, 0x2ADB, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2ADC, 0x2ADD, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2AF6, 0x2AF6, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2AFB, 0x2AFB, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2AFD, 0x2AFD, OperatorCategory::B),
+ (OperatorForm::Infix, 0x2AFE, 0x2AFE, OperatorCategory::C),
+ (OperatorForm::Infix, 0x2B04, 0x2B07, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B0C, 0x2B11, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B30, 0x2B3E, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B40, 0x2B4C, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B60, 0x2B65, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B6A, 0x2B6D, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B70, 0x2B73, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B7A, 0x2B7D, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B80, 0x2B87, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2B95, 0x2B95, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2BA0, 0x2BAF, OperatorCategory::A),
+ (OperatorForm::Infix, 0x2BB8, 0x2BB8, OperatorCategory::A),
+ (OperatorForm::Prefix, 0x0021, 0x0021, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x0028, 0x0028, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x002B, 0x002B, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x002D, 0x002D, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x005B, 0x005B, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x007B, 0x007B, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x007C, 0x007C, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x00AC, 0x00AC, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x00B1, 0x00B1, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x0331, 0x0331, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x2016, 0x2016, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2018, 0x2018, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x201C, 0x201C, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x2145, 0x2146, OperatorCategory::L),
+ (OperatorForm::Prefix, 0x2200, 0x2201, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x2202, 0x2202, OperatorCategory::L),
+ (OperatorForm::Prefix, 0x2203, 0x2204, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x2207, 0x2207, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x220F, 0x2211, OperatorCategory::J),
+ (OperatorForm::Prefix, 0x2212, 0x2213, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x221A, 0x221C, OperatorCategory::L),
+ (OperatorForm::Prefix, 0x221F, 0x2222, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x222B, 0x2233, OperatorCategory::H),
+ (OperatorForm::Prefix, 0x2234, 0x2235, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x223C, 0x223C, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x22BE, 0x22BF, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x22C0, 0x22C3, OperatorCategory::J),
+ (OperatorForm::Prefix, 0x2308, 0x2308, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x230A, 0x230A, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2310, 0x2310, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x2319, 0x2319, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x2329, 0x2329, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2772, 0x2772, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2795, 0x2796, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x27C0, 0x27C0, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x27E6, 0x27E6, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x27E8, 0x27E8, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x27EA, 0x27EA, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x27EC, 0x27EC, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x27EE, 0x27EE, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2980, 0x2980, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2983, 0x2983, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2985, 0x2985, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2987, 0x2987, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2989, 0x2989, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x298B, 0x298B, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x298D, 0x298D, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x298F, 0x298F, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2991, 0x2991, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2993, 0x2993, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2995, 0x2995, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2997, 0x2997, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2999, 0x2999, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x299B, 0x29AF, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x29D8, 0x29D8, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x29DA, 0x29DA, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x29FC, 0x29FC, OperatorCategory::F),
+ (OperatorForm::Prefix, 0x2A00, 0x2A0A, OperatorCategory::J),
+ (OperatorForm::Prefix, 0x2A0B, 0x2A1C, OperatorCategory::H),
+ (OperatorForm::Prefix, 0x2A1D, 0x2A1E, OperatorCategory::J),
+ (OperatorForm::Prefix, 0x2AEC, 0x2AED, OperatorCategory::D),
+ (OperatorForm::Prefix, 0x2AFC, 0x2AFC, OperatorCategory::J),
+ (OperatorForm::Prefix, 0x2AFF, 0x2AFF, OperatorCategory::J),
+ (OperatorForm::Postfix, 0x0021, 0x0022, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x0025, 0x0027, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x0029, 0x0029, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x005D, 0x005D, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x005E, 0x005F, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x0060, 0x0060, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x007C, 0x007C, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x007D, 0x007D, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x007E, 0x007E, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x00A8, 0x00A8, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x00AF, 0x00AF, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x00B0, 0x00B0, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x00B2, 0x00B4, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x00B8, 0x00B9, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x02C6, 0x02C7, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x02C9, 0x02C9, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x02CA, 0x02CB, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x02CD, 0x02CD, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x02D8, 0x02DA, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x02DC, 0x02DC, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x02DD, 0x02DD, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x02F7, 0x02F7, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x0302, 0x0302, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x0311, 0x0311, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x0320, 0x0320, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x0325, 0x0325, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x0327, 0x0327, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x0331, 0x0331, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x2016, 0x2016, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2019, 0x201B, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x201D, 0x201F, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x2032, 0x2037, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x203E, 0x203E, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x2057, 0x2057, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x20DB, 0x20DC, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x2309, 0x2309, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x230B, 0x230B, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2322, 0x2323, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x232A, 0x232A, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x23B4, 0x23B5, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x23CD, 0x23CD, OperatorCategory::E),
+ (OperatorForm::Postfix, 0x23DC, 0x23E1, OperatorCategory::I),
+ (OperatorForm::Postfix, 0x2773, 0x2773, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x27E7, 0x27E7, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x27E9, 0x27E9, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x27EB, 0x27EB, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x27ED, 0x27ED, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x27EF, 0x27EF, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2980, 0x2980, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2984, 0x2984, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2986, 0x2986, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2988, 0x2988, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x298A, 0x298A, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x298C, 0x298C, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x298E, 0x298E, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2990, 0x2990, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2992, 0x2992, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2994, 0x2994, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2996, 0x2996, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2998, 0x2998, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x2999, 0x2999, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x29D9, 0x29D9, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x29DB, 0x29DB, OperatorCategory::G),
+ (OperatorForm::Postfix, 0x29FD, 0x29FD, OperatorCategory::G),
+];
+
+// https://w3c.github.io/mathml-core/#dfn-algorithm-to-determine-the-category-of-an-operator
+fn operator_category(content: &[u16], form: OperatorForm) -> OperatorCategory {
+ // 1. If Content as an UTF-16 string does not have length or 1 or 2 then exit with category Default.
+ if content.is_empty() || content.len() > 2 {
+ return OperatorCategory::Default;
+ }
+ let mut character = u32::from(content[0]);
+ // 2. If Content is a single character in the range U+0320–U+03FF then exit with category Default. Otherwise, if
+ // it has two characters:
+ if content.len() == 1 {
+ if (0x0320..=0x03FF).contains(&character) {
+ return OperatorCategory::Default;
+ }
+ } else {
+ let second = content[1];
+ // - If Content is the surrogate pairs corresponding to U+1EEF0 ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH
+ // WITH TATWEEL or U+1EEF1 ARABIC MATHEMATICAL OPERATOR HAH WITH DAL and Form is postfix, exit with category
+ // I.
+ if form == OperatorForm::Postfix && content[0] == 0xD83B && (second == 0xDEF0 || second == 0xDEF1) {
+ return OperatorCategory::I;
+ }
+ // - If the second character is U+0338 COMBINING LONG SOLIDUS OVERLAY or U+20D2 COMBINING LONG VERTICAL LINE
+ // OVERLAY then replace Content with the first character and move to step 3.
+ if second == 0x0338 || second == 0x20D2 {
+ }
+ // - Otherwise, if Content is listed in Operators_2_ascii_chars then replace Content with the Unicode character
+ // "U+0320 plus the index of Content in Operators_2_ascii_chars" and move to step 3.
+ else if let Some(index) = OPERATORS_2_ASCII_CHARS
+ .iter()
+ .position(|pair| content[0] == u16::from(pair[0]) && second == u16::from(pair[1]))
+ {
+ character = 0x0320 + index as u32;
+ }
+ // - Otherwise exit with category Default.
+ else {
+ return OperatorCategory::Default;
+ }
+ }
+ // 3. If Form is infix and Content corresponds to one of U+007C VERTICAL LINE or U+223C TILDE OPERATOR then exit
+ // with category ForceDefault.
+ if form == OperatorForm::Infix && (character == 0x007C || character == 0x223C) {
+ return OperatorCategory::ForceDefault;
+ }
+ // NB: The remaining steps search the compact encoding of the dictionary. Content outside the ranges
+ // U+0000–U+03FF and U+2000–U+2BFF has category Default, and so does any key the dictionary does not list.
+ if !(character <= 0x03FF || (0x2000..=0x2BFF).contains(&character)) {
+ return OperatorCategory::Default;
+ }
+ let index =
+ OPERATOR_CATEGORIES.partition_point(|&(entry_form, start, _, _)| (entry_form, start) <= (form, character));
+ match index.checked_sub(1).map(|index| OPERATOR_CATEGORIES[index]) {
+ Some((entry_form, start, end, category)) if entry_form == form && (start..=end).contains(&character) => {
+ category
+ }
+ _ => OperatorCategory::Default,
+ }
+}
+
/// An in-flow child box after its layout. The ascent and descent are measured from the alphabetic baseline to the
/// line-over and line-under edges of the child's margin box.
#[derive(Clone, Copy)]
@@ -222,12 +598,16 @@ impl<'pass> MathFormattingContext<'pass> {
}
fn in_flow_children(&self) -> Vec<Node> {
+ self.in_flow_children_of(self.run.box_)
+ }
+
+ fn in_flow_children_of(&self, parent: Node) -> Vec<Node> {
// https://w3c.github.io/mathml-core/#css-styling
// The float property does not create floating of elements whose parent's computed display value is block
// math or inline math, and does not take them out-of-flow.
self.run
.callbacks
- .children(self.run.box_)
+ .children(parent)
.filter(|&child| {
let facts = self.facts(child);
facts.is_box()
@@ -237,6 +617,187 @@ impl<'pass> MathFormattingContext<'pass> {
.collect()
}
+ // https://w3c.github.io/mathml-core/#dfn-space-like
+ fn is_space_like(&self, node: Node) -> bool {
+ // A MathML Core element is a space-like element if it is:
+ let kind = self.kind(node);
+ // - an <mtext> or <mspace>;
+ if matches!(kind, MathLayoutKind::Mtext | MathLayoutKind::Mspace) {
+ return true;
+ }
+ // - or a grouping element or <mpadded> all of whose in-flow children are space-like.
+ if kind.is_grouping_element() || kind == MathLayoutKind::Mpadded {
+ return self
+ .in_flow_children_of(node)
+ .into_iter()
+ .all(|child| self.is_space_like(child));
+ }
+ false
+ }
+
+ /// The core operator of the embellished operator `node`, or `None` if `node` is not an embellished operator.
+ // https://w3c.github.io/mathml-core/#dfn-embellished-operator
+ fn core_operator(&self, node: Node) -> Option<Node> {
+ // A MathML Core element is an embellished operator if it is:
+ let kind = self.kind(node);
+ // - An <mo> element;
+ if kind == MathLayoutKind::Mo {
+ // The core operator of an <mo> element is the element itself.
+ return Some(node);
+ }
+ // - a scripted element or an <mfrac>, whose first in-flow child exists and is an embellished operator;
+ if kind.is_scripted_element() || kind == MathLayoutKind::Mfrac {
+ // The core operator of an embellished scripted element or <mfrac> element is the core operator of its
+ // first in-flow child.
+ return self
+ .in_flow_children_of(node)
+ .first()
+ .and_then(|&child| self.core_operator(child));
+ }
+ // - a grouping element or <mpadded>, whose in-flow children consist (in any order) of one embellished operator
+ // and zero or more space-like elements.
+ if kind.is_grouping_element() || kind == MathLayoutKind::Mpadded {
+ // The core operator of an embellished grouping element or <mpadded> is the core operator of its unique
+ // embellished operator in-flow child.
+ let mut core_operator = Option::None;
+ for child in self.in_flow_children_of(node) {
+ if let Some(child_core_operator) = self.core_operator(child) {
+ if core_operator.is_some() {
+ return Option::None;
+ }
+ core_operator = Some(child_core_operator);
+ } else if !self.is_space_like(child) {
+ return Option::None;
+ }
+ }
+ return core_operator;
+ }
+ Option::None
+ }
+
+ /// The text of an operator that contains only text content.
+ fn operator_text_content(&self, operator: Node) -> Option<Vec<u16>> {
+ let callbacks = &self.run.callbacks;
+ let mut content = Vec::new();
+ for child in callbacks.children(operator) {
+ if !node_facts::kind_is_text(callbacks.node_data(child).kind.get()) {
+ return Option::None;
+ }
+ content.extend_from_slice(&callbacks.text_content(child).text);
+ }
+ let is_whitespace = |unit: &u16| *unit <= 0x7f && (*unit as u8).is_ascii_whitespace();
+ let start = content
+ .iter()
+ .position(|unit| !is_whitespace(unit))
+ .unwrap_or(content.len());
+ let end = content
+ .iter()
+ .rposition(|unit| !is_whitespace(unit))
+ .map_or(start, |end| end + 1);
+ Some(content[start..end].to_vec())
+ }
+
+ /// The indices of the first and last of `siblings` that are not space-like, if there are at least two such
+ /// siblings and their parent is a grouping element, <mpadded> or <msqrt>.
+ fn first_and_last_non_space_like(&self, siblings: &[Node], parent_kind: MathLayoutKind) -> Option<(usize, usize)> {
+ if !parent_kind.is_grouping_element() && !matches!(parent_kind, MathLayoutKind::Mpadded | MathLayoutKind::Msqrt)
+ {
+ return Option::None;
+ }
+ let first = siblings.iter().position(|&sibling| !self.is_space_like(sibling))?;
+ let last = siblings.iter().rposition(|&sibling| !self.is_space_like(sibling))?;
+ (first != last).then_some((first, last))
+ }
+
+ // https://w3c.github.io/mathml-core/#dfn-algorithm-for-determining-the-form-of-an-embellished-operator
+ // NB: `first_and_last_non_space_like` is what `first_and_last_non_space_like()` returns for the siblings.
+ fn embellished_operator_form(
+ &self,
+ index: usize,
+ parent_kind: MathLayoutKind,
+ first_and_last_non_space_like: Option<(usize, usize)>,
+ ) -> OperatorForm {
+ // 1. If the form attribute is present and valid on the core operator, then its ASCII lowercased value is used.
+ // NB: The caller handles this step.
+ if let Some((first, last)) = first_and_last_non_space_like {
+ // 2. If the embellished operator is the first in-flow child of a grouping element, <mpadded> or <msqrt>
+ // with more than one in-flow child (ignoring all space-like children) then it has form prefix.
+ if index == first {
+ return OperatorForm::Prefix;
+ }
+ // 3. Or, if the embellished operator is the last in-flow child of a grouping element, <mpadded> or
+ // <msqrt> with more than one in-flow child (ignoring all space-like children) then it has form postfix.
+ if index == last {
+ return OperatorForm::Postfix;
+ }
+ }
+ // 4. Or, if the embellished operator is an in-flow child of a scripted element, other than the first in-flow
+ // child, then it has form postfix.
+ if parent_kind.is_scripted_element() && index > 0 {
+ return OperatorForm::Postfix;
+ }
+ // 5. Otherwise, the embellished operator has form infix.
+ OperatorForm::Infix
+ }
+
+ /// The lspace and rspace of the in-flow child at `index` of the box being laid out, if it is an embellished
+ /// operator.
+ // https://w3c.github.io/mathml-core/#dfn-algorithm-for-determining-the-properties-of-an-embellished-operator
+ fn embellished_operator_spacing(
+ &self,
+ siblings: &[Node],
+ index: usize,
+ parent_kind: MathLayoutKind,
+ first_and_last_non_space_like: Option<(usize, usize)>,
+ ) -> Option<(CssPixels, CssPixels)> {
+ let core_operator = self.core_operator(siblings[index])?;
+ let attributes = self.run.callbacks.arena().math_attribute_facts(core_operator);
+ // 2. Otherwise, run the algorithm for determining the form of an embellished operator.
+ let explicit_form = OperatorForm::from_attribute(attributes.form);
+ let form = explicit_form
+ .unwrap_or_else(|| self.embellished_operator_form(index, parent_kind, first_and_last_non_space_like));
+ let mut category = OperatorCategory::Default;
+ // 3. If the core operator contains only text content Content, then set Category to the result of the
+ // algorithm to determine the category of an operator (Content, Form) where Form is the form calculated at
+ // the previous step.
+ if let Some(content) = self.operator_text_content(core_operator) {
+ category = operator_category(&content, form);
+ // 4. If Category is Default and the form of embellished operator was not explicitly specified as an
+ // attribute on its core operator:
+ if category == OperatorCategory::Default && explicit_form.is_none() {
+ // 1. Set Category to the result of the algorithm to determine the category of an operator (Content,
+ // Form) where Form is infix.
+ // 2. If Category is Default, then run the algorithm again with Form set to postfix.
+ // 3. If Category is Default, then run the algorithm again with Form set to prefix.
+ for fallback_form in [OperatorForm::Infix, OperatorForm::Postfix, OperatorForm::Prefix] {
+ category = operator_category(&content, fallback_form);
+ if category != OperatorCategory::Default {
+ break;
+ }
+ }
+ }
+ }
+ // 5. Run the algorithm to set the properties of an operator from its category Category.
+ // NB: Font-relative lengths for lspace and rspace rely on the font style of the core operator, not the one of
+ // the embellished operator.
+ let core_style = self.style(core_operator);
+ let (lspace, rspace) = category.spacing_in_eighteenths_of_em();
+ let dictionary_lspace = core_style.font_size().scaled(f64::from(lspace) / 18.0);
+ let dictionary_rspace = core_style.font_size().scaled(f64::from(rspace) / 18.0);
+ // 1. If the corresponding lspace or rspace attribute is present and valid on the core operator, then the
+ // ASCII lowercased value of this property is used.
+ // NB: Percentage values for lspace and rspace are interpreted relative to the value read from the dictionary.
+ let lspace = attributes
+ .lspace
+ .resolve(&core_style, dictionary_lspace)
+ .unwrap_or(dictionary_lspace);
+ let rspace = attributes
+ .rspace
+ .resolve(&core_style, dictionary_rspace)
+ .unwrap_or(dictionary_rspace);
+ Some((lspace, rspace))
+ }
+
fn layout_child(&self, child: Node, constraints: ContainingBlockConstraints) -> Child {
let run = &self.run;
run.records.create_used_values(&run.callbacks, child, constraints);
@@ -305,7 +866,28 @@ impl<'pass> MathFormattingContext<'pass> {
self.accents(root),
),
(MathLayoutKind::Mspace, _) => self.layout_space(&root_style),
- _ => layout_row(&children),
+ _ => {
+ // https://w3c.github.io/mathml-core/#layout-of-mrow
+ // Set add-space to true if the box corresponds to a <math> element or is not an embellished operator;
+ // and to false otherwise.
+ let add_space = kind == MathLayoutKind::Math || self.core_operator(root).is_none();
+ let nodes: Vec<Node> = children.iter().map(|child| child.node).collect();
+ let first_and_last_non_space_like = if add_space {
+ self.first_and_last_non_space_like(&nodes, kind)
+ } else {
+ Option::None
+ };
+ let spacing: Vec<Option<(CssPixels, CssPixels)>> = (0..nodes.len())
+ .map(|index| {
+ add_space
+ .then(|| {
+ self.embellished_operator_spacing(&nodes, index, kind, first_and_last_non_space_like)
+ })
+ .flatten()
+ })
+ .collect();
+ layout_row(&children, &spacing)
+ }
};
// https://w3c.github.io/mathml-core/#layout-algorithms
@@ -517,13 +1099,21 @@ impl<'pass> MathFormattingContext<'pass> {
}
// https://w3c.github.io/mathml-core/#layout-of-mrow
-fn layout_row(children: &[Child]) -> MathContent {
- // FIXME: Add the lspace and rspace of embellished operators, and handle italic correction.
+// NB: `spacing` holds the lspace and rspace of each child that is an embellished operator, if add-space is true.
+fn layout_row(children: &[Child], spacing: &[Option<(CssPixels, CssPixels)>]) -> MathContent {
+ // FIXME: Handle italic correction.
+ // Set inline-offset to 0.
let mut inline_offset = CssPixels::default();
let mut ascent = CssPixels::default();
let mut descent = CssPixels::default();
let mut positions = Vec::with_capacity(children.len());
- for child in children {
+ // For each in-flow child:
+ for (child, spacing) in children.iter().zip(spacing) {
+ // If the child is an embellished operator and add-space is true then increment inline-offset by its lspace
+ // property.
+ if let Some((lspace, _)) = spacing {
+ inline_offset += *lspace;
+ }
// Set the inline offset of the child to inline-offset and its block offset such that the alphabetic baseline
// of the child is aligned with the alphabetic baseline.
positions.push(ChildPosition {
@@ -532,6 +1122,11 @@ fn layout_row(children: &[Child]) -> MathContent {
});
// Increment inline-offset by the inline size of the child's margin box.
inline_offset += child.inline_size;
+ // If the child is an embellished operator and add-space is true then increment inline-offset by its rspace
+ // property.
+ if let Some((_, rspace)) = spacing {
+ inline_offset += *rspace;
+ }
// The line-ascent (respectively line-descent) of the math content is the maximum of the line-ascents
// (respectively line-descents) of all the in-flow children's margin boxes.
ascent = ascent.max(child.ascent);
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.ini
index 4a8d86bc0f1..6c61c94b00a 100644
--- a/Tests/LibWeb/TestConfig.ini
+++ b/Tests/LibWeb/TestConfig.ini
@@ -695,6 +695,9 @@ Ref/input/wpt-import/css/css-position/hypothetical-dynamic-change-003.html
; Test seems broken
Text/input/window-scrollTo.html
+; Expects U+223F SINE WAVE to have the spacing of an operator dictionary entry that MathML Core no longer has
+Ref/input/wpt-import/mathml/presentation-markup/operators/mo-lspace-rspace.html
+
; Flaky on CI
Text/input/Crypto/SubtleCrypto-exportKey.html
Text/input/Crypto/SubtleCrypto-generateKey.html
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
index ce95b7bed37..1bdcba8d300 100644
--- 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
@@ -2,8 +2,7 @@ Harness status: OK
Found 3 tests
-1 Pass
-2 Fail
+3 Pass
Pass 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
+Pass Preferred width of mrow with mn and mo children
+Pass 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
index 69359a431ac..91849ee8747 100644
--- 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
@@ -2,54 +2,55 @@ 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>.
+37 Pass
+17 Fail
+Pass Spacing inside an <mfrac> child of <math>.
+Pass Spacing around an <mfrac> child of an <math>.
+Pass Spacing inside an <mfrac> child of <mrow>.
+Pass Spacing around an <mfrac> child of an <mrow>.
+Pass 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>.
+Pass Spacing inside an <msub> child of <math>.
+Pass Spacing around an <msub> child of an <math>.
+Pass Spacing inside an <msub> child of <mrow>.
+Pass Spacing around an <msub> child of an <mrow>.
+Pass 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>.
+Pass Spacing inside an <msup> child of <math>.
+Pass Spacing around an <msup> child of an <math>.
+Pass Spacing inside an <msup> child of <mrow>.
+Pass Spacing around an <msup> child of an <mrow>.
+Pass 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>.
+Pass Spacing inside an <msubsup> child of <math>.
+Pass Spacing around an <msubsup> child of an <math>.
+Pass Spacing inside an <msubsup> child of <mrow>.
+Pass Spacing around an <msubsup> child of an <mrow>.
+Pass 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>.
+Pass 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>.
+Pass 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>.
+Pass Spacing inside an <munder> child of <math>.
+Pass Spacing around an <munder> child of an <math>.
+Pass Spacing inside an <munder> child of <mrow>.
+Pass Spacing around an <munder> child of an <mrow>.
+Pass 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>.
+Pass Spacing inside an <mover> child of <math>.
+Pass Spacing around an <mover> child of an <math>.
+Pass Spacing inside an <mover> child of <mrow>.
+Pass Spacing around an <mover> child of an <mrow>.
+Pass 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>.
+Pass Spacing inside an <munderover> child of <math>.
+Pass Spacing around an <munderover> child of an <math>.
+Pass Spacing inside an <munderover> child of <mrow>.
+Pass Spacing around an <munderover> child of an <mrow>.
+Pass 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>.
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
index 62ca5c1567e..77c30aa1b14 100644
--- 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
@@ -2,8 +2,8 @@ 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
+4 Pass
+Pass Spacing properly set for <mo> with a previous sibling and a next sibling..
+Pass Spacing properly set for <mo> with only a next sibling.
+Pass Spacing properly set for <mo> with only a previous sibling.
+Pass 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
index 51d2c8911d1..d6185d85dbc 100644
--- 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
@@ -2,16 +2,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
+11 Pass
+1 Fail
+Pass operator spacing inside Mrow
+Pass operator spacing inside Sqrt
+Pass operator spacing inside Style
+Pass operator spacing inside Error
+Pass operator spacing inside Phantom
+Pass operator spacing inside Math
+Pass operator spacing inside Menclose
+Pass operator spacing inside Mpadded
+Pass operator spacing inside Unknown
+Pass operator spacing inside Fenced
+Pass 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/embellished-operator-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-001.txt
index e8dfcb993af..bd9614c2c72 100644
--- 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
@@ -2,44 +2,45 @@ Harness status: OK
Found 40 tests
-40 Fail
-Fail mrow (embellished operator)
+29 Pass
+11 Fail
+Pass 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)
+Pass mrow (not embellished operator)
+Pass mrow (not embellished operator, from in-flow children)
+Pass 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)
+Pass mstyle (not embellished operator)
+Pass mstyle (not embellished operator, from in-flow children)
+Pass 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)
+Pass mphantom (not embellished operator)
+Pass mphantom (not embellished operator, from in-flow children)
+Pass 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)
+Pass mpadded (not embellished operator)
+Pass mpadded (not embellished operator, from in-flow children)
+Pass 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)
+Pass merror (not embellished operator)
+Pass merror (not embellished operator, from in-flow children)
+Pass 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)
+Pass mprescripts (not embellished operator)
+Pass 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)
+Pass none (not embellished operator)
+Pass none (not embellished operator, from in-flow children)
+Pass 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)
+Pass unknown (not embellished operator)
+Pass unknown (not embellished operator, from in-flow children)
+Pass 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)
+Pass mfenced (not embellished operator)
+Pass mfenced (not embellished operator, from in-flow children)
+Pass 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
+Pass a (not embellished operator)
+Pass 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
index 47702c11fde..c483e6180de 100644
--- 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
@@ -2,36 +2,37 @@ Harness status: OK
Found 32 tests
-32 Fail
-Fail msub (embellished operator)
+24 Pass
+8 Fail
+Pass 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)
+Pass msub (not embellished operator)
+Pass msub (not embellished operator, from in-flow children)
+Pass 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)
+Pass msup (not embellished operator)
+Pass msup (not embellished operator, from in-flow children)
+Pass 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)
+Pass msubsup (not embellished operator)
+Pass msubsup (not embellished operator, from in-flow children)
+Pass 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)
+Pass munder (not embellished operator)
+Pass munder (not embellished operator, from in-flow children)
+Pass 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)
+Pass mover (not embellished operator)
+Pass mover (not embellished operator, from in-flow children)
+Pass 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)
+Pass munderover (not embellished operator)
+Pass munderover (not embellished operator, from in-flow children)
+Pass 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)
+Pass mmultiscripts (not embellished operator)
+Pass mmultiscripts (not embellished operator, from in-flow children)
+Pass 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
+Pass mfrac (not embellished operator)
+Pass 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
index 038c1b612d9..10b93e48b17 100644
--- 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
@@ -2,18 +2,18 @@ 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
+14 Pass
+Pass maction (embellished operator)
+Pass maction (embellished operator, from in-flow children)
+Pass maction (not embellished operator)
+Pass maction (not embellished operator, from in-flow children)
+Pass maction (not embellished operator, empty)
+Pass maction (embellished operator, one child)
+Pass maction (embellished operator, complex)
+Pass semantics (embellished operator)
+Pass semantics (embellished operator, from in-flow children)
+Pass semantics (not embellished operator)
+Pass semantics (not embellished operator, from in-flow children)
+Pass semantics (not embellished operator, empty)
+Pass semantics (embellished operator, one child)
+Pass 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-dynamic-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/embellished-operator-dynamic-002.txt
index 05e66aa2e83..126f85a1d4c 100644
--- 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
@@ -2,13 +2,12 @@ Harness status: OK
Found 8 tests
-4 Pass
-4 Fail
-Fail container1: Initially an embellished operator
+8 Pass
+Pass container1: Initially an embellished operator
Pass container2: Initially not an embellished operator
Pass container1: No longer an embellished operator
-Fail container2: Became an embellished operator
-Fail container3: Initially an embellished operator (testing space-like)
+Pass container2: Became an embellished operator
+Pass container3: Initially an embellished operator (testing space-like)
Pass container4/space-like: Initially not an embellished operator (testing space-like)
Pass container3: No longer an embellished operator (testing space-like)
-Fail container4: Became an embellished operator (testing space-like)
\ No newline at end of file
+Pass 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/mo-font-relative-lengths-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/presentation-markup/operators/mo-font-relative-lengths-001.txt
index bf19fad6a07..982d62c66e0 100644
--- 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
@@ -2,9 +2,9 @@ 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
+3 Pass
+1 Fail
+Pass font-relative lspace refers to the core operator
+Pass 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
index 58bfe707d01..c2f0ba7e2d2 100644
--- 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
@@ -2,51 +2,52 @@ 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).
+32 Pass
+16 Fail
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, stretchy variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, LTR, glyph assembly).
+Pass lspace/rspace spacing correctly set around operator (child of math, not embellished, LTR, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of math, not embellished, LTR, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of math, not embellished, LTR, stretchy variant).
+Pass 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).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, stretchy variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, LTR, glyph assembly).
+Pass lspace/rspace spacing correctly set around operator (child of math, embellished, LTR, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of math, embellished, LTR, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of math, embellished, LTR, stretchy variant).
+Pass 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).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, stretchy variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, not embellished, RTL, glyph assembly).
+Pass lspace/rspace spacing correctly set around operator (child of math, not embellished, RTL, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of math, not embellished, RTL, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of math, not embellished, RTL, stretchy variant).
+Pass 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).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, stretchy variant).
+Pass lspace/rspace spacing correctly set around operator (child of mrow, embellished, RTL, glyph assembly).
+Pass lspace/rspace spacing correctly set around operator (child of math, embellished, RTL, normal text).
+Pass lspace/rspace spacing correctly set around operator (child of math, embellished, RTL, largeop variant).
+Pass lspace/rspace spacing correctly set around operator (child of math, embellished, RTL, stretchy variant).
+Pass 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).
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
index 9f66ecf1393..2e1a66f71be 100644
--- 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
@@ -2,6 +2,6 @@ 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
+2 Pass
+Pass Default spacing for = + unsupported combining char U+0303
+Pass 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
index 609fd0c5a56..7f33f5146d2 100644
--- 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
@@ -2,12 +2,12 @@ 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
+8 Pass
+Pass Spacing around ≠
+Pass Spacing around =⃒
+Pass Spacing around |̸
+Pass Spacing around |⃒
+Pass Spacing around ⋉̸
+Pass Spacing around ⋉⃒
+Pass Spacing around ∄
+Pass Spacing around ∃⃒
\ No newline at end of file
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
index 74b099e7917..68888197b97 100644
--- 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
@@ -2,24 +2,24 @@ 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
+20 Pass
+Pass Operator dictionary spacing for "!!" (postfix)
+Pass Operator dictionary spacing for "!=" (infix)
+Pass Operator dictionary spacing for "&&" (infix)
+Pass Operator dictionary spacing for "**" (infix)
+Pass Operator dictionary spacing for "*=" (infix)
+Pass Operator dictionary spacing for "++" (postfix)
+Pass Operator dictionary spacing for "+=" (infix)
+Pass Operator dictionary spacing for "--" (postfix)
+Pass Operator dictionary spacing for "-=" (infix)
+Pass Operator dictionary spacing for "->" (infix)
+Pass Operator dictionary spacing for "//" (infix)
+Pass Operator dictionary spacing for "/=" (infix)
+Pass Operator dictionary spacing for ":=" (infix)
+Pass Operator dictionary spacing for "<=" (infix)
+Pass Operator dictionary spacing for "<>" (infix)
+Pass Operator dictionary spacing for "==" (infix)
+Pass Operator dictionary spacing for ">=" (infix)
+Pass Operator dictionary spacing for "||" (infix)
+Pass Operator dictionary spacing for "||" (postfix)
+Pass Operator dictionary spacing for "||" (prefix)
\ 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
index 8c73a668e0c..f77438268d4 100644
--- 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
@@ -2,18 +2,18 @@ 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
+14 Pass
+Pass mtext is space-like
+Pass mspace is space-like
+Pass space-like mrow
+Pass non-space-like mrow
+Pass space-like mstyle
+Pass non-space-like mstyle
+Pass space-like mphantom
+Pass non-space-like mphantom
+Pass space-like mpadded
+Pass non-space-like mpadded
+Pass space-like merror
+Pass non-space-like merror
+Pass space-like menclose
+Pass 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
index 548e3351dc4..9d20e11f31a 100644
--- 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
@@ -2,10 +2,10 @@ 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
+6 Pass
+Pass space-like maction
+Pass space-like maction (no first child)
+Pass non-space like maction (first child not space-like)
+Pass space-like semantics
+Pass space-like semantics (no first child)
+Pass 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
index b870c4d84ac..4b1b4270daa 100644
--- 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
@@ -2,19 +2,19 @@ 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
+15 Pass
+Pass mroot is not space-like
+Pass mfrac is not space-like
+Pass mi is not space-like
+Pass mmultiscripts is not space-like
+Pass mn is not space-like
+Pass mo is not space-like
+Pass mover is not space-like
+Pass munder is not space-like
+Pass ms is not space-like
+Pass munderover is not space-like
+Pass msup is not space-like
+Pass msub is not space-like
+Pass msubsup is not space-like
+Pass msqrt is not space-like
+Pass 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
index 559cde8d385..30d117df43d 100644
--- 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
@@ -2,8 +2,9 @@ Harness status: OK
Found 4 tests
-4 Fail
-Fail complex space-like subtree
+3 Pass
+1 Fail
+Pass 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
+Pass complex non-space-like subtree
+Pass 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/relations/css-styling/width-height-001.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/width-height-001.txt
index f064469fab5..c55e08cfd0b 100644
--- 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
@@ -2,8 +2,8 @@ Harness status: OK
Found 103 tests
-94 Pass
-9 Fail
+95 Pass
+8 Fail
Pass width and height properties on a
Pass inline-size and block-size properties on a
Pass width and height properties on a (content overflowing)
@@ -39,7 +39,7 @@ Pass width property on mn (preferred width)
Pass width and height properties on mo
Pass inline-size and block-size properties on mo
Pass width and height properties on mo (content overflowing)
-Fail width property on mo (preferred width)
+Pass width property on mo (preferred width)
Pass width and height properties on mover
Pass inline-size and block-size properties on mover
Pass width and height properties on mover (content overflowing)