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

Side by Side Diff: third_party/WebKit/Source/platform/transforms/TranslateTransformOperation.cpp

Issue 2667923002: Animations: Fix blend to identity for transform: translate Z (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/interpolation/transform-interpolation.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 13 matching lines...) Expand all
24 namespace blink { 24 namespace blink {
25 25
26 PassRefPtr<TransformOperation> TranslateTransformOperation::blend( 26 PassRefPtr<TransformOperation> TranslateTransformOperation::blend(
27 const TransformOperation* from, 27 const TransformOperation* from,
28 double progress, 28 double progress,
29 bool blendToIdentity) { 29 bool blendToIdentity) {
30 if (from && !from->canBlendWith(*this)) 30 if (from && !from->canBlendWith(*this))
31 return this; 31 return this;
32 32
33 const Length zeroLength(0, Fixed); 33 const Length zeroLength(0, Fixed);
34 if (blendToIdentity) 34 if (blendToIdentity) {
35 return TranslateTransformOperation::create( 35 return TranslateTransformOperation::create(
36 zeroLength.blend(m_x, progress, ValueRangeAll), 36 zeroLength.blend(m_x, progress, ValueRangeAll),
37 zeroLength.blend(m_y, progress, ValueRangeAll), 37 zeroLength.blend(m_y, progress, ValueRangeAll),
38 blink::blend(0., m_z, progress), m_type); 38 blink::blend(m_z, 0., progress), m_type);
39 }
39 40
40 const TranslateTransformOperation* fromOp = 41 const TranslateTransformOperation* fromOp =
41 static_cast<const TranslateTransformOperation*>(from); 42 static_cast<const TranslateTransformOperation*>(from);
42 Length fromX = fromOp ? fromOp->m_x : zeroLength; 43 Length fromX = fromOp ? fromOp->m_x : zeroLength;
43 Length fromY = fromOp ? fromOp->m_y : zeroLength; 44 Length fromY = fromOp ? fromOp->m_y : zeroLength;
44 double fromZ = fromOp ? fromOp->m_z : 0; 45 double fromZ = fromOp ? fromOp->m_z : 0;
45 return TranslateTransformOperation::create( 46 return TranslateTransformOperation::create(
46 m_x.blend(fromX, progress, ValueRangeAll), 47 m_x.blend(fromX, progress, ValueRangeAll),
47 m_y.blend(fromY, progress, ValueRangeAll), 48 m_y.blend(fromY, progress, ValueRangeAll),
48 blink::blend(fromZ, m_z, progress), m_type); 49 blink::blend(fromZ, m_z, progress), m_type);
49 } 50 }
50 51
51 bool TranslateTransformOperation::canBlendWith( 52 bool TranslateTransformOperation::canBlendWith(
52 const TransformOperation& other) const { 53 const TransformOperation& other) const {
53 return other.type() == Translate || other.type() == TranslateX || 54 return other.type() == Translate || other.type() == TranslateX ||
54 other.type() == TranslateY || other.type() == TranslateZ || 55 other.type() == TranslateY || other.type() == TranslateZ ||
55 other.type() == Translate3D; 56 other.type() == Translate3D;
56 } 57 }
57 58
58 PassRefPtr<TranslateTransformOperation> 59 PassRefPtr<TranslateTransformOperation>
59 TranslateTransformOperation::zoomTranslate(double factor) { 60 TranslateTransformOperation::zoomTranslate(double factor) {
60 return create(m_x.zoom(factor), m_y.zoom(factor), m_z * factor, m_type); 61 return create(m_x.zoom(factor), m_y.zoom(factor), m_z * factor, m_type);
61 } 62 }
62 63
63 } // namespace blink 64 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/interpolation/transform-interpolation.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698