OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "core/rendering/RenderLayer.h" | 36 #include "core/rendering/RenderLayer.h" |
37 #include "core/rendering/RenderObject.h" | 37 #include "core/rendering/RenderObject.h" |
38 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
39 #include "public/platform/WebAnimation.h" | 39 #include "public/platform/WebAnimation.h" |
40 #include "public/platform/WebCompositorSupport.h" | 40 #include "public/platform/WebCompositorSupport.h" |
41 #include "public/platform/WebFloatAnimationCurve.h" | 41 #include "public/platform/WebFloatAnimationCurve.h" |
42 #include "public/platform/WebFloatKeyframe.h" | 42 #include "public/platform/WebFloatKeyframe.h" |
43 | 43 |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
| 46 // ----------------------------------------------------------------------- |
| 47 |
| 48 PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(c
onst LinearTimingFunction* timefunc) |
| 49 { |
| 50 return const_cast<LinearTimingFunction*>(timefunc); |
| 51 } |
| 52 |
| 53 PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(c
onst CubicBezierTimingFunction* timefunc) |
| 54 { |
| 55 switch (timefunc->subType()) { |
| 56 case CubicBezierTimingFunction::EaseIn: |
| 57 return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease
Out); |
| 58 case CubicBezierTimingFunction::EaseOut: |
| 59 return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease
In); |
| 60 case CubicBezierTimingFunction::EaseInOut: |
| 61 return const_cast<CubicBezierTimingFunction*>(timefunc); |
| 62 case CubicBezierTimingFunction::Ease: // Ease is not symmetrical |
| 63 case CubicBezierTimingFunction::Custom: |
| 64 return CubicBezierTimingFunction::create(1 - timefunc->x2(), 1 - timefun
c->y2(), 1 - timefunc->x1(), 1 - timefunc->y1()); |
| 65 default: |
| 66 ASSERT_NOT_REACHED(); |
| 67 return PassRefPtr<TimingFunction>(); |
| 68 } |
| 69 } |
| 70 |
| 71 PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(c
onst ChainedTimingFunction* timefunc) |
| 72 { |
| 73 RefPtr<ChainedTimingFunction> reversed = ChainedTimingFunction::create(); |
| 74 for (size_t i = 0; i < timefunc->m_segments.size(); i++) { |
| 75 size_t index = timefunc->m_segments.size() - i - 1; |
| 76 |
| 77 RefPtr<TimingFunction> rtf = reverse(timefunc->m_segments[index].m_timin
gFunction.get()); |
| 78 reversed->appendSegment(1 - timefunc->m_segments[index].m_min, rtf.get()
); |
| 79 } |
| 80 return reversed; |
| 81 } |
| 82 |
| 83 PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(c
onst TimingFunction* timefunc) |
| 84 { |
| 85 switch (timefunc->type()) { |
| 86 case TimingFunction::LinearFunction: { |
| 87 const LinearTimingFunction* linear = static_cast<const LinearTimingFunct
ion*>(timefunc); |
| 88 return reverse(linear); |
| 89 } |
| 90 case TimingFunction::CubicBezierFunction: { |
| 91 const CubicBezierTimingFunction* cubic = static_cast<const CubicBezierTi
mingFunction*>(timefunc); |
| 92 return reverse(cubic); |
| 93 } |
| 94 case TimingFunction::ChainedFunction: { |
| 95 const ChainedTimingFunction* chained = static_cast<const ChainedTimingFu
nction*>(timefunc); |
| 96 return reverse(chained); |
| 97 } |
| 98 |
| 99 // Steps function can not be reversed. |
| 100 case TimingFunction::StepsFunction: |
| 101 default: |
| 102 ASSERT_NOT_REACHED(); |
| 103 return PassRefPtr<TimingFunction>(); |
| 104 } |
| 105 } |
| 106 |
| 107 // ----------------------------------------------------------------------- |
| 108 |
| 109 |
46 bool CompositorAnimations::isCandidateForCompositorAnimation(const Timing& timin
g, const AnimationEffect* effect) | 110 bool CompositorAnimations::isCandidateForCompositorAnimation(const Timing& timin
g, const AnimationEffect* effect) |
47 { | 111 { |
48 // FIXME: Implement. | 112 // FIXME: Implement. |
49 ASSERT_NOT_REACHED(); | 113 ASSERT_NOT_REACHED(); |
50 return false; | 114 return false; |
51 } | 115 } |
52 | 116 |
53 bool CompositorAnimations::canStartCompositorAnimation(const Element* element) | 117 bool CompositorAnimations::canStartCompositorAnimation(const Element* element) |
54 { | 118 { |
55 return element->renderer() && element->renderer()->compositingState() == Pai
ntsIntoOwnBacking; | 119 return element->renderer() && element->renderer()->compositingState() == Pai
ntsIntoOwnBacking; |
56 } | 120 } |
57 | 121 |
58 void CompositorAnimations::startCompositorAnimation(const Element* element, cons
t Timing&, const AnimationEffect*, Vector<int>& startedAnimationIds) | 122 void CompositorAnimations::startCompositorAnimation(const Element* element, cons
t Timing&, const AnimationEffect*, Vector<int>& startedAnimationIds) |
59 { | 123 { |
60 // FIXME: Implement. | 124 // FIXME: Implement. |
61 ASSERT_NOT_REACHED(); | 125 ASSERT_NOT_REACHED(); |
62 } | 126 } |
63 | 127 |
64 void CompositorAnimations::cancelCompositorAnimation(const Element* element, int
id) | 128 void CompositorAnimations::cancelCompositorAnimation(const Element* element, int
id) |
65 { | 129 { |
66 // FIXME: Implement. | 130 // FIXME: Implement. |
67 ASSERT_NOT_REACHED(); | 131 ASSERT_NOT_REACHED(); |
68 } | 132 } |
69 | 133 |
70 } | 134 } |
OLD | NEW |