WebKit Bugzilla
Attachment 357595 Details for
Bug 192821
: <rdar://problem/46194315> macOS: WebKit1 does not handle occlusion changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192821-20181218120230.patch (text/plain), 7.15 KB, created by
Benjamin Poulain
on 2018-12-18 12:02:31 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Benjamin Poulain
Created:
2018-12-18 12:02:31 PST
Size:
7.15 KB
patch
obsolete
>Subversion Revision: 239320 >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index e24389c31e7c7067ffe45bc6410bb4a5fe419ada..f20d796358dd41a7d928010b1db88f2e822bdc62 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,25 @@ >+2018-12-18 Benjamin Poulain <benjamin@webkit.org> >+ >+ <rdar://problem/46194315> macOS: WebKit1 does not handle occlusion changes >+ https://bugs.webkit.org/show_bug.cgi?id=192821 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When a window becomes occluded, the window server informs the application. >+ This should be used to suspend any work that is not visible by the user. >+ >+ WebKit2 handles it just fine, but WebKit1 did not handle the notification. >+ In some cases, that lead to performance impact (see radar). >+ >+ This patch adds an observer for the occlusion notification. I tried to stick >+ with the same names used by WebKit2. >+ >+ * WebView/WebView.mm: >+ (-[WebView _isViewVisible]): >+ (-[WebView addWindowObserversForWindow:]): >+ (-[WebView removeWindowObservers]): >+ (-[WebView _windowDidChangeOcclusionState:]): >+ > 2018-12-17 Ryosuke Niwa <rniwa@webkit.org> > > offsetLeft and offsetParent should adjust across shadow boundaries >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 5eb9575282c1b653dcbc9aa6a47ed70c05e7d5ef..6e54da6af01f1c37964c4a3caab2bfbce10c7e2c 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -4668,15 +4668,19 @@ IGNORE_WARNINGS_END > > - (BOOL)_isViewVisible > { >- if (![self window]) >+ NSWindow *window = [self window]; >+ if (!window) > return false; > >- if (![[self window] isVisible]) >+ if (![window isVisible]) > return false; > > if ([self isHiddenOrHasHiddenAncestor]) > return false; > >+ if ((window.occlusionState & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible) >+ return false; >+ > return true; > } > >@@ -6000,22 +6004,26 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl > - (void)addWindowObserversForWindow:(NSWindow *)window > { > if (window) { >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowKeyStateChanged:) >+ NSNotificationCenter *defaultNotificationCenter = [NSNotificationCenter defaultCenter]; >+ >+ [defaultNotificationCenter addObserver:self selector:@selector(windowKeyStateChanged:) > name:NSWindowDidBecomeKeyNotification object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowKeyStateChanged:) >+ [defaultNotificationCenter addObserver:self selector:@selector(windowKeyStateChanged:) > name:NSWindowDidResignKeyNotification object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOnScreen:) >+ [defaultNotificationCenter addObserver:self selector:@selector(_windowWillOrderOnScreen:) > name:NSWindowWillOrderOnScreenNotification object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOffScreen:) >+ [defaultNotificationCenter addObserver:self selector:@selector(_windowWillOrderOffScreen:) > name:NSWindowWillOrderOffScreenNotification object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeBackingProperties:) >+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeBackingProperties:) > name:windowDidChangeBackingPropertiesNotification object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeScreen:) >+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeScreen:) > name:NSWindowDidChangeScreenNotification object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) >+ [defaultNotificationCenter addObserver:self selector:@selector(_windowVisibilityChanged:) > name:NSWindowDidMiniaturizeNotification object:window]; >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) >+ [defaultNotificationCenter addObserver:self selector:@selector(_windowVisibilityChanged:) > name:NSWindowDidDeminiaturizeNotification object:window]; >+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeOcclusionState:) >+ name:NSWindowDidChangeOcclusionStateNotification object:window]; > [_private->windowVisibilityObserver startObserving:window]; > } > } >@@ -6024,22 +6032,26 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl > { > NSWindow *window = [self window]; > if (window) { >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ NSNotificationCenter *defaultNotificationCenter = [NSNotificationCenter defaultCenter]; >+ >+ [defaultNotificationCenter removeObserver:self > name:NSWindowDidBecomeKeyNotification object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ [defaultNotificationCenter removeObserver:self > name:NSWindowDidResignKeyNotification object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ [defaultNotificationCenter removeObserver:self > name:NSWindowWillOrderOnScreenNotification object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ [defaultNotificationCenter removeObserver:self > name:NSWindowWillOrderOffScreenNotification object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ [defaultNotificationCenter removeObserver:self > name:windowDidChangeBackingPropertiesNotification object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ [defaultNotificationCenter removeObserver:self > name:NSWindowDidChangeScreenNotification object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ [defaultNotificationCenter removeObserver:self > name:NSWindowDidMiniaturizeNotification object:window]; >- [[NSNotificationCenter defaultCenter] removeObserver:self >+ [defaultNotificationCenter removeObserver:self > name:NSWindowDidDeminiaturizeNotification object:window]; >+ [defaultNotificationCenter removeObserver:self >+ name:NSWindowDidChangeOcclusionStateNotification object:window]; > [_private->windowVisibilityObserver stopObserving:window]; > } > } >@@ -6190,6 +6202,12 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl > > _private->page->setDeviceScaleFactor(newBackingScaleFactor); > } >+ >+- (void)_windowDidChangeOcclusionState:(NSNotification *)notification >+{ >+ [self _updateVisibilityState]; >+} >+ > #else > - (void)_wakWindowScreenScaleChanged:(NSNotification *)notification > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192821
:
357595
|
357598
|
357601
|
357613
|
357619
|
357626
|
357633
|
357645
|
357649
|
357746
|
357898