[wpt-sync] Sync PR 64495 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=316235
Categories
(Core :: Graphics: Canvas2D, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 64495 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/64495
Details from upstream follow.
Alan Baradlay <zalan@apple.com> wrote:
WebKit export of https://bugs.webkit.org/show_bug.cgi?id=316235
WebKit export from bug: Canvas fillText with textAlign=<!---->center misplaces complex-<!---->shaped text
<pre>
Canvas fillText with textAlign=center misplaces complex-shaped text<canvas id=c width=300 height=200></canvas>
<script>
let ctx = c.getContext("2d");
ctx.font = "152px serif";
ctx.textAlign = "center";
ctx.fillText("\u0BB5", 150, 100);
</script>The Tamil glyph (U+0BB5) should be centered horizontally on x=150.
Instead it was left-aligned at x=150 - canvas treated the text as zero
width.The canvas shaped-text cache reads result.width from
FontCascade::layoutComplexText. That function computed the segment width
as controller.totalAdvance().width() before and after advancing the
ComplexTextController, but totalAdvance() is the full run total - it is
populated up front in the controller's constructor and does not change
across advance() calls. So the difference was always zero for any run
that took the complex shaping path. Pre-cache callers only consumed the
glyph buffer and ignored result.width, so the defect was latent.The fix mirrors layoutSimpleText: use controller.runWidthSoFar() (the
running tally that grows with each advance() call) instead of
totalAdvance().width(). The simple path already did this correctly via
WidthIterator::runWidthSoFar(), which is why Latin text centered
correctly while Tamil/Devanagari/Arabic/emoji did not.WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=316235">https://bugs.webkit.org/show_bug.cgi?id=316235</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/314522@main">https://commits.webkit.org/314522@main</a>
</pre>
| Assignee | ||
Updated•7 days ago
|
| Assignee | ||
Comment 1•6 days ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=118198
| Assignee | ||
Comment 2•6 days ago
|
||
CI Results
Ran 4 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 109 tests and 2 subtests
Status Summary
Firefox
OK : 1[GitHub] 108[Gecko-windows11-64-25h2-debug] 109[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-opt]
PASS: 2[GitHub] 92[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug] 93[Gecko-windows11-64-25h2-opt]
FAIL: 97[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 98[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt]
Chrome
OK : 1
PASS: 2
Safari
OK : 1
PASS: 2
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /html/canvas/element/text/2d.text.draw.fontface.repeat.html [wpt.fyi]:
OK[Gecko-linux2404-64-debug,Gecko-linux2404-64-opt,Gecko-windows11-64-25h2-opt],SKIP[Gecko-windows11-64-25h2-debug] - /html/canvas/element/text/2d.text.font.parse.system.html [wpt.fyi]
- System fonts must be computed to explicit values:
FAIL
- System fonts must be computed to explicit values:
- /html/canvas/element/text/2d.text.measure.actualBoundingBox.small-font.html [wpt.fyi]
- Testing that actualBoundingBox metrics are precise at small font sizes:
FAIL[Gecko-linux2404-64-debug,Gecko-linux2404-64-opt],PASS[Gecko-windows11-64-25h2-debug,Gecko-windows11-64-25h2-opt]
- Testing that actualBoundingBox metrics are precise at small font sizes:
- /html/canvas/element/text/2d.text.measure.fillTextCluster-options.tentative.html [wpt.fyi]
- Test that fillTextCluster() correctly applies the options passed as a dictionary.:
FAIL
- Test that fillTextCluster() correctly applies the options passed as a dictionary.:
- /html/canvas/element/text/2d.text.measure.fillTextCluster-range.tentative.html [wpt.fyi]
- Test that getTextClusters() and fillTextCluster() correctly render different ranges of the input text.:
FAIL
- Test that getTextClusters() and fillTextCluster() correctly render different ranges of the input text.:
- /html/canvas/element/text/2d.text.measure.getActualBoundingBox-exceptions.tentative.html [wpt.fyi]
- Check that TextMetrics::getActualBoundingBox() throws when using invalid indexes.:
FAIL
- Check that TextMetrics::getActualBoundingBox() throws when using invalid indexes.:
- /html/canvas/element/text/2d.text.measure.getActualBoundingBox-full-text.tentative.html [wpt.fyi]
- Test TextMetrics::getActualBoundingBox() for the full length of the string for some edge cases, with direction ltr and no-directional-override:
FAIL - Test TextMetrics::getActualBoundingBox() for the full length of the string for some edge cases, with direction rtl and no-directional-override:
FAIL - Test TextMetrics::getActualBoundingBox() for the full length of the string for some edge cases, with direction ltr and directional-override:
FAIL - Test TextMetrics::getActualBoundingBox() for the full length of the string for some edge cases, with direction rtl and directional-override:
FAIL
- Test TextMetrics::getActualBoundingBox() for the full length of the string for some edge cases, with direction ltr and no-directional-override:
- /html/canvas/element/text/2d.text.measure.getActualBoundingBox.tentative.html [wpt.fyi]
- Test TextMetrics::getActualBoundingBox(), with text align left , and 0px letter spacing.:
FAIL - Test TextMetrics::getActualBoundingBox(), with text align center , and 0px letter spacing.:
FAIL - Test TextMetrics::getActualBoundingBox(), with text align right , and 0px letter spacing.:
FAIL - Test TextMetrics::getActualBoundingBox(), with text align left , and 10px letter spacing.:
FAIL - Test TextMetrics::getActualBoundingBox(), with text align center , and 10px letter spacing.:
FAIL - Test TextMetrics::getActualBoundingBox(), with text align right , and 10px letter spacing.:
FAIL
- Test TextMetrics::getActualBoundingBox(), with text align left , and 0px letter spacing.:
- /html/canvas/element/text/2d.text.measure.index-from-offset-edge-cases.tentative.html [wpt.fyi]
- Test the edge cases for getIndexFromOffset, where the point is at the edge of glyph and at the midpoint.:
FAIL
- Test the edge cases for getIndexFromOffset, where the point is at the edge of glyph and at the midpoint.:
- /html/canvas/element/text/2d.text.measure.index-from-offset-edges.tentative.html [wpt.fyi]
- Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction ltr and text align left.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction rtl and text align left.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction ltr and text align center.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction rtl and text align center.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction ltr and text align right.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction rtl and text align right.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction ltr and text align start.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction rtl and text align start.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction ltr and text align end.:
FAIL - Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction rtl and text align end.:
FAIL
- Check that TextMetrics::getIndexFromOffset() gives correct edges when the requested point is outside the range, with direction ltr and text align left.:
- /html/canvas/element/text/2d.text.measure.index-from-offset.tentative.html [wpt.fyi]
- Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align left, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align left, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align center, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align center, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align right, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align right, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align start, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align start, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align end, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align end, 0px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align left, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align left, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align center, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align center, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align right, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align right, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align start, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align start, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align end, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align end, 10px letter spacing and no-directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align left, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align left, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align center, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align center, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align right, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align right, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align start, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align start, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align end, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align end, 0px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align left, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align left, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align center, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align center, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align right, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align right, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align start, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align start, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align end, 10px letter spacing and directional-override.:
FAIL - Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction rtl, text align end, 10px letter spacing and directional-override.:
FAIL
- Check that TextMetrics::getIndexFromOffset() matches its DOM equivalent, where possible, with direction ltr, text align left, 0px letter spacing and no-directional-override.:
- /html/canvas/element/text/2d.text.measure.selection-rects-baselines.tentative.html [wpt.fyi]
- Check that TextMetrics::getSelectionRects() works correctly with textBaseline.:
FAIL
- Check that TextMetrics::getSelectionRects() works correctly with textBaseline.:
- /html/canvas/element/text/2d.text.measure.selection-rects-exceptions.tentative.html [wpt.fyi]
- Check that TextMetrics::getSelectionRects() throws when using invalid indexes.:
FAIL
- Check that TextMetrics::getSelectionRects() throws when using invalid indexes.:
- /html/canvas/element/text/2d.text.measure.selection-rects.tentative.html [wpt.fyi]
- Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align left, 0px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align left, 0px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align center, 0px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align center, 0px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align right, 0px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align right, 0px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align left, 10px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align left, 10px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align center, 10px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align center, 10px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align right, 10px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align right, 10px letter spacing, and no-directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align left, 0px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align left, 0px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align center, 0px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align center, 0px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align right, 0px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align right, 0px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align left, 10px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align left, 10px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align center, 10px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align center, 10px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align right, 10px letter spacing, and directional-override.:
FAIL - Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction rtl, text align right, 10px letter spacing, and directional-override.:
FAIL
- Check that TextMetrics::getSelectionRects() matches its DOM equivalent, with direction ltr, text align left, 0px letter spacing, and no-directional-override.:
- /html/canvas/element/text/2d.text.measure.strokeTextCluster-options.tentative.html [wpt.fyi]
- Test that strokeTextCluster() correctly applies the options passed as a dictionary.:
FAIL
- Test that strokeTextCluster() correctly applies the options passed as a dictionary.:
- /html/canvas/element/text/2d.text.measure.strokeTextCluster-range.tentative.html [wpt.fyi]
- Test that getTextClusters() and strokeTextCluster() correctly render different ranges of the input text.:
FAIL
- Test that getTextClusters() and strokeTextCluster() correctly render different ranges of the input text.:
- /html/canvas/element/text/2d.text.measure.text-clusters-exceptions.tentative.html [wpt.fyi]
- Check that TextMetrics::getTextClusters() throws when using invalid indexes.:
FAIL
- Check that TextMetrics::getTextClusters() throws when using invalid indexes.:
- /html/canvas/element/text/2d.text.measure.text-clusters-position.tentative.html [wpt.fyi]
- Test that TextMetrics::getTextClusters() returns clusters that are positioned according to the target align and baseline passed as options.:
FAIL
- Test that TextMetrics::getTextClusters() returns clusters that are positioned according to the target align and baseline passed as options.:
- /html/canvas/element/text/2d.text.measure.text-clusters-split.tentative.html [wpt.fyi]
- Test that getTextClusters() splits the input correctly into the minimal clusters, keeping emojis together.:
FAIL
- Test that getTextClusters() splits the input correctly into the minimal clusters, keeping emojis together.:
- /html/canvas/element/text/2d.text.measure.width.nullCharacter.html [wpt.fyi]
- Null character does not take up space:
FAIL
- Null character does not take up space:
Tests Disabled in Gecko Infrastructure
- /html/canvas/element/text/2d.text.draw.fontface.repeat.html [wpt.fyi]:
OK[Gecko-linux2404-64-debug,Gecko-linux2404-64-opt,Gecko-windows11-64-25h2-opt],SKIP[Gecko-windows11-64-25h2-debug]
Comment 4•4 days ago
|
||
| bugherder | ||
Comment 5•4 days ago
|
||
| bugherder | ||
Description
•