Skip to content

Commit

Permalink
Revert e5ee29f.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrison Weinerman committed Nov 4, 2022
1 parent 1d2a308 commit d314676
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Source/WebKit/UIProcess/mac/WebViewImpl.mm
Expand Up @@ -333,10 +333,7 @@ - (void)startObserving:(NSWindow *)window
if (_shouldObserveFontPanel)
[self startObservingFontPanel];

[window addObserver:self forKeyPath:@"contentLayoutRect" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
[window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];

_observedWindow = window;
[self _observeWindow:window];
}

- (void)stopObserving:(NSWindow *)window
Expand Down Expand Up @@ -367,12 +364,25 @@ - (void)stopObserving:(NSWindow *)window
if (_shouldObserveFontPanel)
[[NSFontPanel sharedFontPanel] removeObserver:self forKeyPath:@"visible" context:keyValueObservingContext];

if (_observedWindow == window) {
[window removeObserver:self forKeyPath:@"contentLayoutRect" context:keyValueObservingContext];
[window removeObserver:self forKeyPath:@"titlebarAppearsTransparent" context:keyValueObservingContext];
[self _observeWindow:nil];
}

- (void)_observeWindow:(NSWindow *)window
{
if (_observedWindow == window)
return;

if (_observedWindow) {
[_observedWindow removeObserver:self forKeyPath:@"contentLayoutRect" context:keyValueObservingContext];
[_observedWindow removeObserver:self forKeyPath:@"titlebarAppearsTransparent" context:keyValueObservingContext];
}

_observedWindow = nil;
_observedWindow = window;

if (window) {
[window addObserver:self forKeyPath:@"contentLayoutRect" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
[window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
}
}

- (void)startObservingFontPanel
Expand Down

0 comments on commit d314676

Please sign in to comment.