Index: Source/core/css/resolver/AnimatedStyleBuilder.cpp |
diff --git a/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
index 4daaf8bc351bb5f6d13f5ab4c8c020c59e64efe3..a36ba8424495437cf520e4d17ed1a1a6c91d1661 100644 |
--- a/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
+++ b/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
@@ -38,6 +38,7 @@ |
#include "core/animation/AnimatableLength.h" |
#include "core/animation/AnimatableLengthBox.h" |
#include "core/animation/AnimatableLengthSize.h" |
+#include "core/animation/AnimatableRepeatable.h" |
#include "core/animation/AnimatableSVGLength.h" |
#include "core/animation/AnimatableSVGPaint.h" |
#include "core/animation/AnimatableShapeValue.h" |
@@ -99,6 +100,59 @@ SVGLength animatableValueToNonNegativeSVGLength(const AnimatableValue* value) |
return length; |
} |
+template <CSSPropertyID property> |
+void setOnFillLayers(FillLayer* fillLayer, const AnimatableValue* value, StyleResolverState& state) |
+{ |
+ const Vector<RefPtr<AnimatableValue> >& values = toAnimatableRepeatable(value)->values(); |
+ ASSERT(!values.isEmpty()); |
+ FillLayer* prev = 0; |
+ for (size_t i = 0; i < values.size(); ++i) { |
+ if (!fillLayer) { |
+ switch (property) { |
dstockwell
2013/10/09 23:15:07
do we need this switch? if it's not one of these p
alancutter (OOO until 2018)
2013/10/10 00:58:38
Removed switch.
|
+ case CSSPropertyBackgroundImage: |
+ case CSSPropertyBackgroundPositionX: |
+ case CSSPropertyBackgroundPositionY: |
+ fillLayer = new FillLayer(BackgroundFillLayer); |
+ break; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ prev->setNext(fillLayer); |
+ } |
+ switch (property) { |
+ case CSSPropertyBackgroundImage: |
+ fillLayer->setImage(toAnimatableImage(values[i].get())->toStyleImage()); |
+ break; |
+ case CSSPropertyBackgroundPositionX: |
+ fillLayer->setXPosition(animatableValueToLength(values[i].get(), state)); |
+ break; |
+ case CSSPropertyBackgroundPositionY: |
+ fillLayer->setYPosition(animatableValueToLength(values[i].get(), state)); |
+ break; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ prev = fillLayer; |
+ fillLayer = fillLayer->next(); |
+ } |
+ while (fillLayer) { |
+ switch (property) { |
+ case CSSPropertyBackgroundImage: |
+ fillLayer->clearImage(); |
+ break; |
+ case CSSPropertyBackgroundPositionX: |
+ fillLayer->clearXPosition(); |
+ break; |
+ case CSSPropertyBackgroundPositionY: |
+ fillLayer->clearYPosition(); |
+ break; |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ fillLayer = fillLayer->next(); |
+ } |
+} |
+ |
} // namespace |
// FIXME: Generate this function. |
@@ -114,6 +168,15 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
style->setBackgroundColor(toAnimatableColor(value)->color()); |
style->setVisitedLinkBackgroundColor(toAnimatableColor(value)->visitedLinkColor()); |
return; |
+ case CSSPropertyBackgroundImage: |
+ setOnFillLayers<CSSPropertyBackgroundImage>(style->accessBackgroundLayers(), value, state); |
+ return; |
+ case CSSPropertyBackgroundPositionX: |
+ setOnFillLayers<CSSPropertyBackgroundPositionX>(style->accessBackgroundLayers(), value, state); |
+ return; |
+ case CSSPropertyBackgroundPositionY: |
+ setOnFillLayers<CSSPropertyBackgroundPositionY>(style->accessBackgroundLayers(), value, state); |
+ return; |
case CSSPropertyBaselineShift: |
style->setBaselineShiftValue(toAnimatableSVGLength(value)->toSVGLength()); |
return; |