Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLVideoElement.cpp

Issue 1455763002: Use union type in ImageBitmapFactories.idl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using polymophism in ImageBitmapSource Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 #include "core/html/HTMLVideoElement.h" 27 #include "core/html/HTMLVideoElement.h"
28 28
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "core/CSSPropertyNames.h" 30 #include "core/CSSPropertyNames.h"
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.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/dom/Fullscreen.h" 35 #include "core/dom/Fullscreen.h"
36 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
37 #include "core/frame/ImageBitmap.h"
37 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
38 #include "core/html/parser/HTMLParserIdioms.h" 39 #include "core/html/parser/HTMLParserIdioms.h"
39 #include "core/layout/LayoutImage.h" 40 #include "core/layout/LayoutImage.h"
40 #include "core/layout/LayoutVideo.h" 41 #include "core/layout/LayoutVideo.h"
41 #include "platform/RuntimeEnabledFeatures.h" 42 #include "platform/RuntimeEnabledFeatures.h"
42 #include "platform/UserGestureIndicator.h" 43 #include "platform/UserGestureIndicator.h"
43 #include "platform/graphics/GraphicsContext.h" 44 #include "platform/graphics/GraphicsContext.h"
44 #include "platform/graphics/ImageBuffer.h" 45 #include "platform/graphics/ImageBuffer.h"
45 #include "platform/graphics/gpu/Extensions3DUtil.h" 46 #include "platform/graphics/gpu/Extensions3DUtil.h"
46 #include "public/platform/WebCanvas.h" 47 #include "public/platform/WebCanvas.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const 314 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const
314 { 315 {
315 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); 316 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin);
316 } 317 }
317 318
318 FloatSize HTMLVideoElement::elementSize() const 319 FloatSize HTMLVideoElement::elementSize() const
319 { 320 {
320 return FloatSize(videoWidth(), videoHeight()); 321 return FloatSize(videoWidth(), videoHeight());
321 } 322 }
322 323
324 IntSize HTMLVideoElement::bitmapSourceSize()
325 {
326 return IntSize(videoWidth(), videoHeight());
327 }
328
329 PassRefPtrWillBeRawPtr<ImageBitmap> HTMLVideoElement::createImageBitmap(EventTar get& eventTarget, ImageBitmapSource* bitmapSource, int sx, int sy, int sw, int s h, ExceptionState& exceptionState)
330 {
331 ASSERT(eventTarget.toDOMWindow());
332 HTMLVideoElement* video = static_cast<HTMLVideoElement*>(bitmapSource);
333 if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) {
334 exceptionState.throwDOMException(InvalidStateError, "The provided elemen t has not retrieved data.");
335 return nullptr;
336 }
337 if (video->readyState() <= HTMLMediaElement::HAVE_METADATA) {
338 exceptionState.throwDOMException(InvalidStateError, "The provided elemen t's player has no current data.");
339 return nullptr;
340 }
341 if (!sw || !sh) {
342 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
343 return nullptr;
344 }
345 if (!video->hasSingleSecurityOrigin()) {
346 exceptionState.throwSecurityError("The source video contains image data from multiple origins.");
347 return nullptr;
348 }
349 if (!video->webMediaPlayer()->didPassCORSAccessCheck()
350 && eventTarget.toDOMWindow()->document()->securityOrigin()->taintsCanvas (video->currentSrc())) {
351 exceptionState.throwSecurityError("Cross-origin access to the source vid eo is denied.");
352 return nullptr;
353 }
354 return ImageBitmap::create(video, IntRect(sx, sy, sw, sh));
355 }
356
323 } // namespace blink 357 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698