github web-platform-tests/wpt merge_pr_46057

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
16 months ago

Implement getSelectionRects feature for TextMetrics

This change creates a new API method for TextMetrics objects in canvas
that uses font data and precalculated text runs, to calculate the
selection rects for an interval of characters. This interval is defined
by character positions in the input text.

The selection rects are calculated using the existing
Font::SelectionRectForText method, but on a logical run by run
basis to ensure correct management of bidi text inputs.

The target is to match the rects that would be obtained by using the DOM
from selecting this same interval using
Selection.getRangeAt(0).getClientRects() after having set the selection
with a range.

The new API was enabled under the ExtendedTextMetrics flag.

Change-Id: Ia05ce8e55e3e73a491354293502b457ad712026e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5353031
Reviewed-by: Jean-Philippe Gravel jpgravel@chromium.org
Reviewed-by: Fernando Serboncini fserb@chromium.org
Commit-Queue: Andres Ricardo Perez andresrperez@chromium.org
Cr-Commit-Position: refs/heads/main@{#1300725}

Don't miss a new wpt release

NewReleases is sending notifications on new releases.