Merge pull request #44 from brightray/fix-devtools-flash

Fix flash of page while resizing devtools NSSplitView divider.
This commit is contained in:
Adam Roben 2013-12-12 07:36:16 -08:00
commit dc3f2050c0
2 changed files with 22 additions and 3 deletions

View file

@ -2,7 +2,8 @@
@class BRYInspectableWebContentsViewPrivate; @class BRYInspectableWebContentsViewPrivate;
@interface BRYInspectableWebContentsView : NSView <NSWindowDelegate> { @interface BRYInspectableWebContentsView
: NSView<NSWindowDelegate, NSSplitViewDelegate> {
@private @private
BRYInspectableWebContentsViewPrivate *_private; BRYInspectableWebContentsViewPrivate *_private;
} }

View file

@ -10,10 +10,21 @@
using namespace brightray; using namespace brightray;
@interface GraySplitView : NSSplitView
- (NSColor*)dividerColor;
@end
@implementation GraySplitView
- (NSColor*)dividerColor {
return [NSColor darkGrayColor];
}
@end
@interface BRYInspectableWebContentsViewPrivate : NSObject { @interface BRYInspectableWebContentsViewPrivate : NSObject {
@public @public
InspectableWebContentsViewMac *inspectableWebContentsView; InspectableWebContentsViewMac *inspectableWebContentsView;
NSSplitView *splitView; GraySplitView *splitView;
NSWindow *window; NSWindow *window;
BOOL visible; BOOL visible;
} }
@ -45,7 +56,8 @@ void SetActive(content::WebContents* web_contents, bool active) {
_private = [[BRYInspectableWebContentsViewPrivate alloc] init]; _private = [[BRYInspectableWebContentsViewPrivate alloc] init];
_private->inspectableWebContentsView = inspectableWebContentsView; _private->inspectableWebContentsView = inspectableWebContentsView;
_private->splitView = [[NSSplitView alloc] init]; _private->splitView = [[GraySplitView alloc] init];
_private->splitView.delegate = self;
[self addSubview:_private->splitView]; [self addSubview:_private->splitView];
_private->splitView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; _private->splitView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
@ -207,6 +219,12 @@ void SetActive(content::WebContents* web_contents, bool active) {
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:newWindow]; [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:newWindow];
} }
#pragma mark - NSSplitViewDelegate
-(void)splitViewWillResizeSubviews:(NSNotification *)notification {
[[_private->splitView window] disableScreenUpdatesUntilFlush];
}
#pragma mark - NSWindowDelegate #pragma mark - NSWindowDelegate
- (BOOL)windowShouldClose:(id)sender { - (BOOL)windowShouldClose:(id)sender {