⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 169095 in webkit


Ignore:
Timestamp:
May 19, 2014, 7:22:35 PM (12 years ago)
Author:
barraclough@apple.com
Message:

WebKit2/iOS: parented view should be considered hidden if app is backgrounded
​https://bugs.webkit.org/show_bug.cgi?id=133099
radar://16942183

Reviewed by Simon Fraser.

  • UIProcess/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::isViewWindowActive):

(WebKit::PageClientImpl::isViewFocused):

(WebKit::PageClientImpl::isViewVisible):

  • take UIApplication applicationState into account in determining visibility.

(WebKit::PageClientImpl::isViewVisibleOrOccluded):

  • implemented in terms of isViewVisible.

(WebKit::PageClientImpl::isVisuallyIdle):

  • implemented in terms of isViewVisible.
  • UIProcess/ios/WKContentView.mm:

(-[WKContentView initWithFrame:context:WebKit::configuration:WebKit::webView:]):

  • register for UIApplicationDidEnterBackgroundNotification.

(-[WKContentView _applicationDidEnterBackground:]):
(-[WKContentView _applicationWillEnterForeground:]):

  • when the application state changes all flags except IsInWindow may be affected.
Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r169091 r169095  
     12014-05-19  Gavin Barraclough  <baraclough@apple.com>
     2
     3        WebKit2/iOS: parented view should be considered hidden if app is backgrounded
     4        https://bugs.webkit.org/show_bug.cgi?id=133099
     5        radar://16942183
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/ios/PageClientImplIOS.mm:
     10        (WebKit::PageClientImpl::isViewWindowActive):
     11            - implemented in terms of isViewVisible.
     12            - FIXME: https://bugs.webkit.org/show_bug.cgi?id=133098
     13        (WebKit::PageClientImpl::isViewFocused):
     14            - implemented in terms of isViewWindowActive.
     15            - FIXME: https://bugs.webkit.org/show_bug.cgi?id=133098
     16        (WebKit::PageClientImpl::isViewVisible):
     17            - take UIApplication applicationState into account in determining visibility.
     18        (WebKit::PageClientImpl::isViewVisibleOrOccluded):
     19            - implemented in terms of isViewVisible.
     20        (WebKit::PageClientImpl::isVisuallyIdle):
     21            - implemented in terms of isViewVisible.
     22        * UIProcess/ios/WKContentView.mm:
     23        (-[WKContentView initWithFrame:context:WebKit::configuration:WebKit::webView:]):
     24            - register for UIApplicationDidEnterBackgroundNotification.
     25        (-[WKContentView _applicationDidEnterBackground:]):
     26        (-[WKContentView _applicationWillEnterForeground:]):
     27            - when the application state changes all flags except IsInWindow may be affected.
     28
    1292014-05-19  Enrica Casucci  <enrica@apple.com>
    230
  • trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm

    r168920 r169095  
    111111bool PageClientImpl::isViewWindowActive()
    112112{
     113    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=133098
     114    return isViewVisible();
     115}
     116
     117bool PageClientImpl::isViewFocused()
     118{
     119    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=133098
     120    return isViewWindowActive();
     121}
     122
     123bool PageClientImpl::isViewVisible()
     124{
     125    return [m_webView window] && [UIApplication sharedApplication].applicationState != UIApplicationStateBackground;
     126}
     127
     128bool PageClientImpl::isViewInWindow()
     129{
    113130    return [m_webView window];
    114131}
    115132
    116 bool PageClientImpl::isViewFocused()
    117 {
    118     return [m_webView window];
    119 }
    120 
    121 bool PageClientImpl::isViewVisible()
    122 {
    123     return [m_webView window];
    124 }
    125 
    126 bool PageClientImpl::isViewInWindow()
    127 {
    128     return [m_webView window];
    129 }
    130 
    131133bool PageClientImpl::isViewVisibleOrOccluded()
    132134{
    133     return [m_webView window];
     135    return isViewVisible();
    134136}
    135137
    136138bool PageClientImpl::isVisuallyIdle()
    137139{
    138     return ![m_webView window];
     140    return !isViewVisible();
    139141}
    140142
  • trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm

    r169064 r169095  
    209209    self.layer.hitTestsAsOpaque = YES;
    210210
     211    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];
    211212    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];
    212 
    213213    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication]];
    214 
    215214    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:[UIApplication sharedApplication]];
    216215
    … …  
    462461}
    463462
     463- (void)_applicationDidEnterBackground:(NSNotification*)notification
     464{
     465    _page->viewStateDidChange(ViewState::AllFlags & ~ViewState::IsInWindow);
     466}
     467
    464468- (void)_applicationWillEnterForeground:(NSNotification*)notification
    465469{
    466470    _page->applicationWillEnterForeground();
     471    _page->viewStateDidChange(ViewState::AllFlags & ~ViewState::IsInWindow);
    467472}
    468473
Note: See TracChangeset for help on using the changeset viewer.