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

Unified Diff: Source/core/animation/EffectInput.cpp

Issue 983073002: Make font-size-adjust animatable. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Do not allow font-size-adjust to animate for none or 0 Created 5 years, 9 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
Index: Source/core/animation/EffectInput.cpp
diff --git a/Source/core/animation/EffectInput.cpp b/Source/core/animation/EffectInput.cpp
index 7dbbf7cfe5498cef29b00d8bc7f75ef7915609b1..ad93440e0ff55816b15fb36814e6ecd28864a918 100644
--- a/Source/core/animation/EffectInput.cpp
+++ b/Source/core/animation/EffectInput.cpp
@@ -43,6 +43,19 @@
namespace blink {
+static bool isValidValueForInterpolation(const CSSPropertyID& property, const CSSValue& value)
+{
+ const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+
+ switch (property) {
+ case CSSPropertyFontSizeAdjust:
+ return primitiveValue.getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) > 0;
+ default:
+ break;
+ }
+ return true;
+}
+
PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState)
{
// FIXME: Remove the dependency on element.
@@ -51,6 +64,7 @@ PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
StyleSheetContents* styleSheetContents = element->document().elementSheet().contents();
StringKeyframeVector keyframes;
+ PropertySet invalidValueProperties;
double lastOffset = 0;
for (const auto& keyframeDictionary : keyframeDictionaryVector) {
@@ -104,9 +118,17 @@ PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c
String value;
DictionaryHelper::get(keyframeDictionary, property, value);
keyframe->setPropertyValue(id, value, styleSheetContents);
+
+ if (!isValidValueForInterpolation(id, *keyframe->propertyValue(id)))
+ invalidValueProperties.add(id);
}
}
+ for (CSSPropertyID property : invalidValueProperties) {
+ for (const auto& keyframe : keyframes)
+ keyframe->clearPropertyValue(property);
+ }
+
RefPtrWillBeRawPtr<StringKeyframeEffectModel> keyframeEffectModel = StringKeyframeEffectModel::create(keyframes);
if (keyframeEffectModel->hasSyntheticKeyframes()) {
exceptionState.throwDOMException(NotSupportedError, "Partial keyframes are not supported.");

Powered by Google App Engine
This is Rietveld 408576698