Use two step creation for WKWebView on macOS
This commit is contained in:
@@ -383,13 +383,21 @@ WebFrame::WebFrame(const wxString& url) :
|
||||
wxLogMessage("Edge backend not available");
|
||||
}
|
||||
#endif
|
||||
m_browser = wxWebView::New(this, wxID_ANY, url, wxDefaultPosition, wxDefaultSize, backend);
|
||||
m_browser = wxWebView::New(backend);
|
||||
#ifdef __WXMAC__
|
||||
// With WKWebView handlers need to be registered before creation
|
||||
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
||||
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
||||
#endif
|
||||
m_browser->Create(this, wxID_ANY, url, wxDefaultPosition, wxDefaultSize);
|
||||
topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
|
||||
|
||||
#ifndef __WXMAC__
|
||||
//We register the wxfs:// protocol for testing purposes
|
||||
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
||||
//And the memory: file system
|
||||
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
||||
#endif
|
||||
|
||||
SetSizer(topsizer);
|
||||
|
||||
|
Reference in New Issue
Block a user