Add window occlusion criteria to determine page visibility on Mac
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2013 05:11:09 +0000 (05:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2013 05:11:09 +0000 (05:11 +0000)
commit3534cc224a9c124a7406e442af5dac5e60096c06
treea4b92cb06235cd50a102480bd0705f47c4f140da
parent0dbf9bdb49bd28da9359aecabe16a92366b180e0
Add window occlusion criteria to determine page visibility on Mac
https://bugs.webkit.org/show_bug.cgi?id=107494

Patch by Kiran Muppala <cmuppala@apple.com> on 2013-01-28
Reviewed by Simon Fraser.

Source/WebKit2:

* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::isViewVisible): Add window occlusion check.
* UIProcess/API/mac/WKView.mm:
(-[WKView dealloc]): Remove self from the all views vector.
(-[WKView addWindowObserversForWindow:]): Register observer for
NSWindowWillOrderOffScreenNotification.
(-[WKView removeWindowObservers]): Unregister observer for
NSWindowWillOrderOffScreenNotification.
(-[WKView viewWillMoveToWindow:]): Disable occlusion notifications.
(-[WKView viewDidMoveToWindow]): Enable occlusion notifications.
(-[WKView _windowWillOrderOffScreen:]): Disable occlusion notifications.
(-[WKView _windowDidOrderOnScreen:]): Enable occlusion notifications.
This notification ensures that occlusion notifications are registered
correctly even if the NSWindow object is assigned a window number after
the viewDidMoveToWindow notification has been received.  This occurs
for instance during application launch.
(-[WKView _setIsWindowOccluded:]):
(-[WKView _enableWindowOcclusionNotifications]):
(-[WKView _disableWindowOcclusionNotifications]):
(windowBecameVisible):
(windowBecameOccluded):
(+[WKView _registerWindowOcclusionNotificationHandlers]):
(+[WKView _unregisterWindowOcclusionNotificationHandlers]):
(+[WKView _allViews]):
(-[WKView _isWindowOccluded]):
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): Add
self to the all views vector.
* UIProcess/API/mac/WKViewInternal.h:

WebKitLibraries:

Add enum constants to specify window occlusion notification type to
notification registration/unregistration methods.  Add typedef for
window ID data passed to the window occlusion notification handler.
Add method to enable occlusion notifications for a particular window.

* WebKitSystemInterface.h: Add
WKOcclusionNotificationTypeWindowBecameVisible,
WKOcclusionNotificationTypeWindowBecameOccluded,
WKWindowID,
WKEnableWindowOcclusionNotifications().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h