Modified: trunk/Source/WebCore/ChangeLog (99555 => 99556)
--- trunk/Source/WebCore/ChangeLog 2011-11-08 13:22:03 UTC (rev 99555)
+++ trunk/Source/WebCore/ChangeLog 2011-11-08 13:23:24 UTC (rev 99556)
@@ -1,5 +1,19 @@
2011-11-08 Andreas Kling <[email protected]>
+ CSSGradientValue: Devirtualize createGradient().
+ <http://webkit.org/b/71800>
+
+ Reviewed by Antti Koivisto.
+
+ Make createGradient() non-virtual and call the appropriate subclass
+ implementation in image() based on is{Linear,Radial}Gradient().
+
+ * css/CSSGradientValue.cpp:
+ (WebCore::CSSGradientValue::image):
+ * css/CSSGradientValue.h:
+
+2011-11-08 Andreas Kling <[email protected]>
+
CSSCanvasValue: Remove inheritance from CanvasObserver.
<http://webkit.org/b/71796>
Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (99555 => 99556)
--- trunk/Source/WebCore/css/CSSGradientValue.cpp 2011-11-08 13:22:03 UTC (rev 99555)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp 2011-11-08 13:23:24 UTC (rev 99556)
@@ -58,7 +58,16 @@
}
// We need to create an image.
- RefPtr<Image> newImage = GeneratedImage::create(createGradient(renderer, size), size);
+ RefPtr<Gradient> gradient;
+
+ if (isLinearGradient())
+ gradient = static_cast<CSSLinearGradientValue*>(this)->createGradient(renderer, size);
+ else {
+ ASSERT(isRadialGradient());
+ gradient = static_cast<CSSRadialGradientValue*>(this)->createGradient(renderer, size);
+ }
+
+ RefPtr<Image> newImage = GeneratedImage::create(gradient, size);
if (cacheable)
putImage(size, newImage);
Modified: trunk/Source/WebCore/css/CSSGradientValue.h (99555 => 99556)
--- trunk/Source/WebCore/css/CSSGradientValue.h 2011-11-08 13:22:03 UTC (rev 99555)
+++ trunk/Source/WebCore/css/CSSGradientValue.h 2011-11-08 13:23:24 UTC (rev 99556)
@@ -77,9 +77,6 @@
void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLengthForRepeat = 0);
- // Create the gradient for a given size.
- virtual PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&) = 0;
-
// Resolve points/radii to front end values.
FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize&);
@@ -111,15 +108,15 @@
virtual String cssText() const;
+ // Create the gradient for a given size.
+ PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&);
+
private:
CSSLinearGradientValue(CSSGradientRepeat repeat, bool deprecatedType = false)
: CSSGradientValue(LinearGradientClass, repeat, deprecatedType)
{
}
- // Create the gradient for a given size.
- virtual PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&);
-
RefPtr<CSSPrimitiveValue> m_angle; // may be null.
};
@@ -141,15 +138,15 @@
void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizontalSize = val; }
void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSize = val; }
+ // Create the gradient for a given size.
+ PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&);
+
private:
CSSRadialGradientValue(CSSGradientRepeat repeat, bool deprecatedType = false)
: CSSGradientValue(RadialGradientClass, repeat, deprecatedType)
{
}
- // Create the gradient for a given size.
- virtual PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&);
-
// Resolve points/radii to front end values.
float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, float* widthOrHeight = 0);