Title: [134679] trunk/Source/WebCore
- Revision
- 134679
- Author
- k...@webkit.org
- Date
- 2012-11-14 15:27:11 -0800 (Wed, 14 Nov 2012)
Log Message
Cleanup BasicShape blending check
https://bugs.webkit.org/show_bug.cgi?id=102289
Reviewed by Daniel Bates.
CSSPropertyAnimation had the same code for varifying that two BasicShape objects can be blended
twice. Refactor the code and add a canBlend method in BasicShape that combines both checks. This
is a preparation for follow-up patches.
Pure refactoring without behavior change, no new tests.
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc): Call new canBlend method for blending verification.
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShape::canBlend): Check if two BasicShape objects can be blended.
(WebCore):
* rendering/style/BasicShapes.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (134678 => 134679)
--- trunk/Source/WebCore/ChangeLog 2012-11-14 23:09:28 UTC (rev 134678)
+++ trunk/Source/WebCore/ChangeLog 2012-11-14 23:27:11 UTC (rev 134679)
@@ -1,5 +1,25 @@
2012-11-14 Dirk Schulze <k...@webkit.org>
+ Cleanup BasicShape blending check
+ https://bugs.webkit.org/show_bug.cgi?id=102289
+
+ Reviewed by Daniel Bates.
+
+ CSSPropertyAnimation had the same code for varifying that two BasicShape objects can be blended
+ twice. Refactor the code and add a canBlend method in BasicShape that combines both checks. This
+ is a preparation for follow-up patches.
+
+ Pure refactoring without behavior change, no new tests.
+
+ * page/animation/CSSPropertyAnimation.cpp:
+ (WebCore::blendFunc): Call new canBlend method for blending verification.
+ * rendering/style/BasicShapes.cpp:
+ (WebCore::BasicShape::canBlend): Check if two BasicShape objects can be blended.
+ (WebCore):
+ * rendering/style/BasicShapes.h:
+
+2012-11-14 Dirk Schulze <k...@webkit.org>
+
[CSS Exclusions] Basic shapes on 'shape-inside' should be animatable
https://bugs.webkit.org/show_bug.cgi?id=102123
Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (134678 => 134679)
--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp 2012-11-14 23:09:28 UTC (rev 134678)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp 2012-11-14 23:27:11 UTC (rev 134679)
@@ -135,28 +135,18 @@
const BasicShape* fromShape = static_cast<ShapeClipPathOperation*>(from)->basicShape();
const BasicShape* toShape = static_cast<ShapeClipPathOperation*>(to)->basicShape();
- // FIXME: Support animations between different shapes in the future.
- if (fromShape->type() != toShape->type())
+ if (!fromShape->canBlend(toShape))
return to;
- // FIXME: Support animations between polygons in the future.
- if (fromShape->type() == BasicShape::BASIC_SHAPE_POLYGON)
- return to;
-
return ShapeClipPathOperation::create(toShape->blend(fromShape, progress));
}
#if ENABLE(CSS_EXCLUSIONS)
static inline PassRefPtr<BasicShape> blendFunc(const AnimationBase*, BasicShape* from, BasicShape* to, double progress)
{
- // FIXME: Support animations between different shapes in the future.
- if (from->type() != to->type())
+ if (!from->canBlend(to))
return to;
- // FIXME: Support animations between polygons in the future.
- if (from->type() == BasicShape::BASIC_SHAPE_POLYGON)
- return to;
-
return to->blend(from, progress);
}
#endif
Modified: trunk/Source/WebCore/rendering/style/BasicShapes.cpp (134678 => 134679)
--- trunk/Source/WebCore/rendering/style/BasicShapes.cpp 2012-11-14 23:09:28 UTC (rev 134678)
+++ trunk/Source/WebCore/rendering/style/BasicShapes.cpp 2012-11-14 23:27:11 UTC (rev 134679)
@@ -37,6 +37,19 @@
namespace WebCore {
+bool BasicShape::canBlend(const BasicShape* other) const
+{
+ // FIXME: Support animations between different shapes in the future.
+ if (type() != other->type())
+ return false;
+
+ // FIXME: Support animations between polygons in the future.
+ if (type() == BasicShape::BASIC_SHAPE_POLYGON)
+ return false;
+
+ return true;
+}
+
void BasicShapeRectangle::path(Path& path, const FloatRect& boundingBox)
{
ASSERT(path.isEmpty());
Modified: trunk/Source/WebCore/rendering/style/BasicShapes.h (134678 => 134679)
--- trunk/Source/WebCore/rendering/style/BasicShapes.h 2012-11-14 23:09:28 UTC (rev 134678)
+++ trunk/Source/WebCore/rendering/style/BasicShapes.h 2012-11-14 23:27:11 UTC (rev 134679)
@@ -52,6 +52,8 @@
BASIC_SHAPE_POLYGON = 4
};
+ bool canBlend(const BasicShape*) const;
+
virtual void path(Path&, const FloatRect&) = 0;
virtual WindRule windRule() const { return RULE_NONZERO; }
virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes