Truly independent web browser
LibWeb: Keep multi-character math identifiers upright
sideshowbarker79de583e5822
diff --git a/Libraries/LibWeb/Rust/src/layout/text_transform.rs b/Libraries/LibWeb/Rust/src/layout/text_transform.rsindex 5f4394268d4..58a6163e2f6 100644--- a/Libraries/LibWeb/Rust/src/layout/text_transform.rs+++ b/Libraries/LibWeb/Rust/src/layout/text_transform.rs@@ -287,14 +287,16 @@ pub(super) fn render_text(map_code_points(&source, |_| 0x2022)} else {match options.text_transform {- text_transform::NONE | text_transform::FULL_SIZE_KANA => {+ // https://w3c.github.io/mathml-core/#math-auto-transform+ // Every character with a mathematical italic mapping occupies one UTF-16 code unit.+ text_transform::MATH_AUTO if source.len() == 1 => map_code_points(&source, math_auto),+ text_transform::NONE | text_transform::FULL_SIZE_KANA | text_transform::MATH_AUTO => {// FIXME: Implement full-size-kana.TransformedText {text: source,edits: Vec::new(),}}- text_transform::MATH_AUTO => map_code_points(&source, math_auto),text_transform::LOWERCASE | text_transform::UPPERCASEif locale.is_none() && source.iter().all(|unit| *unit <= 0x7f) =>{diff --git a/Tests/LibWeb/Layout/expected/css-text-transform-math-auto.txt b/Tests/LibWeb/Layout/expected/css-text-transform-math-auto.txtindex a70516d7e47..52f8416c714 100644--- a/Tests/LibWeb/Layout/expected/css-text-transform-math-auto.txt+++ b/Tests/LibWeb/Layout/expected/css-text-transform-math-auto.txt@@ -2,8 +2,8 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenBlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 48 0+0+0] [BFC] children: not-inlineBlockContainer <body> at [8,16] [8+0+0 784 0+0+8] [8+0+0 16 0+0+8] children: not-inlineBlockContainer <p> at [8,16] [0+0+0 784 0+0+0] [16+0+0 16 0+0+16] children: inline- frag 0 from TextNode start: 0, length: 35, rect: [8,16 118.40625x16] baseline: 13- "ππππ, βππππ πππππππ !"+ frag 0 from TextNode start: 0, length: 20, rect: [8,16 147.1875x16] baseline: 13+ "Well, hello friends!"TextNode <#text> (not painted)SC for Viewport<#document> [0,0 800x600] (z-index: auto)diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-text/text-transform/math/text-transform-math-auto-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-text/text-transform/math/text-transform-math-auto-002-ref.htmlnew file mode 100644index 00000000000..97560913063--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-text/text-transform/math/text-transform-math-auto-002-ref.html@@ -0,0 +1,29 @@+<!DOCTYPE html>+<html>+<head>+<meta charset="utf-8"/>+<title>text-transform math-auto (reference)</title>+<style>+ @font-face {+ font-family: TestFont;+ src: url("../../../../fonts/math/mathvariant-italic.woff");+ }+ body > div {+ padding: 10px;+ }+ div > span {+ font-family: monospace;+ font-size: 16px;+ }+ .testfont {+ font-family: TestFont;+ font-size: 16px;+ }+</style>+<body>+ <p>Test passes if all the equalities below are true.</p>+ <div>Single character: <span class="testfont">𝜕</span>=<span>1D715</span></div>+ <div>Two characters: <span class="testfont">∂∇</span>=<span>0220202207</span></div>+ <div>Three characters: <span class="testfont">∂∇ȷ</span>=<span>022020220700237</span></div>+ </body>+</html>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/fonts/math/mathvariant-italic.woff b/Tests/LibWeb/Ref/expected/wpt-import/fonts/math/mathvariant-italic.woffnew file mode 100644index 00000000000..9687f377b32Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/fonts/math/mathvariant-italic.woff differdiff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-text/text-transform/math/text-transform-math-auto-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-text/text-transform/math/text-transform-math-auto-002.htmlnew file mode 100644index 00000000000..b3b1192927c--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-text/text-transform/math/text-transform-math-auto-002.html@@ -0,0 +1,33 @@+<!DOCTYPE html>+<html>+<head>+<meta charset="utf-8"/>+<title>text-transform math-auto</title>+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/3745"/>+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#math-auto-transform">+<link rel="match" href="../../../../../../expected/wpt-import/css/css-text/text-transform/math/text-transform-math-auto-002-ref.html"/>+<meta name="assert" content="Test 'text-transform: math-auto' for text nodes of different lengths">+<style>+ @font-face {+ font-family: TestFont;+ src: url("../../../../fonts/math/mathvariant-italic.woff");+ }+ body > div {+ padding: 10px;+ }+ div > span {+ font-family: monospace;+ font-size: 16px;+ }+ .testfont {+ font-family: TestFont;+ font-size: 16px;+ }+</style>+<body>+ <p>Test passes if all the equalities below are true.</p>+ <div>Single character: <span class="testfont" style="text-transform: math-auto">∂</span>=<span>1D715</span></div>+ <div>Two characters: <span class="testfont" style="text-transform: math-auto">∂∇</span>=<span>0220202207</span></div>+ <div>Three characters: <span class="testfont" style="text-transform: math-auto">∂∇ȷ</span>=<span>022020220700237</span></div>+ </body>+</html>diff --git a/Tests/LibWeb/Ref/input/wpt-import/fonts/math/mathvariant-italic.woff b/Tests/LibWeb/Ref/input/wpt-import/fonts/math/mathvariant-italic.woffnew file mode 100644index 00000000000..9687f377b32Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/fonts/math/mathvariant-italic.woff differ