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

Add UpdateSelectionBehavior to Range::UpdateSelectionIfAddedToSelection #50283

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

When a live range attached to a document is modified, this change is
upstreamed to the FrameSelection. New spec [1] says to only update
the composed live range (frame selection)'s start position if setStart
is called and only update end position if setEnd is called:
whatwg/dom#1342

This is the proposal (B) discussed here:
whatwg/dom#772 (comment)

To do this, we define enum UpdateSelectionIfAddedToSelection to have
three possible update selection behavior:

  1. kAll, set selection to have the same start and end as range.
    --> Default case, when both setStart, setEnd are called.
  2. kStartOnly, set selection to have the same start as range only.
    --> When only setStart is called.
  3. kEndOnly, set selection to have the same end as range only.
    --> When only setEnd is called.

We add a WPT test for this new behavior, which only affects the output
of getComposedRanges() as it is the only API that accesses the frame
selection's endpoints directly.

Change-Id: I51ea53fe6156164ba3fbe38b14bc47ff502633b1
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6188157
Reviewed-by: Siye Liu <[email protected]>
Commit-Queue: Di Zhang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1411209}

When a live range attached to a document is modified, this change is
upstreamed to the FrameSelection. New spec [1] says to only update
the composed live range (frame selection)'s start position if setStart
is called and only update end position if setEnd is called:
whatwg/dom#1342

This is the proposal (B) discussed here:
whatwg/dom#772 (comment)

To do this, we define enum UpdateSelectionIfAddedToSelection to have
three possible update selection behavior:
1. kAll, set selection to have the same start and end as range.
--> Default case, when both setStart, setEnd are called.
2. kStartOnly, set selection to have the same start as range only.
--> When only setStart is called.
3. kEndOnly, set selection to have the same end as range only.
--> When only setEnd is called.

We add a WPT test for this new behavior, which only affects the output
of getComposedRanges() as it is the only API that accesses the frame
selection's endpoints directly.

Change-Id: I51ea53fe6156164ba3fbe38b14bc47ff502633b1
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6188157
Reviewed-by: Siye Liu <[email protected]>
Commit-Queue: Di Zhang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1411209}
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 e679be3 into master Jan 25, 2025
18 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-518f88cf9a branch January 25, 2025 00:28
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