cefsharp / CefSharp

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

WPF - Mouse wheel in PDF viewer doesn't work after scrolling with touch screen #4106

Open klotzoliver opened 2 years ago

klotzoliver commented 2 years ago

After using touch display in PDF viewer to scroll (document and thumbnail area) scrolling using mouse wheel doesn’t work anymore.

OS: Windows 10 (19044.1645)

Using Google Chrome 101.0.4951.54 and CEF sample app version 101.0.18.0 feature works as expected.

Tested with CEFSharp WPF sample app

amaitland commented 2 years ago

What version of CefSharp did you test with?

CEF sample app version 101.0.18.0 feature

Did you test with the command line args for WPF as listed in the bug report template?

This sounds like an upstream bug.

amaitland commented 2 years ago

Please confirm you've tested using the following

 cefclient.exe --multi-threaded-message-loop --no-sandbox --off-screen-rendering-enabled --enable-gpu
klotzoliver commented 2 years ago

I've tested the cefclient without any parameter and by calling cefclient.exe --multi-threaded-message-loop --no-sandbox --off-screen-rendering-enabled --enable-gpu cefclient without any parameter works as expected. Using parameter above only mouse wheel works. Scrolling using touch screen doesn't work.

Everything was tested with Cef/CefSharp version 101.0.180

amaitland commented 2 years ago

Based on additional feedback the CEF OSR implementation which WPF uses needs fixes to support the new PDF viewer implementation. Looks like you already raised https://github.com/chromiumembedded/cef/issues/3331 report your findings there.

As an alternative you should be able to use https://github.com/cefsharp/CefSharp.Wpf.HwndHost which is the equivalent of hosting the WinForms version in WPF. It uses windowed rendering as opposed to OSR.

Making as upstream as issue needs to be fixed in CEF.

amaitland commented 2 years ago

There are multiple potentially related issues with the OSR implementation currently

amaitland commented 2 years ago

Does the cef log provide any relevant information? (By default there should be a debug.log file in your bin directory)

Any errors in the log?

Any further issues I'd ask that you please use the Bug Report Template.

zhaozehong commented 2 years ago

I can make sure there is a bug for CefSharp.Wpf. I cannot tell how to reproduce the bug, since I have not found the rule, but it's very easy to reproduce. Basically, I can reproduce the problem within 1 minute by clicking here and there for several times.

the way I am using to reproduce with the CefSharp source code:

  1. set CefShart.Wpf.Example as startup project.
  2. change Reload command to be able to switch between two pdf file, see the code below. if (browser.Address.EndsWith("1.PDF")) browser.LoadUrl(@"C:\Folder\2.PDF"); else browser.LoadUrl(@"C:\Folder\1.PDF");
  3. run the app
  4. change properties from toolbar and hit RELOAD button to switch pdf files. You can find the scroll issue very quickly in this way.

I am sure, the problem must be in the handler of SendMouseWheelEvent(see the last line of the following code of WebBrowserExtensions.cs), I cannot go inside the method. `public static void SendMouseWheelEvent(this IBrowser browser, int x, int y, int deltaX, int deltaY, CefEventFlags modifiers) { browser.ThrowExceptionIfBrowserNull();

  var host = browser.GetHost();
  ThrowExceptionIfBrowserHostNull(host);

  **host.SendMouseWheelEvent(new MouseEvent(x, y, modifiers), deltaX, deltaY);**

}`

If you want any other materials or the screen capture video, please reach me out via skype: xjtu_ok

Really hope the bug can be fixed ASAP. Thanks! Yes, I am using the latest source code of 101 branch.

amaitland commented 2 years ago

@zhaozehong See https://github.com/cefsharp/CefSharp/issues/4106#issuecomment-1128209352

This needs to be fixed in CEF. It's not something that can be fixed in CefSharp directly.

zhaozehong commented 2 years ago

@zhaozehong See #4106 (comment)

This needs to be fixed in CEF. It's not something that can be fixed in CefSharp directly.

Right. Thanks for your reply. Any plan to fix that in CEF? Cos it really leads to a bad user experience.

amaitland commented 2 years ago

Any plan to fix that in CEF? Cos it really leads to a bad user experience.

You'll need to ask the CEF maintainers.