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

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

Issue 14298018: This CL implements the first draft of Canvas 2D Context Attributes, aka getContext('2d', { alpha: f… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased to ToT; test cleanup Created 7 years, 7 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 public: 47 public:
48 virtual ~CanvasRenderingContext() { } 48 virtual ~CanvasRenderingContext() { }
49 49
50 void ref() { m_canvas->ref(); } 50 void ref() { m_canvas->ref(); }
51 void deref() { m_canvas->deref(); } 51 void deref() { m_canvas->deref(); }
52 HTMLCanvasElement* canvas() const { return m_canvas; } 52 HTMLCanvasElement* canvas() const { return m_canvas; }
53 53
54 virtual bool is2d() const { return false; } 54 virtual bool is2d() const { return false; }
55 virtual bool is3d() const { return false; } 55 virtual bool is3d() const { return false; }
56 virtual bool isAccelerated() const { return false; } 56 virtual bool isAccelerated() const { return false; }
57 virtual bool hasAlpha() const { return true; }
57 58
58 virtual void paintRenderingResultsToCanvas() {} 59 virtual void paintRenderingResultsToCanvas() {}
59 60
60 virtual PlatformLayer* platformLayer() const { return 0; } 61 virtual PlatformLayer* platformLayer() const { return 0; }
61 62
62 protected: 63 protected:
63 CanvasRenderingContext(HTMLCanvasElement*); 64 CanvasRenderingContext(HTMLCanvasElement*);
64 bool wouldTaintOrigin(const CanvasPattern*); 65 bool wouldTaintOrigin(const CanvasPattern*);
65 bool wouldTaintOrigin(const HTMLCanvasElement*); 66 bool wouldTaintOrigin(const HTMLCanvasElement*);
66 bool wouldTaintOrigin(const HTMLImageElement*); 67 bool wouldTaintOrigin(const HTMLImageElement*);
67 bool wouldTaintOrigin(const HTMLVideoElement*); 68 bool wouldTaintOrigin(const HTMLVideoElement*);
68 bool wouldTaintOrigin(const KURL&); 69 bool wouldTaintOrigin(const KURL&);
69 70
70 template<class T> void checkOrigin(const T* arg) 71 template<class T> void checkOrigin(const T* arg)
71 { 72 {
72 if (wouldTaintOrigin(arg)) 73 if (wouldTaintOrigin(arg))
73 canvas()->setOriginTainted(); 74 canvas()->setOriginTainted();
74 } 75 }
75 void checkOrigin(const KURL&); 76 void checkOrigin(const KURL&);
76 77
77 private: 78 private:
78 HTMLCanvasElement* m_canvas; 79 HTMLCanvasElement* m_canvas;
79 HashSet<String> m_cleanURLs; 80 HashSet<String> m_cleanURLs;
80 }; 81 };
81 82
82 } // namespace WebCore 83 } // namespace WebCore
83 84
84 #endif 85 #endif
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasContextAttributes.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698