Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 22799020: Web Animations CSS: Support Animation of StyleImage and LengthBox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/animation/AnimatableValue.h ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/css/CSSAnimatableValueFactory.cpp
diff --git a/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
index 7aac3b80f38d6ccdc88158947c22727416ffb692..9e45fa7f40fc88272e523a6f28f86dc2b136e5a9 100644
--- a/Source/core/animation/css/CSSAnimatableValueFactory.cpp
+++ b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
@@ -32,89 +32,20 @@
#include "core/animation/css/CSSAnimatableValueFactory.h"
#include "CSSValueKeywords.h"
+#include "core/animation/AnimatableImage.h"
+#include "core/animation/AnimatableLengthBox.h"
#include "core/animation/AnimatableNumber.h"
#include "core/animation/AnimatableTransform.h"
#include "core/animation/AnimatableUnknown.h"
+#include "core/animation/css/CSSAnimations.h"
+#include "core/css/CSSPrimitiveValue.h"
#include "core/platform/Length.h"
+#include "core/platform/LengthBox.h"
#include "core/rendering/style/RenderStyle.h"
namespace WebCore {
-// FIXME: Handle remaining animatable properties (pulled from CSSPropertyAnimation):
-// CSSPropertyBackgroundColor
-// CSSPropertyBackgroundImage
-// CSSPropertyBackgroundPositionX
-// CSSPropertyBackgroundPositionY
-// CSSPropertyBackgroundSize
-// CSSPropertyBaselineShift
-// CSSPropertyBorderBottomColor
-// CSSPropertyBorderBottomLeftRadius
-// CSSPropertyBorderBottomRightRadius
-// CSSPropertyBorderImageOutset
-// CSSPropertyBorderImageSlice
-// CSSPropertyBorderImageSource
-// CSSPropertyBorderImageWidth
-// CSSPropertyBorderLeftColor
-// CSSPropertyBorderRightColor
-// CSSPropertyBorderTopColor
-// CSSPropertyBorderTopLeftRadius
-// CSSPropertyBorderTopRightRadius
-// CSSPropertyBoxShadow
-// CSSPropertyClip
-// CSSPropertyColor
-// CSSPropertyFill
-// CSSPropertyFillOpacity
-// CSSPropertyFloodColor
-// CSSPropertyFloodOpacity
-// CSSPropertyFontSize
-// CSSPropertyKerning
-// CSSPropertyLetterSpacing
-// CSSPropertyLightingColor
-// CSSPropertyLineHeight
-// CSSPropertyListStyleImage
-// CSSPropertyOpacity
-// CSSPropertyOrphans
-// CSSPropertyOutlineColor
-// CSSPropertyOutlineOffset
-// CSSPropertyOutlineWidth
-// CSSPropertyStopColor
-// CSSPropertyStopOpacity
-// CSSPropertyStroke
-// CSSPropertyStrokeDashoffset
-// CSSPropertyStrokeMiterlimit
-// CSSPropertyStrokeOpacity
-// CSSPropertyStrokeWidth
-// CSSPropertyTextIndent
-// CSSPropertyTextShadow
-// CSSPropertyVisibility
-// CSSPropertyWebkitBackgroundSize
-// CSSPropertyWebkitBorderHorizontalSpacing
-// CSSPropertyWebkitBorderVerticalSpacing
-// CSSPropertyWebkitBoxShadow
-// CSSPropertyWebkitClipPath
-// CSSPropertyWebkitColumnCount
-// CSSPropertyWebkitColumnGap
-// CSSPropertyWebkitColumnRuleColor
-// CSSPropertyWebkitColumnRuleWidth
-// CSSPropertyWebkitColumnWidth
-// CSSPropertyWebkitFilter
-// CSSPropertyWebkitMaskBoxImage
-// CSSPropertyWebkitMaskBoxImageSource
-// CSSPropertyWebkitMaskImage
-// CSSPropertyWebkitMaskPositionX
-// CSSPropertyWebkitMaskPositionY
-// CSSPropertyWebkitMaskSize
-// CSSPropertyWebkitPerspective
-// CSSPropertyWebkitShapeInside
-// CSSPropertyWebkitTextFillColor
-// CSSPropertyWebkitTextStrokeColor
-// CSSPropertyWebkitTransformOriginZ
-// CSSPropertyWidows
-// CSSPropertyWordSpacing
-// CSSPropertyZIndex
-// CSSPropertyZoom
-
static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle* style)
{
switch (length.type()) {
@@ -159,12 +90,29 @@ inline static PassRefPtr<AnimatableValue> createFromDouble(double value)
return AnimatableNumber::create(value, AnimatableNumber::UnitTypeNumber);
}
+inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox lengthBox, const RenderStyle* style)
+{
+ return AnimatableLengthBox::create(
+ createFromLength(lengthBox.left(), style),
+ createFromLength(lengthBox.right(), style),
+ createFromLength(lengthBox.top(), style),
+ createFromLength(lengthBox.bottom(), style));
+}
+
// FIXME: Generate this function.
PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle* style)
{
switch (property) {
case CSSPropertyBorderBottomWidth:
return createFromDouble(style->borderBottomWidth());
+ case CSSPropertyBorderImageOutset:
+ return createFromLengthBox(style->borderImageOutset(), style);
+ case CSSPropertyBorderImageSlice:
+ return createFromLengthBox(style->borderImageSlices(), style);
+ case CSSPropertyBorderImageSource:
+ return AnimatableImage::create(style->borderImageSource());
+ case CSSPropertyBorderImageWidth:
+ return createFromLengthBox(style->borderImageWidth(), style);
case CSSPropertyBorderLeftWidth:
return createFromDouble(style->borderLeftWidth());
case CSSPropertyBorderRightWidth:
@@ -173,8 +121,12 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop
return createFromDouble(style->borderTopWidth());
case CSSPropertyBottom:
return createFromLength(style->bottom(), style);
+ case CSSPropertyClip:
+ return createFromLengthBox(style->clip(), style);
case CSSPropertyHeight:
return createFromLength(style->height(), style);
+ case CSSPropertyListStyleImage:
+ return AnimatableImage::create(style->listStyleImage());
case CSSPropertyLeft:
return createFromLength(style->left(), style);
case CSSPropertyMarginBottom:
@@ -207,6 +159,10 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop
return createFromLength(style->right(), style);
case CSSPropertyTop:
return createFromLength(style->top(), style);
+ case CSSPropertyWebkitMaskBoxImageSource:
+ return AnimatableImage::create(style->maskBoxImageSource());
+ case CSSPropertyWebkitMaskImage:
+ return AnimatableImage::create(style->maskImage());
case CSSPropertyWebkitPerspectiveOriginX:
return createFromLength(style->perspectiveOriginX(), style);
case CSSPropertyWebkitPerspectiveOriginY:
@@ -220,7 +176,8 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop
case CSSPropertyWidth:
return createFromLength(style->width(), style);
default:
- RELEASE_ASSERT_WITH_MESSAGE(false, "Web Animations not yet implemented: Create AnimatableValue from render style");
+ RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Create AnimatableValue from render style: %s", getPropertyNameString(property).utf8().data());
+ ASSERT_NOT_REACHED();
return 0;
}
}
« no previous file with comments | « Source/core/animation/AnimatableValue.h ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698