Index: third_party/WebKit/Source/core/html/HTMLVideoElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp |
index fe5170644016ab7a1e42efe73e22ff1a051996b1..1d23185800daf4c826720073df69450ba6c81dce 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp |
+++ b/third_party/WebKit/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,6 @@ void HTMLVideoElement::attach(const AttachContext& context) |
{ |
HTMLMediaElement::attach(context); |
- updateDisplayState(); |
if (shouldDisplayPosterImage()) { |
if (!m_imageLoader) |
m_imageLoader = HTMLImageLoader::create(this); |
@@ -115,13 +115,6 @@ bool HTMLVideoElement::isPresentationAttribute(const QualifiedName& name) const |
void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
{ |
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 (!posterImageURL().isEmpty()) { |
if (!m_imageLoader) |
m_imageLoader = HTMLImageLoader::create(this); |
@@ -165,9 +158,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 +167,15 @@ 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(); |
-} |
- |
-void HTMLVideoElement::updateDisplayState() |
-{ |
- if (posterImageURL().isEmpty()) |
- setDisplayMode(Video); |
- else if (displayMode() < Poster) |
- setDisplayMode(Poster); |
+ if (showPoster != m_showPoster) { |
+ m_showPoster = showPoster; |
+ if (layoutObject()) |
+ layoutObject()->updateFromElement(); |
+ } |
} |
void HTMLVideoElement::paintCurrentFrame(SkCanvas* canvas, const IntRect& destRect, const SkPaint* paint) const |