Hello. It's me again.
I have a webpage that asks for a confirmation to the user. The problem is that cef doesn't handle the js popup correctly on specific configuration. You can see it for yourself on the picture here :
On Windows XP, when using the Windows Classic theme, it is displayed correctly but if the Windows XP theme is used (the one with the big green startup menu and the blue taskbar) the display is not correct. As you can see, the upper part of the dialog box is transparent and the actual content is below, with the buttons almost not visibles.
I know that it is a cef bug (where should I go to report it ? forum ?) but I'd like to quickly fix it on my end with custom dialogs. I found that I could use CefJSDialogHandler but it seems you locked you CefWebClient class (many classes are internal or sealed). I had to modify your source to add a delegate parameter to the CefWebBrowser constructor and call that delegate when calling CreateBrowser() to create the CefClient. Above that, I had to duplicate your classes (CefWebLifeSpanHandler & CefWebDisplayHandler) because I couldn't use them in my own CefClient.
Here is some code:
- Code: Select all
[ToolboxBitmap(typeof(CefWebBrowser))]
public sealed class CefWebBrowser : Control
{
public delegate CefClient CreateCefClientDelegate(CefWebBrowser core);
private CreateCefClientDelegate _create_cef_client;
private bool _handleCreated;
private CefBrowser _browser;
private IntPtr _browserWindowHandle;
CefClient CreateDefaultCefClient(CefWebBrowser core)
{
return new CefWebClient(core);
}
public CefWebBrowser()
: this(null)
{ }
public CefWebBrowser(CreateCefClientDelegate create_cef_client)
{
if (create_cef_client == null)
_create_cef_client = CreateDefaultCefClient;
else
_create_cef_client = create_cef_client;
....
}
protected override void OnHandleCreated(EventArgs e)
{
....
CefBrowserHost.CreateBrowser(windowInfo, _create_cef_client(this), settings, StartUrl);
}
_handleCreated = true;
}
Is there an easier way to do specify a custom handle for js dialogs ? Are you interested in the patch I made ? What are your thoughts about this ?
Also, I had to add the following code in DemoApps.cs to be allowed to debug in Visual Studio (as it tries to use <project>.vshost.exe to spawn multiple process, which doesn't work):
- Code: Select all
#if DEBUG
settings.SingleProcess = true;
#endif
Thansk forward,
Sebastien
PS: Should I keep asking my questions here or should I create new topics ?