Index: third_party/WebKit/Source/platform/graphics/paint/GeometryMapperClipCache.h |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperClipCache.h b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperClipCache.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7ddbb42b881727d022c773c4e713e105d20a0f52 |
--- /dev/null |
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperClipCache.h |
@@ -0,0 +1,64 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef GeometryMapperClipCache_h |
+#define GeometryMapperClipCache_h |
+ |
+#include "platform/PlatformExport.h" |
+#include "platform/graphics/paint/FloatClipRect.h" |
+#include "wtf/Vector.h" |
+ |
+namespace blink { |
+ |
+class ClipPaintPropertyNode; |
+class FloatClipRect; |
+class TransformPaintPropertyNode; |
+ |
+// A GeometryMapperClipCache hangs off a ClipPaintPropertyNode. It stores |
+// cached "clip visual rects" (See GeometryMapper.h) from that node in |
+// ancestor spaces. |
+class PLATFORM_EXPORT GeometryMapperClipCache { |
+ public: |
+ struct ClipAndTransform { |
+ const ClipPaintPropertyNode* ancestorClip; |
+ const TransformPaintPropertyNode* ancestorTransform; |
+ bool operator==(const ClipAndTransform& other) const { |
+ return ancestorClip == other.ancestorClip && |
+ ancestorTransform == other.ancestorTransform; |
+ } |
+ ClipAndTransform(const ClipPaintPropertyNode* ancestorClipArg, |
+ const TransformPaintPropertyNode* ancestorTransformArg) |
+ : ancestorClip(ancestorClipArg), |
+ ancestorTransform(ancestorTransformArg) {} |
+ }; |
+ |
+ // Returns the clip visual rect of the owning |
+ // clip of |this| in the space of |ancestors|, if there is one cached. |
+ // Otherwise returns null. |
+ const FloatClipRect* getCachedClip(const ClipAndTransform& ancestors); |
+ // Stores the "clip visual rect" of |this in the space of |ancestors|, |
+ // into a local cache. |
+ |
+ void setCachedClip(const ClipAndTransform&, const FloatClipRect&); |
+ |
+ static void clearCache(); |
+ |
+ private: |
+ struct ClipCacheEntry { |
+ const ClipAndTransform clipAndTransform; |
+ const FloatClipRect clipRect; |
+ ClipCacheEntry(const ClipAndTransform& clipAndTransformArg, |
+ const FloatClipRect& clipRectArg) |
+ : clipAndTransform(clipAndTransformArg), clipRect(clipRectArg) {} |
+ }; |
+ |
+ Vector<ClipCacheEntry>* getClipCacheEntries(); |
+ |
+ std::unique_ptr<Vector<ClipCacheEntry>> m_clipCache; |
pdr.
2017/03/08 02:34:55
Because GeometryMapperClipCache is lazily allocate
chrishtr
2017/03/08 02:59:28
Done.
|
+ unsigned m_cacheGeneration; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // GeometryMapperClipCache_h |