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

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

Issue 1926063004: Don't decompose retargeted rotate() transform transitions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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/transitions/retargeted-matching-rotation-transforms.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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #include "platform/transforms/RotateTransformOperation.h" 22 #include "platform/transforms/RotateTransformOperation.h"
23 23
24 #include "platform/animation/AnimationUtilities.h"
25
24 namespace blink { 26 namespace blink {
25 27
26 bool RotateTransformOperation::operator==(const TransformOperation& other) const 28 bool RotateTransformOperation::operator==(const TransformOperation& other) const
27 { 29 {
28 if (!isSameType(other)) 30 if (!isSameType(other))
29 return false; 31 return false;
30 const Rotation& otherRotation = toRotateTransformOperation(other).m_rotation ; 32 const Rotation& otherRotation = toRotateTransformOperation(other).m_rotation ;
31 return m_rotation.axis == otherRotation.axis && m_rotation.angle == otherRot ation.angle; 33 return m_rotation.axis == otherRotation.axis && m_rotation.angle == otherRot ation.angle;
32 } 34 }
33 35
34 bool RotateTransformOperation::getCommonAxis(const RotateTransformOperation* a, const RotateTransformOperation* b, FloatPoint3D& resultAxis, double& resultAngle A, double& resultAngleB) 36 bool RotateTransformOperation::getCommonAxis(const RotateTransformOperation* a, const RotateTransformOperation* b, FloatPoint3D& resultAxis, double& resultAngle A, double& resultAngleB)
35 { 37 {
36 return Rotation::getCommonAxis(a ? a->m_rotation : Rotation(), b ? b->m_rota tion : Rotation(), resultAxis, resultAngleA, resultAngleB); 38 return Rotation::getCommonAxis(a ? a->m_rotation : Rotation(), b ? b->m_rota tion : Rotation(), resultAxis, resultAngleA, resultAngleB);
37 } 39 }
38 40
39 PassRefPtr<TransformOperation> RotateTransformOperation::blend(const TransformOp eration* from, double progress, bool blendToIdentity) 41 PassRefPtr<TransformOperation> RotateTransformOperation::blend(const TransformOp eration* from, double progress, bool blendToIdentity)
40 { 42 {
41 if (from && !from->isSameType(*this)) 43 if (from && !from->isSameType(*this))
42 return this; 44 return this;
43 45
44 if (blendToIdentity) 46 if (blendToIdentity)
45 return RotateTransformOperation::create(Rotation(axis(), angle() * (1 - progress)), m_type); 47 return RotateTransformOperation::create(Rotation(axis(), angle() * (1 - progress)), m_type);
46 48
47 // Optimize for single axis rotation 49 // Optimize for single axis rotation
48 if (!from) 50 if (!from)
49 return RotateTransformOperation::create(Rotation(axis(), angle() * progr ess), m_type); 51 return RotateTransformOperation::create(Rotation(axis(), angle() * progr ess), m_type);
50 52
51 return RotateTransformOperation::create( 53 const RotateTransformOperation& fromRotate = toRotateTransformOperation(*fro m);
52 Rotation::slerp(toRotateTransformOperation(*from).m_rotation, m_rotation , progress), Rotate3D); 54 if (type() == Rotate3D) {
55 return RotateTransformOperation::create(
56 Rotation::slerp(fromRotate.m_rotation, m_rotation, progress), Rotate 3D);
57 }
58
59 ASSERT(axis() == fromRotate.axis());
60 return RotateTransformOperation::create(Rotation(axis(), blink::blend(fromRo tate.angle(), angle(), progress)), m_type);
53 } 61 }
54 62
55 bool RotateTransformOperation::canBlendWith(const TransformOperation& other) con st 63 bool RotateTransformOperation::canBlendWith(const TransformOperation& other) con st
56 { 64 {
57 return other.isSameType(*this); 65 return other.isSameType(*this);
58 } 66 }
59 67
60 } // namespace blink 68 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/transitions/retargeted-matching-rotation-transforms.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698