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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (name == widthAttr || name == heightAttr) | 111 if (name == widthAttr || name == heightAttr) |
112 return true; | 112 return true; |
113 return HTMLMediaElement::isPresentationAttribute(name); | 113 return HTMLMediaElement::isPresentationAttribute(name); |
114 } | 114 } |
115 | 115 |
116 void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& oldValue, const AtomicString& value) | 116 void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& oldValue, const AtomicString& value) |
117 { | 117 { |
118 if (name == posterAttr) { | 118 if (name == posterAttr) { |
119 // 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 |
120 // display state, post playback the correct state will be picked up. | 120 // display state, post playback the correct state will be picked up. |
121 if (displayMode() < Video || !hasAvailableVideoFrame()) { | 121 if (getDisplayMode() < Video || !hasAvailableVideoFrame()) { |
122 // 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. |
123 HTMLMediaElement::setDisplayMode(Unknown); | 123 HTMLMediaElement::setDisplayMode(Unknown); |
124 updateDisplayState(); | 124 updateDisplayState(); |
125 } | 125 } |
126 if (!posterImageURL().isEmpty()) { | 126 if (!posterImageURL().isEmpty()) { |
127 if (!m_imageLoader) | 127 if (!m_imageLoader) |
128 m_imageLoader = HTMLImageLoader::create(this); | 128 m_imageLoader = HTMLImageLoader::create(this); |
129 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); | 129 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); |
130 } else { | 130 } else { |
131 if (layoutObject()) | 131 if (layoutObject()) |
(...skipping 29 matching lines...) Expand all Loading... |
161 const AtomicString HTMLVideoElement::imageSourceURL() const | 161 const AtomicString HTMLVideoElement::imageSourceURL() const |
162 { | 162 { |
163 const AtomicString& url = getAttribute(posterAttr); | 163 const AtomicString& url = getAttribute(posterAttr); |
164 if (!stripLeadingAndTrailingHTMLSpaces(url).isEmpty()) | 164 if (!stripLeadingAndTrailingHTMLSpaces(url).isEmpty()) |
165 return url; | 165 return url; |
166 return m_defaultPosterURL; | 166 return m_defaultPosterURL; |
167 } | 167 } |
168 | 168 |
169 void HTMLVideoElement::setDisplayMode(DisplayMode mode) | 169 void HTMLVideoElement::setDisplayMode(DisplayMode mode) |
170 { | 170 { |
171 DisplayMode oldMode = displayMode(); | 171 DisplayMode oldMode = getDisplayMode(); |
172 KURL poster = posterImageURL(); | 172 KURL poster = posterImageURL(); |
173 | 173 |
174 if (!poster.isEmpty()) { | 174 if (!poster.isEmpty()) { |
175 // 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 |
176 // media engine has something to display. | 176 // media engine has something to display. |
177 // 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 |
178 // the video has restarted because of loop attribute | 178 // the video has restarted because of loop attribute |
179 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) | 179 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) |
180 return; | 180 return; |
181 } | 181 } |
182 | 182 |
183 HTMLMediaElement::setDisplayMode(mode); | 183 HTMLMediaElement::setDisplayMode(mode); |
184 | 184 |
185 if (layoutObject() && displayMode() != oldMode) | 185 if (layoutObject() && getDisplayMode() != oldMode) |
186 layoutObject()->updateFromElement(); | 186 layoutObject()->updateFromElement(); |
187 } | 187 } |
188 | 188 |
189 void HTMLVideoElement::updateDisplayState() | 189 void HTMLVideoElement::updateDisplayState() |
190 { | 190 { |
191 if (posterImageURL().isEmpty()) | 191 if (posterImageURL().isEmpty()) |
192 setDisplayMode(Video); | 192 setDisplayMode(Video); |
193 else if (displayMode() < Poster) | 193 else if (getDisplayMode() < Poster) |
194 setDisplayMode(Poster); | 194 setDisplayMode(Poster); |
195 } | 195 } |
196 | 196 |
197 void HTMLVideoElement::paintCurrentFrame(SkCanvas* canvas, const IntRect& destRe
ct, const SkPaint* paint) const | 197 void HTMLVideoElement::paintCurrentFrame(SkCanvas* canvas, const IntRect& destRe
ct, const SkPaint* paint) const |
198 { | 198 { |
199 if (!webMediaPlayer()) | 199 if (!webMediaPlayer()) |
200 return; | 200 return; |
201 | 201 |
202 SkXfermode::Mode mode; | 202 SkXfermode::Mode mode; |
203 if (!paint || !SkXfermode::AsMode(paint->getXfermode(), &mode)) | 203 if (!paint || !SkXfermode::AsMode(paint->getXfermode(), &mode)) |
(...skipping 10 matching lines...) Expand all Loading... |
214 | 214 |
215 ASSERT(Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalFo
rmat, type, 0)); | 215 ASSERT(Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalFo
rmat, type, 0)); |
216 return webMediaPlayer()->copyVideoTextureToPlatformTexture(context, texture,
internalFormat, type, premultiplyAlpha, flipY); | 216 return webMediaPlayer()->copyVideoTextureToPlatformTexture(context, texture,
internalFormat, type, premultiplyAlpha, flipY); |
217 } | 217 } |
218 | 218 |
219 bool HTMLVideoElement::hasAvailableVideoFrame() const | 219 bool HTMLVideoElement::hasAvailableVideoFrame() const |
220 { | 220 { |
221 if (!webMediaPlayer()) | 221 if (!webMediaPlayer()) |
222 return false; | 222 return false; |
223 | 223 |
224 return webMediaPlayer()->hasVideo() && webMediaPlayer()->readyState() >= Web
MediaPlayer::ReadyStateHaveCurrentData; | 224 return webMediaPlayer()->hasVideo() && webMediaPlayer()->getReadyState() >=
WebMediaPlayer::ReadyStateHaveCurrentData; |
225 } | 225 } |
226 | 226 |
227 void HTMLVideoElement::webkitEnterFullscreen() | 227 void HTMLVideoElement::webkitEnterFullscreen() |
228 { | 228 { |
229 if (!isFullscreen()) | 229 if (!isFullscreen()) |
230 enterFullscreen(); | 230 enterFullscreen(); |
231 } | 231 } |
232 | 232 |
233 void HTMLVideoElement::webkitExitFullscreen() | 233 void HTMLVideoElement::webkitExitFullscreen() |
234 { | 234 { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 return IntSize(videoWidth(), videoHeight()); | 326 return IntSize(videoWidth(), videoHeight()); |
327 } | 327 } |
328 | 328 |
329 ScriptPromise HTMLVideoElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) | 329 ScriptPromise HTMLVideoElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) |
330 { | 330 { |
331 ASSERT(eventTarget.toDOMWindow()); | 331 ASSERT(eventTarget.toDOMWindow()); |
332 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) { | 332 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) { |
333 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t has not retrieved data."); | 333 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t has not retrieved data."); |
334 return ScriptPromise(); | 334 return ScriptPromise(); |
335 } | 335 } |
336 if (readyState() <= HTMLMediaElement::HAVE_METADATA) { | 336 if (getReadyState() <= HTMLMediaElement::HAVE_METADATA) { |
337 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); | 337 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); |
338 return ScriptPromise(); | 338 return ScriptPromise(); |
339 } | 339 } |
340 if (!sw || !sh) { | 340 if (!sw || !sh) { |
341 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 341 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
342 return ScriptPromise(); | 342 return ScriptPromise(); |
343 } | 343 } |
344 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toDOMWindow()->document(), options)
); | 344 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toDOMWindow()->document(), options)
); |
345 } | 345 } |
346 | 346 |
347 } // namespace blink | 347 } // namespace blink |
OLD | NEW |