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

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

Issue 2693823002: Allow CSSTransformInterpolationType to merge interpolated values together (Closed)
Patch Set: Rebased Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp
index 12ec3a503119ffdbc25d7b6fa82de8fa1d00fc3d..33019b66467eeef965980b9eb273c382ced87ff0 100644
--- a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp
@@ -27,10 +27,13 @@ class CSSTransformNonInterpolableValue : public NonInterpolableValue {
static PassRefPtr<CSSTransformNonInterpolableValue> create(
CSSTransformNonInterpolableValue&& start,
- CSSTransformNonInterpolableValue&& end) {
+ double startFraction,
+ CSSTransformNonInterpolableValue&& end,
+ double endFraction) {
return adoptRef(new CSSTransformNonInterpolableValue(
- false, std::move(start.transform()), std::move(end.transform()),
- start.isAdditive(), end.isAdditive()));
+ false, start.getInterpolatedTransform(startFraction),
+ end.getInterpolatedTransform(endFraction), start.isAdditive(),
+ end.isAdditive()));
}
PassRefPtr<CSSTransformNonInterpolableValue> composite(
@@ -59,15 +62,15 @@ class CSSTransformNonInterpolableValue : public NonInterpolableValue {
void setSingleAdditive() {
DCHECK(m_isSingle);
m_isStartAdditive = true;
+ m_isEndAdditive = true;
}
TransformOperations getInterpolatedTransform(double progress) const {
- DCHECK(!m_isStartAdditive && !m_isEndAdditive);
- DCHECK(!m_isSingle || progress == 0);
if (progress == 0)
return m_start;
if (progress == 1)
return m_end;
+ DCHECK(!isAdditive());
return m_end.blend(m_start, progress);
}
@@ -89,13 +92,10 @@ class CSSTransformNonInterpolableValue : public NonInterpolableValue {
DCHECK(m_isSingle);
return m_start;
}
- TransformOperations& transform() {
- DCHECK(m_isSingle);
- return m_start;
- }
bool isAdditive() const {
- DCHECK(m_isSingle);
- return m_isStartAdditive;
+ bool result = m_isStartAdditive || m_isEndAdditive;
+ DCHECK(!result || m_isSingle);
+ return result;
}
Vector<RefPtr<TransformOperation>> concat(const TransformOperations& a,
@@ -217,13 +217,16 @@ void CSSTransformInterpolationType::additiveKeyframeHook(
PairwiseInterpolationValue CSSTransformInterpolationType::maybeMergeSingles(
InterpolationValue&& start,
InterpolationValue&& end) const {
+ double startFraction = toInterpolableNumber(*start.interpolableValue).value();
+ double endFraction = toInterpolableNumber(*end.interpolableValue).value();
return PairwiseInterpolationValue(
InterpolableNumber::create(0), InterpolableNumber::create(1),
CSSTransformNonInterpolableValue::create(
std::move(
toCSSTransformNonInterpolableValue(*start.nonInterpolableValue)),
- std::move(
- toCSSTransformNonInterpolableValue(*end.nonInterpolableValue))));
+ startFraction, std::move(toCSSTransformNonInterpolableValue(
+ *end.nonInterpolableValue)),
+ endFraction));
}
InterpolationValue
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698