Skip to content

Commit adcea26

Browse files
icesfontchromium-wpt-export-bot
authored andcommitted
Account for spacing around mo in WPT test width-height-001.html
For `mo` elements, the preferred width of a shrink wrapper around the operator includes the spacing around it. This change introduces a special case for `mo` to account for this. Bug: 370553386 Change-Id: Ie220443b57bb5ab63fd996acf9ec760a02ca612a
1 parent da7a99e commit adcea26

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mathml/relations/css-styling/width-height-001.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,18 @@
7575
assert_true(MathMLFeatureDetection[`has_${tag}`](), `${tag} is supported`);
7676
var style = `width: 300px;`;
7777
element.setAttribute("style", style);
78+
let refPreferredWidth = 300;
79+
80+
// In the case of mo, spacing is added around the element so that it is included
81+
// in the preferred width calculation, which should be the sum of lspace, rspace and width.
82+
if (tag === "mo") {
83+
element.setAttribute("lspace", "50px");
84+
element.setAttribute("rspace", "30px");
85+
refPreferredWidth = 380;
86+
}
87+
7888
let box = shrinkWrapDiv.getBoundingClientRect();
79-
assert_approx_equals(box.width, 300, epsilon);
89+
assert_approx_equals(box.width, refPreferredWidth, epsilon);
8090
}, `width property on ${tag} (preferred width)`);
8191

8292
div.style = "display: none;"; // Hide the div after measurement.

0 commit comments

Comments
 (0)