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

Unified Diff: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp

Issue 2351363002: Make CSSStyleImageValue a member of CanvasImageSource. (Closed)
Patch Set: added additional nullptr checks to getSourceImageForCanvas, changed toImageSourceInternal to includ… Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
index e0db5591d855ae297d2134e964605ecc916ca831..619496afd06b69b4a33144010c35a2fa809990b8 100644
--- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
@@ -7,6 +7,7 @@
#include "bindings/core/v8/ExceptionMessages.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
+#include "core/css/cssom/CSSURLImageValue.h"
#include "core/css/parser/CSSParser.h"
#include "core/frame/ImageBitmap.h"
#include "core/html/HTMLCanvasElement.h"
@@ -19,6 +20,7 @@
#include "modules/canvas2d/CanvasStyle.h"
#include "modules/canvas2d/Path2D.h"
#include "platform/Histogram.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/geometry/FloatQuad.h"
#include "platform/graphics/Color.h"
#include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
@@ -867,6 +869,8 @@ static inline void clipRectsToImageRect(const FloatRect& imageRect, FloatRect* s
static inline CanvasImageSource* toImageSourceInternal(const CanvasImageSourceUnion& value, ExceptionState& exceptionState)
{
+ if (value.isCSSImageValue())
+ return RuntimeEnabledFeatures::cssPaintAPIEnabled() ? value.getAsCSSImageValue() : nullptr;
Justin Novosad 2016/09/28 17:12:33 Good idea to do it this way.
Justin Novosad 2016/09/28 17:17:35 Wait a second... To be correct, a TypeError except
Gleb Lanbin 2016/09/28 17:47:00 Done.
if (value.isHTMLImageElement())
return value.getAsHTMLImageElement();
if (value.isHTMLVideoElement())

Powered by Google App Engine
This is Rietveld 408576698