Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement getSelectionRects feature for TextMetrics #46057

Merged
merged 1 commit into from
May 14, 2024

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented May 3, 2024

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}

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}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 12f8a90 into master May 14, 2024
19 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-5353031 branch May 14, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants