| Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
|
| diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
|
| index bdb5895211e80c4e59101fe6ea0cf8f71ba6353a..38e955b6e0505711de55c10e8b3966bba580b735 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
|
| +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
|
| @@ -16,6 +16,7 @@
|
| #include <memory>
|
|
|
| namespace cc {
|
| +class DisplayItemList;
|
| class Layer;
|
| }
|
|
|
| @@ -25,6 +26,7 @@ class Vector2dF;
|
|
|
| namespace blink {
|
|
|
| +class GeometryMapper;
|
| class JSONObject;
|
| class PaintArtifact;
|
| class WebLayer;
|
| @@ -81,24 +83,50 @@ class PLATFORM_EXPORT PaintArtifactCompositor {
|
|
|
| std::unique_ptr<JSONObject> layersAsJSON(LayerTreeFlags) const;
|
|
|
| +#ifndef NDEBUG
|
| + void showDebugData();
|
| +#endif
|
| +
|
| private:
|
| + // A pending layer is a collection of paint chunks that will end up in
|
| + // the same cc::Layer.
|
| + struct PLATFORM_EXPORT PendingLayer {
|
| + PendingLayer(const PaintChunk& firstPaintChunk);
|
| + void add(const PaintChunk&, GeometryMapper*);
|
| + FloatRect bounds;
|
| + Vector<const PaintChunk*> paintChunks;
|
| + bool knownToBeOpaque;
|
| + bool backfaceHidden;
|
| + PropertyTreeState propertyTreeState;
|
| + };
|
| +
|
| PaintArtifactCompositor();
|
|
|
| class ContentLayerClientImpl;
|
|
|
| + // Collects the PaintChunks into groups which will end up in the same
|
| + // cc layer. This includes testing PaintChunks for "merge" compatibility (e.g.
|
| + // directly composited property tree states are separately composited)
|
| + // and overlap testing (PaintChunks that overlap existing PaintLayers they
|
| + // are not compatible with must be separately composited).
|
| + void collectPendingLayers(const PaintArtifact&,
|
| + Vector<PendingLayer>& pendingLayers,
|
| + GeometryMapper&);
|
| +
|
| // Builds a leaf layer that represents a single paint chunk.
|
| // Note: cc::Layer API assumes the layer bounds start at (0, 0), but the
|
| // bounding box of a paint chunk does not necessarily start at (0, 0) (and
|
| // could even be negative). Internally the generated layer translates the
|
| // paint chunk to align the bounding box to (0, 0) and return the actual
|
| // origin of the paint chunk in the |layerOffset| outparam.
|
| - scoped_refptr<cc::Layer> layerForPaintChunk(
|
| + scoped_refptr<cc::Layer> compositedLayerForPendingLayer(
|
| const PaintArtifact&,
|
| - const PaintChunk&,
|
| + const PendingLayer&,
|
| gfx::Vector2dF& layerOffset,
|
| Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients,
|
| - RasterInvalidationTracking*,
|
| - bool storeDebugInfo);
|
| + RasterInvalidationTrackingMap<const PaintChunk>*,
|
| + bool storeDebugInfo,
|
| + GeometryMapper&);
|
|
|
| // Finds a client among the current vector of clients that matches the paint
|
| // chunk's id, or otherwise allocates a new one.
|
| @@ -106,6 +134,26 @@ class PLATFORM_EXPORT PaintArtifactCompositor {
|
| const PaintChunk&,
|
| const PaintArtifact&);
|
|
|
| + // This method is an implementation of Algorithm step 4 from goo.gl/6xP8Oe.
|
| + static scoped_refptr<cc::DisplayItemList> recordPendingLayer(
|
| + const PaintArtifact&,
|
| + const PendingLayer&,
|
| + const gfx::Rect& combinedBounds,
|
| + GeometryMapper&);
|
| +
|
| + static bool canMergeInto(const PaintArtifact&,
|
| + const PaintChunk& newChunk,
|
| + const PendingLayer& candidatePendingLayer);
|
| +
|
| + // Returns true if |newChunk| might overlap |candidatePendingLayer| in the
|
| + // root property tree space. If it does overlap, it will always return true.
|
| + // If it doesn't overlap, it might return true in cases were we can't
|
| + // efficiently determine a false value, or the truth depends on
|
| + // compositor animations.
|
| + static bool mightOverlap(const PaintChunk& newChunk,
|
| + const PendingLayer& candidatePendingLayer,
|
| + GeometryMapper&);
|
| +
|
| scoped_refptr<cc::Layer> m_rootLayer;
|
| std::unique_ptr<WebLayer> m_webLayer;
|
| Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients;
|
| @@ -115,6 +163,35 @@ class PLATFORM_EXPORT PaintArtifactCompositor {
|
| friend class StubChromeClientForSPv2;
|
|
|
| bool m_isTrackingRasterInvalidations;
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + ForeignLayerPassesThrough);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + MergeSimpleChunks);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + Merge2DTransform);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + MergeClip);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + MergeOpacity);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + MergeNested);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + ClipPushedUp);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + EffectPushedUp);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + EffectAndClipPushedUp);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + ClipAndEffectNoTransform);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + TwoClips);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + TwoEffects);
|
| +
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + PendingLayer);
|
| + FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees,
|
| + PendingLayerWithGeometry);
|
| };
|
|
|
| } // namespace blink
|
|
|