Changeset 86588 in webkit


Ignore:
Timestamp:
May 16, 2011 10:50:54 AM (13 years ago)
Author:
jer.noble@apple.com
Message:

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

Reviewed by Simon Fraser.

Video is blank, controller is misplaced on trailers.apple.com movie in fullscreen (with two screens)
https://bugs.webkit.org/show_bug.cgi?id=60826

Listen for a WebKitLayerHostChanged notification and, if the affected layer is an
ancestor layer of the qtMovieLayer, tear down the layer and recreate it the
next time setVisible(true) is called.

  • dom/Document.cpp: (WebCore::Document::webkitDidEnterFullScreenForElement): Call setFullScreenRootLayer(0)

before disabling animation on the full screen renderer.

  • platform/graphics/mac/MediaPlayerPrivateQTKit.h:
  • platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivateQTKit::createQTMovie): Register an observer for the new

WebKitLayerHostChanged notification.

(WebCore::layerIsDescendentOf): Added.
(WebCore::MediaPlayerPrivateQTKit::layerHostChanged): Added. If the changed

layer is an ancestor of the movie layer, tear down rendering and re-
create the next time setVisible(true) is called.

(-[WebCoreMovieObserver layerHostChanged:]): Added ObjC listener wrapper.

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

Reviewed by Simon Fraser.

Video is blank, controller is misplaced on trailers.apple.com movie in fullscreen (with two screens)
https://bugs.webkit.org/show_bug.cgi?id=60826

Emit a notification when moving a CALayer from the WebProcess's main
layer host to a new context. This allows listeners to invalidate their
layers which may not support moving between different CAContexts (as is
the case with QTMovieLayer). In order to allow listeners to determine if they
are affected, the notification will pass the root CALayer in a userInfo
dictionary.

In WebFullScreenManagerMac, move from storing a pointer to a non-refcounted
class (GraphicsLayer) to a retainable class (PlatformLayer).

  • WebProcess/FullScreen/mac/WebFullScreenManagerMac.h:
  • WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm: (WebKit::WebFullScreenManagerMac::WebFullScreenManagerMac): No need to initialize

m_fullScreenRootLayer now that it is a RetainPtr<>.

(WebKit::WebFullScreenManagerMac::setRootFullScreenLayer): Emit a notification

after either creating or destroying the full screen layer host.

