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

Side by Side Diff: third_party/WebKit/Source/web/LinkHighlightImpl.cpp

Issue 1663963004: Blink Compositor Animation: Use PassOwnPtr in CompositorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@curves
Patch Set: Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 { 77 {
78 ASSERT(m_node); 78 ASSERT(m_node);
79 ASSERT(owningWebViewImpl); 79 ASSERT(owningWebViewImpl);
80 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup port(); 80 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup port();
81 ASSERT(compositorSupport); 81 ASSERT(compositorSupport);
82 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); 82 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this));
83 m_clipLayer = adoptPtr(compositorSupport->createLayer()); 83 m_clipLayer = adoptPtr(compositorSupport->createLayer());
84 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); 84 m_clipLayer->setTransformOrigin(WebFloatPoint3D());
85 m_clipLayer->addChild(m_contentLayer->layer()); 85 m_clipLayer->addChild(m_contentLayer->layer());
86 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { 86 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
87 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimati onPlayer()); 87 m_compositorPlayer = CompositorFactory::current().createAnimationPlayer( );
88 ASSERT(m_compositorPlayer); 88 ASSERT(m_compositorPlayer);
89 m_compositorPlayer->setAnimationDelegate(this); 89 m_compositorPlayer->setAnimationDelegate(this);
90 if (m_owningWebViewImpl->linkHighlightsTimeline()) 90 if (m_owningWebViewImpl->linkHighlightsTimeline())
91 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this) ; 91 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this) ;
92 m_compositorPlayer->attachLayer(m_contentLayer->layer()); 92 m_compositorPlayer->attachLayer(m_contentLayer->layer());
93 } else { 93 } else {
94 owningWebViewImpl->registerForAnimations(m_contentLayer->layer()); 94 owningWebViewImpl->registerForAnimations(m_contentLayer->layer());
95 m_contentLayer->layer()->setAnimationDelegate(this); 95 m_contentLayer->layer()->setAnimationDelegate(this);
96 } 96 }
97 m_contentLayer->layer()->setDrawsContent(true); 97 m_contentLayer->layer()->setDrawsContent(true);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 return; 288 return;
289 289
290 m_isAnimating = true; 290 m_isAnimating = true;
291 const float startOpacity = 1; 291 const float startOpacity = 1;
292 // FIXME: Should duration be configurable? 292 // FIXME: Should duration be configurable?
293 const float fadeDuration = 0.1f; 293 const float fadeDuration = 0.1f;
294 const float minPreFadeDuration = 0.1f; 294 const float minPreFadeDuration = 0.1f;
295 295
296 m_contentLayer->layer()->setOpacity(startOpacity); 296 m_contentLayer->layer()->setOpacity(startOpacity);
297 297
298 OwnPtr<CompositorFloatAnimationCurve> curve = adoptPtr(CompositorFactory::cu rrent().createFloatAnimationCurve()); 298 OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFactory::current().c reateFloatAnimationCurve();
299 299
300 curve->add(CompositorFloatKeyframe(0, startOpacity)); 300 curve->add(CompositorFloatKeyframe(0, startOpacity));
301 // Make sure we have displayed for at least minPreFadeDuration before starti ng to fade out. 301 // Make sure we have displayed for at least minPreFadeDuration before starti ng to fade out.
302 float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast <float>(monotonicallyIncreasingTime() - m_startTime)); 302 float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast <float>(monotonicallyIncreasingTime() - m_startTime));
303 if (extraDurationRequired) 303 if (extraDurationRequired)
304 curve->add(CompositorFloatKeyframe(extraDurationRequired, startOpacity)) ; 304 curve->add(CompositorFloatKeyframe(extraDurationRequired, startOpacity)) ;
305 // For layout tests we don't fade out. 305 // For layout tests we don't fade out.
306 curve->add(CompositorFloatKeyframe(fadeDuration + extraDurationRequired, lay outTestMode() ? startOpacity : 0)); 306 curve->add(CompositorFloatKeyframe(fadeDuration + extraDurationRequired, lay outTestMode() ? startOpacity : 0));
307 307
308 OwnPtr<CompositorAnimation> animation = adoptPtr(CompositorFactory::current( ).createAnimation(*curve, CompositorAnimation::TargetPropertyOpacity)); 308 OwnPtr<CompositorAnimation> animation = CompositorFactory::current().createA nimation(*curve, CompositorAnimation::TargetPropertyOpacity);
309 309
310 m_contentLayer->layer()->setDrawsContent(true); 310 m_contentLayer->layer()->setDrawsContent(true);
311 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) 311 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
312 m_compositorPlayer->addAnimation(animation.leakPtr()); 312 m_compositorPlayer->addAnimation(animation.leakPtr());
313 else 313 else
314 m_contentLayer->layer()->addAnimation(animation->releaseCCAnimation()); 314 m_contentLayer->layer()->addAnimation(animation->releaseCCAnimation());
315 315
316 invalidate(); 316 invalidate();
317 m_owningWebViewImpl->scheduleAnimation(); 317 m_owningWebViewImpl->scheduleAnimation();
318 } 318 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 { 380 {
381 return clipLayer(); 381 return clipLayer();
382 } 382 }
383 383
384 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const 384 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const
385 { 385 {
386 return m_compositorPlayer.get(); 386 return m_compositorPlayer.get();
387 } 387 }
388 388
389 } // namespace blink 389 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698