| Index: Source/core/html/HTMLVideoElement.cpp
|
| diff --git a/Source/core/html/HTMLVideoElement.cpp b/Source/core/html/HTMLVideoElement.cpp
|
| index e64a10fd0aa63fa70bd7c1a0daedc0f29a5d553a..640dce8a006a5a93a0cd6604d92a2ebdac9626c6 100644
|
| --- a/Source/core/html/HTMLVideoElement.cpp
|
| +++ b/Source/core/html/HTMLVideoElement.cpp
|
| @@ -52,6 +52,7 @@ using namespace HTMLNames;
|
|
|
| inline HTMLVideoElement::HTMLVideoElement(Document& document)
|
| : HTMLMediaElement(videoTag, document)
|
| + , m_showPoster(true)
|
| {
|
| if (document.settings())
|
| m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPosterURL());
|
| @@ -85,7 +86,7 @@ void HTMLVideoElement::attach(const AttachContext& context)
|
| {
|
| HTMLMediaElement::attach(context);
|
|
|
| - updateDisplayState();
|
| + updateDisplayState(true);
|
| if (shouldDisplayPosterImage()) {
|
| if (!m_imageLoader)
|
| m_imageLoader = HTMLImageLoader::create(this);
|
| @@ -117,10 +118,9 @@ void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
|
| if (name == posterAttr) {
|
| // In case the poster attribute is set after playback, don't update the
|
| // display state, post playback the correct state will be picked up.
|
| - if (displayMode() < Video || !hasAvailableVideoFrame()) {
|
| - // Force a poster recalc by setting m_displayMode to Unknown directly before calling updateDisplayState.
|
| - HTMLMediaElement::setDisplayMode(Unknown);
|
| - updateDisplayState();
|
| + if (m_showPoster || !hasAvailableVideoFrame()) {
|
| + m_showPoster = true;
|
| + updateDisplayState(true);
|
| }
|
| if (!posterImageURL().isEmpty()) {
|
| if (!m_imageLoader)
|
| @@ -165,9 +165,8 @@ const AtomicString HTMLVideoElement::imageSourceURL() const
|
| return m_defaultPosterURL;
|
| }
|
|
|
| -void HTMLVideoElement::setDisplayMode(DisplayMode mode)
|
| +void HTMLVideoElement::setShowPoster(bool showPoster)
|
| {
|
| - DisplayMode oldMode = displayMode();
|
| KURL poster = posterImageURL();
|
|
|
| if (!poster.isEmpty()) {
|
| @@ -175,22 +174,26 @@ void HTMLVideoElement::setDisplayMode(DisplayMode mode)
|
| // media engine has something to display.
|
| // Don't show the poster if there is a seek operation or
|
| // the video has restarted because of loop attribute
|
| - if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame())
|
| + if (!showPoster && m_showPoster && !hasAvailableVideoFrame())
|
| return;
|
| }
|
|
|
| - HTMLMediaElement::setDisplayMode(mode);
|
| -
|
| - if (layoutObject() && displayMode() != oldMode)
|
| - layoutObject()->updateFromElement();
|
| + if (showPoster != m_showPoster) {
|
| + m_showPoster = showPoster;
|
| + if (layoutObject())
|
| + layoutObject()->updateFromElement();
|
| + }
|
| }
|
|
|
| -void HTMLVideoElement::updateDisplayState()
|
| +void HTMLVideoElement::updateDisplayState(bool forceUpdate)
|
| {
|
| - if (posterImageURL().isEmpty())
|
| - setDisplayMode(Video);
|
| - else if (displayMode() < Poster)
|
| - setDisplayMode(Poster);
|
| + if (posterImageURL().isEmpty()) {
|
| + setShowPoster(false);
|
| + } else if (m_showPoster) {
|
| + if (forceUpdate)
|
| + m_showPoster = false;
|
| + setShowPoster(true);
|
| + }
|
| }
|
|
|
| void HTMLVideoElement::paintCurrentFrame(SkCanvas* canvas, const IntRect& destRect, const SkPaint* paint) const
|
|
|