OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 bool RenderLayerBacking::startAnimation(double timeOffset, const CSSAnimationDat
a* anim, const KeyframeList& keyframes) | 1765 bool RenderLayerBacking::startAnimation(double timeOffset, const CSSAnimationDat
a* anim, const KeyframeList& keyframes) |
1766 { | 1766 { |
1767 bool hasTransform = renderer()->isBox() && keyframes.containsProperty(CSSPro
pertyWebkitTransform); | 1767 bool hasTransform = renderer()->isBox() && keyframes.containsProperty(CSSPro
pertyWebkitTransform); |
1768 IntSize boxSize; | 1768 IntSize boxSize; |
1769 if (hasTransform) | 1769 if (hasTransform) |
1770 boxSize = toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(); | 1770 boxSize = toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(); |
1771 WebAnimations animations(m_animationProvider->startAnimation(timeOffset, ani
m, keyframes, hasTransform, boxSize)); | 1771 WebAnimations animations(m_animationProvider->startAnimation(timeOffset, ani
m, keyframes, hasTransform, boxSize)); |
1772 if (animations.isEmpty()) | 1772 if (animations.isEmpty()) |
1773 return false; | 1773 return false; |
1774 | 1774 |
1775 bool didAnimate = false; | 1775 bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity); |
1776 if (animations.m_transformAnimation && m_graphicsLayer->addAnimation(animati
ons.m_transformAnimation.get())) | 1776 bool hasFilter = keyframes.containsProperty(CSSPropertyWebkitFilter); |
1777 didAnimate = true; | 1777 int animationId = m_animationProvider->getWebAnimationId(keyframes.animation
Name()); |
1778 if (animations.m_opacityAnimation && m_graphicsLayer->addAnimation(animation
s.m_opacityAnimation.get())) | |
1779 didAnimate = true; | |
1780 if (animations.m_filterAnimation && m_graphicsLayer->addAnimation(animations
.m_filterAnimation.get())) | |
1781 didAnimate = true; | |
1782 | 1778 |
1783 return didAnimate; | 1779 // Animating only some properties of the animation is not supported. So if t
he |
| 1780 // GraphicsLayer rejects any property of the animation, we have to remove th
e |
| 1781 // animation and return false to indicate un-accelerated animation is requir
ed. |
| 1782 if (hasTransform) { |
| 1783 if (!animations.m_transformAnimation || !m_graphicsLayer->addAnimation(a
nimations.m_transformAnimation.get())) |
| 1784 return false; |
| 1785 } |
| 1786 if (hasOpacity) { |
| 1787 if (!animations.m_opacityAnimation || !m_graphicsLayer->addAnimation(ani
mations.m_opacityAnimation.get())) { |
| 1788 if (hasTransform) |
| 1789 m_graphicsLayer->removeAnimation(animationId); |
| 1790 return false; |
| 1791 } |
| 1792 } |
| 1793 if (hasFilter) { |
| 1794 if (!animations.m_filterAnimation || !m_graphicsLayer->addAnimation(anim
ations.m_filterAnimation.get())) { |
| 1795 if (hasTransform || hasOpacity) |
| 1796 m_graphicsLayer->removeAnimation(animationId); |
| 1797 return false; |
| 1798 } |
| 1799 } |
| 1800 return true; |
1784 } | 1801 } |
1785 | 1802 |
1786 void RenderLayerBacking::animationPaused(double timeOffset, const String& animat
ionName) | 1803 void RenderLayerBacking::animationPaused(double timeOffset, const String& animat
ionName) |
1787 { | 1804 { |
1788 int animationId = m_animationProvider->getWebAnimationId(animationName); | 1805 int animationId = m_animationProvider->getWebAnimationId(animationName); |
1789 if (animationId) | 1806 if (animationId) |
1790 m_graphicsLayer->pauseAnimation(animationId, timeOffset); | 1807 m_graphicsLayer->pauseAnimation(animationId, timeOffset); |
1791 } | 1808 } |
1792 | 1809 |
1793 void RenderLayerBacking::animationFinished(const String& animationName) | 1810 void RenderLayerBacking::animationFinished(const String& animationName) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 1957 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
1941 name = "Scrolling Contents Layer"; | 1958 name = "Scrolling Contents Layer"; |
1942 } else { | 1959 } else { |
1943 ASSERT_NOT_REACHED(); | 1960 ASSERT_NOT_REACHED(); |
1944 } | 1961 } |
1945 | 1962 |
1946 return name; | 1963 return name; |
1947 } | 1964 } |
1948 | 1965 |
1949 } // namespace WebCore | 1966 } // namespace WebCore |
OLD | NEW |