| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 return HTMLMediaElement::isPresentationAttribute(name); | 113 return HTMLMediaElement::isPresentationAttribute(name); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void HTMLVideoElement::parseAttribute(const QualifiedName& name, | 116 void HTMLVideoElement::parseAttribute(const QualifiedName& name, |
| 117 const AtomicString& oldValue, | 117 const AtomicString& oldValue, |
| 118 const AtomicString& value) { | 118 const AtomicString& value) { |
| 119 if (name == posterAttr) { | 119 if (name == posterAttr) { |
| 120 // In case the poster attribute is set after playback, don't update the | 120 // In case the poster attribute is set after playback, don't update the |
| 121 // display state, post playback the correct state will be picked up. | 121 // display state, post playback the correct state will be picked up. |
| 122 if (getDisplayMode() < Video || !hasAvailableVideoFrame()) { | 122 if (getDisplayMode() < Video || !hasAvailableVideoFrame()) { |
| 123 // Force a poster recalc by setting m_displayMode to Unknown directly befo
re calling updateDisplayState. | 123 // Force a poster recalc by setting m_displayMode to Unknown directly |
| 124 // before calling updateDisplayState. |
| 124 HTMLMediaElement::setDisplayMode(Unknown); | 125 HTMLMediaElement::setDisplayMode(Unknown); |
| 125 updateDisplayState(); | 126 updateDisplayState(); |
| 126 } | 127 } |
| 127 if (!posterImageURL().isEmpty()) { | 128 if (!posterImageURL().isEmpty()) { |
| 128 if (!m_imageLoader) | 129 if (!m_imageLoader) |
| 129 m_imageLoader = HTMLImageLoader::create(this); | 130 m_imageLoader = HTMLImageLoader::create(this); |
| 130 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousError); | 131 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousError); |
| 131 } else { | 132 } else { |
| 132 if (layoutObject()) | 133 if (layoutObject()) |
| 133 toLayoutImage(layoutObject())->imageResource()->setImageResource(0); | 134 toLayoutImage(layoutObject())->imageResource()->setImageResource(0); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 162 if (!stripLeadingAndTrailingHTMLSpaces(url).isEmpty()) | 163 if (!stripLeadingAndTrailingHTMLSpaces(url).isEmpty()) |
| 163 return url; | 164 return url; |
| 164 return m_defaultPosterURL; | 165 return m_defaultPosterURL; |
| 165 } | 166 } |
| 166 | 167 |
| 167 void HTMLVideoElement::setDisplayMode(DisplayMode mode) { | 168 void HTMLVideoElement::setDisplayMode(DisplayMode mode) { |
| 168 DisplayMode oldMode = getDisplayMode(); | 169 DisplayMode oldMode = getDisplayMode(); |
| 169 KURL poster = posterImageURL(); | 170 KURL poster = posterImageURL(); |
| 170 | 171 |
| 171 if (!poster.isEmpty()) { | 172 if (!poster.isEmpty()) { |
| 172 // We have a poster path, but only show it until the user triggers display b
y playing or seeking and the | 173 // We have a poster path, but only show it until the user triggers display |
| 173 // media engine has something to display. | 174 // by playing or seeking and the media engine has something to display. |
| 174 // Don't show the poster if there is a seek operation or | 175 // Don't show the poster if there is a seek operation or the video has |
| 175 // the video has restarted because of loop attribute | 176 // restarted because of loop attribute |
| 176 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) | 177 if (mode == Video && oldMode == Poster && !hasAvailableVideoFrame()) |
| 177 return; | 178 return; |
| 178 } | 179 } |
| 179 | 180 |
| 180 HTMLMediaElement::setDisplayMode(mode); | 181 HTMLMediaElement::setDisplayMode(mode); |
| 181 | 182 |
| 182 if (layoutObject() && getDisplayMode() != oldMode) | 183 if (layoutObject() && getDisplayMode() != oldMode) |
| 183 layoutObject()->updateFromElement(); | 184 layoutObject()->updateFromElement(); |
| 184 } | 185 } |
| 185 | 186 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 SourceImageStatus* status, | 294 SourceImageStatus* status, |
| 294 AccelerationHint, | 295 AccelerationHint, |
| 295 SnapshotReason, | 296 SnapshotReason, |
| 296 const FloatSize&) const { | 297 const FloatSize&) const { |
| 297 if (!hasAvailableVideoFrame()) { | 298 if (!hasAvailableVideoFrame()) { |
| 298 *status = InvalidSourceImageStatus; | 299 *status = InvalidSourceImageStatus; |
| 299 return nullptr; | 300 return nullptr; |
| 300 } | 301 } |
| 301 | 302 |
| 302 IntSize intrinsicSize(videoWidth(), videoHeight()); | 303 IntSize intrinsicSize(videoWidth(), videoHeight()); |
| 303 // FIXME: Not sure if we dhould we be doing anything with the AccelerationHint
argument here? | 304 // FIXME: Not sure if we dhould we be doing anything with the AccelerationHint |
| 305 // argument here? |
| 304 std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); | 306 std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); |
| 305 if (!imageBuffer) { | 307 if (!imageBuffer) { |
| 306 *status = InvalidSourceImageStatus; | 308 *status = InvalidSourceImageStatus; |
| 307 return nullptr; | 309 return nullptr; |
| 308 } | 310 } |
| 309 | 311 |
| 310 paintCurrentFrame(imageBuffer->canvas(), | 312 paintCurrentFrame(imageBuffer->canvas(), |
| 311 IntRect(IntPoint(0, 0), intrinsicSize), nullptr); | 313 IntRect(IntPoint(0, 0), intrinsicSize), nullptr); |
| 312 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot(); | 314 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot(); |
| 313 if (!snapshot) { | 315 if (!snapshot) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 return ScriptPromise(); | 361 return ScriptPromise(); |
| 360 if (!ImageBitmap::isResizeOptionValid(options, exceptionState)) | 362 if (!ImageBitmap::isResizeOptionValid(options, exceptionState)) |
| 361 return ScriptPromise(); | 363 return ScriptPromise(); |
| 362 return ImageBitmapSource::fulfillImageBitmap( | 364 return ImageBitmapSource::fulfillImageBitmap( |
| 363 scriptState, | 365 scriptState, |
| 364 ImageBitmap::create(this, cropRect, | 366 ImageBitmap::create(this, cropRect, |
| 365 eventTarget.toLocalDOMWindow()->document(), options)); | 367 eventTarget.toLocalDOMWindow()->document(), options)); |
| 366 } | 368 } |
| 367 | 369 |
| 368 } // namespace blink | 370 } // namespace blink |
| OLD | NEW |