Implement the HTML5 canvas tainting rules to prevent potential data leakage
[WebKit-https.git] / WebCore / html / CanvasPattern.h
index d384d9308290f61d8b291ab779c18068270c2a48..867870204150fadb4ecb48dfd2b03065cbf2ae43 100644 (file)
@@ -32,6 +32,8 @@
 #if PLATFORM(CG)
 #include <wtf/RetainPtr.h>
 #include <ApplicationServices/ApplicationServices.h>
 #if PLATFORM(CG)
 #include <wtf/RetainPtr.h>
 #include <ApplicationServices/ApplicationServices.h>
+#elif PLATFORM(CAIRO)
+#include <cairo.h>
 #endif
 
 namespace WebCore {
 #endif
 
 namespace WebCore {
@@ -46,27 +48,38 @@ namespace WebCore {
         static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&);
 
 #if PLATFORM(CG)
         static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&);
 
 #if PLATFORM(CG)
-        CanvasPattern(CGImageRef, bool repeatX, bool repeatY);
+        CanvasPattern(CGImageRef, bool repeatX, bool repeatY, bool originClean);
+#elif PLATFORM(CAIRO)
+        CanvasPattern(cairo_surface_t*, bool repeatX, bool repeatY, bool originClean);
 #endif
 #endif
-        CanvasPattern(CachedImage*, bool repeatX, bool repeatY);
+        CanvasPattern(CachedImage*, bool repeatX, bool repeatY, bool originClean);
         ~CanvasPattern();
 
 #if PLATFORM(CG)
         CGImageRef platformImage() const { return m_platformImage.get(); }
         ~CanvasPattern();
 
 #if PLATFORM(CG)
         CGImageRef platformImage() const { return m_platformImage.get(); }
+#elif PLATFORM(CAIRO)
+        cairo_surface_t* platformImage() const { return m_platformImage; }
 #endif
         CachedImage* cachedImage() const { return m_cachedImage; }
 
 #if PLATFORM(CG)
         CGPatternRef createPattern(const CGAffineTransform&);
 #endif
         CachedImage* cachedImage() const { return m_cachedImage; }
 
 #if PLATFORM(CG)
         CGPatternRef createPattern(const CGAffineTransform&);
+#elif PLATFORM(CAIRO)
+        cairo_pattern_t* createPattern(const cairo_matrix_t&);
 #endif
 
 #endif
 
+        bool originClean() const { return m_originClean; }
+
     private:
 #if PLATFORM(CG)
         const RetainPtr<CGImageRef> m_platformImage;
     private:
 #if PLATFORM(CG)
         const RetainPtr<CGImageRef> m_platformImage;
+#elif PLATFORM(CAIRO)
+        cairo_surface_t* const m_platformImage;
 #endif
         CachedImage* const m_cachedImage;
         const bool m_repeatX;
         const bool m_repeatY;
 #endif
         CachedImage* const m_cachedImage;
         const bool m_repeatX;
         const bool m_repeatY;
+        bool m_originClean;
     };
 
 } // namespace WebCore
     };
 
 } // namespace WebCore