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

Side by Side Diff: Source/core/platform/graphics/GraphicsLayer.h

Issue 23431021: Refactoring animation code in accelerated path. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef GraphicsLayer_h 27 #ifndef GraphicsLayer_h
28 #define GraphicsLayer_h 28 #define GraphicsLayer_h
29 29
30 #include "core/platform/animation/CSSAnimationData.h"
31 #include "core/platform/animation/KeyframeValueList.h"
32 #include "core/platform/graphics/Color.h" 30 #include "core/platform/graphics/Color.h"
33 #include "core/platform/graphics/FloatPoint.h" 31 #include "core/platform/graphics/FloatPoint.h"
34 #include "core/platform/graphics/FloatPoint3D.h" 32 #include "core/platform/graphics/FloatPoint3D.h"
35 #include "core/platform/graphics/FloatSize.h" 33 #include "core/platform/graphics/FloatSize.h"
36 #include "core/platform/graphics/GraphicsLayerClient.h" 34 #include "core/platform/graphics/GraphicsLayerClient.h"
37 #include "core/platform/graphics/IntRect.h" 35 #include "core/platform/graphics/IntRect.h"
38 #include "core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate .h" 36 #include "core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate .h"
39 #include "core/platform/graphics/filters/FilterOperations.h" 37 #include "core/platform/graphics/filters/FilterOperations.h"
40 #include "core/platform/graphics/transforms/TransformationMatrix.h" 38 #include "core/platform/graphics/transforms/TransformationMatrix.h"
41 39
42 #include "wtf/HashMap.h"
43 #include "wtf/OwnPtr.h" 40 #include "wtf/OwnPtr.h"
44 #include "wtf/PassOwnPtr.h" 41 #include "wtf/PassOwnPtr.h"
45 42
46 #include "public/platform/WebAnimationDelegate.h" 43 #include "public/platform/WebAnimationDelegate.h"
47 #include "public/platform/WebCompositingReasons.h" 44 #include "public/platform/WebCompositingReasons.h"
48 #include "public/platform/WebContentLayer.h" 45 #include "public/platform/WebContentLayer.h"
49 #include "public/platform/WebImageLayer.h" 46 #include "public/platform/WebImageLayer.h"
50 #include "public/platform/WebLayerClient.h" 47 #include "public/platform/WebLayerClient.h"
51 #include "public/platform/WebLayerScrollClient.h" 48 #include "public/platform/WebLayerScrollClient.h"
52 #include "public/platform/WebNinePatchLayer.h" 49 #include "public/platform/WebNinePatchLayer.h"
53 #include "public/platform/WebSolidColorLayer.h" 50 #include "public/platform/WebSolidColorLayer.h"
54 51
55 namespace WebKit { 52 namespace WebKit {
56 class GraphicsLayerFactoryChromium; 53 class GraphicsLayerFactoryChromium;
54 class WebAnimation;
57 class WebLayer; 55 class WebLayer;
58 } 56 }
59 57
60 namespace WebCore { 58 namespace WebCore {
61 59
62 class FloatRect; 60 class FloatRect;
63 class GraphicsContext; 61 class GraphicsContext;
64 class GraphicsLayerFactory; 62 class GraphicsLayerFactory;
65 class Image; 63 class Image;
66 class ScrollableArea; 64 class ScrollableArea;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 void setNeedsDisplay(); 209 void setNeedsDisplay();
212 // mark the given rect (in layer coords) as needing dispay. Never goes deep. 210 // mark the given rect (in layer coords) as needing dispay. Never goes deep.
213 void setNeedsDisplayInRect(const FloatRect&); 211 void setNeedsDisplayInRect(const FloatRect&);
214 212
215 void setContentsNeedsDisplay(); 213 void setContentsNeedsDisplay();
216 214
217 // Set that the position/size of the contents (image or video). 215 // Set that the position/size of the contents (image or video).
218 IntRect contentsRect() const { return m_contentsRect; } 216 IntRect contentsRect() const { return m_contentsRect; }
219 void setContentsRect(const IntRect&); 217 void setContentsRect(const IntRect&);
220 218
221 // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
222 static String animationNameForTransition(AnimatedPropertyID);
223
224 // Return true if the animation is handled by the compositing system. If thi s returns 219 // Return true if the animation is handled by the compositing system. If thi s returns
225 // false, the animation will be run by AnimationController. 220 // false, the animation will be run by AnimationController.
226 // These methods handle both transitions and keyframe animations. 221 // These methods handle both transitions and keyframe animations.
227 bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, cons t CSSAnimationData*, const String& /*animationName*/, double /*timeOffset*/); 222 bool addAnimation(WebKit::WebAnimation*);
228 void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/); 223 void pauseAnimation(int animationId, double /*timeOffset*/);
229 void removeAnimation(const String& /*animationName*/); 224 void removeAnimation(int animationId);
230 225
231 void suspendAnimations(double time); 226 void suspendAnimations(double time);
232 void resumeAnimations(); 227 void resumeAnimations();
233 228
234 // Layer contents 229 // Layer contents
235 void setContentsToImage(Image*); 230 void setContentsToImage(Image*);
236 void setContentsToNinePatch(Image*, const IntRect& aperture); 231 void setContentsToNinePatch(Image*, const IntRect& aperture);
237 bool shouldDirectlyCompositeImage(Image*) const { return true; } 232 bool shouldDirectlyCompositeImage(Image*) const { return true; }
238 void setContentsToMedia(WebKit::WebLayer*); // video or plug-in 233 void setContentsToMedia(WebKit::WebLayer*); // video or plug-in
239 // Pass an invalid color to remove the contents layer. 234 // Pass an invalid color to remove the contents layer.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point 395 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point
401 // on. 396 // on.
402 int m_contentsLayerId; 397 int m_contentsLayerId;
403 398
404 LinkHighlightClient* m_linkHighlight; 399 LinkHighlightClient* m_linkHighlight;
405 400
406 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate; 401 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate;
407 402
408 ContentsLayerPurpose m_contentsLayerPurpose; 403 ContentsLayerPurpose m_contentsLayerPurpose;
409 404
410 typedef HashMap<String, int> AnimationIdMap;
411 AnimationIdMap m_animationIdMap;
412
413 ScrollableArea* m_scrollableArea; 405 ScrollableArea* m_scrollableArea;
414 WebKit::WebCompositingReasons m_compositingReasons; 406 WebKit::WebCompositingReasons m_compositingReasons;
415 }; 407 };
416 408
417 409
418 } // namespace WebCore 410 } // namespace WebCore
419 411
420 #ifndef NDEBUG 412 #ifndef NDEBUG
421 // Outside the WebCore namespace for ease of invocation from gdb. 413 // Outside the WebCore namespace for ease of invocation from gdb.
422 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer); 414 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer);
423 #endif 415 #endif
424 416
425 #endif // GraphicsLayer_h 417 #endif // GraphicsLayer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698