cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.86k stars 2.92k forks source link

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

Open oetjen opened 2 weeks ago

oetjen commented 2 weeks ago

Is there an existing issue for this?

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 commented 1 week ago

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 commented 4 days ago

There's been some major upstream changes recently. See https://github.com/cefsharp/CefSharp/issues/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 commented 4 days ago

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.