OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
34 #include "core/rendering/RenderLayer.h" | 34 #include "core/rendering/RenderLayer.h" |
35 #include "core/rendering/RenderLayerModelObject.h" | 35 #include "core/rendering/RenderLayerModelObject.h" |
36 #include "core/rendering/RenderObject.h" | 36 #include "core/rendering/RenderObject.h" |
37 #include "core/rendering/RenderPart.h" | 37 #include "core/rendering/RenderPart.h" |
38 #include "core/rendering/RenderView.h" | 38 #include "core/rendering/RenderView.h" |
39 #include "core/rendering/compositing/CompositedLayerMapping.h" | 39 #include "core/rendering/compositing/CompositedLayerMapping.h" |
40 #include "core/rendering/style/ShadowData.h" | 40 #include "core/rendering/style/ShadowData.h" |
41 #include "platform/graphics/Color.h" | 41 #include "platform/graphics/Color.h" |
42 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
43 #include "public/platform/WebCompositorAnimationCurve.h" | 43 #include "public/platform/WebAnimationCurve.h" |
44 #include "public/platform/WebCompositorSupport.h" | 44 #include "public/platform/WebCompositorSupport.h" |
45 #include "public/platform/WebFloatAnimationCurve.h" | 45 #include "public/platform/WebFloatAnimationCurve.h" |
46 #include "public/platform/WebFloatPoint.h" | 46 #include "public/platform/WebFloatPoint.h" |
47 #include "public/platform/WebRect.h" | 47 #include "public/platform/WebRect.h" |
48 #include "public/platform/WebSize.h" | 48 #include "public/platform/WebSize.h" |
49 #include "public/web/WebKit.h" | 49 #include "public/web/WebKit.h" |
50 #include "web/WebLocalFrameImpl.h" | 50 #include "web/WebLocalFrameImpl.h" |
51 #include "web/WebSettingsImpl.h" | 51 #include "web/WebSettingsImpl.h" |
52 #include "web/WebViewImpl.h" | 52 #include "web/WebViewImpl.h" |
53 #include "wtf/CurrentTime.h" | 53 #include "wtf/CurrentTime.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); | 282 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); |
283 | 283 |
284 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFlo
atAnimationCurve()); | 284 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFlo
atAnimationCurve()); |
285 | 285 |
286 curve->add(WebFloatKeyframe(0, startOpacity)); | 286 curve->add(WebFloatKeyframe(0, startOpacity)); |
287 // Make sure we have displayed for at least minPreFadeDuration before starti
ng to fade out. | 287 // Make sure we have displayed for at least minPreFadeDuration before starti
ng to fade out. |
288 float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast
<float>(monotonicallyIncreasingTime() - m_startTime)); | 288 float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast
<float>(monotonicallyIncreasingTime() - m_startTime)); |
289 if (extraDurationRequired) | 289 if (extraDurationRequired) |
290 curve->add(WebFloatKeyframe(extraDurationRequired, startOpacity)); | 290 curve->add(WebFloatKeyframe(extraDurationRequired, startOpacity)); |
291 // For layout tests we don't fade out. | 291 // For layout tests we don't fade out. |
292 curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, layoutTest
Mode() ? startOpacity : 0)); | 292 curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, blink::lay
outTestMode() ? startOpacity : 0)); |
293 | 293 |
294 OwnPtr<WebCompositorAnimation> animation = adoptPtr(compositorSupport->creat
eAnimation(*curve, WebCompositorAnimation::TargetPropertyOpacity)); | 294 OwnPtr<WebAnimation> animation = adoptPtr(compositorSupport->createAnimation
(*curve, WebAnimation::TargetPropertyOpacity)); |
295 | 295 |
296 m_contentLayer->layer()->setDrawsContent(true); | 296 m_contentLayer->layer()->setDrawsContent(true); |
297 m_contentLayer->layer()->addAnimation(animation.leakPtr()); | 297 m_contentLayer->layer()->addAnimation(animation.leakPtr()); |
298 | 298 |
299 invalidate(); | 299 invalidate(); |
300 m_owningWebViewImpl->scheduleAnimation(); | 300 m_owningWebViewImpl->scheduleAnimation(); |
301 } | 301 } |
302 | 302 |
303 void LinkHighlight::clearGraphicsLayerLinkHighlightPointer() | 303 void LinkHighlight::clearGraphicsLayerLinkHighlightPointer() |
304 { | 304 { |
305 if (m_currentGraphicsLayer) { | 305 if (m_currentGraphicsLayer) { |
306 m_currentGraphicsLayer->removeLinkHighlight(this); | 306 m_currentGraphicsLayer->removeLinkHighlight(this); |
307 m_currentGraphicsLayer = 0; | 307 m_currentGraphicsLayer = 0; |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 void LinkHighlight::notifyAnimationStarted(double, WebCompositorAnimation::Targe
tProperty) | 311 void LinkHighlight::notifyAnimationStarted(double, blink::WebAnimation::TargetPr
operty) |
312 { | 312 { |
313 } | 313 } |
314 | 314 |
315 void LinkHighlight::notifyAnimationFinished(double, WebCompositorAnimation::Targ
etProperty) | 315 void LinkHighlight::notifyAnimationFinished(double, blink::WebAnimation::TargetP
roperty) |
316 { | 316 { |
317 // Since WebViewImpl may hang on to us for a while, make sure we | 317 // Since WebViewImpl may hang on to us for a while, make sure we |
318 // release resources as soon as possible. | 318 // release resources as soon as possible. |
319 clearGraphicsLayerLinkHighlightPointer(); | 319 clearGraphicsLayerLinkHighlightPointer(); |
320 releaseResources(); | 320 releaseResources(); |
321 } | 321 } |
322 | 322 |
323 void LinkHighlight::updateGeometry() | 323 void LinkHighlight::updateGeometry() |
324 { | 324 { |
325 // To avoid unnecessary updates (e.g. other entities have requested animatio
ns from our WebViewImpl), | 325 // To avoid unnecessary updates (e.g. other entities have requested animatio
ns from our WebViewImpl), |
(...skipping 28 matching lines...) Expand all Loading... |
354 // Make sure we update geometry on the next callback from WebViewImpl::layou
t(). | 354 // Make sure we update geometry on the next callback from WebViewImpl::layou
t(). |
355 m_geometryNeedsUpdate = true; | 355 m_geometryNeedsUpdate = true; |
356 } | 356 } |
357 | 357 |
358 WebLayer* LinkHighlight::layer() | 358 WebLayer* LinkHighlight::layer() |
359 { | 359 { |
360 return clipLayer(); | 360 return clipLayer(); |
361 } | 361 } |
362 | 362 |
363 } // namespace WeKit | 363 } // namespace WeKit |
OLD | NEW |