| 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 15 matching lines...) Expand all Loading... |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/html/HTMLVideoElement.h" | 27 #include "core/html/HTMLVideoElement.h" |
| 28 | 28 |
| 29 #include "CSSPropertyNames.h" | 29 #include "CSSPropertyNames.h" |
| 30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
| 31 #include "bindings/v8/ExceptionState.h" | 31 #include "bindings/v8/ExceptionState.h" |
| 32 #include "core/dom/Attribute.h" | 32 #include "core/dom/Attribute.h" |
| 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/html/HTMLImageLoader.h" | 35 #include "core/html/HTMLImageLoader.h" |
| 36 #include "core/html/canvas/CanvasRenderingContext.h" |
| 36 #include "core/html/parser/HTMLParserIdioms.h" | 37 #include "core/html/parser/HTMLParserIdioms.h" |
| 37 #include "core/frame/Settings.h" | 38 #include "core/frame/Settings.h" |
| 38 #include "core/rendering/RenderImage.h" | 39 #include "core/rendering/RenderImage.h" |
| 39 #include "core/rendering/RenderVideo.h" | 40 #include "core/rendering/RenderVideo.h" |
| 40 #include "platform/UserGestureIndicator.h" | 41 #include "platform/UserGestureIndicator.h" |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| 44 using namespace HTMLNames; | 45 using namespace HTMLNames; |
| 45 | 46 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 167 } |
| 167 | 168 |
| 168 void HTMLVideoElement::updateDisplayState() | 169 void HTMLVideoElement::updateDisplayState() |
| 169 { | 170 { |
| 170 if (posterImageURL().isEmpty()) | 171 if (posterImageURL().isEmpty()) |
| 171 setDisplayMode(Video); | 172 setDisplayMode(Video); |
| 172 else if (displayMode() < Poster) | 173 else if (displayMode() < Poster) |
| 173 setDisplayMode(Poster); | 174 setDisplayMode(Poster); |
| 174 } | 175 } |
| 175 | 176 |
| 176 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons
t IntRect& destRect) | 177 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons
t IntRect& destRect) const |
| 177 { | 178 { |
| 178 MediaPlayer* player = HTMLMediaElement::player(); | 179 MediaPlayer* player = HTMLMediaElement::player(); |
| 179 if (!player) | 180 if (!player) |
| 180 return; | 181 return; |
| 181 player->paint(context, destRect); | 182 player->paint(context, destRect); |
| 182 } | 183 } |
| 183 | 184 |
| 184 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(blink::WebGraphicsConte
xt3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum intern
alFormat, bool premultiplyAlpha, bool flipY) | 185 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(blink::WebGraphicsConte
xt3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum intern
alFormat, bool premultiplyAlpha, bool flipY) |
| 185 { | 186 { |
| 186 if (!player()) | 187 if (!player()) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (url.isEmpty()) | 226 if (url.isEmpty()) |
| 226 return KURL(); | 227 return KURL(); |
| 227 return document().completeURL(url); | 228 return document().completeURL(url); |
| 228 } | 229 } |
| 229 | 230 |
| 230 KURL HTMLVideoElement::mediaPlayerPosterURL() | 231 KURL HTMLVideoElement::mediaPlayerPosterURL() |
| 231 { | 232 { |
| 232 return posterImageURL(); | 233 return posterImageURL(); |
| 233 } | 234 } |
| 234 | 235 |
| 236 PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageMode mode
, SourceImageStatus* status) const |
| 237 { |
| 238 if (!hasAvailableVideoFrame()) { |
| 239 *status = InvalidSourceImageStatus; |
| 240 return nullptr; |
| 241 } |
| 242 |
| 243 IntSize intrinsicSize(videoWidth(), videoHeight()); |
| 244 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); |
| 245 if (!imageBuffer) { |
| 246 *status = InvalidSourceImageStatus; |
| 247 return nullptr; |
| 248 } |
| 249 |
| 250 paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), i
ntrinsicSize)); |
| 251 |
| 252 *status = NormalSourceImageStatus; |
| 253 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin
gStore : DontCopyBackingStore, Unscaled); |
| 235 } | 254 } |
| 255 |
| 256 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi
n) const |
| 257 { |
| 258 return !hasSingleSecurityOrigin() || (!(player() && player()->didPassCORSAcc
essCheck()) && destinationSecurityOrigin->taintsCanvas(currentSrc())); |
| 259 } |
| 260 |
| 261 FloatSize HTMLVideoElement::sourceSize() const |
| 262 { |
| 263 return FloatSize(videoWidth(), videoHeight()); |
| 264 } |
| 265 |
| 266 } |
| OLD | NEW |