Image subclasses should support is<> and downcast<>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Sep 2017 02:40:40 +0000 (02:40 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Sep 2017 02:40:40 +0000 (02:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177209

Reviewed by Tim Horton.

Add SPECIALIZE_TYPE_TRAITS_IMAGE() for Image subclasses.

Also use #pragma once in these headers.

* platform/graphics/CrossfadeGeneratedImage.h:
* platform/graphics/GeneratedImage.h:
* platform/graphics/GradientImage.h:
* platform/graphics/Image.h:
* platform/graphics/NamedImageGeneratedImage.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222246 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h
Source/WebCore/platform/graphics/GeneratedImage.h
Source/WebCore/platform/graphics/GradientImage.h
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/NamedImageGeneratedImage.h

index f73313a..0aba38b 100644 (file)
@@ -1,3 +1,20 @@
+2017-09-19  Simon Fraser  <simon.fraser@apple.com>
+
+        Image subclasses should support is<> and downcast<>
+        https://bugs.webkit.org/show_bug.cgi?id=177209
+
+        Reviewed by Tim Horton.
+
+        Add SPECIALIZE_TYPE_TRAITS_IMAGE() for Image subclasses.
+
+        Also use #pragma once in these headers.
+
+        * platform/graphics/CrossfadeGeneratedImage.h:
+        * platform/graphics/GeneratedImage.h:
+        * platform/graphics/GradientImage.h:
+        * platform/graphics/Image.h:
+        * platform/graphics/NamedImageGeneratedImage.h:
+
 2017-09-19  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         REGRESSION (r215613): Incorrect corners clipping with border-radius
index ec6dcc4..73208aa 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CrossfadeGeneratedImage_h
-#define CrossfadeGeneratedImage_h
+#pragma once
 
 #include "FloatSize.h"
 #include "GeneratedImage.h"
@@ -68,4 +67,4 @@ private:
 
 }
 
-#endif
+SPECIALIZE_TYPE_TRAITS_IMAGE(CrossfadeGeneratedImage)
index d5f5b71..de95d80 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef GeneratedImage_h
-#define GeneratedImage_h
+#pragma once
 
 #include "FloatSize.h"
 #include "Image.h"
@@ -64,4 +63,4 @@ private:
 
 }
 
-#endif
+SPECIALIZE_TYPE_TRAITS_IMAGE(GeneratedImage)
index 4a68499..d3e6575 100644 (file)
@@ -41,6 +41,8 @@ public:
 
     virtual ~GradientImage();
 
+    const Gradient& gradient() const { return m_gradient.get(); }
+
 private:
     GradientImage(Gradient&, const FloatSize&);
 
@@ -56,3 +58,5 @@ private:
 };
 
 }
+
+SPECIALIZE_TYPE_TRAITS_IMAGE(GradientImage)
index f006705..54a4f3b 100644 (file)
@@ -24,8 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef Image_h
-#define Image_h
+#pragma once
 
 #include "Color.h"
 #include "DecodingOptions.h"
@@ -217,4 +216,3 @@ SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToClassName) \
     static bool isType(const WebCore::Image& image) { return image.is##ToClassName(); } \
 SPECIALIZE_TYPE_TRAITS_END()
 
-#endif // Image_h
index 2e5d716..1ac825f 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef NamedImageGeneratedImage_h
-#define NamedImageGeneratedImage_h
+#pragma once
 
 #include "FloatSize.h"
 #include "GeneratedImage.h"
@@ -54,4 +53,4 @@ private:
 
 }
 
-#endif
+SPECIALIZE_TYPE_TRAITS_IMAGE(NamedImageGeneratedImage)