(WebKit::WebFullScreenManagerMac::beginEnterFullScreenAnimation):
(WebKit::WebFullScreenManagerMac::beginExitFullScreenAnimation):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86586 r86588  
     12011-05-13  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Video is blank, controller is misplaced on trailers.apple.com movie in fullscreen (with two screens)
     6        https://bugs.webkit.org/show_bug.cgi?id=60826
     7
     8        Listen for a WebKitLayerHostChanged notification and, if the affected layer is an
     9        ancestor layer of the qtMovieLayer, tear down the layer and recreate it the
     10        next time setVisible(true) is called.
     11
     12        * dom/Document.cpp:
     13        (WebCore::Document::webkitDidEnterFullScreenForElement):  Call setFullScreenRootLayer(0)
     14            before disabling animation on the full screen renderer.
     15        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
     16        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
     17        (WebCore::MediaPlayerPrivateQTKit::createQTMovie): Register an observer for the new
     18            WebKitLayerHostChanged notification.
     19        (WebCore::layerIsDescendentOf): Added.
     20        (WebCore::MediaPlayerPrivateQTKit::layerHostChanged): Added.  If the changed
     21            layer is an ancestor of the movie layer, tear down rendering and re-
     22            create the next time setVisible(true) is called.
     23        (-[WebCoreMovieObserver layerHostChanged:]):  Added ObjC listener wrapper.
     24
    1252011-05-16  Adam Barth  <abarth@webkit.org>
    226
  • trunk/Source/WebCore/dom/Document.cpp

    r86584 r86588  
    48934893{
    48944894    if (m_fullScreenRenderer) {
     4895#if USE(ACCELERATED_COMPOSITING)
     4896        page()->chrome()->client()->setRootFullScreenLayer(0);
     4897#endif
    48954898        m_fullScreenRenderer->setAnimating(false);
    48964899#if USE(ACCELERATED_COMPOSITING)
    48974900        view()->updateCompositingLayers();
    4898         page()->chrome()->client()->setRootFullScreenLayer(0);
    48994901#endif
    49004902    }
  • trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h

    r86418 r86588  
    6969    void timeChanged();
    7070    void didEnd();
     71#if USE(ACCELERATED_COMPOSITING)
     72    void layerHostChanged(PlatformLayer* rootLayer);
     73#endif
    7174
    7275private:
  • trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

    r86451 r86588  
    171171-(void)timeChanged:(NSNotification *)notification;
    172172-(void)didEnd:(NSNotification *)notification;
     173-(void)layerHostChanged:(NSNotification *)notification;
    173174@end
    174175
     
    404405                                                 name:QTMovieDidEndNotification
    405406                                               object:m_qtMovie.get()];
     407#if defined(BUILDING_ON_SNOW_LEOPARD)
     408    [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
     409                                             selector:@selector(layerHostChanged:)
     410                                                 name:@"WebKitLayerHostChanged"
     411                                               object:nil];
     412#endif
    406413}
    407414
     
    12051212    m_player->timeChanged();
    12061213}
     1214
     1215#if USE(ACCELERATED_COMPOSITING)
     1216static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent)
     1217{
     1218    if (!child || !descendent)
     1219        return false;
     1220
     1221    do {
     1222        if (child == descendent)
     1223            return true;
     1224    } while((child = [child superlayer]));
     1225
     1226    return false;
     1227}
     1228
     1229void MediaPlayerPrivateQTKit::layerHostChanged(PlatformLayer* rootLayer)
     1230{
     1231#if defined(BUILDING_ON_SNOW_LEOPARD)
     1232    if (!rootLayer)
     1233        return;
     1234
     1235    if (layerIsDescendentOf(m_qtVideoLayer.get(), rootLayer)) {
     1236        // We own a child layer of a layer which has switched contexts. 
     1237        // Tear down our layer, and set m_visible to false, so that the
     1238        // next time setVisible(true) is called, the layer will be re-
     1239        // created in the correct context.
     1240        tearDownVideoRendering();
     1241        m_visible = false;
     1242    }
     1243#else
     1244    UNUSED_PARAM(rootLayer);
     1245#endif
     1246}
     1247#endif
    12071248
    12081249void MediaPlayerPrivateQTKit::setSize(const IntSize&)
     
    17001741}
    17011742
     1743- (void)layerHostChanged:(NSNotification *)notification
     1744{
     1745#if USE(ACCELERATED_COMPOSITING)
     1746    CALayer* rootLayer = static_cast<CALayer*>([notification object]);
     1747    m_callback->layerHostChanged(rootLayer);
     1748#else
     1749    UNUSED_PARAM(notification);
     1750#endif
     1751}
     1752
    17021753- (void)setDelayCallbacks:(BOOL)shouldDelay
    17031754{
  • trunk/Source/WebKit2/ChangeLog

    r86585 r86588  
     12011-05-13  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Video is blank, controller is misplaced on trailers.apple.com movie in fullscreen (with two screens)
     6        https://bugs.webkit.org/show_bug.cgi?id=60826
     7
     8        Emit a notification when moving a CALayer from the WebProcess's main
     9        layer host to a new context.  This allows listeners to invalidate their
     10        layers which may not support moving between different CAContexts (as is
     11        the case with QTMovieLayer).  In order to allow listeners to determine if they
     12        are affected, the notification will pass the root CALayer in a userInfo
     13        dictionary.
     14
     15        In WebFullScreenManagerMac, move from storing a pointer to a non-refcounted
     16        class (GraphicsLayer) to a retainable class (PlatformLayer).
     17
     18        * WebProcess/FullScreen/mac/WebFullScreenManagerMac.h:
     19        * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
     20        (WebKit::WebFullScreenManagerMac::WebFullScreenManagerMac): No need to initialize
     21            m_fullScreenRootLayer now that it is a RetainPtr<>.
     22        (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer): Emit a notification
     23            after either creating or destroying the full screen layer host.
     24        (WebKit::WebFullScreenManagerMac::beginEnterFullScreenAnimation):
     25        (WebKit::WebFullScreenManagerMac::beginExitFullScreenAnimation):
     26
    1272011-05-16  Siddharth Mathur  <siddharth.mathur@nokia.com>
    228
  • trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.h

    r80925 r86588  
    3232#import "WebFullScreenManager.h"
    3333
     34#import <WebCore/GraphicsLayer.h>
    3435#import <WebCore/IntRect.h>
    3536#import <wtf/RetainPtr.h>
     
    5455
    5556    OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
    56     WebCore::GraphicsLayer* m_fullScreenRootLayer;
     57    RetainPtr<PlatformLayer> m_fullScreenRootLayer;
    5758    LayerTreeContext m_layerTreeContext;
    5859    RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
  • trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm

    r85515 r86588  
    118118WebFullScreenManagerMac::WebFullScreenManagerMac(WebPage* page)
    119119    : WebFullScreenManager(page)
    120     , m_fullScreenRootLayer(0)
    121120{
    122121    m_enterFullScreenListener.adoptNS([[WebFullScreenManagerAnimationListener alloc] initWithManager:this began:&WebFullScreenManagerMac::beganEnterFullScreenAnimation finished:&WebFullScreenManagerMac::finishedEnterFullScreenAnimation]);
     
    133132void WebFullScreenManagerMac::setRootFullScreenLayer(WebCore::GraphicsLayer* layer)
    134133{
    135     if (m_fullScreenRootLayer == layer)
    136         return;
    137     m_fullScreenRootLayer = layer;
    138 
    139     if (!m_fullScreenRootLayer) {
     134    if (m_fullScreenRootLayer == (layer ? layer->platformLayer() : 0))
     135        return;
     136
     137    if (!layer) {
    140138        m_page->send(Messages::WebFullScreenManagerProxy::ExitAcceleratedCompositingMode());
    141139        if (m_rootLayer) {
     
    143141            m_rootLayer = nullptr;
    144142        }
    145         return;
    146     }
    147 
     143       
     144        [[NSNotificationCenter defaultCenter] postNotificationName:@"WebKitLayerHostChanged" object:m_fullScreenRootLayer.get() userInfo:nil];
     145        m_fullScreenRootLayer = 0;
     146        return;
     147    }
     148   
    148149    if (!m_rootLayer) {
    149150        mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
     
    164165
    165166    m_rootLayer->removeAllChildren();
    166 
    167     if (m_fullScreenRootLayer)
    168         m_rootLayer->addChild(m_fullScreenRootLayer);
     167    m_rootLayer->addChild(layer);
    169168
    170169    m_rootLayer->syncCompositingStateForThisLayerOnly();
    171170    m_page->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
     171    m_fullScreenRootLayer = layer->platformLayer();
     172    layer->syncCompositingState();
     173
     174    [[NSNotificationCenter defaultCenter] postNotificationName:@"WebKitLayerHostChanged" object:m_fullScreenRootLayer.get() userInfo:nil];
    172175}
    173176
     
    191194    // content, this can change to use them.  Meanwhile, we'll have to animate the
    192195    // CALayer directly:
    193     CALayer* caLayer = m_fullScreenRootLayer->platformLayer();
     196    CALayer* caLayer = m_fullScreenRootLayer.get();
    194197
    195198    // Create a transformation matrix that will transform the renderer layer such that
     
    246249    // content, this can change to use them.  Meanwhile, we'll have to animate the
    247250    // CALayer directly:
    248     CALayer* caLayer = m_fullScreenRootLayer->platformLayer();
     251    CALayer* caLayer = m_fullScreenRootLayer.get();
    249252
    250253    // Create a transformation matrix that will transform the renderer layer such that
Note: See TracChangeset for help on using the changeset viewer.