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

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

Issue 1616653002: CC Animation: Move files from cc_blink to Source/platform/animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Fix copyrights and years. 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 17 matching lines...) Expand all
28 #include "core/dom/LayoutTreeBuilderTraversal.h" 28 #include "core/dom/LayoutTreeBuilderTraversal.h"
29 #include "core/dom/Node.h" 29 #include "core/dom/Node.h"
30 #include "core/frame/FrameView.h" 30 #include "core/frame/FrameView.h"
31 #include "core/frame/LocalFrame.h" 31 #include "core/frame/LocalFrame.h"
32 #include "core/layout/LayoutBoxModelObject.h" 32 #include "core/layout/LayoutBoxModelObject.h"
33 #include "core/layout/LayoutObject.h" 33 #include "core/layout/LayoutObject.h"
34 #include "core/layout/LayoutView.h" 34 #include "core/layout/LayoutView.h"
35 #include "core/layout/compositing/CompositedLayerMapping.h" 35 #include "core/layout/compositing/CompositedLayerMapping.h"
36 #include "core/paint/PaintLayer.h" 36 #include "core/paint/PaintLayer.h"
37 #include "platform/RuntimeEnabledFeatures.h" 37 #include "platform/RuntimeEnabledFeatures.h"
38 #include "platform/animation/CompositorAnimationCurve.h"
39 #include "platform/animation/CompositorFloatAnimationCurve.h"
38 #include "platform/graphics/Color.h" 40 #include "platform/graphics/Color.h"
41 #include "platform/graphics/CompositorFactory.h"
39 #include "platform/graphics/GraphicsLayer.h" 42 #include "platform/graphics/GraphicsLayer.h"
40 #include "platform/graphics/paint/DrawingRecorder.h" 43 #include "platform/graphics/paint/DrawingRecorder.h"
41 #include "public/platform/Platform.h" 44 #include "public/platform/Platform.h"
42 #include "public/platform/WebCompositorAnimationCurve.h"
43 #include "public/platform/WebCompositorSupport.h" 45 #include "public/platform/WebCompositorSupport.h"
44 #include "public/platform/WebContentLayer.h" 46 #include "public/platform/WebContentLayer.h"
45 #include "public/platform/WebDisplayItemList.h" 47 #include "public/platform/WebDisplayItemList.h"
46 #include "public/platform/WebFloatAnimationCurve.h"
47 #include "public/platform/WebFloatPoint.h" 48 #include "public/platform/WebFloatPoint.h"
48 #include "public/platform/WebLayer.h" 49 #include "public/platform/WebLayer.h"
49 #include "public/platform/WebRect.h" 50 #include "public/platform/WebRect.h"
50 #include "public/platform/WebSize.h" 51 #include "public/platform/WebSize.h"
51 #include "public/web/WebKit.h" 52 #include "public/web/WebKit.h"
52 #include "third_party/skia/include/core/SkCanvas.h" 53 #include "third_party/skia/include/core/SkCanvas.h"
53 #include "third_party/skia/include/core/SkPictureRecorder.h" 54 #include "third_party/skia/include/core/SkPictureRecorder.h"
54 #include "third_party/skia/include/utils/SkMatrix44.h" 55 #include "third_party/skia/include/utils/SkMatrix44.h"
55 #include "ui/gfx/geometry/rect.h" 56 #include "ui/gfx/geometry/rect.h"
56 #include "web/WebLocalFrameImpl.h" 57 #include "web/WebLocalFrameImpl.h"
(...skipping 19 matching lines...) Expand all
76 { 77 {
77 ASSERT(m_node); 78 ASSERT(m_node);
78 ASSERT(owningWebViewImpl); 79 ASSERT(owningWebViewImpl);
79 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup port(); 80 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup port();
80 ASSERT(compositorSupport); 81 ASSERT(compositorSupport);
81 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); 82 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this));
82 m_clipLayer = adoptPtr(compositorSupport->createLayer()); 83 m_clipLayer = adoptPtr(compositorSupport->createLayer());
83 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); 84 m_clipLayer->setTransformOrigin(WebFloatPoint3D());
84 m_clipLayer->addChild(m_contentLayer->layer()); 85 m_clipLayer->addChild(m_contentLayer->layer());
85 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { 86 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
86 m_compositorPlayer = adoptPtr(compositorSupport->createAnimationPlayer() ); 87 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimati onPlayer());
87 ASSERT(m_compositorPlayer); 88 ASSERT(m_compositorPlayer);
88 m_compositorPlayer->setAnimationDelegate(this); 89 m_compositorPlayer->setAnimationDelegate(this);
89 if (m_owningWebViewImpl->linkHighlightsTimeline()) 90 if (m_owningWebViewImpl->linkHighlightsTimeline())
90 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this) ; 91 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this) ;
91 m_compositorPlayer->attachLayer(m_contentLayer->layer()); 92 m_compositorPlayer->attachLayer(m_contentLayer->layer());
92 } else { 93 } else {
93 owningWebViewImpl->registerForAnimations(m_contentLayer->layer()); 94 owningWebViewImpl->registerForAnimations(m_contentLayer->layer());
94 m_contentLayer->layer()->setAnimationDelegate(this); 95 m_contentLayer->layer()->setAnimationDelegate(this);
95 } 96 }
96 m_contentLayer->layer()->setDrawsContent(true); 97 m_contentLayer->layer()->setDrawsContent(true);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 return; 288 return;
288 289
289 m_isAnimating = true; 290 m_isAnimating = true;
290 const float startOpacity = 1; 291 const float startOpacity = 1;
291 // FIXME: Should duration be configurable? 292 // FIXME: Should duration be configurable?
292 const float fadeDuration = 0.1f; 293 const float fadeDuration = 0.1f;
293 const float minPreFadeDuration = 0.1f; 294 const float minPreFadeDuration = 0.1f;
294 295
295 m_contentLayer->layer()->setOpacity(startOpacity); 296 m_contentLayer->layer()->setOpacity(startOpacity);
296 297
297 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup port(); 298 OwnPtr<CompositorFloatAnimationCurve> curve = adoptPtr(CompositorFactory::cu rrent().createFloatAnimationCurve());
298 299
299 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFlo atAnimationCurve()); 300 curve->add(CompositorFloatKeyframe(0, startOpacity));
300
301 curve->add(WebFloatKeyframe(0, startOpacity));
302 // 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.
303 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));
304 if (extraDurationRequired) 303 if (extraDurationRequired)
305 curve->add(WebFloatKeyframe(extraDurationRequired, startOpacity)); 304 curve->add(CompositorFloatKeyframe(extraDurationRequired, startOpacity)) ;
306 // For layout tests we don't fade out. 305 // For layout tests we don't fade out.
307 curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, layoutTest Mode() ? startOpacity : 0)); 306 curve->add(CompositorFloatKeyframe(fadeDuration + extraDurationRequired, lay outTestMode() ? startOpacity : 0));
308 307
309 OwnPtr<WebCompositorAnimation> animation = adoptPtr(compositorSupport->creat eAnimation(*curve, WebCompositorAnimation::TargetPropertyOpacity)); 308 OwnPtr<CompositorAnimation> animation = adoptPtr(CompositorFactory::current( ).createAnimation(*curve, CompositorAnimation::TargetPropertyOpacity));
310 309
311 m_contentLayer->layer()->setDrawsContent(true); 310 m_contentLayer->layer()->setDrawsContent(true);
312 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) 311 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
313 m_compositorPlayer->addAnimation(animation.leakPtr()); 312 m_compositorPlayer->addAnimation(animation.leakPtr());
314 else 313 else
315 m_contentLayer->layer()->addAnimation(animation.leakPtr()); 314 m_contentLayer->layer()->addAnimation(animation->releaseCCAnimation());
316 315
317 invalidate(); 316 invalidate();
318 m_owningWebViewImpl->scheduleAnimation(); 317 m_owningWebViewImpl->scheduleAnimation();
319 } 318 }
320 319
321 void LinkHighlightImpl::clearGraphicsLayerLinkHighlightPointer() 320 void LinkHighlightImpl::clearGraphicsLayerLinkHighlightPointer()
322 { 321 {
323 if (m_currentGraphicsLayer) { 322 if (m_currentGraphicsLayer) {
324 m_currentGraphicsLayer->removeLinkHighlight(this); 323 m_currentGraphicsLayer->removeLinkHighlight(this);
325 m_currentGraphicsLayer = 0; 324 m_currentGraphicsLayer = 0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 { 374 {
376 // Make sure we update geometry on the next callback from WebViewImpl::layou t(). 375 // Make sure we update geometry on the next callback from WebViewImpl::layou t().
377 m_geometryNeedsUpdate = true; 376 m_geometryNeedsUpdate = true;
378 } 377 }
379 378
380 WebLayer* LinkHighlightImpl::layer() 379 WebLayer* LinkHighlightImpl::layer()
381 { 380 {
382 return clipLayer(); 381 return clipLayer();
383 } 382 }
384 383
385 WebCompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const 384 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const
386 { 385 {
387 return m_compositorPlayer.get(); 386 return m_compositorPlayer.get();
388 } 387 }
389 388
390 } // namespace blink 389 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/LinkHighlightImpl.h ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698