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

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 917733002: HTMLCanvasElement.toDataURL should use IDL 'any' to avoid using custom binding. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch rebased! Created 5 years, 10 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
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLCanvasElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 7cdc91b8fb9600d5f5d035b92dc15a92d23a79c4..b49e13120cb5ecb49f152ca83bed4c5d554e9b9d 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -485,14 +485,22 @@ String HTMLCanvasElement::toDataURLInternal(const String& mimeType, const double
return buffer()->toDataURL(encodingMimeType, quality);
}
-String HTMLCanvasElement::toDataURL(const String& mimeType, const double* quality, ExceptionState& exceptionState) const
+String HTMLCanvasElement::toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState& exceptionState) const
{
if (!originClean()) {
exceptionState.throwSecurityError("Tainted canvases may not be exported.");
return String();
}
-
- return toDataURLInternal(mimeType, quality, BackBuffer);
+ double quality;
+ double* qualityPtr = nullptr;
+ if (!qualityArgument.isEmpty()) {
+ v8::Local<v8::Value> v8Value = qualityArgument.v8Value();
+ if (v8Value->IsNumber()) {
+ quality = v8Value->NumberValue();
+ qualityPtr = &quality;
+ }
+ }
+ return toDataURLInternal(mimeType, qualityPtr, BackBuffer);
}
SecurityOrigin* HTMLCanvasElement::securityOrigin() const
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLCanvasElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698