CefSharp
CefSharp copied to clipboard
WinForms Example - Find not correctly selecting next match.
Is there an existing issue for this?
- [X] I have searched both open/closed issues, no issue already exists.
CefSharp Version
113.1.4
Operating System
Windows 11
Architecture
x86
.Net Version
4.8
Implementation
WinForms
Reproduction Steps
- Open any PDF file in the browser with "file:///"
- In the WinForms.Example application click on Edit->Find
- Enter text in the TextBox and hit Enter --> Find(...) method will be executed and found results are marked in the scroll bar at the side --> Matching text will not be highlighted and "Find Next", "Find Previous" buttons won't do anything visible to the user (they also do not seem to do from HTML pages)
Expected behavior
Matching content is highlighted (like it is for HTML documents) and the browser scrolls to make the match visible, if not currently visible.
Actual behavior
Matches are only indicated in the scroll bar but no highlighting is visible.
Regression?
No response
Known Workarounds
No response
Does this problem also occur in the CEF Sample Application
No
Other information
Not sure if it is a CefSharp or a CEF issue. The CEF sample application behaves a bit better, but has a different search dialog compared to the WinForms Example that comes with CefSharp.
Matches are only indicated in the scroll bar but no highlighting is visible.
The PDF viewer is implemented entirely at the CEF/Chromium level, the example just calls the Find method.
The CEF sample application behaves a bit better
What does that mean exactly? What's a bit better?
No matches in the PDF would be a CEF bug. Test with the latest beta build from https://cef-builds.spotifycdn.com/index.html
If the problem still reproduces then raise an issue on https://github.com/chromiumembedded/cef (search for existing first of course).
A bit better means, it jumops from match to match and marks that current match, but it doesn't highlight all the matches like it does for HTML.
This is like Google Chrome seems to behave as well.
In CefSharp neither of that works.
it jumops from match to match and marks that current match
The example likely needs some improvements then. You can compare to the cefclient implementation. PR welcome with improvements.
- https://github.com/cefsharp/CefSharp/blob/b79c7c8f79e73953f7c3d1cbb19800bf93e0573d/CefSharp.WinForms.Example/BrowserTabUserControl.cs#L534
- https://github.com/chromiumembedded/cef/blob/a576150ab570a8b73a3ad00110b54100ab5f729e/tests/cefclient/browser/root_window_win.cc#L879
In CefSharp neither of that works.
That's just the example. Long as the API is mapped correctly you should be able to achieve the same behaviour as cefclient in your application.
Renaming this issue as we'll use to track improvements to the example. The highlight in the PDF will need to be fixed in CEF.
Open any PDF file in the browser with "file:///" In the WinForms.Example application click on Edit->Find Enter text in the TextBox and hit Enter --> Find(...) method will be executed and found results are marked in the scroll bar at the side --> Matching text will not be highlighted and "Find Next", "Find Previous" buttons won't do anything visible to the user (they also do not seem to do from HTML pages)
Can you address this issue? If so, could you please provide details on the steps you took to resolve it?
Hello @lutz-fechner, were you able to solve the issue with the suggestion provided by @amaitland? We are also facing the exact same issue. Just curious if there is any way around it.
No I did not solve this issue. When I compared the code of both examples, they looked quite similar to me. Would be better if someone checks this, that has better understanding how the integration between Cef and CefSharp works.