| OLD | NEW |
| 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 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "platform/graphics/GraphicsLayerClient.h" | 39 #include "platform/graphics/GraphicsLayerClient.h" |
| 40 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 40 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
| 41 #include "platform/graphics/ImageOrientation.h" | 41 #include "platform/graphics/ImageOrientation.h" |
| 42 #include "platform/graphics/PaintInvalidationReason.h" | 42 #include "platform/graphics/PaintInvalidationReason.h" |
| 43 #include "platform/graphics/filters/FilterOperations.h" | 43 #include "platform/graphics/filters/FilterOperations.h" |
| 44 #include "platform/graphics/paint/CachedDisplayItem.h" | 44 #include "platform/graphics/paint/CachedDisplayItem.h" |
| 45 #include "platform/graphics/paint/DisplayItemClient.h" | 45 #include "platform/graphics/paint/DisplayItemClient.h" |
| 46 #include "platform/graphics/paint/PaintController.h" | 46 #include "platform/graphics/paint/PaintController.h" |
| 47 #include "platform/heap/Handle.h" | 47 #include "platform/heap/Handle.h" |
| 48 #include "platform/transforms/TransformationMatrix.h" | 48 #include "platform/transforms/TransformationMatrix.h" |
| 49 #include "public/platform/WebCompositorAnimationDelegate.h" | |
| 50 #include "public/platform/WebContentLayer.h" | 49 #include "public/platform/WebContentLayer.h" |
| 51 #include "public/platform/WebImageLayer.h" | 50 #include "public/platform/WebImageLayer.h" |
| 52 #include "public/platform/WebLayerScrollClient.h" | 51 #include "public/platform/WebLayerScrollClient.h" |
| 53 #include "third_party/skia/include/core/SkPaint.h" | 52 #include "third_party/skia/include/core/SkPaint.h" |
| 54 #include "wtf/OwnPtr.h" | 53 #include "wtf/OwnPtr.h" |
| 55 #include "wtf/PassOwnPtr.h" | 54 #include "wtf/PassOwnPtr.h" |
| 56 #include "wtf/Vector.h" | 55 #include "wtf/Vector.h" |
| 57 | 56 |
| 58 namespace blink { | 57 namespace blink { |
| 59 | 58 |
| 60 class FloatRect; | 59 class FloatRect; |
| 61 class GraphicsLayerFactory; | 60 class GraphicsLayerFactory; |
| 62 class GraphicsLayerFactoryChromium; | 61 class GraphicsLayerFactoryChromium; |
| 63 class Image; | 62 class Image; |
| 64 class LinkHighlight; | 63 class LinkHighlight; |
| 65 class JSONObject; | 64 class JSONObject; |
| 66 class PaintController; | 65 class PaintController; |
| 67 class ScrollableArea; | 66 class ScrollableArea; |
| 68 class CompositorAnimation; | |
| 69 class WebLayer; | 67 class WebLayer; |
| 70 | 68 |
| 71 typedef Vector<GraphicsLayer*, 64> GraphicsLayerVector; | 69 typedef Vector<GraphicsLayer*, 64> GraphicsLayerVector; |
| 72 | 70 |
| 73 // GraphicsLayer is an abstraction for a rendering surface with backing store, | 71 // GraphicsLayer is an abstraction for a rendering surface with backing store, |
| 74 // which may have associated transformation and animations. | 72 // which may have associated transformation and animations. |
| 75 | 73 |
| 76 class PLATFORM_EXPORT GraphicsLayer : public WebCompositorAnimationDelegate, pub
lic WebLayerScrollClient, public cc::LayerClient, public DisplayItemClient { | 74 class PLATFORM_EXPORT GraphicsLayer : public WebLayerScrollClient, public cc::La
yerClient, public DisplayItemClient { |
| 77 WTF_MAKE_NONCOPYABLE(GraphicsLayer); USING_FAST_MALLOC(GraphicsLayer); | 75 WTF_MAKE_NONCOPYABLE(GraphicsLayer); USING_FAST_MALLOC(GraphicsLayer); |
| 78 public: | 76 public: |
| 79 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer
Client*); | 77 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer
Client*); |
| 80 | 78 |
| 81 ~GraphicsLayer() override; | 79 ~GraphicsLayer() override; |
| 82 | 80 |
| 83 GraphicsLayerClient* client() const { return m_client; } | 81 GraphicsLayerClient* client() const { return m_client; } |
| 84 | 82 |
| 85 GraphicsLayerDebugInfo& debugInfo(); | 83 GraphicsLayerDebugInfo& debugInfo(); |
| 86 | 84 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // Mark the given rect (in layer coords) as needing display. Never goes deep
. | 185 // Mark the given rect (in layer coords) as needing display. Never goes deep
. |
| 188 void setNeedsDisplayInRect(const IntRect&, PaintInvalidationReason); | 186 void setNeedsDisplayInRect(const IntRect&, PaintInvalidationReason); |
| 189 | 187 |
| 190 void setContentsNeedsDisplay(); | 188 void setContentsNeedsDisplay(); |
| 191 | 189 |
| 192 void invalidateDisplayItemClient(const DisplayItemClient&, PaintInvalidation
Reason); | 190 void invalidateDisplayItemClient(const DisplayItemClient&, PaintInvalidation
Reason); |
| 193 | 191 |
| 194 // Set that the position/size of the contents (image or video). | 192 // Set that the position/size of the contents (image or video). |
| 195 void setContentsRect(const IntRect&); | 193 void setContentsRect(const IntRect&); |
| 196 | 194 |
| 197 // Return true if the animation is handled by the compositing system. If thi
s returns | |
| 198 // false, the animation will be run by AnimationController. | |
| 199 // These methods handle both transitions and keyframe animations. | |
| 200 bool addAnimation(PassOwnPtr<CompositorAnimation>); | |
| 201 void pauseAnimation(int animationId, double /*timeOffset*/); | |
| 202 void removeAnimation(int animationId); | |
| 203 void abortAnimation(int animationId); | |
| 204 | |
| 205 // Layer contents | 195 // Layer contents |
| 206 void setContentsToImage(Image*, RespectImageOrientationEnum = DoNotRespectIm
ageOrientation); | 196 void setContentsToImage(Image*, RespectImageOrientationEnum = DoNotRespectIm
ageOrientation); |
| 207 void setContentsToPlatformLayer(WebLayer* layer) { setContentsTo(layer); } | 197 void setContentsToPlatformLayer(WebLayer* layer) { setContentsTo(layer); } |
| 208 bool hasContentsLayer() const { return m_contentsLayer; } | 198 bool hasContentsLayer() const { return m_contentsLayer; } |
| 209 | 199 |
| 210 // For hosting this GraphicsLayer in a native layer hierarchy. | 200 // For hosting this GraphicsLayer in a native layer hierarchy. |
| 211 WebLayer* platformLayer() const; | 201 WebLayer* platformLayer() const; |
| 212 | 202 |
| 213 typedef HashMap<int, int> RenderingContextMap; | 203 typedef HashMap<int, int> RenderingContextMap; |
| 214 PassRefPtr<JSONObject> layerTreeAsJSON(LayerTreeFlags, RenderingContextMap&)
const; | 204 PassRefPtr<JSONObject> layerTreeAsJSON(LayerTreeFlags, RenderingContextMap&)
const; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 235 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 225 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
| 236 | 226 |
| 237 WebContentLayer* contentLayer() const { return m_layer.get(); } | 227 WebContentLayer* contentLayer() const { return m_layer.get(); } |
| 238 | 228 |
| 239 static void registerContentsLayer(WebLayer*); | 229 static void registerContentsLayer(WebLayer*); |
| 240 static void unregisterContentsLayer(WebLayer*); | 230 static void unregisterContentsLayer(WebLayer*); |
| 241 | 231 |
| 242 IntRect interestRect(); | 232 IntRect interestRect(); |
| 243 void paint(const IntRect* interestRect, GraphicsContext::DisabledMode = Grap
hicsContext::NothingDisabled); | 233 void paint(const IntRect* interestRect, GraphicsContext::DisabledMode = Grap
hicsContext::NothingDisabled); |
| 244 | 234 |
| 245 // WebCompositorAnimationDelegate implementation. | |
| 246 void notifyAnimationStarted(double monotonicTime, int group) override; | |
| 247 void notifyAnimationFinished(double monotonicTime, int group) override; | |
| 248 void notifyAnimationAborted(double monotonicTime, int group) override; | |
| 249 | |
| 250 // WebLayerScrollClient implementation. | 235 // WebLayerScrollClient implementation. |
| 251 void didScroll() override; | 236 void didScroll() override; |
| 252 | 237 |
| 253 // cc::LayerClient implementation. | 238 // cc::LayerClient implementation. |
| 254 scoped_ptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo(cc::La
yer*) override; | 239 scoped_ptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo(cc::La
yer*) override; |
| 255 | 240 |
| 256 PaintController& paintController(); | 241 PaintController& paintController(); |
| 257 | 242 |
| 258 // Exposed for tests. | 243 // Exposed for tests. |
| 259 WebLayer* contentsLayer() const { return m_contentsLayer; } | 244 WebLayer* contentsLayer() const { return m_contentsLayer; } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 }; | 367 }; |
| 383 | 368 |
| 384 } // namespace blink | 369 } // namespace blink |
| 385 | 370 |
| 386 #ifndef NDEBUG | 371 #ifndef NDEBUG |
| 387 // Outside the blink namespace for ease of invocation from gdb. | 372 // Outside the blink namespace for ease of invocation from gdb. |
| 388 void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*); | 373 void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*); |
| 389 #endif | 374 #endif |
| 390 | 375 |
| 391 #endif // GraphicsLayer_h | 376 #endif // GraphicsLayer_h |
| OLD | NEW |