Truly independent web browser
LibWeb: Publish MathML attributes to layout
Andreas Kling1879019c9223
diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cppindex 34c3016ed7a..37b405ce6e7 100644--- a/Libraries/LibWeb/CSS/StyleComputer.cpp+++ b/Libraries/LibWeb/CSS/StyleComputer.cpp@@ -99,6 +99,7 @@#include <LibWeb/HTML/Scripting/Environments.h>#include <LibWeb/Layout/LayoutRustBridge.h>#include <LibWeb/Layout/Node.h>+#include <LibWeb/MathML/MathMLElement.h>#include <LibWeb/Namespace.h>#include <LibWeb/Page/Page.h>#include <LibWeb/Page/RenderingStats.h>@@ -263,6 +264,8 @@ void StyleComputer::register_style_node(StyleNodeID style_node_id, DOM::Node& no// had one published nothing.if (auto* svg_element = as_if<SVG::SVGElement>(node))Layout::publish_svg_attribute_facts(*svg_element);+ else if (auto* mathml_element = as_if<MathML::MathMLElement>(node))+ Layout::publish_math_attribute_facts(*mathml_element);}static void ensure_slot(auto& nodes, u32 index)diff --git a/Libraries/LibWeb/CSS/StyleEngineInput.cpp b/Libraries/LibWeb/CSS/StyleEngineInput.cppindex 99b8c8add5e..471efe525b2 100644--- a/Libraries/LibWeb/CSS/StyleEngineInput.cpp+++ b/Libraries/LibWeb/CSS/StyleEngineInput.cpp@@ -1163,6 +1163,7 @@ enum class MathMLLayoutKind : u32 {Mprescripts,None,Mpadded,+ Mtext,};static MathMLLayoutKind mathml_layout_kind(DOM::Element const& element)@@ -1173,7 +1174,9 @@ static MathMLLayoutKind mathml_layout_kind(DOM::Element const& element)auto const& name = element.local_name();if (name == TagNames::math)return MathMLLayoutKind::Math;- if (first_is_one_of(name, TagNames::mi, TagNames::mn, TagNames::ms, TagNames::mtext, TagNames::annotation, TagNames::annotation_xml))+ if (name == TagNames::mtext)+ return MathMLLayoutKind::Mtext;+ if (first_is_one_of(name, TagNames::mi, TagNames::mn, TagNames::ms, TagNames::annotation, TagNames::annotation_xml))return MathMLLayoutKind::Token;if (name == TagNames::mo)return MathMLLayoutKind::Mo;diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.hindex 3b4a70a7781..943499c4b1d 100644--- a/Libraries/LibWeb/DOM/Node.h+++ b/Libraries/LibWeb/DOM/Node.h@@ -97,6 +97,7 @@ enum class RootNodeComposed {X(HTMLVideoElementSetVideoTrack) \X(KeyframeEffect) \X(LayoutTreeUpdate) \+ X(MathMLAttributeChange) \X(NavigableSetViewportSize) \X(SVGImageElementFetchTheDocument) \X(SVGResourceElementAttributeChange) \diff --git a/Libraries/LibWeb/Layout/LayoutRustBridge.cpp b/Libraries/LibWeb/Layout/LayoutRustBridge.cppindex c60d76032da..00a8e3d3d23 100644--- a/Libraries/LibWeb/Layout/LayoutRustBridge.cpp+++ b/Libraries/LibWeb/Layout/LayoutRustBridge.cpp@@ -15,8 +15,11 @@#include <LibWeb/CSS/ComputedValues.h>#include <LibWeb/CSS/Display.h>#include <LibWeb/CSS/LengthBox.h>+#include <LibWeb/CSS/Parser/Parser.h>#include <LibWeb/CSS/StyleComputer.h>#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>+#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>+#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>#include <LibWeb/CSS/ValueType.h>#include <LibWeb/DOM/AbstractElement.h>#include <LibWeb/DOM/CommitMessages.h>@@ -36,6 +39,7 @@#include <LibWeb/Layout/NodeArena.h>#include <LibWeb/Layout/TextNode.h>#include <LibWeb/Layout/Viewport.h>+#include <LibWeb/MathML/AttributeNames.h>#include <LibWeb/Painting/PaintableTypes.h>#include <LibWeb/Painting/ScrollSnap.h>#include <LibWeb/SVG/FragmentIdentifier.h>@@ -389,6 +393,101 @@ void publish_svg_attribute_facts(DOM::Element& element)points.size());}+// The unit of a published MathML length. Mirrors Rust `math_length_unit`.+enum class MathLengthUnit : u8 {+ Absent,+ Px,+ Em,+ Ex,+ Percentage,+};++// The value of a published MathML boolean attribute. Mirrors Rust `math_boolean`.+enum class MathBoolean : u8 {+ Absent,+ True,+ False,+};++static RustFFI::FfiMathLength math_length_attribute(DOM::Element const& element, Utf16FlyString const& name)+{+ auto value = element.attribute(name);+ if (!value.has_value())+ return {};+ auto style_value = parse_css_type(CSS::Parser::ParsingParams { element.document() }, value->utf16_view(), CSS::ValueType::LengthPercentage);+ if (!style_value)+ return {};+ if (style_value->is_percentage())+ return { to_underlying(MathLengthUnit::Percentage), static_cast<float>(style_value->as_percentage().percentage().value()) };+ if (!style_value->is_length())+ return {};+ auto const& length = style_value->as_length().length();+ if (length.is_absolute())+ return { to_underlying(MathLengthUnit::Px), static_cast<float>(length.absolute_length_to_px_without_rounding()) };+ if (length.unit() == CSS::LengthUnit::Em)+ return { to_underlying(MathLengthUnit::Em), static_cast<float>(length.raw_value()) };+ if (length.unit() == CSS::LengthUnit::Ex)+ return { to_underlying(MathLengthUnit::Ex), static_cast<float>(length.raw_value()) };+ // FIXME: Publish the other relative lengths, which resolve against the box that reads them.+ return {};+}++static u8 math_boolean_attribute(DOM::Element const& element, Utf16FlyString const& name)+{+ auto value = element.attribute(name);+ if (!value.has_value())+ return to_underlying(MathBoolean::Absent);+ if (value->equals_ignoring_ascii_case("true"sv))+ return to_underlying(MathBoolean::True);+ if (value->equals_ignoring_ascii_case("false"sv))+ return to_underlying(MathBoolean::False);+ return to_underlying(MathBoolean::Absent);+}++// https://w3c.github.io/mathml-core/#dfn-form+static u8 math_form_attribute(DOM::Element const& element)+{+ auto value = element.attribute(MathML::AttributeNames::form);+ if (!value.has_value())+ return 0;+ // The corresponding form attribute on the <mo> element, if present, must be an ASCII case-insensitive match to+ // one of these values.+ // NB: The published form is one plus Rust's `OperatorForm`.+ if (value->equals_ignoring_ascii_case("infix"sv))+ return 1;+ if (value->equals_ignoring_ascii_case("prefix"sv))+ return 2;+ if (value->equals_ignoring_ascii_case("postfix"sv))+ return 3;+ return 0;+}++void publish_math_attribute_facts(DOM::Element const& element)+{+ if (element.style_node_id().value() == 0)+ return;+ namespace AttributeNames = MathML::AttributeNames;+ RustFFI::FfiMathAttributeFacts facts {+ .width = math_length_attribute(element, AttributeNames::width),+ .height = math_length_attribute(element, AttributeNames::height),+ .depth = math_length_attribute(element, AttributeNames::depth),+ .lspace = math_length_attribute(element, AttributeNames::lspace),+ .rspace = math_length_attribute(element, AttributeNames::rspace),+ .voffset = math_length_attribute(element, AttributeNames::voffset),+ .linethickness = math_length_attribute(element, AttributeNames::linethickness),+ .minsize = math_length_attribute(element, AttributeNames::minsize),+ .maxsize = math_length_attribute(element, AttributeNames::maxsize),+ .form = math_form_attribute(element),+ .stretchy = math_boolean_attribute(element, AttributeNames::stretchy),+ .symmetric = math_boolean_attribute(element, AttributeNames::symmetric),+ .largeop = math_boolean_attribute(element, AttributeNames::largeop),+ .movablelimits = math_boolean_attribute(element, AttributeNames::movablelimits),+ .accent = math_boolean_attribute(element, AttributeNames::accent),+ .accentunder = math_boolean_attribute(element, AttributeNames::accentunder),+ };+ RustFFI::render_state_set_math_attribute_facts(const_cast<DOM::Document&>(element.document()).layout_node_arena().host(), element.style_node_id().value(), facts);+}+// Republished on its own when an element's style record is replaced: the presentation attributes it sits beside are// unchanged, and parsing all of them again for four names would make every style change on every SVG element pay for// it.diff --git a/Libraries/LibWeb/Layout/LayoutRustBridge.h b/Libraries/LibWeb/Layout/LayoutRustBridge.hindex 3829f308131..4b825ceb06a 100644--- a/Libraries/LibWeb/Layout/LayoutRustBridge.h+++ b/Libraries/LibWeb/Layout/LayoutRustBridge.h@@ -37,6 +37,7 @@ WEB_API void register_layout_host(NodeArena&, DOM::Document&);// identity. An element's attributes are layout input that no pass can change, so the document publishes them as// they are written rather than answering for them while a pass runs.void publish_svg_attribute_facts(DOM::Element&);+void publish_math_attribute_facts(DOM::Element const&);void publish_svg_style_references(DOM::Element&);// Which shape an SVG geometry element draws, and the endpoints a <line> parses. The other fields keep their defaults.diff --git a/Libraries/LibWeb/MathML/AttributeNames.h b/Libraries/LibWeb/MathML/AttributeNames.hindex 3e983e105bb..2c935b72092 100644--- a/Libraries/LibWeb/MathML/AttributeNames.h+++ b/Libraries/LibWeb/MathML/AttributeNames.h@@ -12,17 +12,30 @@namespace Web::MathML::AttributeNames {#define ENUMERATE_MATHML_ATTRIBUTES \+ __ENUMERATE_MATHML_ATTRIBUTE(accent, "accent") \+ __ENUMERATE_MATHML_ATTRIBUTE(accentunder, "accentunder") \__ENUMERATE_MATHML_ATTRIBUTE(autofocus, "autofocus") \__ENUMERATE_MATHML_ATTRIBUTE(depth, "depth") \__ENUMERATE_MATHML_ATTRIBUTE(dir, "dir") \__ENUMERATE_MATHML_ATTRIBUTE(displaystyle, "displaystyle") \+ __ENUMERATE_MATHML_ATTRIBUTE(form, "form") \__ENUMERATE_MATHML_ATTRIBUTE(height, "height") \__ENUMERATE_MATHML_ATTRIBUTE(href, "href") \+ __ENUMERATE_MATHML_ATTRIBUTE(largeop, "largeop") \+ __ENUMERATE_MATHML_ATTRIBUTE(linethickness, "linethickness") \+ __ENUMERATE_MATHML_ATTRIBUTE(lspace, "lspace") \__ENUMERATE_MATHML_ATTRIBUTE(mathbackground, "mathbackground") \__ENUMERATE_MATHML_ATTRIBUTE(mathcolor, "mathcolor") \__ENUMERATE_MATHML_ATTRIBUTE(mathsize, "mathsize") \__ENUMERATE_MATHML_ATTRIBUTE(mathvariant, "mathvariant") \+ __ENUMERATE_MATHML_ATTRIBUTE(maxsize, "maxsize") \+ __ENUMERATE_MATHML_ATTRIBUTE(minsize, "minsize") \+ __ENUMERATE_MATHML_ATTRIBUTE(movablelimits, "movablelimits") \+ __ENUMERATE_MATHML_ATTRIBUTE(rspace, "rspace") \__ENUMERATE_MATHML_ATTRIBUTE(scriptlevel, "scriptlevel") \+ __ENUMERATE_MATHML_ATTRIBUTE(stretchy, "stretchy") \+ __ENUMERATE_MATHML_ATTRIBUTE(symmetric, "symmetric") \+ __ENUMERATE_MATHML_ATTRIBUTE(voffset, "voffset") \__ENUMERATE_MATHML_ATTRIBUTE(width, "width")#define __ENUMERATE_MATHML_ATTRIBUTE(name, attribute) extern WEB_API Utf16FlyString const& name;diff --git a/Libraries/LibWeb/MathML/MathMLElement.cpp b/Libraries/LibWeb/MathML/MathMLElement.cppindex 791321da392..bff193f79f4 100644--- a/Libraries/LibWeb/MathML/MathMLElement.cpp+++ b/Libraries/LibWeb/MathML/MathMLElement.cpp@@ -10,6 +10,7 @@#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>#include <LibWeb/HTML/Parser/HTMLParser.h>+#include <LibWeb/Layout/LayoutRustBridge.h>#include <LibWeb/MathML/AttributeNames.h>#include <LibWeb/MathML/MathMLElement.h>#include <LibWeb/MathML/TagNames.h>@@ -29,6 +30,16 @@ void MathMLElement::attribute_changed(Utf16FlyString const& local_name, Optional{Base::attribute_changed(local_name, old_value, value, namespace_);HTMLOrSVGOrMathMLElement::attribute_changed(local_name, old_value, value, namespace_);++ // NB: These attributes are read by the layout of the element's box.+ if (old_value != value && !namespace_.has_value()+ && local_name.is_one_of(AttributeNames::width, AttributeNames::height, AttributeNames::depth, AttributeNames::lspace, AttributeNames::rspace,+ AttributeNames::voffset, AttributeNames::linethickness, AttributeNames::minsize, AttributeNames::maxsize, AttributeNames::form,+ AttributeNames::stretchy, AttributeNames::symmetric, AttributeNames::largeop, AttributeNames::movablelimits, AttributeNames::accent,+ AttributeNames::accentunder)) {+ Layout::publish_math_attribute_facts(*this);+ set_needs_layout_update(DOM::SetNeedsLayoutReason::MathMLAttributeChange);+ }}WebIDL::ExceptionOr<void> MathMLElement::cloned(DOM::Node& node, bool clone_children) constdiff --git a/Libraries/LibWeb/MathML/MathMLMspaceElement.cpp b/Libraries/LibWeb/MathML/MathMLMspaceElement.cppindex 508268a9cc3..d45959aa85c 100644--- a/Libraries/LibWeb/MathML/MathMLMspaceElement.cpp+++ b/Libraries/LibWeb/MathML/MathMLMspaceElement.cpp@@ -50,8 +50,8 @@ void MathMLMspaceElement::apply_presentational_hints(Vector<CSS::StyleProperty>&// https://w3c.github.io/mathml-core/#attribute-mspace-height// If the height attribute is absent, invalid or a percentage then the requested line-ascent is 0. Otherwise the// requested line-ascent is the resolved value of the height attribute, clamping negative values to 0.+ // NB: The requested line-ascent is applied by the layout of the box.auto height_value = parse_non_percentage_value(AttributeNames::height);- // FIXME: set the line-ascent// If both the height and depth attributes are present, valid and not a percentage then they are used as a// presentational hint setting the element's height property to the concatenation of thediff --git a/Libraries/LibWeb/Rust/build.rs b/Libraries/LibWeb/Rust/build.rsindex 18f7dc6db4c..60007584f2a 100644--- a/Libraries/LibWeb/Rust/build.rs+++ b/Libraries/LibWeb/Rust/build.rs@@ -2889,6 +2889,7 @@ fn main() -> Result<(), Box<dyn Error>> {manifest_dir.join("src/layout/flex_formatting_context.rs"),manifest_dir.join("src/layout/grid_formatting_context.rs"),manifest_dir.join("src/layout/svg_formatting_context.rs"),+ manifest_dir.join("src/layout/math_formatting_context.rs"),manifest_dir.join("src/layout/table_formatting_context.rs"),manifest_dir.join("src/layout/inline_formatting_context.rs"),manifest_dir.join("src/layout/inline_level_iterator.rs"),diff --git a/Libraries/LibWeb/Rust/src/layout/layout_changes.rs b/Libraries/LibWeb/Rust/src/layout/layout_changes.rsindex 31684497c18..c0f6d95211f 100644--- a/Libraries/LibWeb/Rust/src/layout/layout_changes.rs+++ b/Libraries/LibWeb/Rust/src/layout/layout_changes.rs@@ -8,6 +8,7 @@//! a node by its slot or its identity and queues the change on the document's host; it does not reach the arena.use super::LayoutNodeArena;+use super::math_formatting_context::FfiMathAttributeFacts;use super::node_data::{NodeFlag, NodeSlotId};use super::svg_formatting_context::{FfiFloatPoint, FfiSvgAttributeFacts};use super::tree_mutation::{HostCalls, HostWorkDue, OwedHostWork};@@ -82,6 +83,11 @@ pub(crate) enum LayoutChange {facts: Box<FfiSvgAttributeFacts>,points: Box<[FfiFloatPoint]>,},+ /// The parsed MathML attributes a MathML element published, which its layout reads.+ MathAttributeFacts {+ element: StyleNodeID,+ facts: Box<FfiMathAttributeFacts>,+ },/// The resources an SVG graphics element's style names: its mask, clip path, fill and stroke.SvgStyleReferences {element: StyleNodeID,@@ -173,6 +179,7 @@ impl LayoutChange {| Self::SetPseudoElementScrollOffset { .. }| Self::SetIdentityInFocusedTextControl { .. }| Self::SvgAttributeFacts { .. }+ | Self::MathAttributeFacts { .. }| Self::SvgStyleReferences { .. }| Self::SetDocumentIsDecodedSvg(_)| Self::SetNodeFlag { .. }@@ -270,6 +277,7 @@ impl LayoutChange {Self::SvgAttributeFacts { element, facts, points } => {arena.set_style_node_svg_attribute_facts(element, *facts, &points);}+ Self::MathAttributeFacts { element, facts } => arena.set_style_node_math_attribute_facts(element, *facts),Self::SvgStyleReferences { element, references } => {arena.set_style_node_svg_style_references(element, references);}@@ -637,6 +645,25 @@ pub extern "C" fn render_state_set_svg_style_references(queue(host, change);}+/// Publishes the MathML attributes an element parsed, which the layout of its box reads.+#[unsafe(no_mangle)]+pub extern "C" fn render_state_set_math_attribute_facts(+ host: &DocumentHost,+ element: u32,+ facts: FfiMathAttributeFacts,+) {+ let Some(element) = StyleNodeID::from_raw(element) else {+ return;+ };+ queue(+ host,+ LayoutChange::MathAttributeFacts {+ element,+ facts: Box::new(facts),+ },+ );+}+#[unsafe(no_mangle)]pub extern "C" fn render_state_set_document_is_decoded_svg(host: &DocumentHost, is_decoded_svg: bool) {queue(host, LayoutChange::SetDocumentIsDecodedSvg(is_decoded_svg));diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rsindex 450dd050a63..fdee71cdeac 100644--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs@@ -1112,6 +1112,8 @@ struct StyleNodeTables {/// tree build is under way: an element styled on the build's behalf replaces its style record,/// which republishes the resources its style names. No reader holds a borrow across a host call.svg_attribute_facts: RefCell<HashMap<StyleNodeID, super::svg_formatting_context::FfiSvgAttributeFacts>>,+ /// The parsed MathML attributes each MathML element published, keyed by its style node.+ math_attribute_facts: RefCell<HashMap<StyleNodeID, super::math_formatting_context::FfiMathAttributeFacts>>,/// The `points` list each <polyline> and <polygon> published beside its facts.svg_points: RefCell<HashMap<StyleNodeID, std::sync::Arc<[super::svg_formatting_context::FfiFloatPoint]>>>,/// The elements carrying each anchor name, in tree order. The DOM's registry republishes a@@ -2317,6 +2319,7 @@ impl LayoutNodeArena {counters_sets,generated_content,svg_attribute_facts,+ math_attribute_facts,svg_points,anchor_name_elements,identities_in_focused_text_control,@@ -2334,6 +2337,7 @@ impl LayoutNodeArena {);}svg_points.borrow_mut().remove(&style_node);+ math_attribute_facts.borrow_mut().remove(&style_node);identities_in_focused_text_control.borrow_mut().remove(&style_node);element_scroll_offsets.borrow_mut().remove(&style_node);pseudo_element_scroll_offsets.borrow_mut().remove(&style_node);@@ -3211,6 +3215,31 @@ impl LayoutNodeArena {.unwrap_or_default()}+ /// The parsed MathML attributes of the element a row is built for. A row built for no MathML element answers+ /// with the default facts, in which every attribute is absent.+ pub(crate) fn math_attribute_facts(&self, id: NodeSlotId) -> super::math_formatting_context::FfiMathAttributeFacts {+ self.dom_node_style_node(id)+ .and_then(|style_node| {+ self.style_node_tables+ .math_attribute_facts+ .borrow()+ .get(&style_node)+ .copied()+ })+ .unwrap_or_default()+ }++ pub(crate) fn set_style_node_math_attribute_facts(+ &self,+ style_node: StyleNodeID,+ facts: super::math_formatting_context::FfiMathAttributeFacts,+ ) {+ self.style_node_tables+ .math_attribute_facts+ .borrow_mut()+ .insert(style_node, facts);+ }+/// The `points` list a <polyline> or <polygon> parsed, shared rather than borrowed: a/// publication can replace it while a reader still uses it.pub(crate) fn svg_points(diff --git a/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rsindex 3b8a9365e32..bffca7a1efe 100644--- a/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/math_formatting_context.rs@@ -33,6 +33,7 @@ pub(crate) enum MathLayoutKind {Mprescripts,None,Mpadded,+ Mtext,}impl MathLayoutKind {@@ -57,6 +58,7 @@ impl MathLayoutKind {16 => Self::Mprescripts,17 => Self::None,18 => Self::Mpadded,+ 19 => Self::Mtext,_ => Self::NotMathML,}}@@ -64,10 +66,76 @@ impl MathLayoutKind {/// Whether boxes of this kind lay out their children with a MathML layout algorithm. Token elements lay out their/// text as a block box.pub(crate) fn uses_math_layout(self) -> bool {- !matches!(self, Self::NotMathML | Self::Token | Self::Mo)+ !matches!(self, Self::NotMathML | Self::Token | Self::Mo | Self::Mtext)}}+/// The unit of a MathML attribute value that is a `<length-percentage>`. Mirrors the C++ `MathLengthUnit`, where 0+/// stands for an attribute that is absent or invalid.+pub(crate) mod math_length_unit {+ pub(crate) const PX: u8 = 1;+ pub(crate) const EM: u8 = 2;+ pub(crate) const EX: u8 = 3;+ pub(crate) const PERCENTAGE: u8 = 4;+}++/// A MathML attribute value that is a `<length-percentage>`, as the host parsed it. Font-relative lengths are kept+/// in their unit, as they resolve against the font of the box that reads them.+#[derive(Clone, Copy, Debug, Default, PartialEq)]+#[repr(C)]+pub struct FfiMathLength {+ pub unit: u8,+ pub value: f32,+}++impl FfiMathLength {+ fn is_percentage(self) -> bool {+ self.unit == math_length_unit::PERCENTAGE+ }++ /// Resolves the length against the font of `style`, and a percentage against `percentage_basis`.+ fn resolve(self, style: &StyleValues<'_>, percentage_basis: CssPixels) -> Option<CssPixels> {+ let value = f64::from(self.value);+ match self.unit {+ math_length_unit::PX => Some(CssPixels::nearest_value_for(value)),+ math_length_unit::EM => Some(style.font_size().scaled(value)),+ math_length_unit::EX => Some(CssPixels::nearest_value_for(f64::from(style.font_x_height()) * value)),+ math_length_unit::PERCENTAGE => Some(percentage_basis.scaled(value / 100.0)),+ _ => None,+ }+ }+}++/// The value of a MathML attribute that is a boolean. Mirrors the C++ `MathBoolean`, where 0 stands for an attribute+/// that is absent or invalid and 2 for false.+pub(crate) mod math_boolean {+ pub(crate) const TRUE: u8 = 1;+}++/// The MathML attributes of an element that its layout reads, as the host parsed them. Every element publishes all+/// of them; the layout of its box reads those its tag name gives a meaning to.+#[derive(Clone, Copy, Debug, Default, PartialEq)]+#[repr(C)]+pub struct FfiMathAttributeFacts {+ pub width: FfiMathLength,+ pub height: FfiMathLength,+ pub depth: FfiMathLength,+ pub lspace: FfiMathLength,+ pub rspace: FfiMathLength,+ pub voffset: FfiMathLength,+ pub linethickness: FfiMathLength,+ pub minsize: FfiMathLength,+ pub maxsize: FfiMathLength,+ /// The form attribute: 1 for infix, 2 for prefix and 3 for postfix, or 0 if it is absent or invalid.+ pub form: u8,+ pub stretchy: u8,+ pub symmetric: u8,+ pub largeop: u8,+ pub movablelimits: u8,+ pub accent: u8,+ pub accentunder: u8,+}+/// 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)]@@ -223,11 +291,20 @@ impl<'pass> MathFormattingContext<'pass> {(MathLayoutKind::Msubsup, 3) => {layout_scripts(&children[0], Some(&children[1]), Some(&children[2]), &constants)}- (MathLayoutKind::Munder, 2) => layout_underover(&children[0], Some(&children[1]), None, &constants),- (MathLayoutKind::Mover, 2) => layout_underover(&children[0], None, Some(&children[1]), &constants),- (MathLayoutKind::Munderover, 3) => {- layout_underover(&children[0], Some(&children[1]), Some(&children[2]), &constants)+ (MathLayoutKind::Munder, 2) => {+ layout_underover(&children[0], Some(&children[1]), None, &constants, self.accents(root))+ }+ (MathLayoutKind::Mover, 2) => {+ layout_underover(&children[0], None, Some(&children[1]), &constants, self.accents(root))}+ (MathLayoutKind::Munderover, 3) => layout_underover(+ &children[0],+ Some(&children[1]),+ Some(&children[2]),+ &constants,+ self.accents(root),+ ),+ (MathLayoutKind::Mspace, _) => self.layout_space(&root_style),_ => layout_row(&children),};@@ -280,13 +357,58 @@ impl<'pass> MathFormattingContext<'pass> {self.content = content;}+ /// Whether the accentunder and accent attributes of an <munder>, <mover> or <munderover> are a match to true.+ // https://w3c.github.io/mathml-core/#dfn-accent+ fn accents(&self, node: Node) -> (bool, bool) {+ let attributes = self.run.callbacks.arena().math_attribute_facts(node);+ (+ attributes.accentunder == math_boolean::TRUE,+ attributes.accent == math_boolean::TRUE,+ )+ }++ // https://w3c.github.io/mathml-core/#space-mspace+ fn layout_space(&self, style: &StyleValues<'_>) -> MathContent {+ // If the height attribute is absent, invalid or a percentage then the requested line-ascent is 0. Otherwise+ // the requested line-ascent is the resolved value of the height attribute, clamping negative values to 0.+ let height = self.run.callbacks.arena().math_attribute_facts(self.run.box_).height;+ let requested_line_ascent = if height.is_percentage() {+ CssPixels::default()+ } else {+ height+ .resolve(style, CssPixels::default())+ .unwrap_or_default()+ .max(CssPixels::default())+ };+ // The line-ascent of the math content is equal to the requested line-ascent determined above.+ MathContent {+ ascent: requested_line_ascent,+ ..MathContent::default()+ }+ }+// https://w3c.github.io/mathml-core/#fraction-with-nonzero-line-thicknessfn layout_fraction(&self, children: &[Child], constants: &MathConstants, style: &StyleValues<'_>) -> MathContent {let numerator = &children[0];let denominator = &children[1];let is_display_style = style.math_style() == math_style::NORMAL;- // FIXME: Support the linethickness attribute.- let line_thickness = constants.default_rule_thickness;+ // https://w3c.github.io/mathml-core/#dfn-linethickness+ // The linethickness attribute indicates the fraction line thickness to use for the fraction bar. If present,+ // it must have a value that is a valid <length-percentage>. If the attribute is absent or has an invalid value,+ // FractionRuleThickness is used as the default value. A percentage is interpreted relative to that default+ // value. A negative value is interpreted as 0.+ let line_thickness = self+ .run+ .callbacks+ .arena()+ .math_attribute_facts(self.run.box_)+ .linethickness+ .resolve(style, constants.default_rule_thickness)+ .unwrap_or(constants.default_rule_thickness)+ .max(CssPixels::default());+ if line_thickness == CssPixels::default() {+ return layout_fraction_without_bar(numerator, denominator, constants, is_display_style);+ }let half_thickness = line_thickness / 2;let axis_height = constants.axis_height;// NB: FractionNumeratorShiftUp and FractionDenominatorShiftDown fall back to 0.@@ -312,6 +434,16 @@ impl<'pass> MathFormattingContext<'pass> {let denominator_shift =CssPixels::default().max(half_thickness + denominator_gap_min + denominator.ascent - axis_height);+ // The line-ascent of the math content is the maximum between:+ // - Numerator Shift + the line-ascent of the numerator's margin box.+ // - Denominator Shift + the line-ascent of the denominator's margin box+ // - AxisHeight plus half the fraction line thickness.+ // The line-descent of the math content is the maximum between:+ // - Numerator Shift + the line-descent of the numerator's margin box.+ // - Denominator Shift + the line-descent of the denominator's margin box.+ // - AxisHeight plus half the fraction line thickness.+ // NB: The shifts are applied in the directions the numerator and denominator are moved in, and the fraction+ // bar extends below the alphabetic baseline by half the fraction line thickness minus the AxisHeight.let ascent = (numerator_shift + numerator.ascent).max(denominator.ascent - denominator_shift).max(axis_height + half_thickness);@@ -413,6 +545,73 @@ fn layout_row(children: &[Child]) -> MathContent {}}+// https://w3c.github.io/mathml-core/#fraction-with-zero-line-thickness+fn layout_fraction_without_bar(+ numerator: &Child,+ denominator: &Child,+ constants: &MathConstants,+ is_display_style: bool,+) -> MathContent {+ // The min-content inline size, max-content inline size and inline size of the math content are calculated the+ // same as in Fraction with nonzero line thickness.+ let inline_size = numerator.inline_size.max(denominator.inline_size);++ // If the math-style is compact then TopShift and BottomShift are respectively set to StackTopShiftUp and+ // StackBottomShiftDown. Otherwise math-style is normal and they are respectively set to+ // StackTopDisplayStyleShiftUp and StackBottomDisplayStyleShiftDown.+ // NB: These constants fall back to the Default fallback constant, which is 0.+ let mut top_shift = CssPixels::default();+ let mut bottom_shift = CssPixels::default();++ // Gap is defined to be (BottomShift − the ink line-ascent of the denominator's margin box) + (TopShift − the ink+ // line-descent of the numerator's margin box). If math-style is compact then GapMin is StackGapMin, otherwise+ // math-style is normal and it is StackDisplayStyleGapMin.+ // NB: stackGapMin falls back to 3 × default rule thickness, and stackDisplayStyleGapMin to 7 × default rule+ // thickness.+ let gap = (bottom_shift - denominator.ascent) + (top_shift - numerator.descent);+ let gap_min = if is_display_style {+ constants.default_rule_thickness * 7usize+ } else {+ constants.default_rule_thickness * 3usize+ };+ // If Δ = GapMin − Gap is positive then TopShift and BottomShift are respectively increased by Δ/2 and Δ − Δ/2.+ let delta = gap_min - gap;+ if delta > CssPixels::default() {+ top_shift += delta / 2;+ bottom_shift += delta - delta / 2;+ }++ // The line-ascent of the math content is the maximum between:+ // - TopShift + the line-ascent of the numerator's margin box.+ // - BottomShift + the line-ascent of the denominator's margin box.+ // The line-descent of the math content is the maximum between:+ // - TopShift + the line-descent of the numerator's margin box.+ // - BottomShift + the line-descent of the denominator's margin box.+ // NB: The shifts are applied in the directions the numerator and denominator are moved in.+ let ascent = (top_shift + numerator.ascent).max(denominator.ascent - bottom_shift);+ let descent = (numerator.descent - top_shift).max(bottom_shift + denominator.descent);++ // The inline offsets of the numerator and denominator are calculated the same as in Fraction with nonzero line+ // thickness.+ // The alphabetic baseline of the numerator (respectively denominator) is shifted away from the alphabetic baseline+ // by a distance of TopShift (respectively − BottomShift) towards the line-over (respectively line-under).+ MathContent {+ inline_size,+ ascent,+ descent,+ positions: vec![+ ChildPosition {+ line_left_offset: (inline_size - numerator.inline_size) / 2,+ baseline_shift: -top_shift,+ },+ ChildPosition {+ line_left_offset: (inline_size - denominator.inline_size) / 2,+ baseline_shift: bottom_shift,+ },+ ],+ }+}+// https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsupfn layout_scripts(base: &Child,@@ -512,11 +711,27 @@ fn layout_underover(underscript: Option<&Child>,overscript: Option<&Child>,constants: &MathConstants,+ (accentunder, accent): (bool, bool),) -> MathContent {- // FIXME: Handle accents, large operators and operators stretchy along the inline axis.- // underbarVerticalGap and overbarVerticalGap: 3 × default rule thickness if the constant is not available.- let under_shift = constants.default_rule_thickness * 3usize;- let over_shift = constants.default_rule_thickness * 3usize;+ // FIXME: Handle large operators, operators stretchy along the inline axis, and bases that are embellished+ // operators with the movablelimits property when the math-style is compact, which are laid out as scripts.+ // UnderShift is equal to UnderbarVerticalGap if the accentunder attribute is not an ASCII case-insensitive match+ // to true and to zero otherwise.+ // NB: underbarVerticalGap and overbarVerticalGap fall back to 3 × default rule thickness, and accentBaseHeight+ // to OS/2.sxHeight.+ let under_shift = if accentunder {+ CssPixels::default()+ } else {+ constants.default_rule_thickness * 3usize+ };+ // Otherwise, OverShift is equal to OverbarVerticalGap if the accent attribute is not an ASCII case-insensitive+ // match to true. Or AccentBaseHeight minus the line-ascent of the mover base's margin box if this difference is+ // nonnegative. Or 0 otherwise.+ let over_shift = if accent {+ (constants.x_height - base.ascent).max(CssPixels::default())+ } else {+ constants.default_rule_thickness * 3usize+ };// underbarExtraDescender and overbarExtraAscender: default rule thickness if the constant is not available.let under_extra_descender = constants.default_rule_thickness;let over_extra_ascender = constants.default_rule_thickness;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.txtindex b6986c0fbd8..5181653adc5 100644--- 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@@ -2,9 +2,10 @@ Harness status: OKFound 6 tests-6 Fail-Fail Positive-Fail Negative+2 Pass+4 Fail+Pass Positive+Pass NegativeFail PercentageFail Named spaceFail Calc() expressiondiff --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.txtindex e68615f5014..69f8d028093 100644--- 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@@ -2,8 +2,8 @@ Harness status: OKFound 10 tests-1 Pass-9 Fail+2 Pass+8 FailFail mpadded with no attributesFail Different widthsFail Different heights@@ -11,6 +11,6 @@ Fail Percentage calculation for width, height and depthFail Different depthsFail Various combinations of height, depth and width.Pass Preferred width-Fail dynamic attributes (remove)+Pass dynamic attributes (remove)Fail dynamic attributes (attach)Fail dynamic attributes (modify)\ No newline at end of filediff --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.txtindex fd329a8e02f..e2ff86c023b 100644--- 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@@ -2,10 +2,10 @@ Harness status: OKFound 5 tests-1 Pass-4 Fail+2 Pass+3 FailPass lspace/voffset shifts don't affect mpadded preferred width-Fail lspace/voffset shifts don't affect mpadded size+Pass lspace/voffset shifts don't affect mpadded sizeFail content is shifted by the specified lspace/voffsetFail content is shifted by the specified lspace/voffset (RTL)Fail dynamic changes of lspace/voffset\ No newline at end of filediff --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.txtindex 55f3aafa921..db3ca6af2d9 100644--- 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@@ -2,19 +2,18 @@ Harness status: OKFound 14 tests-1 Pass-13 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+14 Pass+Pass baseline alignment inside Mrow+Pass baseline alignment inside Sqrt+Pass baseline alignment inside Style+Pass baseline alignment inside Error+Pass baseline alignment inside Phantom+Pass baseline alignment inside Math+Pass baseline alignment inside Menclose+Pass baseline alignment inside Mpadded+Pass baseline alignment inside UnknownPass 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+Pass baseline alignment inside None+Pass baseline alignment inside Mprescripts+Pass baseline alignment inside Mfenced+Pass baseline alignment inside A\ No newline at end of filediff --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.txtindex 69999a7935b..befda3d91fd 100644--- 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@@ -2,10 +2,9 @@ Harness status: OKFound 5 tests-4 Pass-1 Fail+5 PassPass Respective horizontal positions-Fail Alignment of the base on the baseline+Pass Alignment of the base on the baselinePass Vertical position of scriptsPass Width of scripted elementsPass Height of scripted elements\ No newline at end of filediff --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.txtindex 56adc48dd78..2778cd36d24 100644--- 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@@ -2,10 +2,10 @@ Harness status: OKFound 6 tests-2 Pass-4 Fail+3 Pass+3 FailFail Respective horizontal positions-Fail Alignment of the base on the baseline+Pass Alignment of the base on the baselineFail Vertical position of scriptsFail Width of scripted elementsPass Height of scripted elementsdiff --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.txtindex ac22644855b..84cdec73db7 100644--- 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@@ -2,8 +2,9 @@ Harness status: OKFound 5 tests-5 Fail-Fail Alignment of the base on the baseline+1 Pass+4 Fail+Pass Alignment of the base on the baselineFail Dimensions of the scripted elementsFail Vertical positions of scriptsFail Horizontal alignment of scriptsdiff --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.txtindex f30b9b8b242..c2d5ab0a63c 100644--- 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@@ -2,7 +2,6 @@ Harness status: OKFound 2 tests-1 Pass-1 Fail-Fail Alignment on the baseline for bases of different heights+2 Pass+Pass Alignment on the baseline for bases of different heightsPass Vertical position of the scripts for bases of different heights\ No newline at end of filediff --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.txtindex 0a0d4b4cec2..3b113d92045 100644--- 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@@ -2,7 +2,8 @@ Harness status: OKFound 3 tests-3 Fail-Fail Alignment on the baseline with different and large script heights+1 Pass+2 Fail+Pass Alignment on the baseline with different and large script heightsFail Tall subscripts/superscripts are not placed too high/lowFail No collisions for tall subscripts and superscripts\ No newline at end of filediff --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.txtindex a23365c3ddb..eab3f99f7b6 100644--- 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@@ -2,9 +2,8 @@ Harness status: OKFound 5 tests-4 Pass-1 Fail-Fail Alignment of the base on the baseline+5 Pass+Pass Alignment of the base on the baselinePass Horizontal alignments of base and scriptsPass Relative vertical positions of base and scriptsPass Width of scripted elementsdiff --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.txtindex 004d54f4b63..818d7495567 100644--- 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@@ -2,9 +2,9 @@ Harness status: OKFound 8 tests-1 Pass-7 Fail-Fail Baseline alignment+2 Pass+6 Fail+Pass Baseline alignmentPass Heights of basesFail AccentBaseHeight, UnderbarExtraDescenderFail AccentBaseHeight, UnderbarVerticalGapdiff --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.txtindex ffdc2cf1335..545ac3f50a0 100644--- 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@@ -2,9 +2,9 @@ Harness status: OKFound 6 tests-1 Pass-5 Fail-Fail Baseline alignment+2 Pass+4 Fail+Pass Baseline alignmentPass Heights of basesFail AccentBaseHeight, UnderbarExtraDescenderFail AccentBaseHeight, UnderbarVerticalGapdiff --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.txtindex 997b9aa2ec8..3425439a2d6 100644--- 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@@ -2,9 +2,8 @@ Harness status: OKFound 4 tests-1 Pass-3 Fail-Fail width attribute + width property+4 Pass+Pass width attribute + width propertyPass height/depth attributes + height property-Fail height attribute + height property-Fail depth attribute + height property\ No newline at end of file+Pass height attribute + height property+Pass depth attribute + height property\ No newline at end of filediff --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.txtindex 62e41498276..4d19e4f405a 100644--- 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@@ -2,14 +2,13 @@ Harness status: OKFound 9 tests-5 Pass-4 Fail+9 PassPass Empty mspacePass Different widths-Fail Different heights+Pass Different heightsPass Different depths-Fail Various combinations of height, depth and width.+Pass Various combinations of height, depth and width.Pass Preferred widthPass dynamic attributes (remove)-Fail dynamic attributes (attach)-Fail dynamic attributes (modify)\ No newline at end of file+Pass dynamic attributes (attach)+Pass dynamic attributes (modify)\ No newline at end of filediff --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.txtindex 190a2aff47e..05b00849d95 100644--- 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@@ -2,6 +2,7 @@ Harness status: OKFound 2 tests-2 Fail-Fail Vertical alignment of cells+1 Pass+1 Fail+Pass Vertical alignment of cellsFail Horizontal alignment of cells\ No newline at end of filediff --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.txtindex 190a2aff47e..05b00849d95 100644--- 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@@ -2,6 +2,7 @@ Harness status: OKFound 2 tests-2 Fail-Fail Vertical alignment of cells+1 Pass+1 Fail+Pass Vertical alignment of cellsFail Horizontal alignment of cells\ No newline at end of filediff --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.txtindex 0883fd7d521..98d4892945c 100644--- 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@@ -2,12 +2,12 @@ Harness status: OKFound 17 tests-11 Pass-6 Fail+15 Pass+2 FailPass Margin properties on the children of aPass Margin properties on the children of menclosePass Margin properties on the children of merror-Fail Margin properties on the children of mfrac+Pass Margin properties on the children of mfracPass Margin properties on the children of mmultiscriptsPass Margin properties on the children of moverPass Margin properties on the children of mpadded@@ -16,8 +16,8 @@ Fail Margin properties on the children of mrootPass Margin properties on the children of mrowFail Margin properties on the children of msqrtPass 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+Pass Margin properties on the children of msub+Pass Margin properties on the children of msubsup+Pass Margin properties on the children of msupPass Margin properties on the children of munderPass Margin properties on the children of munderover\ No newline at end of filediff --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.txtindex 6a0a3d7869d..3add6fdcd87 100644--- 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@@ -2,16 +2,15 @@ Harness status: OKFound 11 tests-7 Pass-4 Fail+11 PassPass Test display math lowercase-Fail Test inline math lowercase+Pass Test inline math lowercasePass Test width on display=block math lowercasePass Test display math uppercase-Fail Test inline math uppercase+Pass Test inline math uppercasePass Test width on display=block math uppercasePass Test display math alternate_case-Fail Test inline math alternate_case+Pass Test inline math alternate_casePass Test width on display=block math alternate_casePass Test dynamically setting display=block-Fail Test dynamically setting display=inline\ No newline at end of file+Pass Test dynamically setting display=inline\ No newline at end of file