script: Ensure that leaving the WebView sets the cursor back to the default cursor#38759
Merged
mrobinson merged 1 commit intoservo:mainfrom Aug 22, 2025
Merged
Conversation
6780a6d to
f7a1c67
Compare
Member
Author
|
I have added a unit test verifying the behavior of this change. |
f7a1c67 to
6838911
Compare
jdm
approved these changes
Aug 21, 2025
components/servo/tests/webview.rs
Outdated
| test_evaluate_javascript_basic, | ||
| test_evaluate_javascript_panic, | ||
| test_theme_change, | ||
| test_theme_change, |
Member
There was a problem hiding this comment.
Suggested change
| test_theme_change, |
| /// Request that the given pipeline do a hit test at the location and reset the | ||
| /// cursor accordingly. This happens after a display list update is rendered. | ||
| RefreshCursor(PipelineId, Point2D<f32, CSSPixel>), | ||
| RefreshCursor(PipelineId), |
Member
There was a problem hiding this comment.
Make sure the docs for this message are up to date?
| /// Ask that the given pipeline refreshes the cursor (after a display list render) based | ||
| /// on the hit test at the given point. | ||
| RefreshCursor(PipelineId, Point2D<f32, CSSPixel>), | ||
| RefreshCursor(PipelineId), |
… default cursor This changes makes a variety of changes to ensure that the cursor is set back to the default cursor when it leaves the `WebView`: 1. Display list updates can come after a mouse leaves the `WebView`, so when refreshing the cursor after the update, base the updated cursor on the last hovered location in the `DocumentEventHandler`, rather than the compositor. This allows us to catch when the last hovered position is `None` (ie the cursor has left the `WebView`). 2. When handling `MouseLeftViewport` events for the cursor leaving the entire WebView, properly set the MouseLeftViewport::focus_moving_to_another_iframe` on the input event passed to the script thread. 3. When moving out of the `WebView` entirely, explicitly ask the embedder to set the cursor back to the default. Signed-off-by: Martin Robinson <[email protected]>
6838911 to
6daf901
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes makes a variety of changes to ensure that the cursor is set
back to the default cursor when it leaves the
WebView:WebView, sowhen refreshing the cursor after the update, base the updated cursor
on the last hovered location in the
DocumentEventHandler, ratherthan the compositor. This allows us to catch when the last hovered
position is
None(ie the cursor has left theWebView).MouseLeftViewportevents for the cursor leaving theentire WebView, properly set the
MouseLeftViewport::focus_moving_to_another_iframe` on the input event
passed to the script thread.
WebViewentirely, explicitly ask theembedder to set the cursor back to the default.
Testing: This change adds a unit test verifying this behavior.
Fixes: #38710.