2010-02-16 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Feb 2010 21:46:06 +0000 (21:46 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Feb 2010 21:46:06 +0000 (21:46 +0000)
commit32de9af673c25827c44396ae2c01ee0c611c5bfd
tree4665a79579d938824c4df24ce2868cf297f7053e
parent33d8d51b83f9146723b9bc0c2d69197f809ae678
2010-02-16  Simon Fraser  <simon.fraser@apple.com>

        Reviewed by Eric Carlson.

        Autoplaying video with poster doesn't reliably show up
        https://bugs.webkit.org/show_bug.cgi?id=34966

        A timing issue with compositing updates when replacing the poster image
        with the video could cause the video to not display.

        Fix by making video layer hook up more similar to WebGL etc, by having the
        video kick off a recalcStyle() via a SyntheticStyleChange. This requires
        vending a PlaformLayer* from the media player, up through the element.

        Test: media/video-replaces-poster.html

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::mediaPlayerRenderingModeChanged): Use setNeedsStyleRecalc()
        to kick off a compositing update.

        * html/HTMLMediaElement.h:
        (WebCore::HTMLMediaElement::platformLayer): Export the media engine's layer.

        * platform/graphics/MediaPlayer.cpp:
        (WebCore::NullMediaPlayerPrivate::platformLayer): Method to vend the media layer.
        (WebCore::MediaPlayer::platformLayer):

        * platform/graphics/MediaPlayer.h:
        (WebCore::MediaPlayerClient::mediaPlayerRenderingModeChanged): New client callback
        to indicate that the rendering mode changed. The element uses this to kick off a
        recalcStyle.

        * platform/graphics/MediaPlayerPrivate.h:
        (WebCore::MediaPlayerPrivateInterface::platformLayer): Method to vend the media layer.
        * platform/graphics/mac/MediaPlayerPrivateQTKit.h: Ditto
        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivate::createQTMovieLayer): No longer parent the layer directly
        via setContentsToMedia().
        (WebCore::MediaPlayerPrivate::acceleratedRenderingStateChanged): Ditto.
        (WebCore::MediaPlayerPrivate::setUpVideoRendering): Tell the client that the
        rendering mode changed.
        (WebCore::MediaPlayerPrivate::platformLayer): Method to vend the media layer.
        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Call setContentsToMedia()
        here.

        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h: Add platformLayer().
        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
        (WebCore::MediaPlayerPrivate::platformLayer): Method to vend the media layer.
        (WebCore::MediaPlayerPrivate::setUpVideoRendering): Call mediaPlayerRenderingModeChanged()
        (WebCore::MediaPlayerPrivate::createLayerForMovie): Don't parent the layer ourselves any more.

        * rendering/RenderVideo.h: videoGraphicsLayer() is no longer needed.
        * rendering/RenderVideo.cpp: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@54826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/media/video-replaces-poster.html [new file with mode: 0644]
LayoutTests/platform/mac/media/video-replaces-poster-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/media/video-replaces-poster-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/media/video-replaces-poster-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLMediaElement.cpp
WebCore/html/HTMLMediaElement.h
WebCore/platform/graphics/MediaPlayer.cpp
WebCore/platform/graphics/MediaPlayer.h
WebCore/platform/graphics/MediaPlayerPrivate.h
WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h
WebCore/rendering/RenderLayerBacking.cpp
WebCore/rendering/RenderVideo.cpp
WebCore/rendering/RenderVideo.h