Closed Bug 2023798 Opened 2 months ago Closed 1 month ago

[wpt-sync] Sync PR 58468 - [Fonts] Fix measureText() actualBoundingBox precision for MeasureRuns

Categories

(Core :: Graphics: Canvas2D, task, P4)

task

Tracking

()

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 58468 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/58468
Details from upstream follow.

Sejal Anand <sejalanand@microsoft.com> wrote:

[Fonts] Fix measureText() actualBoundingBox precision for MeasureRuns

The original fix (crrev.com/c/7564913) added PreciseBoundsForGlyph
for small font sizes but only applied it in GetActualBoundingBox(),
which handles the getActualBoundingBox(start, end) sub-range API.

The top-level measureText().actualBoundingBoxLeft/Right/Ascent/Descent
properties are computed via MeasureRuns() → InkBounds(), which still
used integer-precision BoundsForGlyph. This caused the original bug
to remain unfixed for the most commonly used API.

Apply PreciseBoundsForGlyph in MeasureRuns() for font sizes \<= 4px.

Also improve the WPT test:

  • Move the WPT to the canvas test generator for coverage across
    HtmlCanvas, OffscreenCanvas, and Worker contexts.
  • Switch from pixel-rendering check to direct metric assertions.
  • Use glyph 'E' (has ascent + descent) and ±0.25 tolerances so
    integer-quantized values are reliably caught.

Bug: 479240778
Change-Id: I5e3f332b19ee0b7936a664bff5a87fa4cc780333
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7656848
Reviewed-by: Stephen Chenney \<schenney@chromium.org>
Reviewed-by: Koji Ishii \<kojii@chromium.org>
Commit-Queue: Sejal Anand \<sejalanand@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1599896}

Component: web-platform-tests → Graphics: Canvas2D
Product: Testing → Core
Attached file Notable wpt changes
# CI Results Ran 7 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI Total 370 tests and 1 subtests ## Status Summary ### Firefox `OK` : 3[GitHub] 311[Gecko-windows11-64-24h2-debug] 312[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-24h2-opt] `PASS`: 26[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 35[Gecko-android-em-14-x86_64-debug-geckoview] 287[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 289[Gecko-windows11-64-24h2-debug] 290[Gecko-windows11-64-24h2-opt] `FAIL`: 3[GitHub] 15[Gecko-android-em-14-x86_64-debug-geckoview] 24[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 248[Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt] 251[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] ### Chrome `OK` : 3 `FAIL`: 3 ### Safari `OK` : 3 `PASS`: 3 ## Links [Gecko CI (Treeherder)](https://treeherder.mozilla.org/#/jobs?repo=try&revision=a28ec596c8e18c40466ce282a82859b3d89bffa6) [GitHub PR Head](https://wpt.fyi/results/?sha=36ddc485e32ef1a6a581f427fddbcd1240824394&label=pr_head) [GitHub PR Base](https://wpt.fyi/results/?sha=36ddc485e32ef1a6a581f427fddbcd1240824394&label=pr_base) ## Details (See attachment for full changes)
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: