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

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: Fix typo 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 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
46 43
47 #include "public/platform/WebAnimationDelegate.h" 44 #include "public/platform/WebAnimationDelegate.h"
48 #include "public/platform/WebCompositingReasons.h" 45 #include "public/platform/WebCompositingReasons.h"
49 #include "public/platform/WebContentLayer.h" 46 #include "public/platform/WebContentLayer.h"
50 #include "public/platform/WebImageLayer.h" 47 #include "public/platform/WebImageLayer.h"
51 #include "public/platform/WebLayerClient.h" 48 #include "public/platform/WebLayerClient.h"
52 #include "public/platform/WebLayerScrollClient.h" 49 #include "public/platform/WebLayerScrollClient.h"
53 #include "public/platform/WebNinePatchLayer.h" 50 #include "public/platform/WebNinePatchLayer.h"
54 #include "public/platform/WebSolidColorLayer.h" 51 #include "public/platform/WebSolidColorLayer.h"
55 52
56 namespace WebKit { 53 namespace WebKit {
57 class GraphicsLayerFactoryChromium; 54 class GraphicsLayerFactoryChromium;
55 class WebAnimation;
58 class WebLayer; 56 class WebLayer;
59 } 57 }
60 58
61 namespace WebCore { 59 namespace WebCore {
62 60
63 class FloatRect; 61 class FloatRect;
64 class GraphicsContext; 62 class GraphicsContext;
65 class GraphicsLayerFactory; 63 class GraphicsLayerFactory;
66 class Image; 64 class Image;
67 class ScrollableArea; 65 class ScrollableArea;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void setNeedsDisplay(); 210 void setNeedsDisplay();
213 // mark the given rect (in layer coords) as needing dispay. Never goes deep. 211 // mark the given rect (in layer coords) as needing dispay. Never goes deep.
214 void setNeedsDisplayInRect(const FloatRect&); 212 void setNeedsDisplayInRect(const FloatRect&);
215 213
216 void setContentsNeedsDisplay(); 214 void setContentsNeedsDisplay();
217 215
218 // Set that the position/size of the contents (image or video). 216 // Set that the position/size of the contents (image or video).
219 IntRect contentsRect() const { return m_contentsRect; } 217 IntRect contentsRect() const { return m_contentsRect; }
220 void setContentsRect(const IntRect&); 218 void setContentsRect(const IntRect&);
221 219
222 // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
223 static String animationNameForTransition(AnimatedPropertyID);
224
225 // Return true if the animation is handled by the compositing system. If thi s returns 220 // Return true if the animation is handled by the compositing system. If thi s returns
226 // false, the animation will be run by AnimationController. 221 // false, the animation will be run by AnimationController.
227 // These methods handle both transitions and keyframe animations. 222 // These methods handle both transitions and keyframe animations.
228 bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, cons t CSSAnimationData*, const String& /*animationName*/, double /*timeOffset*/); 223 bool addAnimation(WebKit::WebAnimation*);
229 void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/); 224 void pauseAnimation(int animationId, double /*timeOffset*/);
230 void removeAnimation(const String& /*animationName*/); 225 void removeAnimation(int animationId);
231 226
232 void suspendAnimations(double time); 227 void suspendAnimations(double time);
233 void resumeAnimations(); 228 void resumeAnimations();
234 229
235 // Layer contents 230 // Layer contents
236 void setContentsToImage(Image*); 231 void setContentsToImage(Image*);
237 void setContentsToNinePatch(Image*, const IntRect& aperture); 232 void setContentsToNinePatch(Image*, const IntRect& aperture);
238 bool shouldDirectlyCompositeImage(Image*) const { return true; } 233 bool shouldDirectlyCompositeImage(Image*) const { return true; }
239 void setContentsToMedia(WebKit::WebLayer*); // video or plug-in 234 void setContentsToMedia(WebKit::WebLayer*); // video or plug-in
240 // Pass an invalid color to remove the contents layer. 235 // Pass an invalid color to remove the contents layer.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point 398 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point
404 // on. 399 // on.
405 int m_contentsLayerId; 400 int m_contentsLayerId;
406 401
407 Vector<LinkHighlightClient*> m_linkHighlights; 402 Vector<LinkHighlightClient*> m_linkHighlights;
408 403
409 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate; 404 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate;
410 405
411 ContentsLayerPurpose m_contentsLayerPurpose; 406 ContentsLayerPurpose m_contentsLayerPurpose;
412 407
413 typedef HashMap<String, int> AnimationIdMap;
414 AnimationIdMap m_animationIdMap;
415
416 ScrollableArea* m_scrollableArea; 408 ScrollableArea* m_scrollableArea;
417 WebKit::WebCompositingReasons m_compositingReasons; 409 WebKit::WebCompositingReasons m_compositingReasons;
418 }; 410 };
419 411
420 412
421 } // namespace WebCore 413 } // namespace WebCore
422 414
423 #ifndef NDEBUG 415 #ifndef NDEBUG
424 // Outside the WebCore namespace for ease of invocation from gdb. 416 // Outside the WebCore namespace for ease of invocation from gdb.
425 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer); 417 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer);
426 #endif 418 #endif
427 419
428 #endif // GraphicsLayer_h 420 #endif // GraphicsLayer_h
OLDNEW
« no previous file with comments | « Source/core/platform/animation/AnimationTranslationUtilTest.cpp ('k') | Source/core/platform/graphics/GraphicsLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698