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

WPF - Browser not correctly refreshing on Resize >= 127.3.50 #4953

Open
1 task done
oetjen opened this issue Oct 10, 2024 · 9 comments
Open
1 task done

WPF - Browser not correctly refreshing on Resize >= 127.3.50 #4953

oetjen opened this issue Oct 10, 2024 · 9 comments
Labels

Comments

@oetjen
Copy link

oetjen commented Oct 10, 2024

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

129.0.110

Operating System

Windows 11

Architecture

x64

.Net Version

.NET Framework 4.8

Implementation

WPF

Reproduction Steps

Create a WPF Window with a Grid, add several ChromiumWebBrowsers into each grid.
Load some simple HTML content into each browser.
Start App and resize the window
-> WebBrowser is not resized according to the window / grid size changes
-> When using the mouse scroll wheel, the browser size is updated correctly.
This behaviour is observed first in 127.3.50. In 126.2.180.0, everything was ok

The following project contains some sample code, as well as a video:
See: https://github.com/oetjen/ChromiumResizeProblem

Expected behavior

As in 126.2.180.0 -> Browser windows should resize

Actual behavior

Browser windows do not resize

Regression?

Worked in 126.2.180.0

Known Workarounds

none

Does this problem also occur in the CEF Sample Application

No

Other information

No response

@jpmikkers
Copy link

jpmikkers commented Oct 12, 2024

I also see wpf ChromiumWebBrowser resizing issues in my demo app for Baksteen.Blazor.CefSharp, .net 8.0. When enlarging the window the webview seems to automatically resize up to a certain size, but then it stops, and it will only suddenly resize when I start hovering the mouse over elements in the webview.
I've tested this issue occurs both in 128.4.90 and 129.0.110.

Screenrecording:
https://github.com/user-attachments/assets/ad6ec647-095e-48ff-badf-ee96e41cf2e7

@amaitland
Copy link
Member

There's been some major upstream changes recently. See #4795 for more details.

There's a pretty high change this is an upsteram issue. There's only been minor changes to the WPF implementation over the last few versions.

Make sure you have an app.manifest with Win 10 compatibility set so GPU detection works correctly.

https://github.com/cefsharp/CefSharp/wiki/Quick-Start-For-MS-.Net-4.x#40-add-appmanifest-to-your-application

Resize Problem in WPF Grid since 127.3.50

Using version 127.3.50 can you please try setting the following option, in your App.xaml.cs is ane asy place.

c#

 var settings = new CefSettings();
settings .ChromeRuntime = false;
settings.CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MyCefSharpApp\\Cache")

var initialized = Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

Create a WPF Window with a Grid, add several ChromiumWebBrowsers into each grid.

Is a grid actually relevant? Or is it just multiple browsers displayed at the same time?

@amaitland amaitland changed the title Resize Problem in WPF Grid since 127.3.50 WPF - Browser not correctly refreshing on Resize >= 127.3.50 Oct 20, 2024
@amaitland amaitland added the wpf label Oct 20, 2024
@amaitland
Copy link
Member

When enlarging the window the webview seems to automatically resize up to a certain size, but then it stops, and it will only suddenly resize when I start hovering the mouse over elements in the webview.
I've tested this issue occurs both in 128.4.90 and 129.0.110.

Based on this I don't think multiple browsers has anything to do with the issue.

@amaitland
Copy link
Member

It would be helpful if someone can run a git bisect on the 127 branch and see which commit introduced the change in behavior.

@jpmikkers
Copy link

@amaitland resize issue started in d3953b8

@jpmikkers
Copy link

jpmikkers commented Oct 28, 2024

FWIW, it seems that after this commit the call to browser.GetHost().WasResized(); in OnActualSizeChanged() no longer reliably results in the callback leading to IRenderWebBrowser.GetViewRect(). (tested using the example CefSharp.Wpf.Example.netcore)

Update: strangely enough, I cannot reproduce the resize problem in CefSharp.WinForms.Example.netcore 😕

@amaitland
Copy link
Member

resize issue started in d3953b8

Thanks for confirming. Have to see what changes were made upstream.

Did some testing, I can reproduce part of the problem with cefclient, have opened chromiumembedded/cef#3822

It'll still be worth debugging cefclient to see what's difference.

@amaitland
Copy link
Member

Likely related https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=20038#p56379

@amaitland
Copy link
Member

Other rendering issue with CEF OSR chromiumembedded/cef#3826

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants