-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mathml] Wrap <mtd> children in an anonymous <mrow>
This CL wraps the children of an <mtd> cell within an anonymous <mrow>. That way, such children are laid out as if they were in an explicit <mrow>, in particular avoiding line breaks, performing operator stretching and adding proper operator spacing [1]. In particular, this fixes the second use case demonstrated at BlinkOn 16 [2]. [1] https://w3c.github.io/mathml-core/#layout-of-mrow [2] https://people.igalia.com/fwang/2022-blinkon-16-remainder-estimate-for-mathml-integration/?showNotes=true#/19 Bug: 6606, 1125111, 1237043 Change-Id: Icd330b523df4548bf7065eed986bd3698514f50b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3657309 Reviewed-by: Ian Kilpatrick <[email protected]> Commit-Queue: Frédéric Wang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1010954}
- Loading branch information
1 parent
a6101f1
commit 47f4e9d
Showing
5 changed files
with
93 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
mathml/presentation-markup/tables/table-cell-mrow-layout.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Table cell mrow layout</title> | ||
<link rel="help" href="https://w3c.github.io/mathml-core/#table-or-matrix-mtable"> | ||
<meta name="assert" content="Table cell relies on the mrow layout for their children."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/mathml/support/feature-detection.js"></script> | ||
<script src="/mathml/support/layout-comparison.js"></script> | ||
<style> | ||
/* Remove default padding, since there is none on reference mrow element. */ | ||
mtd { padding: 0; } | ||
</style> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<p> | ||
<math> | ||
<mtable id="mtable"> | ||
<mtr> | ||
<mtd id="mtd"> | ||
<mspace width="10px" depth="20px" height="20px" style="background: blue"/> | ||
<mspace width="10px" depth="10px" height="30px" style="background: lightblue"/> | ||
<mspace width="10px" depth="30px" height="10px" style="background: black"/> | ||
</mtd> | ||
</mtr> | ||
</mtable> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow id="mtd-reference"> | ||
<mspace width="10px" depth="20px" height="20px" style="background: blue"/> | ||
<mspace width="10px" depth="10px" height="30px" style="background: lightblue"/> | ||
<mspace width="10px" depth="30px" height="10px" style="background: black"/> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mtable id="mtable-reference"> | ||
<mtr> | ||
<mtd> | ||
<mrow> | ||
<mspace width="10px" depth="20px" height="20px" style="background: blue"/> | ||
<mspace width="10px" depth="10px" height="30px" style="background: lightblue"/> | ||
<mspace width="10px" depth="30px" height="10px" style="background: black"/> | ||
</mrow> | ||
</mtd> | ||
</mtr> | ||
</mtable> | ||
</math> | ||
</p> | ||
<script> | ||
const epsilon = 1; | ||
|
||
test(function() { | ||
assert_true(MathMLFeatureDetection.has_mspace()); | ||
let mtd = document.getElementById("mtd"); | ||
let reference = document.getElementById("mtd-reference"); | ||
compareLayout(mtd, reference, epsilon); | ||
}, "<mtd> relies on mrow algorithm to layout its children"); | ||
|
||
test(function() { | ||
assert_true(MathMLFeatureDetection.has_mspace()); | ||
let mtable = document.getElementById("mtable"); | ||
let reference = document.getElementById("mtable-reference"); | ||
compareLayout(mtable, reference, epsilon); | ||
}, "<mtable> layout does not change if children of <mtd> elements are wrapped in an explicit <mrow>"); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters