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

[Windows] Make WebView.CaptureAsync() work #23474

Conversation

MartyIX
Copy link
Contributor

@MartyIX MartyIX commented Jul 7, 2024

Description of Change

The PR is inspired by #14825 (comment) comment and https://github.com/jfversluis/MauiWindowsWebViewScreenshotSample repo.

Demo

animation

Issues Fixed

Fixes #14825

@MartyIX MartyIX requested a review from a team as a code owner July 7, 2024 10:29
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 7, 2024
@MartyIX MartyIX requested review from Foda and jfversluis and removed request for tj-devel709 July 7, 2024 10:52
Foda
Foda previously approved these changes Jul 8, 2024
@rmarinho
Copy link
Member

rmarinho commented Jul 9, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@MartyIX MartyIX force-pushed the feature/2024-07-07-Windows-WebView-screenshot-FINAL branch from c409e47 to ed308db Compare July 17, 2024 14:50
@rmarinho
Copy link
Member

rmarinho commented Jul 17, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis
Copy link
Member

I think we need to update the snapshot here?

What is the status here anyway @MartyIX ? I see something with the density and things still?

@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 11, 2024

I think we need to update the snapshot here?

Yes. However, at the moment, my Internet access is inversely related to the nice weather of the place I'm at. 🏖️ I can do it next week.

What is the status here anyway @MartyIX ? I see something with the density and things still?

I think that two actions are needed here (in that order):

  1. Add a snapshot from CI.
  2. Revert changes in the src/Core/src/Handlers/Image/ImageHandler.Windows.cs file as that change is very likely not robust enough and it is a different issue: MAUI on Windows does handle display scaling correctly AFAIK. So if the changes in the file are reverted then CI should be still happy because it is very likely not using any display scaling.

@jfversluis
Copy link
Member

OK! Enjoy the vacation! Let me know when this is ready to go! 😄

@MartyIX MartyIX force-pushed the feature/2024-07-07-Windows-WebView-screenshot-FINAL branch from 1977203 to e9c1eca Compare August 16, 2024 10:35
@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 16, 2024

@jfversluis I rebased and reverted the latest commit. My hope is that CI runs with a machine that does not have any display scaling (it's a different/harder bug than this one and I think it should be fixed separately).

Unfortunately, there was no snapshot for me to copy here. Hopefully, it will be generated with a next CI run.

@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

looking very good.

src/Essentials/src/Screenshot/Screenshot.uwp.cs Outdated Show resolved Hide resolved
src/Core/src/ViewExtensions.cs Outdated Show resolved Hide resolved
@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 16, 2024

I added the generated snapshot. Hopefully, it will pass it with now.

@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 16, 2024

@mattleibow Test failures look unrelated (?)

@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 17, 2024

All tests passed :)

@mattleibow mattleibow merged commit 5ff0613 into dotnet:main Aug 19, 2024
97 checks passed
@MartyIX MartyIX deleted the feature/2024-07-07-Windows-WebView-screenshot-FINAL branch August 19, 2024 13:26
@samhouts samhouts added fixed-in-net9.0-nightly This may be available in a nightly release! fixed-in-net8.0-nightly This may be available in a nightly release! labels Aug 27, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community ✨ Community Contribution fixed-in-net8.0-nightly This may be available in a nightly release! fixed-in-net9.0-nightly This may be available in a nightly release!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Screenshot API on Windows to allow for WebView screenshots
7 participants