| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "platform/graphics/gpu/Extensions3DUtil.h" | 45 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 46 #include "public/platform/WebCanvas.h" | 46 #include "public/platform/WebCanvas.h" |
| 47 #include "public/platform/WebGraphicsContext3D.h" | 47 #include "public/platform/WebGraphicsContext3D.h" |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 using namespace HTMLNames; | 51 using namespace HTMLNames; |
| 52 | 52 |
| 53 inline HTMLVideoElement::HTMLVideoElement(Document& document) | 53 inline HTMLVideoElement::HTMLVideoElement(Document& document) |
| 54 : HTMLMediaElement(videoTag, document) | 54 : HTMLMediaElement(videoTag, document) |
| 55 , m_displayMode(Unknown) |
| 55 { | 56 { |
| 56 if (document.settings()) | 57 if (document.settings()) |
| 57 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste
rURL()); | 58 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste
rURL()); |
| 58 } | 59 } |
| 59 | 60 |
| 60 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu
ment) | 61 PassRefPtrWillBeRawPtr<HTMLVideoElement> HTMLVideoElement::create(Document& docu
ment) |
| 61 { | 62 { |
| 62 RefPtrWillBeRawPtr<HTMLVideoElement> video = adoptRefWillBeNoop(new HTMLVide
oElement(document)); | 63 RefPtrWillBeRawPtr<HTMLVideoElement> video = adoptRefWillBeNoop(new HTMLVide
oElement(document)); |
| 63 video->ensureUserAgentShadowRoot(); | 64 video->ensureUserAgentShadowRoot(); |
| 64 video->suspendIfNeeded(); | 65 video->suspendIfNeeded(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return HTMLMediaElement::isPresentationAttribute(name); | 113 return HTMLMediaElement::isPresentationAttribute(name); |
| 113 } | 114 } |
| 114 | 115 |
| 115 void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 116 void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 116 { | 117 { |
| 117 if (name == posterAttr) { | 118 if (name == posterAttr) { |
| 118 // In case the poster attribute is set after playback, don't update the | 119 // In case the poster attribute is set after playback, don't update the |
| 119 // display state, post playback the correct state will be picked up. | 120 // display state, post playback the correct state will be picked up. |
| 120 if (displayMode() < Video || !hasAvailableVideoFrame()) { | 121 if (displayMode() < Video || !hasAvailableVideoFrame()) { |
| 121 // Force a poster recalc by setting m_displayMode to Unknown directl
y before calling updateDisplayState. | 122 // Force a poster recalc by setting m_displayMode to Unknown directl
y before calling updateDisplayState. |
| 122 HTMLMediaElement::setDisplayMode(Unknown); | 123 m_displayMode = Unknown; |
| 123 updateDisplayState(); | 124 updateDisplayState(); |
| 124 } | 125 } |
| 125 if (!posterImageURL().isEmpty()) { | 126 if (!posterImageURL().isEmpty()) { |
| 126 if (!m_imageLoader) | 127 if (!m_imageLoader) |
| 127 m_imageLoader = HTMLImageLoader::create(this); | 128 m_imageLoader = HTMLImageLoader::create(this); |
| 128 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); | 129 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); |
| 129 } else { | 130 } else { |
| 130 if (layoutObject()) | 131 if (layoutObject()) |
| 131 toLayoutImage(layoutObject())->imageResource()->setImageResource
(0); | 132 toLayoutImage(layoutObject())->imageResource()->setImageResource
(0); |
| 132 } | 133 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 173 |
| 173 if (!poster.isEmpty()) { | 174 if (!poster.isEmpty()) { |
| 174 // We have a poster path, but only show it until the user triggers displ
ay by playing or seeking and the | 175 // We have a poster path, but only show it until the user triggers displ
ay by playing or seeking and the |
| 175 // media engine has something to display. | 176 // media engine has something to display. |
| 176 // Don't show the poster if there is a seek operation or | 177 // Don't show the poster if there is a seek operation or |
| 177 // the video has restarted because of loop attribute | 178 // the video has restarted because of loop attribute |
| 178 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) | 179 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) |
| 179 return; | 180 return; |
| 180 } | 181 } |
| 181 | 182 |
| 182 HTMLMediaElement::setDisplayMode(mode); | 183 m_displayMode = mode; |
| 183 | 184 |
| 184 if (layoutObject() && displayMode() != oldMode) | 185 if (layoutObject() && displayMode() != oldMode) |
| 185 layoutObject()->updateFromElement(); | 186 layoutObject()->updateFromElement(); |
| 186 } | 187 } |
| 187 | 188 |
| 188 void HTMLVideoElement::updateDisplayState() | 189 void HTMLVideoElement::updateDisplayState() |
| 189 { | 190 { |
| 190 if (posterImageURL().isEmpty()) | 191 if (posterImageURL().isEmpty()) |
| 191 setDisplayMode(Video); | 192 setDisplayMode(Video); |
| 192 else if (displayMode() < Poster) | 193 else if (displayMode() < Poster) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 { | 320 { |
| 320 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); | 321 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); |
| 321 } | 322 } |
| 322 | 323 |
| 323 FloatSize HTMLVideoElement::elementSize() const | 324 FloatSize HTMLVideoElement::elementSize() const |
| 324 { | 325 { |
| 325 return FloatSize(videoWidth(), videoHeight()); | 326 return FloatSize(videoWidth(), videoHeight()); |
| 326 } | 327 } |
| 327 | 328 |
| 328 } // namespace blink | 329 } // namespace blink |
| OLD | NEW |