-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Offscreen invalidate and sizing fix #7062
Conversation
Hi @gerhardberger. What is the use case for this new method? |
@zeke, it generates a |
|
||
// In offscreen mode call RenderWidgetHostView's SetSize explicitly | ||
const auto view = web_contents()->GetRenderWidgetHostView(); | ||
if (view) { |
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.
IsOffScreen
should be checked here.
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.
I thought about that, but couldn't come up with a proper way to get the atom::api::WebContents
in NativeWindow
.
But this SetSize
call only happens in OSR mode, because in a normal rendering mode having a different size other than the one we wanted to set after we set it should not happen.
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.
How about subscribing to window resize events in RenderWidgetHostView
? It is provided by NativeWindowObserver
.
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.
Great I didn't notice that, thanks! I moved the call to OffscreenRenderWidgetHostView
.
0330038
to
37de230
Compare
This is great! I was doing a The use-case (for me, at least) is you want to grab a PNG representation of the page after a certain client event is emitted, and since the Buffer is volatile, I'm not sure how you'd have done it previously (other than triggering a paint event). |
This PR adds an
invalidate
method towebContents
to manually request a new frame in offscreen mode.And also fixes the issue that a browser did not resize properly in offscreen mode.