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

Unified Diff: Source/core/html/canvas/CanvasRenderingContext.cpp

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: Source/core/html/canvas/CanvasRenderingContext.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext.cpp b/Source/core/html/canvas/CanvasRenderingContext.cpp
index 47a0e616efbfd69748c9a334c842b8e5fa050d32..bf7bb27dfb7ce225192f2e991b59f32ad620d932 100644
--- a/Source/core/html/canvas/CanvasRenderingContext.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext.cpp
@@ -26,10 +26,6 @@
#include "config.h"
#include "core/html/canvas/CanvasRenderingContext.h"
-#include "core/fetch/ImageResource.h"
-#include "core/html/HTMLImageElement.h"
-#include "core/html/HTMLVideoElement.h"
-#include "core/html/canvas/CanvasPattern.h"
#include "platform/weborigin/SecurityOrigin.h"
namespace WebCore {
@@ -40,53 +36,9 @@ CanvasRenderingContext::CanvasRenderingContext(HTMLCanvasElement* canvas)
ScriptWrappable::init(this);
}
-bool CanvasRenderingContext::wouldTaintOrigin(const CanvasPattern* pattern)
-{
- if (canvas()->originClean() && pattern && !pattern->originClean())
- return true;
- return false;
-}
-
-bool CanvasRenderingContext::wouldTaintOrigin(const HTMLCanvasElement* sourceCanvas)
-{
- if (canvas()->originClean() && sourceCanvas && !sourceCanvas->originClean())
- return true;
- return false;
-}
-
-bool CanvasRenderingContext::wouldTaintOrigin(const HTMLImageElement* image)
-{
- if (!image || !canvas()->originClean())
- return false;
-
- ImageResource* cachedImage = image->cachedImage();
- if (!cachedImage->image()->currentFrameHasSingleSecurityOrigin())
- return true;
-
- return wouldTaintOrigin(cachedImage->response().url()) && !cachedImage->passesAccessControlCheck(canvas()->securityOrigin());
-}
-
-bool CanvasRenderingContext::wouldTaintOrigin(const HTMLVideoElement* video)
-{
- // FIXME: This check is likely wrong when a redirect is involved. We need
- // to test the finalURL. Please be careful when fixing this issue not to
- // make currentSrc be the final URL because then the
- // HTMLMediaElement.currentSrc DOM API would leak redirect destinations!
- if (!video || !canvas()->originClean())
- return false;
-
- if (!video->hasSingleSecurityOrigin())
- return true;
-
- if (!(video->player() && video->player()->didPassCORSAccessCheck()) && wouldTaintOrigin(video->currentSrc()))
- return true;
-
- return false;
-}
-
bool CanvasRenderingContext::wouldTaintOrigin(const KURL& url)
{
- if (!canvas()->originClean() || m_cleanURLs.contains(url.string()))
+ if (m_cleanURLs.contains(url.string()))
return false;
if (canvas()->securityOrigin()->taintsCanvas(url))
@@ -99,10 +51,4 @@ bool CanvasRenderingContext::wouldTaintOrigin(const KURL& url)
return false;
}
-void CanvasRenderingContext::checkOrigin(const KURL& url)
-{
- if (wouldTaintOrigin(url))
- canvas()->setOriginTainted();
-}
-
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698