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 28 matching lines...) Expand all Loading... |
39 #include "core/html/parser/HTMLParserIdioms.h" | 39 #include "core/html/parser/HTMLParserIdioms.h" |
40 #include "core/imagebitmap/ImageBitmapOptions.h" | 40 #include "core/imagebitmap/ImageBitmapOptions.h" |
41 #include "core/layout/LayoutImage.h" | 41 #include "core/layout/LayoutImage.h" |
42 #include "core/layout/LayoutVideo.h" | 42 #include "core/layout/LayoutVideo.h" |
43 #include "platform/RuntimeEnabledFeatures.h" | 43 #include "platform/RuntimeEnabledFeatures.h" |
44 #include "platform/UserGestureIndicator.h" | 44 #include "platform/UserGestureIndicator.h" |
45 #include "platform/graphics/GraphicsContext.h" | 45 #include "platform/graphics/GraphicsContext.h" |
46 #include "platform/graphics/ImageBuffer.h" | 46 #include "platform/graphics/ImageBuffer.h" |
47 #include "platform/graphics/gpu/Extensions3DUtil.h" | 47 #include "platform/graphics/gpu/Extensions3DUtil.h" |
48 #include "public/platform/WebCanvas.h" | 48 #include "public/platform/WebCanvas.h" |
| 49 #include <memory> |
49 | 50 |
50 namespace blink { | 51 namespace blink { |
51 | 52 |
52 using namespace HTMLNames; | 53 using namespace HTMLNames; |
53 | 54 |
54 inline HTMLVideoElement::HTMLVideoElement(Document& document) | 55 inline HTMLVideoElement::HTMLVideoElement(Document& document) |
55 : HTMLMediaElement(videoTag, document) | 56 : HTMLMediaElement(videoTag, document) |
56 { | 57 { |
57 if (document.settings()) | 58 if (document.settings()) |
58 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste
rURL()); | 59 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste
rURL()); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 288 |
288 PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageStatus* s
tatus, AccelerationHint, SnapshotReason, const FloatSize&) const | 289 PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageStatus* s
tatus, AccelerationHint, SnapshotReason, const FloatSize&) const |
289 { | 290 { |
290 if (!hasAvailableVideoFrame()) { | 291 if (!hasAvailableVideoFrame()) { |
291 *status = InvalidSourceImageStatus; | 292 *status = InvalidSourceImageStatus; |
292 return nullptr; | 293 return nullptr; |
293 } | 294 } |
294 | 295 |
295 IntSize intrinsicSize(videoWidth(), videoHeight()); | 296 IntSize intrinsicSize(videoWidth(), videoHeight()); |
296 // FIXME: Not sure if we dhould we be doing anything with the AccelerationHi
nt argument here? | 297 // FIXME: Not sure if we dhould we be doing anything with the AccelerationHi
nt argument here? |
297 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); | 298 std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize
); |
298 if (!imageBuffer) { | 299 if (!imageBuffer) { |
299 *status = InvalidSourceImageStatus; | 300 *status = InvalidSourceImageStatus; |
300 return nullptr; | 301 return nullptr; |
301 } | 302 } |
302 | 303 |
303 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi
ze), nullptr); | 304 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi
ze), nullptr); |
304 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot(); | 305 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot(); |
305 if (!snapshot) { | 306 if (!snapshot) { |
306 *status = InvalidSourceImageStatus; | 307 *status = InvalidSourceImageStatus; |
307 return nullptr; | 308 return nullptr; |
(...skipping 30 matching lines...) Expand all Loading... |
338 return ScriptPromise(); | 339 return ScriptPromise(); |
339 } | 340 } |
340 if (!sw || !sh) { | 341 if (!sw || !sh) { |
341 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 342 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
342 return ScriptPromise(); | 343 return ScriptPromise(); |
343 } | 344 } |
344 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); | 345 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); |
345 } | 346 } |
346 | 347 |
347 } // namespace blink | 348 } // namespace blink |
OLD | NEW |