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

Unified Diff: Source/core/frame/animation/CSSPropertyAnimation.cpp

Issue 55813002: Convert animation and renderer code to know about BorderImageLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@length-relative-die-step-1-4
Patch Set: Created 7 years, 1 month 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
Index: Source/core/frame/animation/CSSPropertyAnimation.cpp
diff --git a/Source/core/frame/animation/CSSPropertyAnimation.cpp b/Source/core/frame/animation/CSSPropertyAnimation.cpp
index 4479e657ef0e3de32f0c946b5c9fe427e32a6ff7..ddd16a5e1f8b8fa6bf886b5f8a34e52381e9469a 100644
--- a/Source/core/frame/animation/CSSPropertyAnimation.cpp
+++ b/Source/core/frame/animation/CSSPropertyAnimation.cpp
@@ -71,10 +71,29 @@ static inline Length blendFunc(const AnimationBase*, const Length& from, const L
return to.blend(from, progress, ValueRangeAll);
}
+static inline LengthOrNumber blendFunc(const AnimationBase* anim, const LengthOrNumber& from, const LengthOrNumber& to, double progress)
+{
+ if (from.isNumber() && to.isNumber())
+ return LengthOrNumber(blendFunc(anim, from.number(), to.number(), progress));
+
+ if (from.isLength() && to.isLength())
+ return LengthOrNumber(blendFunc(anim, from.length(), to.length(), progress));
+
+ return to;
Julien - ping for review 2013/11/02 00:00:03 I don't think this is totally correct. In this cas
shans 2013/11/03 23:59:42 If we're interpolating from a length to a number,
davve 2013/11/04 15:02:28 But no worse than the current code though? (see Le
Julien - ping for review 2013/11/04 18:15:54 Fine point. Agreed to punt this to a separate issu
+}
+
+static inline LengthOrNumberBox blendFunc(const AnimationBase* anim, const LengthOrNumberBox& from, const LengthOrNumberBox& to, double progress)
+{
+ return LengthOrNumberBox(blendFunc(anim, from.top(), to.top(), progress),
+ blendFunc(anim, from.right(), to.right(), progress),
+ blendFunc(anim, from.bottom(), to.bottom(), progress),
+ blendFunc(anim, from.left(), to.left(), progress));
+}
+
static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress)
{
return LengthSize(blendFunc(anim, from.width(), to.width(), progress),
- blendFunc(anim, from.height(), to.height(), progress));
+ blendFunc(anim, from.height(), to.height(), progress));
}
static inline LengthPoint blendFunc(const AnimationBase* anim, const LengthPoint& from, const LengthPoint& to, double progress)
@@ -85,7 +104,7 @@ static inline LengthPoint blendFunc(const AnimationBase* anim, const LengthPoint
static inline IntSize blendFunc(const AnimationBase* anim, const IntSize& from, const IntSize& to, double progress)
{
return IntSize(blendFunc(anim, from.width(), to.width(), progress),
- blendFunc(anim, from.height(), to.height(), progress));
+ blendFunc(anim, from.height(), to.height(), progress));
}
static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress)
@@ -964,8 +983,8 @@ void CSSPropertyAnimation::ensurePropertyMap()
gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource));
gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices));
- gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWidth));
- gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImageOutset));
+ gPropertyWrappers->append(new PropertyWrapper<LengthOrNumberBox>(CSSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWidth));
+ gPropertyWrappers->append(new PropertyWrapper<LengthOrNumberBox>(CSSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImageOutset));
gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource));
gPropertyWrappers->append(new PropertyWrapper<const NinePieceImage&>(CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage));

Powered by Google App Engine
This is Rietveld 408576698