diff --git a/Frameworks/DocumentWindow/src/DocumentWindowController.mm b/Frameworks/DocumentWindow/src/DocumentWindowController.mm index fbd8b670..be63cb59 100644 --- a/Frameworks/DocumentWindow/src/DocumentWindowController.mm +++ b/Frameworks/DocumentWindow/src/DocumentWindowController.mm @@ -1210,7 +1210,7 @@ static NSArray* const kObservedKeyPaths = @[ @"arrayController.arrangedObjects.p [htmlOutputViews addObject:[(HTMLOutputWindowController*)window.delegate htmlOutputView]]; } - NSArray* allHTMLViews = [htmlOutputViews filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"needsNewWebView == NO AND commandIdentifier == %@", identifier]]; + NSArray* allHTMLViews = [htmlOutputViews filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"needsNewWebView == NO AND isReusable == YES AND commandIdentifier == %@", identifier]]; NSArray* nonBusyViews = [allHTMLViews filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"isRunningCommand == NO"]]; if(OakHTMLOutputView* view = [nonBusyViews firstObject]) diff --git a/Frameworks/HTMLOutput/src/HTMLOutput.h b/Frameworks/HTMLOutput/src/HTMLOutput.h index 246634f6..976c8deb 100644 --- a/Frameworks/HTMLOutput/src/HTMLOutput.h +++ b/Frameworks/HTMLOutput/src/HTMLOutput.h @@ -8,6 +8,7 @@ @property (nonatomic) NSUUID* commandIdentifier; // UUID from initial load request @property (nonatomic, getter = isRunningCommand, readonly) BOOL runningCommand; @property (nonatomic, getter = isVisible, readonly) BOOL visible; +@property (nonatomic, getter = isReusable) BOOL reusable; // Read-only access to the webview is given to allow reading page title, etc. @property (nonatomic, readonly) WebView* webView; diff --git a/Frameworks/HTMLOutput/src/OakHTMLOutputView.h b/Frameworks/HTMLOutput/src/OakHTMLOutputView.h index 1575f2b8..564a0c94 100644 --- a/Frameworks/HTMLOutput/src/OakHTMLOutputView.h +++ b/Frameworks/HTMLOutput/src/OakHTMLOutputView.h @@ -9,4 +9,5 @@ PUBLIC @interface OakHTMLOutputView : HOBrowserView @property (nonatomic, readonly) NSString* mainFrameTitle; @property (nonatomic) NSUUID* commandIdentifier; // UUID from initial load request @property (nonatomic, getter = isRunningCommand, readonly) BOOL runningCommand; +@property (nonatomic, getter = isReusable) BOOL reusable; @end diff --git a/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm b/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm index 55d285e3..406c6311 100644 --- a/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm +++ b/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm @@ -24,6 +24,15 @@ return [NSSet setWithObjects:@"webView.mainFrameTitle", nil]; } +- (instancetype)initWithFrame:(NSRect)aRect +{ + if(self = [super initWithFrame:aRect]) + { + _reusable = YES; + } + return self; +} + - (void)loadRequest:(NSURLRequest*)aRequest environment:(std::map const&)anEnvironment autoScrolls:(BOOL)flag { if(flag)