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> | |
50 | 49 |
51 namespace blink { | 50 namespace blink { |
52 | 51 |
53 using namespace HTMLNames; | 52 using namespace HTMLNames; |
54 | 53 |
55 inline HTMLVideoElement::HTMLVideoElement(Document& document) | 54 inline HTMLVideoElement::HTMLVideoElement(Document& document) |
56 : HTMLMediaElement(videoTag, document) | 55 : HTMLMediaElement(videoTag, document) |
57 { | 56 { |
58 if (document.settings()) | 57 if (document.settings()) |
59 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste
rURL()); | 58 m_defaultPosterURL = AtomicString(document.settings()->defaultVideoPoste
rURL()); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 287 |
289 PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageStatus* s
tatus, AccelerationHint, SnapshotReason, const FloatSize&) const | 288 PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageStatus* s
tatus, AccelerationHint, SnapshotReason, const FloatSize&) const |
290 { | 289 { |
291 if (!hasAvailableVideoFrame()) { | 290 if (!hasAvailableVideoFrame()) { |
292 *status = InvalidSourceImageStatus; | 291 *status = InvalidSourceImageStatus; |
293 return nullptr; | 292 return nullptr; |
294 } | 293 } |
295 | 294 |
296 IntSize intrinsicSize(videoWidth(), videoHeight()); | 295 IntSize intrinsicSize(videoWidth(), videoHeight()); |
297 // FIXME: Not sure if we dhould we be doing anything with the AccelerationHi
nt argument here? | 296 // FIXME: Not sure if we dhould we be doing anything with the AccelerationHi
nt argument here? |
298 std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize
); | 297 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); |
299 if (!imageBuffer) { | 298 if (!imageBuffer) { |
300 *status = InvalidSourceImageStatus; | 299 *status = InvalidSourceImageStatus; |
301 return nullptr; | 300 return nullptr; |
302 } | 301 } |
303 | 302 |
304 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi
ze), nullptr); | 303 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi
ze), nullptr); |
305 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot(); | 304 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot(); |
306 if (!snapshot) { | 305 if (!snapshot) { |
307 *status = InvalidSourceImageStatus; | 306 *status = InvalidSourceImageStatus; |
308 return nullptr; | 307 return nullptr; |
(...skipping 30 matching lines...) Expand all Loading... |
339 return ScriptPromise(); | 338 return ScriptPromise(); |
340 } | 339 } |
341 if (!sw || !sh) { | 340 if (!sw || !sh) { |
342 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")); |
343 return ScriptPromise(); | 342 return ScriptPromise(); |
344 } | 343 } |
345 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); | 344 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); |
346 } | 345 } |
347 | 346 |
348 } // namespace blink | 347 } // namespace blink |
OLD | NEW |