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

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

Issue 1928043002: Add drawImage() originClean() getSecurityOrigin() to OffscreenCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: drawImage API added to interface listing Created 4 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 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 1f6d8b41d433809b9034173c9a98df84f4b9f9ce..29c48be833467769c8dbb93287dc9d2d2fd54f10 100644
--- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
@@ -858,7 +858,7 @@ static inline CanvasImageSource* toImageSourceInternal(const CanvasImageSourceUn
return nullptr;
}
-void BaseRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSource, double x, double y, ExceptionState& exceptionState)
+void BaseRenderingContext2D::drawImage(ExecutionContext* executionContext, const CanvasImageSourceUnion& imageSource, double x, double y, ExceptionState& exceptionState)
{
CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource, exceptionState);
if (!imageSourceInternal)
@@ -866,10 +866,10 @@ void BaseRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSource
FloatSize defaultObjectSize(width(), height());
FloatSize sourceRectSize = imageSourceInternal->elementSize(defaultObjectSize);
FloatSize destRectSize = imageSourceInternal->defaultDestinationSize(defaultObjectSize);
- drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize.height(), x, y, destRectSize.width(), destRectSize.height(), exceptionState);
+ drawImage(executionContext, imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize.height(), x, y, destRectSize.width(), destRectSize.height(), exceptionState);
}
-void BaseRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSource,
+void BaseRenderingContext2D::drawImage(ExecutionContext* executionContext, const CanvasImageSourceUnion& imageSource,
double x, double y, double width, double height, ExceptionState& exceptionState)
{
CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource, exceptionState);
@@ -877,17 +877,17 @@ void BaseRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSource
return;
FloatSize defaultObjectSize(this->width(), this->height());
FloatSize sourceRectSize = imageSourceInternal->elementSize(defaultObjectSize);
- drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize.height(), x, y, width, height, exceptionState);
+ drawImage(executionContext, imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize.height(), x, y, width, height, exceptionState);
}
-void BaseRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSource,
+void BaseRenderingContext2D::drawImage(ExecutionContext* executionContext, const CanvasImageSourceUnion& imageSource,
double sx, double sy, double sw, double sh,
double dx, double dy, double dw, double dh, ExceptionState& exceptionState)
{
CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource, exceptionState);
if (!imageSourceInternal)
return;
- drawImage(imageSourceInternal, sx, sy, sw, sh, dx, dy, dw, dh, exceptionState);
+ drawImage(executionContext, imageSourceInternal, sx, sy, sw, sh, dx, dy, dw, dh, exceptionState);
}
bool BaseRenderingContext2D::shouldDrawImageAntialiased(const FloatRect& destRect) const
@@ -981,7 +981,7 @@ bool shouldDisableDeferral(CanvasImageSource* imageSource, DisableDeferralReason
return false;
}
-void BaseRenderingContext2D::drawImage(CanvasImageSource* imageSource,
+void BaseRenderingContext2D::drawImage(ExecutionContext* executionContext, CanvasImageSource* imageSource,
double sx, double sy, double sw, double sh,
double dx, double dy, double dw, double dh, ExceptionState& exceptionState)
{
@@ -1052,7 +1052,7 @@ void BaseRenderingContext2D::drawImage(CanvasImageSource* imageSource,
buffer->setHasExpensiveOp();
}
- if (originClean() && wouldTaintOrigin(imageSource, nullptr))
+ if (originClean() && wouldTaintOrigin(imageSource, executionContext))
setOriginTainted();
}
@@ -1089,7 +1089,7 @@ CanvasGradient* BaseRenderingContext2D::createRadialGradient(double x0, double y
return gradient;
}
-CanvasPattern* BaseRenderingContext2D::createPattern(ScriptState* scriptState, const CanvasImageSourceUnion& imageSource, const String& repetitionType, ExceptionState& exceptionState)
+CanvasPattern* BaseRenderingContext2D::createPattern(ExecutionContext* executionContext, const CanvasImageSourceUnion& imageSource, const String& repetitionType, ExceptionState& exceptionState)
{
Pattern::RepeatMode repeatMode = CanvasPattern::parseRepetitionType(repetitionType, exceptionState);
if (exceptionState.hadException())
@@ -1122,7 +1122,7 @@ CanvasPattern* BaseRenderingContext2D::createPattern(ScriptState* scriptState, c
}
ASSERT(imageForRendering);
- bool originClean = !wouldTaintOrigin(imageSourceInternal, scriptState);
+ bool originClean = !wouldTaintOrigin(imageSourceInternal, executionContext);
return CanvasPattern::create(imageForRendering.release(), repeatMode, originClean);
}

Powered by Google App Engine
This is Rietveld 408576698