| 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
| 34 #include "core/dom/ExceptionCode.h" | 34 #include "core/dom/ExceptionCode.h" |
| 35 #include "core/dom/shadow/ShadowRoot.h" | 35 #include "core/dom/shadow/ShadowRoot.h" |
| 36 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
| 37 #include "core/html/HTMLImageLoader.h" | 37 #include "core/html/HTMLImageLoader.h" |
| 38 #include "core/html/canvas/CanvasRenderingContext.h" | 38 #include "core/html/canvas/CanvasRenderingContext.h" |
| 39 #include "core/html/parser/HTMLParserIdioms.h" | 39 #include "core/html/parser/HTMLParserIdioms.h" |
| 40 #include "core/rendering/RenderImage.h" | 40 #include "core/rendering/RenderImage.h" |
| 41 #include "core/rendering/RenderVideo.h" | 41 #include "core/rendering/RenderVideo.h" |
| 42 #include "platform/UserGestureIndicator.h" | 42 #include "platform/UserGestureIndicator.h" |
| 43 #include "platform/graphics/GraphicsContext.h" |
| 44 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 45 #include "public/platform/WebCanvas.h" |
| 46 #include "public/platform/WebGraphicsContext3D.h" |
| 43 | 47 |
| 44 namespace blink { | 48 namespace blink { |
| 45 | 49 |
| 46 using namespace HTMLNames; | 50 using namespace HTMLNames; |
| 47 | 51 |
| 48 inline HTMLVideoElement::HTMLVideoElement(Document& document) | 52 inline HTMLVideoElement::HTMLVideoElement(Document& document) |
| 49 : HTMLMediaElement(videoTag, document) | 53 : HTMLMediaElement(videoTag, document) |
| 50 { | 54 { |
| 51 ScriptWrappable::init(this); | 55 ScriptWrappable::init(this); |
| 52 if (document.settings()) | 56 if (document.settings()) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 void HTMLVideoElement::updateDisplayState() | 194 void HTMLVideoElement::updateDisplayState() |
| 191 { | 195 { |
| 192 if (posterImageURL().isEmpty()) | 196 if (posterImageURL().isEmpty()) |
| 193 setDisplayMode(Video); | 197 setDisplayMode(Video); |
| 194 else if (displayMode() < Poster) | 198 else if (displayMode() < Poster) |
| 195 setDisplayMode(Poster); | 199 setDisplayMode(Poster); |
| 196 } | 200 } |
| 197 | 201 |
| 198 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons
t IntRect& destRect) const | 202 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons
t IntRect& destRect) const |
| 199 { | 203 { |
| 200 MediaPlayer* player = HTMLMediaElement::player(); | 204 if (!webMediaPlayer()) |
| 201 if (!player) | |
| 202 return; | 205 return; |
| 203 player->paint(context, destRect); | 206 if (!context->paintingDisabled()) { |
| 207 WebCanvas* canvas = context->canvas(); |
| 208 webMediaPlayer()->paint(canvas, destRect, context->getNormalizedAlpha())
; |
| 209 } |
| 204 } | 210 } |
| 205 | 211 |
| 206 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(blink::WebGraphicsConte
xt3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum intern
alFormat, bool premultiplyAlpha, bool flipY) | 212 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(WebGraphicsContext3D* c
ontext, Platform3DObject texture, GLint level, GLenum internalFormat, GLenum typ
e, bool premultiplyAlpha, bool flipY) |
| 207 { | 213 { |
| 208 if (!player()) | 214 if (!webMediaPlayer()) |
| 209 return false; | 215 return false; |
| 210 return player()->copyVideoTextureToPlatformTexture(context, texture, level,
type, internalFormat, premultiplyAlpha, flipY); | 216 |
| 217 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, type, level
) || !context->makeContextCurrent()) |
| 218 return false; |
| 219 |
| 220 return webMediaPlayer()->copyVideoTextureToPlatformTexture(context, texture,
level, internalFormat, type, premultiplyAlpha, flipY); |
| 211 } | 221 } |
| 212 | 222 |
| 213 bool HTMLVideoElement::hasAvailableVideoFrame() const | 223 bool HTMLVideoElement::hasAvailableVideoFrame() const |
| 214 { | 224 { |
| 215 if (!webMediaPlayer()) | 225 if (!webMediaPlayer()) |
| 216 return false; | 226 return false; |
| 217 | 227 |
| 218 return webMediaPlayer()->hasVideo() && webMediaPlayer()->readyState() >= bli
nk::WebMediaPlayer::ReadyStateHaveCurrentData; | 228 return webMediaPlayer()->hasVideo() && webMediaPlayer()->readyState() >= bli
nk::WebMediaPlayer::ReadyStateHaveCurrentData; |
| 219 } | 229 } |
| 220 | 230 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 { | 317 { |
| 308 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer()
->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr
c())); | 318 return !hasSingleSecurityOrigin() || (!(webMediaPlayer() && webMediaPlayer()
->didPassCORSAccessCheck()) && destinationSecurityOrigin->taintsCanvas(currentSr
c())); |
| 309 } | 319 } |
| 310 | 320 |
| 311 FloatSize HTMLVideoElement::sourceSize() const | 321 FloatSize HTMLVideoElement::sourceSize() const |
| 312 { | 322 { |
| 313 return FloatSize(videoWidth(), videoHeight()); | 323 return FloatSize(videoWidth(), videoHeight()); |
| 314 } | 324 } |
| 315 | 325 |
| 316 } | 326 } |
| OLD | NEW |