1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

WebBrowserComponent: Allow developer tools in debug builds on macOS

This commit is contained in:
reuk 2022-08-08 19:53:12 +01:00
parent e0fd976779
commit d4184b120d
3 changed files with 28 additions and 12 deletions

View file

@ -71,6 +71,12 @@ public:
/** Resizes this component to fit the view that it contains. */
void resizeToFitView();
/** Resizes the NSView to match the bounds of this component.
Most of the time, this will be done for you automatically.
*/
void resizeViewToFit();
//==============================================================================
/** @internal */
void paint (Graphics&) override;

View file

@ -164,6 +164,12 @@ void NSViewComponent::resizeToFitView()
}
}
void NSViewComponent::resizeViewToFit()
{
if (attachment != nullptr)
static_cast<NSViewAttachment*> (attachment.get())->componentMovedOrResized (true, true);
}
void NSViewComponent::paint (Graphics&) {}
void NSViewComponent::alphaChanged()

View file

@ -499,20 +499,24 @@ class API_AVAILABLE (macos (10.11)) WKWebViewImpl : public WebViewBase
public:
WKWebViewImpl (WebBrowserComponent* owner)
{
#if JUCE_MAC
static WebViewKeyEquivalentResponder<WKWebView> webviewClass;
#if JUCE_MAC
static WebViewKeyEquivalentResponder<WKWebView> webviewClass;
webView.reset ([webviewClass.createInstance() initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)]);
#else
webView.reset ([[WKWebView alloc] initWithFrame: CGRectMake (0, 0, 100.0f, 100.0f)]);
#endif
webView.reset ([webviewClass.createInstance() initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)]);
#else
webView.reset ([[WKWebView alloc] initWithFrame: CGRectMake (0, 0, 100.0f, 100.0f)]);
#endif
static WebViewDelegateClass cls;
webViewDelegate.reset ([cls.createInstance() init]);
WebViewDelegateClass::setOwner (webViewDelegate.get(), owner);
static WebViewDelegateClass cls;
webViewDelegate.reset ([cls.createInstance() init]);
WebViewDelegateClass::setOwner (webViewDelegate.get(), owner);
[webView.get() setNavigationDelegate: webViewDelegate.get()];
[webView.get() setUIDelegate: webViewDelegate.get()];
[webView.get() setNavigationDelegate: webViewDelegate.get()];
[webView.get() setUIDelegate: webViewDelegate.get()];
#if JUCE_DEBUG
[[[webView.get() configuration] preferences] setValue: @(true) forKey: @"developerExtrasEnabled"];
#endif
}
~WKWebViewImpl() override
@ -584,7 +588,7 @@ public:
setView (webView->getWebView());
}
~Pimpl()
~Pimpl() override
{
webView = nullptr;
setView (nil);