WebKit Bugzilla
Attachment 357633 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-20181218164432.patch (text/plain), 10.29 KB, created by
Benjamin Poulain
on 2018-12-18 16:44:33 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Benjamin Poulain
Created:
2018-12-18 16:44:33 PST
Size:
10.29 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..17ea0ba70429901042602eefd8b8d34e84761b05 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -4668,15 +4668,21 @@ 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 !PLATFORM(IOS_FAMILY) >+ if (_private->windowOcclusionDetectionEnabled && (window.occlusionState & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible) >+ return false; >+#endif >+ > return true; > } > >@@ -5065,6 +5071,18 @@ static Vector<String> toStringVector(NSArray* patterns) > } > } > >+#if !PLATFORM(IOS_FAMILY) >+- (BOOL)windowOcclusionDetectionEnabled >+{ >+ return _private->windowOcclusionDetectionEnabled; >+} >+ >+- (void)setWindowOcclusionDetectionEnabled:(BOOL)flag >+{ >+ _private->windowOcclusionDetectionEnabled = flag; >+} >+#endif >+ > - (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns > { > Page* page = core(self); >@@ -6000,22 +6018,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 +6046,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 +6216,12 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl > > _private->page->setDeviceScaleFactor(newBackingScaleFactor); > } >+ >+- (void)_windowDidChangeOcclusionState:(NSNotification *)notification >+{ >+ [self _updateVisibilityState]; >+} >+ > #else > - (void)_wakWindowScreenScaleChanged:(NSNotification *)notification > { >diff --git a/Source/WebKitLegacy/mac/WebView/WebViewData.h b/Source/WebKitLegacy/mac/WebView/WebViewData.h >index da555b9ca504c9e8c4615f08638a810b6dc1ad7a..c77f6ed15b0b7cdf76887441ed864e55715293de 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebViewData.h >+++ b/Source/WebKitLegacy/mac/WebView/WebViewData.h >@@ -211,6 +211,7 @@ private: > std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow; > BOOL hasInitializedLookupObserver; > RetainPtr<WebWindowVisibilityObserver> windowVisibilityObserver; >+ BOOL windowOcclusionDetectionEnabled; > RetainPtr<NSEvent> pressureEvent; > #endif // PLATFORM(MAC) > >diff --git a/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h b/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h >index a8be2f6d360996cc52594c438e3b9b0d24dbec5f..299fe677f2a7a6bdb3632e3b55f8f46cccfac9c8 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h >+++ b/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h >@@ -852,6 +852,11 @@ Could be worth adding to the API. > - (WebPageVisibilityState)_visibilityState; > - (void)_setVisibilityState:(WebPageVisibilityState)visibilityState isInitialState:(BOOL)isInitialState; > >+#if !TARGET_OS_IPHONE >+- (BOOL)windowOcclusionDetectionEnabled; >+- (void)setWindowOcclusionDetectionEnabled:(BOOL)flag; >+#endif >+ > // Whether the column-break-{before,after} properties are respected instead of the > // page-break-{before,after} properties. > - (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 3507c3614725736877fc8cba89d21874b3693e0a..84e98bc35989a0f8a60300867c64f27a6386977a 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,13 @@ >+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!). >+ >+ * DumpRenderTree/mac/DumpRenderTree.mm: >+ (createWebViewAndOffscreenWindow): >+ > 2018-12-17 Chris Dumez <cdumez@apple.com> > > Allow passing nil as session state to [WKWebView _restoreSessionState:] >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index 5de612c59f367c4d094c8fb3178286ed3bdcbff0..13f8cc86fe72c34b9c807c80be6c444474b1a27f 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -724,6 +724,7 @@ WebView *createWebViewAndOffscreenWindow() > [WebView registerURLSchemeAsLocal:@"feedsearch"]; > > #if PLATFORM(MAC) >+ [webView setWindowOcclusionDetectionEnabled:NO]; > [WebView _setFontWhitelist:fontWhitelist()]; > #endif >
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