Changeset 172836 in webkit
- Timestamp:
- Aug 21, 2014 3:43:18 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r172835 r172836 1 2014-08-21 Simon Fraser <simon.fraser@apple.com> 2 3 Add animationDidEnd callbacks on GraphicsLayer 4 https://bugs.webkit.org/show_bug.cgi?id=136084 5 6 Reviewed by Tim Horton. 7 8 Hook up GraphicsLayerClient::notifyAnimationEnded() so that code using GraphicsLayers directly 9 can add animations, and know when they finish. 10 11 * WebCore.exp.in: 12 * platform/graphics/GraphicsLayerClient.h: 13 (WebCore::GraphicsLayerClient::notifyAnimationStarted): 14 (WebCore::GraphicsLayerClient::notifyAnimationEnded): 15 * platform/graphics/ca/GraphicsLayerCA.cpp: 16 (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted): 17 (WebCore::GraphicsLayerCA::platformCALayerAnimationEnded): 18 * platform/graphics/ca/GraphicsLayerCA.h: 19 * platform/graphics/ca/PlatformCALayer.h: 20 * platform/graphics/ca/PlatformCALayerClient.h: 21 (WebCore::PlatformCALayerClient::platformCALayerAnimationStarted): 22 (WebCore::PlatformCALayerClient::platformCALayerAnimationEnded): 23 * platform/graphics/ca/mac/PlatformCALayerMac.h: 24 * platform/graphics/ca/mac/PlatformCALayerMac.mm: 25 (-[WebAnimationDelegate animationDidStart:]): 26 (-[WebAnimationDelegate animationDidStop:finished:]): 27 (PlatformCALayerMac::animationStarted): 28 (PlatformCALayerMac::animationEnded): 29 * rendering/RenderLayerBacking.cpp: 30 (WebCore::RenderLayerBacking::notifyAnimationStarted): 31 * rendering/RenderLayerBacking.h: 32 1 33 2014-08-21 Zalan Bujtas <zalan@apple.com> 2 34 -
trunk/Source/WebCore/WebCore.exp.in
r172826 r172836 598 598 __ZN7WebCore15GraphicsLayerCA23setDebugBackgroundColorERKNS_5ColorE 599 599 __ZN7WebCore15GraphicsLayerCA28platformCALayerPaintContentsEPNS_15PlatformCALayerERNS_15GraphicsContextERKNS_9FloatRectE 600 __ZN7WebCore15GraphicsLayerCA29platformCALayerAnimationEndedERKN3WTF6StringE 600 601 __ZN7WebCore15GraphicsLayerCA30deviceOrPageScaleFactorChangedEv 601 __ZN7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedE d602 __ZN7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedERKN3WTF6StringEd 602 603 __ZN7WebCore15GraphicsLayerCA37flushCompositingStateForThisLayerOnlyEv 603 604 __ZN7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv … … 2059 2060 __ZTVN7WebCore31BasicColorMatrixFilterOperationE 2060 2061 __ZTVN7WebCore37BasicComponentTransferFilterOperationE 2062 __ZThn504_N7WebCore15GraphicsLayerCA29platformCALayerAnimationEndedERKN3WTF6StringE 2063 __ZThn504_N7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedERKN3WTF6StringEd 2061 2064 __ZThn???_N7WebCore15GraphicsLayerCA28platformCALayerPaintContentsEPNS_15PlatformCALayerERNS_15GraphicsContextERKNS_9FloatRectE 2062 2065 __ZThn???_N7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedEd -
trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h
r172738 r172836 63 63 64 64 // Callback for when hardware-accelerated animation started. 65 virtual void notifyAnimationStarted(const GraphicsLayer*, double /*time*/) { } 65 virtual void notifyAnimationStarted(const GraphicsLayer*, const String& /*animationKey*/, double /*time*/) { } 66 virtual void notifyAnimationEnded(const GraphicsLayer*, const String& /*animationKey*/) { } 66 67 67 68 // Notification that a layer property changed that requires a subsequent call to flushCompositingState() -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r172681 r172836 844 844 } 845 845 846 void GraphicsLayerCA::platformCALayerAnimationStarted(CFTimeInterval startTime) 847 { 848 client().notifyAnimationStarted(this, startTime); 846 void GraphicsLayerCA::platformCALayerAnimationStarted(const String& animationKey, CFTimeInterval startTime) 847 { 848 client().notifyAnimationStarted(this, animationKey, startTime); 849 } 850 851 void GraphicsLayerCA::platformCALayerAnimationEnded(const String& animationKey) 852 { 853 client().notifyAnimationEnded(this, animationKey); 849 854 } 850 855 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r172831 r172836 180 180 virtual bool platformCALayerRespondsToLayoutChanges() const override { return false; } 181 181 182 WEBCORE_EXPORT virtual void platformCALayerAnimationStarted(CFTimeInterval beginTime) override; 182 WEBCORE_EXPORT void platformCALayerAnimationStarted(const String& animationKey, CFTimeInterval beginTime) override; 183 WEBCORE_EXPORT void platformCALayerAnimationEnded(const String& animationKey) override; 183 184 virtual CompositingCoordinatesOrientation platformCALayerContentsOrientation() const override { return contentsOrientation(); } 184 185 WEBCORE_EXPORT virtual void platformCALayerPaintContents(PlatformCALayer*, GraphicsContext&, const FloatRect& clip) override; -
trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
r172831 r172836 103 103 104 104 virtual void animationStarted(const String& key, CFTimeInterval beginTime) = 0; 105 virtual void animationEnded(const String& key) = 0; 105 106 106 107 virtual void setNeedsDisplay() = 0; -
trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h
r170071 r172836 40 40 virtual bool platformCALayerRespondsToLayoutChanges() const { return false; } 41 41 42 virtual void platformCALayerAnimationStarted(CFTimeInterval) { } 42 virtual void platformCALayerAnimationStarted(const String& /*animationKey*/, CFTimeInterval) { } 43 virtual void platformCALayerAnimationEnded(const String& /*animationKey*/) { } 43 44 virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return GraphicsLayer::CompositingCoordinatesTopDown; } 44 45 virtual void platformCALayerPaintContents(PlatformCALayer*, GraphicsContext&, const FloatRect& inClip) = 0; -
trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h
r172831 r172836 66 66 virtual PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) override; 67 67 virtual void animationStarted(const String& key, CFTimeInterval beginTime) override; 68 virtual void animationEnded(const String& key) override; 68 69 69 70 virtual void setMask(PlatformCALayer*) override; -
trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
r172681 r172836 115 115 WebThreadLock(); 116 116 #endif 117 if (!m_owner) 118 return; 119 117 120 CFTimeInterval startTime; 118 121 if (hasExplicitBeginTime(animation)) { … … 123 126 startTime = mediaTimeToCurrentTime([animation beginTime]); 124 127 125 if (m_owner) { 126 CALayer *layer = m_owner->platformLayer(); 127 128 String animationKey; 129 for (NSString *key in [layer animationKeys]) { 130 if ([layer animationForKey:key] == animation) { 131 animationKey = key; 132 break; 133 } 128 CALayer *layer = m_owner->platformLayer(); 129 130 String animationKey; 131 for (NSString *key in [layer animationKeys]) { 132 if ([layer animationForKey:key] == animation) { 133 animationKey = key; 134 break; 134 135 } 135 136 if (!animationKey.isEmpty()) 137 m_owner->animationStarted(animationKey, startTime); 138 } 136 } 137 138 if (!animationKey.isEmpty()) 139 m_owner->animationStarted(animationKey, startTime); 140 } 141 142 - (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)finished 143 { 144 #if PLATFORM(IOS) 145 WebThreadLock(); 146 #endif 147 UNUSED_PARAM(finished); 148 149 if (!m_owner) 150 return; 151 152 CALayer *layer = m_owner->platformLayer(); 153 154 String animationKey; 155 for (NSString *key in [layer animationKeys]) { 156 if ([layer animationForKey:key] == animation) { 157 animationKey = key; 158 break; 159 } 160 } 161 162 if (!animationKey.isEmpty()) 163 m_owner->animationEnded(animationKey); 139 164 } 140 165 … … 326 351 } 327 352 328 void PlatformCALayerMac::animationStarted(const String& , CFTimeInterval beginTime)353 void PlatformCALayerMac::animationStarted(const String& animationKey, CFTimeInterval beginTime) 329 354 { 330 355 if (m_owner) 331 m_owner->platformCALayerAnimationStarted(beginTime); 356 m_owner->platformCALayerAnimationStarted(animationKey, beginTime); 357 } 358 359 void PlatformCALayerMac::animationEnded(const String& animationKey) 360 { 361 if (m_owner) 362 m_owner->platformCALayerAnimationEnded(animationKey); 332 363 } 333 364 -
trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
r172681 r172836 196 196 } 197 197 198 void PlatformCALayerWin::animationStarted(const String& , CFTimeInterval beginTime)198 void PlatformCALayerWin::animationStarted(const String& animationKey, CFTimeInterval beginTime) 199 199 { 200 200 // Update start time for any animation not yet started … … 206 206 207 207 if (m_owner) 208 m_owner->platformCALayerAnimationStarted(beginTime); 208 m_owner->platformCALayerAnimationStarted(animationKey, beginTime); 209 } 210 211 void PlatformCALayerWin::animationEnded(const String& animationKey) 212 { 213 if (m_owner) 214 m_owner->platformCALayerAnimationEnded(animationKey); 209 215 } 210 216 -
trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h
r172681 r172836 57 57 virtual PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) override; 58 58 virtual void animationStarted(const String& key, CFTimeInterval beginTime) override; 59 virtual void animationEnded(const String& key) override; 59 60 60 61 virtual void setMask(PlatformCALayer*) override; -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
r171725 r172836 559 559 560 560 if (m_changeMask & AnimationStarted) 561 client().notifyAnimationStarted(this, m_animationStartTime);561 client().notifyAnimationStarted(this, "", m_animationStartTime); 562 562 563 563 if (m_changeMask & FixedToViewporChange) -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp
r170813 r172836 240 240 } 241 241 242 void CompositingCoordinator::notifyAnimationStarted(const GraphicsLayer*, double /* time */)242 void CompositingCoordinator::notifyAnimationStarted(const GraphicsLayer*, const String&, double /* time */) 243 243 { 244 244 } -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.h
r168423 r172836 90 90 private: 91 91 // GraphicsLayerClient 92 virtual void notifyAnimationStarted(const GraphicsLayer*, double time) override;92 virtual void notifyAnimationStarted(const GraphicsLayer*, const String&, double time) override; 93 93 virtual void notifyFlushRequired(const GraphicsLayer*) override; 94 94 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& clipRect) override; -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
r170774 r172836 1227 1227 void CoordinatedGraphicsLayer::animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*) 1228 1228 { 1229 client().notifyAnimationStarted(this, m_lastAnimationStartTime);1229 client().notifyAnimationStarted(this, "", m_lastAnimationStartTime); 1230 1230 } 1231 1231 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r171494 r172836 2461 2461 } 2462 2462 2463 void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double time)2463 void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, const String&, double time) 2464 2464 { 2465 2465 renderer().animation().notifyAnimationStarted(&renderer(), time); -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r170203 r172836 195 195 virtual bool shouldUseTiledBacking(const GraphicsLayer*) const override; 196 196 virtual void tiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/) override; 197 virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime) override;197 virtual void notifyAnimationStarted(const GraphicsLayer*, const String& animationKey, double startTime) override; 198 198 virtual void notifyFlushRequired(const GraphicsLayer*) override; 199 199 virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) override; -
trunk/Source/WebKit2/ChangeLog
r172835 r172836 1 2014-08-21 Simon Fraser <simon.fraser@apple.com> 2 3 Add animationDidEnd callbacks on GraphicsLayer 4 https://bugs.webkit.org/show_bug.cgi?id=136084 5 6 Reviewed by Tim Horton. 7 8 Hook up GraphicsLayerClient::notifyAnimationEnded() so that code using GraphicsLayers directly 9 can add animations, and know when they finish. 10 11 * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h: 12 * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: 13 (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd): 14 * UIProcess/mac/RemoteLayerTreeHost.h: 15 * UIProcess/mac/RemoteLayerTreeHost.mm: 16 (WebKit::RemoteLayerTreeHost::animationDidEnd): 17 * WebProcess/WebPage/DrawingArea.h: 18 (WebKit::DrawingArea::acceleratedAnimationDidEnd): 19 * WebProcess/WebPage/DrawingArea.messages.in: 20 * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm: 21 (-[WKAnimationDelegate animationDidStop:finished:]): 22 * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp: 23 (WebKit::PlatformCALayerRemote::animationStarted): 24 (WebKit::PlatformCALayerRemote::animationEnded): 25 * WebProcess/WebPage/mac/PlatformCALayerRemote.h: 26 * WebProcess/WebPage/mac/RemoteLayerTreeContext.h: 27 * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm: 28 (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed): 29 (WebKit::RemoteLayerTreeContext::willStartAnimationOnLayer): 30 (WebKit::RemoteLayerTreeContext::animationDidStart): 31 (WebKit::RemoteLayerTreeContext::animationDidEnd): 32 * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: 33 * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: 34 (WebKit::RemoteLayerTreeDrawingArea::acceleratedAnimationDidEnd): 35 1 36 2014-08-21 Zalan Bujtas <zalan@apple.com> 2 37 -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h
r171191 r172836 48 48 49 49 void acceleratedAnimationDidStart(uint64_t layerID, const String& key, double startTime); 50 void acceleratedAnimationDidEnd(uint64_t layerID, const String& key); 50 51 51 52 uint64_t nextLayerTreeTransactionID() const { return m_pendingLayerTreeTransactionID + 1; } -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm
r171560 r172836 242 242 } 243 243 244 void RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd(uint64_t layerID, const String& key) 245 { 246 m_webPageProxy->process().send(Messages::DrawingArea::AcceleratedAnimationDidEnd(layerID, key), m_webPageProxy->pageID()); 247 } 248 244 249 static const float indicatorInset = 10; 245 250 -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h
r171191 r172836 61 61 62 62 void animationDidStart(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *, double startTime); 63 void animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *); 63 64 64 65 void clearLayers(); -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm
r171191 r172836 153 153 } 154 154 155 void RemoteLayerTreeHost::animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID layerID, CAAnimation *animation) 156 { 157 CALayer *layer = asLayer(getLayer(layerID)); 158 if (!layer) 159 return; 160 161 String animationKey; 162 for (NSString *key in [layer animationKeys]) { 163 if ([layer animationForKey:key] == animation) { 164 animationKey = key; 165 break; 166 } 167 } 168 169 if (!animationKey.isEmpty()) 170 m_drawingArea.acceleratedAnimationDidEnd(layerID, animationKey); 171 172 } 173 155 174 void RemoteLayerTreeHost::clearLayers() 156 175 { -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
r172104 r172836 89 89 virtual WebCore::FloatRect exposedRect() const = 0; 90 90 virtual void acceleratedAnimationDidStart(uint64_t /*layerID*/, const String& /*key*/, double /*startTime*/) { } 91 virtual void acceleratedAnimationDidEnd(uint64_t /*layerID*/, const String& /*key*/) { } 91 92 #endif 92 93 #if PLATFORM(IOS) -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
r170761 r172836 36 36 37 37 AcceleratedAnimationDidStart(uint64_t layerID, String key, double startTime) 38 AcceleratedAnimationDidEnd(uint64_t layerID, String key) 38 39 39 40 AddTransactionCallbackID(uint64_t callbackID) -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm
r170774 r172836 82 82 _layerTreeHost->animationDidStart(_layerID, animation, startTime); 83 83 } 84 85 - (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)finished 86 { 87 _layerTreeHost->animationDidEnd(_layerID, animation); 88 } 89 84 90 @end 85 91 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
r172681 r172836 370 370 371 371 if (m_owner) 372 m_owner->platformCALayerAnimationStarted(beginTime); 372 m_owner->platformCALayerAnimationStarted(key, beginTime); 373 } 374 375 void PlatformCALayerRemote::animationEnded(const String& key) 376 { 377 if (m_owner) 378 m_owner->platformCALayerAnimationEnded(key); 373 379 } 374 380 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
r172681 r172836 71 71 virtual PassRefPtr<WebCore::PlatformCAAnimation> animationForKey(const String& key) override; 72 72 virtual void animationStarted(const String& key, CFTimeInterval beginTime) override; 73 virtual void animationEnded(const String& key) override; 73 74 74 75 virtual void setMask(WebCore::PlatformCALayer*) override; -
trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h
r170274 r172836 64 64 // From the UI process 65 65 void animationDidStart(WebCore::GraphicsLayer::PlatformLayerID, const String& key, double startTime); 66 void animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID, const String& key); 66 67 67 68 void willStartAnimationOnLayer(PlatformCALayerRemote&); … … 79 80 80 81 HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_liveLayers; 81 HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_layers AwaitingAnimationStart;82 HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_layersWithAnimations; 82 83 83 84 RemoteLayerBackingStoreCollection m_backingStoreCollection; -
trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm
r170864 r172836 79 79 m_destroyedLayers.append(layerID); 80 80 81 m_layers AwaitingAnimationStart.remove(layerID);81 m_layersWithAnimations.remove(layerID); 82 82 } 83 83 … … 123 123 void RemoteLayerTreeContext::willStartAnimationOnLayer(PlatformCALayerRemote& layer) 124 124 { 125 m_layers AwaitingAnimationStart.add(layer.layerID(), &layer);125 m_layersWithAnimations.add(layer.layerID(), &layer); 126 126 } 127 127 128 128 void RemoteLayerTreeContext::animationDidStart(WebCore::GraphicsLayer::PlatformLayerID layerID, const String& key, double startTime) 129 129 { 130 auto it = m_layers AwaitingAnimationStart.find(layerID);131 if (it != m_layers AwaitingAnimationStart.end())130 auto it = m_layersWithAnimations.find(layerID); 131 if (it != m_layersWithAnimations.end()) 132 132 it->value->animationStarted(key, startTime); 133 133 } 134 134 135 void RemoteLayerTreeContext::animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID layerID, const String& key) 136 { 137 auto it = m_layersWithAnimations.find(layerID); 138 if (it != m_layersWithAnimations.end()) 139 it->value->animationEnded(key); 140 } 141 135 142 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h
r172738 r172836 89 89 90 90 virtual void acceleratedAnimationDidStart(uint64_t layerID, const String& key, double startTime) override; 91 virtual void acceleratedAnimationDidEnd(uint64_t layerID, const String& key) override; 91 92 92 93 #if PLATFORM(IOS) -
trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm
r171336 r172836 194 194 } 195 195 196 void RemoteLayerTreeDrawingArea::acceleratedAnimationDidEnd(uint64_t layerID, const String& key) 197 { 198 m_remoteLayerTreeContext->animationDidEnd(layerID, key); 199 } 200 196 201 void RemoteLayerTreeDrawingArea::setExposedRect(const FloatRect& exposedRect) 197 202 {
Note: See TracChangeset
for help on using the changeset viewer.