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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext.h

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 28
29 #include "core/html/HTMLCanvasElement.h" 29 #include "core/html/HTMLCanvasElement.h"
30 #include "wtf/HashSet.h" 30 #include "wtf/HashSet.h"
31 #include "wtf/Noncopyable.h" 31 #include "wtf/Noncopyable.h"
32 #include "wtf/text/StringHash.h" 32 #include "wtf/text/StringHash.h"
33 33
34 namespace blink { class WebLayer; } 34 namespace blink { class WebLayer; }
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 class CanvasPattern;
39 class HTMLCanvasElement; 38 class HTMLCanvasElement;
40 class HTMLImageElement;
41 class HTMLVideoElement;
42 class KURL; 39 class KURL;
43 class WebGLObject; 40 class WebGLObject;
44 41
45 class CanvasRenderingContext { 42 class CanvasRenderingContext {
46 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); WTF_MAKE_FAST_ALLOCATED; 43 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); WTF_MAKE_FAST_ALLOCATED;
47 public: 44 public:
48 virtual ~CanvasRenderingContext() { } 45 virtual ~CanvasRenderingContext() { }
49 46
50 void ref() { m_canvas->ref(); } 47 void ref() { m_canvas->ref(); }
51 void deref() { m_canvas->deref(); } 48 void deref() { m_canvas->deref(); }
52 HTMLCanvasElement* canvas() const { return m_canvas; } 49 HTMLCanvasElement* canvas() const { return m_canvas; }
53 50
54 virtual bool is2d() const { return false; } 51 virtual bool is2d() const { return false; }
55 virtual bool is3d() const { return false; } 52 virtual bool is3d() const { return false; }
56 virtual bool isAccelerated() const { return false; } 53 virtual bool isAccelerated() const { return false; }
57 virtual bool hasAlpha() const { return true; } 54 virtual bool hasAlpha() const { return true; }
58 55
59 virtual void paintRenderingResultsToCanvas() {} 56 virtual void paintRenderingResultsToCanvas() {}
60 57
61 virtual blink::WebLayer* platformLayer() const { return 0; } 58 virtual blink::WebLayer* platformLayer() const { return 0; }
62
63 protected: 59 protected:
64 CanvasRenderingContext(HTMLCanvasElement*); 60 CanvasRenderingContext(HTMLCanvasElement*);
65 bool wouldTaintOrigin(const CanvasPattern*);
66 bool wouldTaintOrigin(const HTMLCanvasElement*);
67 bool wouldTaintOrigin(const HTMLImageElement*);
68 bool wouldTaintOrigin(const HTMLVideoElement*);
69 bool wouldTaintOrigin(const KURL&);
70
71 template<class T> void checkOrigin(const T* arg)
72 {
73 if (wouldTaintOrigin(arg))
74 canvas()->setOriginTainted();
75 }
76 void checkOrigin(const KURL&);
77 61
78 private: 62 private:
79 HTMLCanvasElement* m_canvas; 63 HTMLCanvasElement* m_canvas;
80 HashSet<String> m_cleanURLs;
81 }; 64 };
82 65
83 } // namespace WebCore 66 } // namespace WebCore
84 67
85 #endif 68 #endif
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasImageSource.h ('k') | Source/core/html/canvas/CanvasRenderingContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698