Commit 8ab03274 authored by simon.fraser@apple.com's avatar simon.fraser@apple.com
Browse files

2010-02-16 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Eric Carlson.

        With hardware acceleration turned off, video frames never display if poster
        image is specified
        https://bugs.webkit.org/show_bug.cgi?id=34965

        HTMLVideoElement's m_shouldDisplayPosterImage was never updated after
        the movie supplied its first video frame, so the poster would continue to show.

        Fixed by calling updatePosterImage() from mediaPlayerRepaint(), which is called
        each time a new frame is available. updatePosterImage() is cheap.

        Also made updatePosterImage() virtual on HTMLMediaElement to avoid a number of
        ugly casts.

        Test: manual-tests/media-elements/video-replaces-poster.html

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::noneSupported): Call updatePosterImage() without video check.
        (WebCore::HTMLMediaElement::setNetworkState): Ditto.
        (WebCore::HTMLMediaElement::setReadyState): Ditto.
        (WebCore::HTMLMediaElement::mediaPlayerRepaint): Call udpatePosterImage().
        * html/HTMLMediaElement.h:
        (WebCore::HTMLMediaElement::updatePosterImage): Make this an empty virtual
        method on the base class.
        * html/HTMLVideoElement.h: Override updatePosterImage().

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4b6d56a5
2010-02-16 Simon Fraser <simon.fraser@apple.com>
Reviewed by Eric Carlson.
With hardware acceleration turned off, video frames never display if poster
image is specified
https://bugs.webkit.org/show_bug.cgi?id=34965
HTMLVideoElement's m_shouldDisplayPosterImage was never updated after
the movie supplied its first video frame, so the poster would continue to show.
Fixed by calling updatePosterImage() from mediaPlayerRepaint(), which is called
each time a new frame is available. updatePosterImage() is cheap.
Also made updatePosterImage() virtual on HTMLMediaElement to avoid a number of
ugly casts.
Test: manual-tests/media-elements/video-replaces-poster.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::noneSupported): Call updatePosterImage() without video check.
(WebCore::HTMLMediaElement::setNetworkState): Ditto.
(WebCore::HTMLMediaElement::setReadyState): Ditto.
(WebCore::HTMLMediaElement::mediaPlayerRepaint): Call udpatePosterImage().
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::updatePosterImage): Make this an empty virtual
method on the base class.
* html/HTMLVideoElement.h: Override updatePosterImage().
2010-02-16 Simon Fraser <simon.fraser@apple.com>
Build fix for platforms without ACCELERATED_COMPOSITING defined.
......
......@@ -664,8 +664,8 @@ void HTMLMediaElement::noneSupported()
// 9 -Abort these steps. Until the load() method is invoked, the element won't attempt to load another resource.
if (isVideo())
static_cast<HTMLVideoElement*>(this)->updatePosterImage();
updatePosterImage();
if (renderer())
renderer()->updateFromElement();
}
......@@ -743,9 +743,7 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
else if (state == MediaPlayer::FormatError && m_loadState == LoadingFromSrcAttr)
noneSupported();
if (isVideo())
static_cast<HTMLVideoElement*>(this)->updatePosterImage();
updatePosterImage();
return;
}
......@@ -883,8 +881,8 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
shouldUpdatePosterImage = true;
}
if (shouldUpdatePosterImage && isVideo())
static_cast<HTMLVideoElement*>(this)->updatePosterImage();
if (shouldUpdatePosterImage)
updatePosterImage();
updatePlayState();
}
......@@ -1506,6 +1504,8 @@ void HTMLMediaElement::mediaPlayerRepaint(MediaPlayer*)
beginProcessingMediaPlayerCallback();
if (renderer())
renderer()->repaint();
updatePosterImage();
endProcessingMediaPlayerCallback();
}
......
......@@ -183,6 +183,7 @@ protected:
virtual void documentWillBecomeInactive();
virtual void documentDidBecomeActive();
virtual void mediaVolumeDidChange();
virtual void updatePosterImage() { }
void setReadyState(MediaPlayer::ReadyState);
void setNetworkState(MediaPlayer::NetworkState);
......
......@@ -70,7 +70,6 @@ public:
bool webkitSupportsFullscreen();
bool webkitDisplayingFullscreen();
void updatePosterImage();
bool shouldDisplayPosterImage() const { return m_shouldDisplayPosterImage; }
void paint(GraphicsContext*, const IntRect&);
......@@ -79,6 +78,7 @@ public:
private:
virtual bool hasAvailableVideoFrame() const;
virtual void updatePosterImage();
OwnPtr<HTMLImageLoader> m_imageLoader;
KURL m_posterURL;
......
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34965">https://bugs.webkit.org/show_bug.cgi?id=34965</a><br>
Disable accelerated compositing and reload this test. You should see the test video
start playing.</p>
<video width="480" height="270" type="video/mp4"
src="../../../LayoutTests/media/content/test.mp4"
poster="../../../LayoutTests/media/content/abe.png" autoplay>
</video>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment