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
fix: allow setsize to be called within a move or resize for preventDefault #34843
Conversation
…e for preventDefault
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
@codebytere May I have some help identifying the next steps for this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To conclude, #33288 assumes widget()->SetBounds(bounds)
is always ignored by Chromium when window is moving or resizing, but #34599 says it is still working under some cases.
If I'm understanding it correctly then I'm good with this PR, apparently removing the early return won't affect the fix of #33288, and it will recover the old behavior for other cases.
@zcbenz Yes, your assessment is correct. Thanks! |
I was waiting for another review, but this change is obvious enough and I'm going to just merge. |
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
I have automatically backported this PR to "18-x-y", please check out #35082 |
I have automatically backported this PR to "19-x-y", please check out #35083 |
I have automatically backported this PR to "20-x-y", please check out #35084 |
…fault (electron#34843) fix: electron#34599 allow setsize to be called within a move or resize for preventDefault
…fault (electron#34843) fix: electron#34599 allow setsize to be called within a move or resize for preventDefault
Description of Change
Closes #34599
Refs #33288
Refs #33279
The prior work in #33279 to allow calling SetBounds during a resize or move (defined as time period between receiving a WM_MOVING or WM_SIZING--respectively--and WM_EXITSIZEMOVE WNDPROC message) prevented the ability to call preventDefault() within 'will-resize' or 'will-move' and then call SetBounds to change the size and position of the window immediately. After the PR, the window does not change bounds until the user ends the resize or move by releasing the mouse button, e.g. This PR simply removes the early-return statement to forward the SetBounds call to the widget, allowing for the bounds to change immediately if the movement or resizing has been cancelled through 'preventDefault' or after it has ended otherwise.
Tested with https://gist.github.com/6b6ea5cdaa1883656a8bd0bf89195283 and https://gist.github.com/meredith-ciq/a7ad120e84bd028a3fbd26b8f61aa45c
This is unfortunately not directly testable via spec, given that it's dependent on user-initiated movement.
Checklist
Release Notes
Notes: Fixed an issue in which calling setBounds() after e.preventDefault in a 'will-move' or 'will-resize' event wouldn't change the window's shape until the mouse button was released.