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

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: applied last corrections Created 6 years, 9 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 a6fa5d710652f1163fb576c1a49ef7f2293862e9..b2cb6faf378fba6f750699a91da7950620099134 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,69 +36,4 @@ CanvasRenderingContext::CanvasRenderingContext(HTMLCanvasElement* canvas)
}
-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()))
- return false;
-
- if (canvas()->securityOrigin()->taintsCanvas(url))
- return true;
-
- if (url.protocolIsData())
- return false;
-
- m_cleanURLs.add(url.string());
- return false;
-}
-
-void CanvasRenderingContext::checkOrigin(const KURL& url)
-{
- if (wouldTaintOrigin(url))
- canvas()->setOriginTainted();
-}
-
} // namespace WebCore
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698