| 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 |
| 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 "cc/layers/layer_client.h" |
| 30 #include "platform/PlatformExport.h" | 31 #include "platform/PlatformExport.h" |
| 31 #include "platform/geometry/FloatPoint.h" | 32 #include "platform/geometry/FloatPoint.h" |
| 32 #include "platform/geometry/FloatPoint3D.h" | 33 #include "platform/geometry/FloatPoint3D.h" |
| 33 #include "platform/geometry/FloatSize.h" | 34 #include "platform/geometry/FloatSize.h" |
| 34 #include "platform/geometry/IntRect.h" | 35 #include "platform/geometry/IntRect.h" |
| 35 #include "platform/graphics/Color.h" | 36 #include "platform/graphics/Color.h" |
| 36 #include "platform/graphics/ContentLayerDelegate.h" | 37 #include "platform/graphics/ContentLayerDelegate.h" |
| 37 #include "platform/graphics/GraphicsLayerClient.h" | 38 #include "platform/graphics/GraphicsLayerClient.h" |
| 38 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 39 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
| 39 #include "platform/graphics/ImageOrientation.h" | 40 #include "platform/graphics/ImageOrientation.h" |
| 40 #include "platform/graphics/PaintInvalidationReason.h" | 41 #include "platform/graphics/PaintInvalidationReason.h" |
| 41 #include "platform/graphics/filters/FilterOperations.h" | 42 #include "platform/graphics/filters/FilterOperations.h" |
| 42 #include "platform/graphics/paint/CachedDisplayItem.h" | 43 #include "platform/graphics/paint/CachedDisplayItem.h" |
| 43 #include "platform/graphics/paint/DisplayItemClient.h" | 44 #include "platform/graphics/paint/DisplayItemClient.h" |
| 44 #include "platform/graphics/paint/PaintController.h" | 45 #include "platform/graphics/paint/PaintController.h" |
| 45 #include "platform/transforms/TransformationMatrix.h" | 46 #include "platform/transforms/TransformationMatrix.h" |
| 46 #include "public/platform/WebCompositorAnimationDelegate.h" | 47 #include "public/platform/WebCompositorAnimationDelegate.h" |
| 47 #include "public/platform/WebContentLayer.h" | 48 #include "public/platform/WebContentLayer.h" |
| 48 #include "public/platform/WebImageLayer.h" | 49 #include "public/platform/WebImageLayer.h" |
| 49 #include "public/platform/WebLayerClient.h" | |
| 50 #include "public/platform/WebLayerScrollClient.h" | 50 #include "public/platform/WebLayerScrollClient.h" |
| 51 #include "public/platform/WebScrollBlocksOn.h" | 51 #include "public/platform/WebScrollBlocksOn.h" |
| 52 #include "third_party/skia/include/core/SkPaint.h" | 52 #include "third_party/skia/include/core/SkPaint.h" |
| 53 #include "wtf/OwnPtr.h" | 53 #include "wtf/OwnPtr.h" |
| 54 #include "wtf/PassOwnPtr.h" | 54 #include "wtf/PassOwnPtr.h" |
| 55 #include "wtf/Vector.h" | 55 #include "wtf/Vector.h" |
| 56 | 56 |
| 57 namespace blink { | 57 namespace blink { |
| 58 | 58 |
| 59 class FloatRect; | 59 class FloatRect; |
| 60 class GraphicsContext; | 60 class GraphicsContext; |
| 61 class GraphicsLayer; | 61 class GraphicsLayer; |
| 62 class GraphicsLayerFactory; | 62 class GraphicsLayerFactory; |
| 63 class GraphicsLayerFactoryChromium; | 63 class GraphicsLayerFactoryChromium; |
| 64 class Image; | 64 class Image; |
| 65 class LinkHighlight; | 65 class LinkHighlight; |
| 66 class JSONObject; | 66 class JSONObject; |
| 67 class PaintController; | 67 class PaintController; |
| 68 class ScrollableArea; | 68 class ScrollableArea; |
| 69 class WebCompositorAnimation; | 69 class WebCompositorAnimation; |
| 70 class WebLayer; | 70 class WebLayer; |
| 71 | 71 |
| 72 typedef Vector<GraphicsLayer*, 64> GraphicsLayerVector; | 72 typedef Vector<GraphicsLayer*, 64> GraphicsLayerVector; |
| 73 | 73 |
| 74 // GraphicsLayer is an abstraction for a rendering surface with backing store, | 74 // GraphicsLayer is an abstraction for a rendering surface with backing store, |
| 75 // which may have associated transformation and animations. | 75 // which may have associated transformation and animations. |
| 76 | 76 |
| 77 class PLATFORM_EXPORT GraphicsLayer : public GraphicsContextPainter, public WebC
ompositorAnimationDelegate, public WebLayerScrollClient, public WebLayerClient { | 77 class PLATFORM_EXPORT GraphicsLayer : public GraphicsContextPainter, public WebC
ompositorAnimationDelegate, public WebLayerScrollClient, public cc::LayerClient
{ |
| 78 WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED(GraphicsLayer); | 78 WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED(GraphicsLayer); |
| 79 public: | 79 public: |
| 80 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer
Client*); | 80 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer
Client*); |
| 81 | 81 |
| 82 ~GraphicsLayer() override; | 82 ~GraphicsLayer() override; |
| 83 | 83 |
| 84 GraphicsLayerClient* client() const { return m_client; } | 84 GraphicsLayerClient* client() const { return m_client; } |
| 85 | 85 |
| 86 // WebLayerClient implementation. | |
| 87 WebGraphicsLayerDebugInfo* takeDebugInfoFor(WebLayer*) override; | |
| 88 | |
| 89 GraphicsLayerDebugInfo& debugInfo(); | 86 GraphicsLayerDebugInfo& debugInfo(); |
| 90 | 87 |
| 91 void setCompositingReasons(CompositingReasons); | 88 void setCompositingReasons(CompositingReasons); |
| 92 CompositingReasons compositingReasons() const { return m_debugInfo.compositi
ngReasons(); } | 89 CompositingReasons compositingReasons() const { return m_debugInfo.compositi
ngReasons(); } |
| 93 void setOwnerNodeId(int); | 90 void setOwnerNodeId(int); |
| 94 | 91 |
| 95 GraphicsLayer* parent() const { return m_parent; } | 92 GraphicsLayer* parent() const { return m_parent; } |
| 96 void setParent(GraphicsLayer*); // Internal use only. | 93 void setParent(GraphicsLayer*); // Internal use only. |
| 97 | 94 |
| 98 const Vector<GraphicsLayer*>& children() const { return m_children; } | 95 const Vector<GraphicsLayer*>& children() const { return m_children; } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 void paint(GraphicsContext&, const IntRect& clip) override; | 242 void paint(GraphicsContext&, const IntRect& clip) override; |
| 246 void paintIfNeeded(GraphicsContext&) override; | 243 void paintIfNeeded(GraphicsContext&) override; |
| 247 | 244 |
| 248 // WebCompositorAnimationDelegate implementation. | 245 // WebCompositorAnimationDelegate implementation. |
| 249 void notifyAnimationStarted(double monotonicTime, int group) override; | 246 void notifyAnimationStarted(double monotonicTime, int group) override; |
| 250 void notifyAnimationFinished(double monotonicTime, int group) override; | 247 void notifyAnimationFinished(double monotonicTime, int group) override; |
| 251 | 248 |
| 252 // WebLayerScrollClient implementation. | 249 // WebLayerScrollClient implementation. |
| 253 void didScroll() override; | 250 void didScroll() override; |
| 254 | 251 |
| 252 // cc::LayerClient implementation. |
| 253 scoped_refptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo(cc:
:Layer*) override; |
| 254 |
| 255 PaintController* paintController() override; | 255 PaintController* paintController() override; |
| 256 | 256 |
| 257 // Exposed for tests. | 257 // Exposed for tests. |
| 258 virtual WebLayer* contentsLayer() const { return m_contentsLayer; } | 258 virtual WebLayer* contentsLayer() const { return m_contentsLayer; } |
| 259 | 259 |
| 260 static void setDrawDebugRedFillForTesting(bool); | 260 static void setDrawDebugRedFillForTesting(bool); |
| 261 ContentLayerDelegate* contentLayerDelegateForTesting() const { return m_cont
entLayerDelegate.get(); } | 261 ContentLayerDelegate* contentLayerDelegateForTesting() const { return m_cont
entLayerDelegate.get(); } |
| 262 | 262 |
| 263 #ifndef NDEBUG | 263 #ifndef NDEBUG |
| 264 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } | 264 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } |
| 265 String debugName() const { return m_client->debugName(this) + " debug red fi
ll"; } | 265 String debugName() const { return m_client->debugName(this) + " debug red fi
ll"; } |
| 266 #endif | 266 #endif |
| 267 | 267 |
| 268 protected: | 268 protected: |
| 269 String debugName(WebLayer*) const; | 269 String debugName(cc::Layer*) const; |
| 270 | 270 |
| 271 explicit GraphicsLayer(GraphicsLayerClient*); | 271 explicit GraphicsLayer(GraphicsLayerClient*); |
| 272 // GraphicsLayerFactoryChromium that wants to create a GraphicsLayer need to
be friends. | 272 // GraphicsLayerFactoryChromium that wants to create a GraphicsLayer need to
be friends. |
| 273 friend class GraphicsLayerFactoryChromium; | 273 friend class GraphicsLayerFactoryChromium; |
| 274 // for testing | 274 // for testing |
| 275 friend class FakeGraphicsLayerFactory; | 275 friend class FakeGraphicsLayerFactory; |
| 276 | 276 |
| 277 private: | 277 private: |
| 278 // Adds a child without calling updateChildList(), so that adding children | 278 // Adds a child without calling updateChildList(), so that adding children |
| 279 // can be batched before updating. | 279 // can be batched before updating. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 }; | 369 }; |
| 370 | 370 |
| 371 } // namespace blink | 371 } // namespace blink |
| 372 | 372 |
| 373 #ifndef NDEBUG | 373 #ifndef NDEBUG |
| 374 // Outside the blink namespace for ease of invocation from gdb. | 374 // Outside the blink namespace for ease of invocation from gdb. |
| 375 void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*); | 375 void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*); |
| 376 #endif | 376 #endif |
| 377 | 377 |
| 378 #endif // GraphicsLayer_h | 378 #endif // GraphicsLayer_h |
| OLD | NEW |