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

Side by Side Diff: Source/web/LinkHighlight.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/web/LinkHighlight.h ('k') | Source/web/tests/GraphicsLayerTest.cpp » ('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) 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFlo atAnimationCurve()); 265 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFlo atAnimationCurve());
266 266
267 curve->add(WebFloatKeyframe(0, startOpacity)); 267 curve->add(WebFloatKeyframe(0, startOpacity));
268 // Make sure we have displayed for at least minPreFadeDuration before starti ng to fade out. 268 // Make sure we have displayed for at least minPreFadeDuration before starti ng to fade out.
269 float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast <float>(monotonicallyIncreasingTime() - m_startTime)); 269 float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast <float>(monotonicallyIncreasingTime() - m_startTime));
270 if (extraDurationRequired) 270 if (extraDurationRequired)
271 curve->add(WebFloatKeyframe(extraDurationRequired, startOpacity)); 271 curve->add(WebFloatKeyframe(extraDurationRequired, startOpacity));
272 // For layout tests we don't fade out. 272 // For layout tests we don't fade out.
273 curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, WebKit::la youtTestMode() ? startOpacity : 0)); 273 curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, WebKit::la youtTestMode() ? startOpacity : 0));
274 274
275 m_animation = adoptPtr(compositorSupport->createAnimation(*curve, WebAnimati on::TargetPropertyOpacity)); 275 OwnPtr<WebAnimation> animation = adoptPtr(compositorSupport->createAnimation (*curve, WebAnimation::TargetPropertyOpacity));
276 276
277 m_contentLayer->layer()->setDrawsContent(true); 277 m_contentLayer->layer()->setDrawsContent(true);
278 m_contentLayer->layer()->addAnimation(m_animation.get()); 278 m_contentLayer->layer()->addAnimation(animation.release());
279 279
280 invalidate(); 280 invalidate();
281 m_owningWebViewImpl->scheduleAnimation(); 281 m_owningWebViewImpl->scheduleAnimation();
282 } 282 }
283 283
284 void LinkHighlight::clearGraphicsLayerLinkHighlightPointer() 284 void LinkHighlight::clearGraphicsLayerLinkHighlightPointer()
285 { 285 {
286 if (m_currentGraphicsLayer) { 286 if (m_currentGraphicsLayer) {
287 m_currentGraphicsLayer->removeLinkHighlight(this); 287 m_currentGraphicsLayer->removeLinkHighlight(this);
288 m_currentGraphicsLayer = 0; 288 m_currentGraphicsLayer = 0;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // Make sure we update geometry on the next callback from WebViewImpl::layou t(). 335 // Make sure we update geometry on the next callback from WebViewImpl::layou t().
336 m_geometryNeedsUpdate = true; 336 m_geometryNeedsUpdate = true;
337 } 337 }
338 338
339 WebLayer* LinkHighlight::layer() 339 WebLayer* LinkHighlight::layer()
340 { 340 {
341 return clipLayer(); 341 return clipLayer();
342 } 342 }
343 343
344 } // namespace WeKit 344 } // namespace WeKit
OLDNEW
« no previous file with comments | « Source/web/LinkHighlight.h ('k') | Source/web/tests/GraphicsLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698