Index: Source/web/LinkHighlight.cpp |
diff --git a/Source/web/LinkHighlight.cpp b/Source/web/LinkHighlight.cpp |
index 02dab9d5c8407439817d33c81a5b64efc55d88e9..05604903df0a2181cd6a65bb95210f1341037c36 100644 |
--- a/Source/web/LinkHighlight.cpp |
+++ b/Source/web/LinkHighlight.cpp |
@@ -38,6 +38,7 @@ |
#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" |
#include "core/style/ShadowData.h" |
#include "core/paint/DeprecatedPaintLayer.h" |
+#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/graphics/Color.h" |
#include "platform/graphics/paint/DrawingRecorder.h" |
#include "public/platform/Platform.h" |
@@ -77,11 +78,19 @@ LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) |
ASSERT(owningWebViewImpl); |
WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); |
m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); |
- owningWebViewImpl->registerForAnimations(m_contentLayer->layer()); |
m_clipLayer = adoptPtr(compositorSupport->createLayer()); |
m_clipLayer->setTransformOrigin(WebFloatPoint3D()); |
m_clipLayer->addChild(m_contentLayer->layer()); |
- m_contentLayer->layer()->setAnimationDelegate(this); |
+ if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platform::current()->compositorSupport()) { |
chrishtr
2015/07/13 21:20:52
When would compositorSupport() be null?
loyso (OOO)
2015/07/14 00:59:04
We can assert that it can't be null here. I'll fix
chrishtr
2015/07/14 18:34:00
Also change the interface to return a reference ra
loyso (OOO)
2015/07/15 02:04:36
We have so many calls to this function throughout
chrishtr
2015/07/15 14:25:14
Ok please add the assert at least then.
loyso (OOO)
2015/07/21 01:19:07
Done.
|
+ m_compositorPlayer = adoptPtr(Platform::current()->compositorSupport()->createAnimationPlayer()); |
+ ASSERT(m_compositorPlayer); |
+ m_compositorPlayer->setAnimationDelegate(this); |
+ m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); |
+ m_compositorPlayer->attachLayer(m_contentLayer->layer()); |
+ } else { |
+ owningWebViewImpl->registerForAnimations(m_contentLayer->layer()); |
+ m_contentLayer->layer()->setAnimationDelegate(this); |
+ } |
m_contentLayer->layer()->setDrawsContent(true); |
m_contentLayer->layer()->setOpacity(1); |
m_geometryNeedsUpdate = true; |
@@ -90,6 +99,13 @@ LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) |
LinkHighlight::~LinkHighlight() |
{ |
+ if (m_compositorPlayer) { |
+ m_compositorPlayer->detachLayer(); |
+ m_owningWebViewImpl->linkHighlightsTimeline()->playerDestroyed(*this); |
+ m_compositorPlayer->setAnimationDelegate(nullptr); |
+ } |
+ m_compositorPlayer.clear(); |
+ |
clearGraphicsLayerLinkHighlightPointer(); |
releaseResources(); |
} |
@@ -292,7 +308,10 @@ void LinkHighlight::startHighlightAnimationIfNeeded() |
OwnPtr<WebCompositorAnimation> animation = adoptPtr(compositorSupport->createAnimation(*curve, WebCompositorAnimation::TargetPropertyOpacity)); |
chrishtr
2015/07/13 21:20:52
Why even put it in an OwnPtr if you are going to l
loyso (OOO)
2015/07/14 00:59:04
1) This is how we mark ownership over this animati
chrishtr
2015/07/14 18:34:00
I agree that unifying after the blink/chromium mer
loyso (OOO)
2015/07/21 01:19:07
Acknowledged.
|
m_contentLayer->layer()->setDrawsContent(true); |
- m_contentLayer->layer()->addAnimation(animation.leakPtr()); |
+ if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) |
+ m_compositorPlayer->addAnimation(animation.leakPtr()); |
+ else |
+ m_contentLayer->layer()->addAnimation(animation.leakPtr()); |
invalidate(); |
m_owningWebViewImpl->scheduleAnimation(); |
@@ -361,4 +380,9 @@ WebLayer* LinkHighlight::layer() |
return clipLayer(); |
} |
+WebCompositorAnimationPlayer* LinkHighlight::compositorPlayer() const |
+{ |
+ return m_compositorPlayer.get(); |
+} |
+ |
} // namespace blink |