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

Unified Diff: third_party/WebKit/Source/core/animation/CSSResolutionInterpolationType.cpp

Issue 2812523002: Support animating <resolution> custom properties (Closed)
Patch Set: Created 3 years, 8 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: third_party/WebKit/Source/core/animation/CSSResolutionInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSResolutionInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSResolutionInterpolationType.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4dd92818739b3aa2569208be19731d468b35acd6
--- /dev/null
+++ b/third_party/WebKit/Source/core/animation/CSSResolutionInterpolationType.cpp
@@ -0,0 +1,37 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/animation/CSSResolutionInterpolationType.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+
+namespace blink {
+
+InterpolationValue CSSResolutionInterpolationType::MaybeConvertNeutral(
+ const InterpolationValue&,
+ ConversionCheckers&) const {
+ return InterpolationValue(InterpolableNumber::Create(0));
+}
+
+InterpolationValue CSSResolutionInterpolationType::MaybeConvertValue(
+ const CSSValue& value,
+ const StyleResolverState*,
+ ConversionCheckers&) const {
+ if (!value.IsPrimitiveValue() ||
+ !CSSPrimitiveValue::IsResolution(
+ ToCSSPrimitiveValue(value).TypeWithCalcResolved()))
+ return nullptr;
+ return InterpolationValue(InterpolableNumber::Create(
+ ToCSSPrimitiveValue(value).ComputeDotsPerPixel()));
+}
+
+const CSSValue* CSSResolutionInterpolationType::CreateCSSValue(
+ const InterpolableValue& value,
+ const NonInterpolableValue*,
+ const StyleResolverState&) const {
+ return CSSPrimitiveValue::Create(ToInterpolableNumber(value).Value(),
+ CSSPrimitiveValue::UnitType::kDotsPerPixel);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698