OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 virtual void paintRenderingResultsToCanvas() {} | 57 virtual void paintRenderingResultsToCanvas() {} |
58 virtual bool paintsIntoCanvasBuffer() const { return true; } | 58 virtual bool paintsIntoCanvasBuffer() const { return true; } |
59 | 59 |
60 #if USE(ACCELERATED_COMPOSITING) | 60 #if USE(ACCELERATED_COMPOSITING) |
61 virtual PlatformLayer* platformLayer() const { return 0; } | 61 virtual PlatformLayer* platformLayer() const { return 0; } |
62 #endif | 62 #endif |
63 | 63 |
64 protected: | 64 protected: |
65 CanvasRenderingContext(HTMLCanvasElement*); | 65 CanvasRenderingContext(HTMLCanvasElement*); |
66 void checkOrigin(const CanvasPattern*); | 66 bool wouldTaintOrigin(const CanvasPattern*); |
67 void checkOrigin(const HTMLCanvasElement*); | 67 bool wouldTaintOrigin(const HTMLCanvasElement*); |
68 void checkOrigin(const HTMLImageElement*); | 68 bool wouldTaintOrigin(const HTMLImageElement*); |
69 void checkOrigin(const HTMLVideoElement*); | 69 bool wouldTaintOrigin(const HTMLVideoElement*); |
| 70 bool wouldTaintOrigin(const KURL&); |
| 71 |
| 72 template<class T> void checkOrigin(const T* arg) |
| 73 { |
| 74 if (wouldTaintOrigin(arg)) |
| 75 canvas()->setOriginTainted(); |
| 76 } |
70 void checkOrigin(const KURL&); | 77 void checkOrigin(const KURL&); |
71 | 78 |
72 private: | 79 private: |
73 HTMLCanvasElement* m_canvas; | 80 HTMLCanvasElement* m_canvas; |
74 HashSet<String> m_cleanOrigins; | 81 HashSet<String> m_cleanURLs; |
75 }; | 82 }; |
76 | 83 |
77 } // namespace WebCore | 84 } // namespace WebCore |
78 | 85 |
79 #endif | 86 #endif |
OLD | NEW |