macOS: Implement access to dev tools for wxWebView
This commit is contained in:
@@ -71,6 +71,9 @@ public:
|
||||
|
||||
virtual bool IsBusy() const wxOVERRIDE;
|
||||
|
||||
virtual bool IsAccessToDevToolsEnabled() const wxOVERRIDE;
|
||||
virtual void EnableAccessToDevTools(bool enable = true) wxOVERRIDE;
|
||||
|
||||
//History functions
|
||||
virtual void ClearHistory() wxOVERRIDE;
|
||||
virtual void EnableHistory(bool enable = true) wxOVERRIDE;
|
||||
|
@@ -308,6 +308,26 @@ bool wxWebViewWebKit::IsEditable() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxWebViewWebKit::IsAccessToDevToolsEnabled() const
|
||||
{
|
||||
// WebKit API available since macOS 10.11 and iOS 9.0
|
||||
WKPreferences* prefs = m_webView.configuration.preferences;
|
||||
SEL devToolsSelector = @selector(_developerExtrasEnabled);
|
||||
id val = nil;
|
||||
if ([prefs respondsToSelector:devToolsSelector])
|
||||
val = [prefs performSelector:devToolsSelector];
|
||||
return (val != nil);
|
||||
}
|
||||
|
||||
void wxWebViewWebKit::EnableAccessToDevTools(bool enable)
|
||||
{
|
||||
// WebKit API available since macOS 10.11 and iOS 9.0
|
||||
WKPreferences* prefs = m_webView.configuration.preferences;
|
||||
SEL devToolsSelector = @selector(_setDeveloperExtrasEnabled:);
|
||||
if ([prefs respondsToSelector:devToolsSelector])
|
||||
[prefs performSelector:devToolsSelector withObject:(id)enable];
|
||||
}
|
||||
|
||||
void wxWebViewWebKit::SetZoomType(wxWebViewZoomType zoomType)
|
||||
{
|
||||
// there is only one supported zoom type at the moment so this setter
|
||||
|
Reference in New Issue
Block a user