Title: [208615] trunk/Source/WebCore
- Revision
- 208615
- Author
- hy...@apple.com
- Date
- 2016-11-11 15:04:55 -0800 (Fri, 11 Nov 2016)
Log Message
[CSS Parser] Support the spring animation timing function
https://bugs.webkit.org/show_bug.cgi?id=164654
Reviewed by Dean Jackson.
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeSpringFunction):
(WebCore::consumeAnimationTimingFunction):
(WebCore::consumeAnimationValue):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (208614 => 208615)
--- trunk/Source/WebCore/ChangeLog 2016-11-11 23:03:41 UTC (rev 208614)
+++ trunk/Source/WebCore/ChangeLog 2016-11-11 23:04:55 UTC (rev 208615)
@@ -1,3 +1,16 @@
+2016-11-11 Dave Hyatt <hy...@apple.com>
+
+ [CSS Parser] Support the spring animation timing function
+ https://bugs.webkit.org/show_bug.cgi?id=164654
+
+ Reviewed by Dean Jackson.
+
+ * css/CSSValueKeywords.in:
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::consumeSpringFunction):
+ (WebCore::consumeAnimationTimingFunction):
+ (WebCore::consumeAnimationValue):
+
2016-11-11 Chris Dumez <cdu...@apple.com>
WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (208614 => 208615)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2016-11-11 23:03:41 UTC (rev 208614)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2016-11-11 23:04:55 UTC (rev 208615)
@@ -1199,6 +1199,7 @@
drop-shadow
url
cubic-bezier
+spring
steps
// colors
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (208614 => 208615)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-11-11 23:03:41 UTC (rev 208614)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-11-11 23:04:55 UTC (rev 208615)
@@ -1183,8 +1183,42 @@
return nullptr;
}
-static RefPtr<CSSValue> consumeAnimationTimingFunction(CSSParserTokenRange& range)
+static RefPtr<CSSValue> consumeSpringFunction(CSSParserTokenRange& range)
{
+ ASSERT(range.peek().functionId() == CSSValueSpring);
+ CSSParserTokenRange rangeCopy = range;
+ CSSParserTokenRange args = consumeFunction(rangeCopy);
+
+ // Mass must be greater than 0.
+ double mass;
+ if (!consumeNumberRaw(args, mass) || mass <= 0)
+ return nullptr;
+
+ // Stiffness must be greater than 0.
+ double stiffness;
+ if (!consumeNumberRaw(args, stiffness) || stiffness <= 0)
+ return nullptr;
+
+ // Damping coefficient must be greater than or equal to 0.
+ double damping;
+ if (!consumeNumberRaw(args, damping) || damping < 0)
+ return nullptr;
+
+ // Initial velocity may have any value.
+ double initialVelocity;
+ if (!consumeNumberRaw(args, initialVelocity))
+ return nullptr;
+
+ if (!args.atEnd())
+ return nullptr;
+
+ range = rangeCopy;
+
+ return CSSSpringTimingFunctionValue::create(mass, stiffness, damping, initialVelocity);
+}
+
+static RefPtr<CSSValue> consumeAnimationTimingFunction(CSSParserTokenRange& range, const CSSParserContext& context)
+{
CSSValueID id = range.peek().id();
if (id == CSSValueEase || id == CSSValueLinear || id == CSSValueEaseIn
|| id == CSSValueEaseOut || id == CSSValueEaseInOut || id == CSSValueStepStart || id == CSSValueStepEnd)
@@ -1195,6 +1229,8 @@
return consumeCubicBezier(range);
if (function == CSSValueSteps)
return consumeSteps(range);
+ if (context.springTimingFunctionEnabled && function == CSSValueSpring)
+ return consumeSpringFunction(range);
return nullptr;
}
@@ -1221,7 +1257,7 @@
return consumeTransitionProperty(range);
case CSSPropertyAnimationTimingFunction:
case CSSPropertyTransitionTimingFunction:
- return consumeAnimationTimingFunction(range);
+ return consumeAnimationTimingFunction(range, context);
default:
ASSERT_NOT_REACHED();
return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes