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