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

Side by Side Diff: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp

Issue 2817093002: Revert of Adds SVGImageElement as a ImageBitmapSource (Closed)
Patch Set: Created 3 years, 8 months 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) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "core/fileapi/Blob.h" 38 #include "core/fileapi/Blob.h"
39 #include "core/frame/ImageBitmap.h" 39 #include "core/frame/ImageBitmap.h"
40 #include "core/frame/LocalDOMWindow.h" 40 #include "core/frame/LocalDOMWindow.h"
41 #include "core/frame/UseCounter.h" 41 #include "core/frame/UseCounter.h"
42 #include "core/html/HTMLCanvasElement.h" 42 #include "core/html/HTMLCanvasElement.h"
43 #include "core/html/HTMLImageElement.h" 43 #include "core/html/HTMLImageElement.h"
44 #include "core/html/HTMLVideoElement.h" 44 #include "core/html/HTMLVideoElement.h"
45 #include "core/html/ImageData.h" 45 #include "core/html/ImageData.h"
46 #include "core/imagebitmap/ImageBitmapOptions.h" 46 #include "core/imagebitmap/ImageBitmapOptions.h"
47 #include "core/offscreencanvas/OffscreenCanvas.h" 47 #include "core/offscreencanvas/OffscreenCanvas.h"
48 #include "core/svg/SVGImageElement.h"
49 #include "core/svg/graphics/SVGImage.h" 48 #include "core/svg/graphics/SVGImage.h"
50 #include "core/workers/WorkerGlobalScope.h" 49 #include "core/workers/WorkerGlobalScope.h"
51 #include "platform/CrossThreadFunctional.h" 50 #include "platform/CrossThreadFunctional.h"
52 #include "platform/SharedBuffer.h" 51 #include "platform/SharedBuffer.h"
53 #include "platform/image-decoders/ImageDecoder.h" 52 #include "platform/image-decoders/ImageDecoder.h"
54 #include "platform/threading/BackgroundTaskRunner.h" 53 #include "platform/threading/BackgroundTaskRunner.h"
55 #include "public/platform/Platform.h" 54 #include "public/platform/Platform.h"
56 #include "public/platform/WebThread.h" 55 #include "public/platform/WebThread.h"
57 #include "public/platform/WebTraceLocation.h" 56 #include "public/platform/WebTraceLocation.h"
58 #include "v8/include/v8.h" 57 #include "v8/include/v8.h"
59 58
60 namespace blink { 59 namespace blink {
61 60
62 static inline ImageBitmapSource* ToImageBitmapSourceInternal( 61 static inline ImageBitmapSource* ToImageBitmapSourceInternal(
63 const ImageBitmapSourceUnion& value, 62 const ImageBitmapSourceUnion& value,
64 ExceptionState& exception_state, 63 ExceptionState& exception_state,
65 const ImageBitmapOptions& options, 64 const ImageBitmapOptions& options,
66 bool has_crop_rect) { 65 bool has_crop_rect) {
67 ImageElementBase* image_element = nullptr;
68 if (value.isHTMLImageElement()) { 66 if (value.isHTMLImageElement()) {
69 if (!(image_element = value.getAsHTMLImageElement())) 67 HTMLImageElement* image_element = value.getAsHTMLImageElement();
70 return nullptr; 68 if (!image_element || !image_element->CachedImage()) {
71 } else if (value.isSVGImageElement()) {
72 if (!(image_element = value.getAsSVGImageElement()))
73 return nullptr;
74 }
75 if (image_element) {
76 if (!image_element->CachedImage()) {
77 exception_state.ThrowDOMException( 69 exception_state.ThrowDOMException(
78 kInvalidStateError, 70 kInvalidStateError,
79 "No image can be retrieved from the provided element."); 71 "No image can be retrieved from the provided element.");
80 return nullptr; 72 return nullptr;
81 } 73 }
82 if (image_element->CachedImage()->GetImage()->IsSVGImage()) { 74 if (image_element->CachedImage()->GetImage()->IsSVGImage()) {
83 SVGImage* image = ToSVGImage(image_element->CachedImage()->GetImage()); 75 SVGImage* image = ToSVGImage(image_element->CachedImage()->GetImage());
84 if (!image->HasIntrinsicDimensions() && 76 if (!image->HasIntrinsicDimensions() &&
85 (!has_crop_rect && 77 (!has_crop_rect &&
86 (!options.hasResizeWidth() || !options.hasResizeHeight()))) { 78 (!options.hasResizeWidth() || !options.hasResizeHeight()))) {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 313 }
322 factory_->DidFinishLoading(this); 314 factory_->DidFinishLoading(this);
323 } 315 }
324 316
325 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { 317 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) {
326 visitor->Trace(factory_); 318 visitor->Trace(factory_);
327 visitor->Trace(resolver_); 319 visitor->Trace(resolver_);
328 } 320 }
329 321
330 } // namespace blink 322 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698