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

Side by Side Diff: Source/core/rendering/CompositedLayerMapping.cpp

Issue 23455058: WIP: WebLayer::addAnimation should transfer the ownership of WebAnimation instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve WebPassOwnPtr so that it is hard to make a mistake. Created 7 years, 2 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 | « Source/core/platform/graphics/GraphicsLayer.cpp ('k') | Source/web/LinkHighlight.h » ('j') | 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) 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 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 return false; 1778 return false;
1779 1779
1780 bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity); 1780 bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity);
1781 bool hasFilter = keyframes.containsProperty(CSSPropertyWebkitFilter); 1781 bool hasFilter = keyframes.containsProperty(CSSPropertyWebkitFilter);
1782 int animationId = m_animationProvider->getWebAnimationId(keyframes.animation Name()); 1782 int animationId = m_animationProvider->getWebAnimationId(keyframes.animation Name());
1783 1783
1784 // Animating only some properties of the animation is not supported. So if t he 1784 // Animating only some properties of the animation is not supported. So if t he
1785 // GraphicsLayer rejects any property of the animation, we have to remove th e 1785 // GraphicsLayer rejects any property of the animation, we have to remove th e
1786 // animation and return false to indicate un-accelerated animation is requir ed. 1786 // animation and return false to indicate un-accelerated animation is requir ed.
1787 if (hasTransform) { 1787 if (hasTransform) {
1788 if (!animations.m_transformAnimation || !m_graphicsLayer->addAnimation(a nimations.m_transformAnimation.get())) 1788 if (!animations.m_transformAnimation || !m_graphicsLayer->addAnimation(a nimations.m_transformAnimation.release()))
1789 return false; 1789 return false;
1790 } 1790 }
1791 if (hasOpacity) { 1791 if (hasOpacity) {
1792 if (!animations.m_opacityAnimation || !m_graphicsLayer->addAnimation(ani mations.m_opacityAnimation.get())) { 1792 if (!animations.m_opacityAnimation || !m_graphicsLayer->addAnimation(ani mations.m_opacityAnimation.release())) {
1793 if (hasTransform) 1793 if (hasTransform)
1794 m_graphicsLayer->removeAnimation(animationId); 1794 m_graphicsLayer->removeAnimation(animationId);
1795 return false; 1795 return false;
1796 } 1796 }
1797 } 1797 }
1798 if (hasFilter) { 1798 if (hasFilter) {
1799 if (!animations.m_filterAnimation || !m_graphicsLayer->addAnimation(anim ations.m_filterAnimation.get())) { 1799 if (!animations.m_filterAnimation || !m_graphicsLayer->addAnimation(anim ations.m_filterAnimation.release())) {
1800 if (hasTransform || hasOpacity) 1800 if (hasTransform || hasOpacity)
1801 m_graphicsLayer->removeAnimation(animationId); 1801 m_graphicsLayer->removeAnimation(animationId);
1802 return false; 1802 return false;
1803 } 1803 }
1804 } 1804 }
1805 return true; 1805 return true;
1806 } 1806 }
1807 1807
1808 void CompositedLayerMapping::animationPaused(double timeOffset, const String& an imationName) 1808 void CompositedLayerMapping::animationPaused(double timeOffset, const String& an imationName)
1809 { 1809 {
(...skipping 20 matching lines...) Expand all
1830 float fromOpacity = 0; 1830 float fromOpacity = 0;
1831 float toOpacity = 0; 1831 float toOpacity = 0;
1832 if (property == CSSPropertyOpacity) { 1832 if (property == CSSPropertyOpacity) {
1833 fromOpacity = compositingOpacity(fromStyle->opacity()); 1833 fromOpacity = compositingOpacity(fromStyle->opacity());
1834 toOpacity = compositingOpacity(toStyle->opacity()); 1834 toOpacity = compositingOpacity(toStyle->opacity());
1835 } 1835 }
1836 1836
1837 // Although KeyframeAnimation can have multiple properties of the animation, ImplicitAnimation (= Transition) has only one animation property. 1837 // Although KeyframeAnimation can have multiple properties of the animation, ImplicitAnimation (= Transition) has only one animation property.
1838 WebAnimations animations(m_animationProvider->startTransition(timeOffset, pr operty, fromStyle, 1838 WebAnimations animations(m_animationProvider->startTransition(timeOffset, pr operty, fromStyle,
1839 toStyle, m_owningLayer->hasTransform(), m_owningLayer->hasFilter(), boxS ize, fromOpacity, toOpacity)); 1839 toStyle, m_owningLayer->hasTransform(), m_owningLayer->hasFilter(), boxS ize, fromOpacity, toOpacity));
1840 if (animations.m_transformAnimation && m_graphicsLayer->addAnimation(animati ons.m_transformAnimation.get())) { 1840 if (animations.m_transformAnimation && m_graphicsLayer->addAnimation(animati ons.m_transformAnimation.release())) {
1841 // To ensure that the correct transform is visible when the animation en ds, also set the final transform. 1841 // To ensure that the correct transform is visible when the animation en ds, also set the final transform.
1842 updateTransform(toStyle); 1842 updateTransform(toStyle);
1843 return true; 1843 return true;
1844 } 1844 }
1845 if (animations.m_opacityAnimation && m_graphicsLayer->addAnimation(animation s.m_opacityAnimation.get())) { 1845 if (animations.m_opacityAnimation && m_graphicsLayer->addAnimation(animation s.m_opacityAnimation.release())) {
1846 // To ensure that the correct opacity is visible when the animation ends , also set the final opacity. 1846 // To ensure that the correct opacity is visible when the animation ends , also set the final opacity.
1847 updateOpacity(toStyle); 1847 updateOpacity(toStyle);
1848 return true; 1848 return true;
1849 } 1849 }
1850 if (animations.m_filterAnimation && m_graphicsLayer->addAnimation(animations .m_filterAnimation.get())) { 1850 if (animations.m_filterAnimation && m_graphicsLayer->addAnimation(animations .m_filterAnimation.release())) {
1851 // To ensure that the correct filter is visible when the animation ends, also set the final filter. 1851 // To ensure that the correct filter is visible when the animation ends, also set the final filter.
1852 updateFilters(toStyle); 1852 updateFilters(toStyle);
1853 ASSERT_NOT_REACHED(); // Chromium compositor cannot accelerate filter ye t. 1853 ASSERT_NOT_REACHED(); // Chromium compositor cannot accelerate filter ye t.
1854 return false; 1854 return false;
1855 } 1855 }
1856 1856
1857 return false; 1857 return false;
1858 } 1858 }
1859 1859
1860 void CompositedLayerMapping::transitionPaused(double timeOffset, CSSPropertyID p roperty) 1860 void CompositedLayerMapping::transitionPaused(double timeOffset, CSSPropertyID p roperty)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 1964 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
1965 name = "Scrolling Contents Layer"; 1965 name = "Scrolling Contents Layer";
1966 } else { 1966 } else {
1967 ASSERT_NOT_REACHED(); 1967 ASSERT_NOT_REACHED();
1968 } 1968 }
1969 1969
1970 return name; 1970 return name;
1971 } 1971 }
1972 1972
1973 } // namespace WebCore 1973 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/GraphicsLayer.cpp ('k') | Source/web/LinkHighlight.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698