Changeset 86924 in webkit


Ignore:
Timestamp:
May 19, 2011 10:31:07 PM (13 years ago)
Author:
jer.noble@apple.com
Message:

2011-05-19 Jer Noble <jer.noble@apple.com>

Reviewed by Maciej Stachowiak.

WebKit2: Flashing when entering and exiting full screen mode
https://bugs.webkit.org/show_bug.cgi?id=56957

Guard against the parameter of setAnimating() matching the ivar value it's
setting, thus avoiding tearing down the renderer's layer backing.

  • rendering/RenderFullScreen.cpp: (RenderFullScreen::setAnimating):

2011-05-19 Jer Noble <jer.noble@apple.com>

Reviewed by Maciej Stachowiak.

WebKit2: Flashing when entering and exiting full screen mode
https://bugs.webkit.org/show_bug.cgi?id=56957

In the WKFullscreenWindowController, when exiting accelerated compositing mode,
force a repaint, and don't actually remove the animation layer until the repaint
completes. Also, move back to parenting the WebView in a layer-backed view, and
work around the SnowLeopard bug which causes a crash in those situations. We no
longer need to do a bunch of work in finishedEnterFullScreenAnimation, because
the animation layer is "hiding" all the drawing happening in the webView underneath.

In the WebFullScreenManagerMac, when asked to tear down the root layer, instead
remove all its children, and set its contents to a flattened image of the full
screen element and its children. This helps patch over the time where everything
is re-rendering and helps give the appearance of continuousness in the animation.

  • UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): (-[WKFullScreenWindowController beganExitFullScreenAnimation]): (-[WKFullScreenWindowController enterAcceleratedCompositingMode:WebKit::]): (-[WKFullScreenWindowController exitAcceleratedCompositingMode]): (-[WKFullScreenWindowController exitCompositedModeRepaintCompleted]): (exitCompositedModeRepaintCompleted): (-[WKFullScreenWindowController _page]): (-[WKFullScreenWindowController _manager]): (-[WKFullScreenWindow initWithContentRect:styleMask:backing:defer:]):
  • WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm: (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer):
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86921 r86924  
     12011-05-19  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        WebKit2: Flashing when entering and exiting full screen mode
     6        https://bugs.webkit.org/show_bug.cgi?id=56957
     7
     8        Guard against the parameter of setAnimating() matching the ivar value it's
     9        setting, thus avoiding tearing down the renderer's layer backing.
     10
     11        * rendering/RenderFullScreen.cpp:
     12        (RenderFullScreen::setAnimating):
     13
    1142011-05-19  Julien Chaffraix  <jchaffraix@codeaurora.org>
    215
  • trunk/Source/WebCore/rendering/RenderFullScreen.cpp

    r85767 r86924  
    3939void RenderFullScreen::setAnimating(bool animating)
    4040{
     41    if (m_isAnimating == animating)
     42        return;
     43
    4144    m_isAnimating = animating;
    4245#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebKit2/ChangeLog

    r86898 r86924  
     12011-05-19  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        WebKit2: Flashing when entering and exiting full screen mode
     6        https://bugs.webkit.org/show_bug.cgi?id=56957
     7
     8        In the WKFullscreenWindowController, when exiting accelerated compositing mode,
     9        force a repaint, and don't actually remove the animation layer until the repaint
     10        completes.  Also, move back to parenting the WebView in a layer-backed view, and
     11        work around the SnowLeopard bug which causes a crash in those situations.  We no
     12        longer need to do a bunch of work in finishedEnterFullScreenAnimation, because
     13        the animation layer is "hiding" all the drawing happening in the webView underneath.
     14
     15        In the WebFullScreenManagerMac, when asked to tear down the root layer, instead
     16        remove all its children, and set its contents to a flattened image of the full
     17        screen element and its children.  This helps patch over the time where everything
     18        is re-rendering and helps give the appearance of continuousness in the animation.
     19
     20        * UIProcess/mac/WKFullScreenWindowController.mm:
     21        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
     22        (-[WKFullScreenWindowController beganExitFullScreenAnimation]):
     23        (-[WKFullScreenWindowController enterAcceleratedCompositingMode:WebKit::]):
     24        (-[WKFullScreenWindowController exitAcceleratedCompositingMode]):
     25        (-[WKFullScreenWindowController exitCompositedModeRepaintCompleted]):
     26        (exitCompositedModeRepaintCompleted):
     27        (-[WKFullScreenWindowController _page]):
     28        (-[WKFullScreenWindowController _manager]):
     29        (-[WKFullScreenWindow initWithContentRect:styleMask:backing:defer:]):
     30        * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
     31        (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer):
     32
    1332011-05-19  Anders Carlsson  <andersca@apple.com>
    234
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm

    r86738 r86924  
    4747using namespace WebCore;
    4848
     49static void exitCompositedModeRepaintCompleted(WKErrorRef, void* context);
     50
    4951#if defined(BUILDING_ON_LEOPARD)
    5052@interface CATransaction(SnowLeopardConvenienceFunctions)
     
    8385- (CFTimeInterval)_animationDuration;
    8486- (void)_swapView:(NSView*)view with:(NSView*)otherView;
     87- (WebPageProxy*)_page;
    8588- (WebFullScreenManagerProxy*)_manager;
    8689@end
     
    242245        return;
    243246    _isEnteringFullScreen = NO;
    244 
    245     NSDisableScreenUpdates();
    246247   
    247248    if (completed) {               
     
    253254        // Then insert the WebView into the full screen window
    254255        NSView* contentView = [[self _fullScreenWindow] contentView];
    255         [contentView addSubview:_webView positioned:NSWindowBelow relativeTo:_layerHostingView.get()];
     256        [contentView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
    256257        [_webView setFrame:[contentView bounds]];
    257 
    258         [CATransaction begin];
    259         [CATransaction setDisableActions:YES];
    260         [[[self _fullScreenWindow] backgroundLayer] setHidden:YES];
    261         [CATransaction commit];
    262258       
    263259        NSWindow *webWindow = [_webViewPlaceholder.get() window];
     
    272268        [webWindow setAnimationBehavior:animationBehavior];
    273269#endif
    274         [[self window] makeKeyAndOrderFront:self];
     270        [self _manager]->didEnterFullScreen();
    275271    }
    276    
    277     [self _manager]->didEnterFullScreen();
    278     NSEnableScreenUpdates();
    279272}
    280273
     
    306299    // Swap the webView back into its original position:
    307300    if ([_webView window] == [self window]) {
     301#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
     302        // Work around a bug in AppKit <rdar://problem/9443385> where moving a
     303        // layer-hosted view from a layer-backed view to a non-layer-backed view
     304        // generates an exception.
     305        if (![_webView wantsLayer] && [_webView layer]) {
     306            [_webView removeFromSuperview];
     307            for (NSView* child in [_webView subviews])
     308                [[child layer] removeFromSuperlayer];
     309        }
     310#endif
    308311        [self _swapView:_webViewPlaceholder.get() with:_webView];
    309312        NSWindow* webWindow = [_webView window];
     
    365368    [CATransaction setDisableActions:YES];
    366369    WKFullScreenWindow* window = [self _fullScreenWindow];
    367     [[window contentView] addSubview:_layerHostingView.get() positioned:NSWindowAbove relativeTo:[window animationView]];
     370    [[window contentView] addSubview:_layerHostingView.get() positioned:NSWindowAbove relativeTo:nil];
    368371   
    369372    // Create a root layer that will back the NSView.
     
    386389    if (!_layerHostingView)
    387390        return;
    388    
     391
     392    NSDisableScreenUpdates();
     393    [self _page]->forceRepaint(VoidCallback::create(self, exitCompositedModeRepaintCompleted));
     394}
     395
     396- (void)exitCompositedModeRepaintCompleted
     397{   
    389398    [CATransaction begin];
    390399    [CATransaction setDisableActions:YES];
     
    396405   
    397406    _layerHostingView = 0;
     407    NSEnableScreenUpdates();
     408}
     409
     410static void exitCompositedModeRepaintCompleted(WKErrorRef, void* context)
     411{
     412    [(WKFullScreenWindowController*)context exitCompositedModeRepaintCompleted];
    398413}
    399414
     
    501516}
    502517
     518- (WebPageProxy*)_page
     519{
     520    return toImpl([_webView pageRef]);
     521}
     522
    503523- (WebFullScreenManagerProxy*)_manager
    504524{
    505     WebPageProxy* webPage = toImpl([_webView pageRef]);
     525    WebPageProxy* webPage = [self _page];
    506526    if (!webPage)
    507527        return 0;
     
    583603   
    584604    NSView* contentView = [self contentView];
     605    [contentView setWantsLayer:YES];
    585606    _animationView = [[NSView alloc] initWithFrame:[contentView bounds]];
    586607   
  • trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm

    r86738 r86924  
    138138        m_page->send(Messages::WebFullScreenManagerProxy::ExitAcceleratedCompositingMode());
    139139        [[NSNotificationCenter defaultCenter] postNotificationName:@"WebKitLayerHostChanged" object:m_rootLayer->platformLayer() userInfo:nil];
     140
     141        Frame* frame = m_element->document()->frame();
     142        DragImageRef dragImage = frame ? frame->nodeImage(m_element.get()) : 0;
     143
    140144        if (m_rootLayer) {
     145            [CATransaction begin];
     146            PlatformLayer* rootPlatformLayer = m_rootLayer->platformLayer();
    141147            m_rootLayer->removeAllChildren();
     148            m_rootLayer->syncCompositingStateForThisLayerOnly();
    142149            m_rootLayer = nullptr;
     150            [rootPlatformLayer setContents:dragImage.get()];
     151            [CATransaction commit];
    143152        }
    144 
     153       
    145154        return;
    146155    }
Note: See TracChangeset for help on using the changeset viewer.