Index: third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h b/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h |
index 7749aace88eaec366958ae0a6b16465392c13f75..ba3c3f3dc52dea45af43945a41efe6f38878fd54 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h |
+++ b/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h |
@@ -7,6 +7,7 @@ |
#include "platform/PlatformExport.h" |
#include "platform/geometry/FloatRoundedRect.h" |
+#include "platform/graphics/paint/FloatClipRect.h" |
#include "platform/graphics/paint/TransformPaintPropertyNode.h" |
#include "wtf/PassRefPtr.h" |
#include "wtf/RefCounted.h" |
@@ -86,21 +87,60 @@ class PLATFORM_EXPORT ClipPaintPropertyNode |
return m_directCompositingReasons != CompositingReasonNone; |
} |
+ // Clears all clip caches (see getClipCache()). |
+ static void clearCache(); |
+ |
+ 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) {} |
+ }; |
+ |
private: |
ClipPaintPropertyNode( |
PassRefPtr<const ClipPaintPropertyNode> parent, |
PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
const FloatRoundedRect& clipRect, |
- CompositingReasons directCompositingReasons) |
- : m_parent(parent), |
- m_localTransformSpace(localTransformSpace), |
- m_clipRect(clipRect), |
- m_directCompositingReasons(directCompositingReasons) {} |
+ CompositingReasons directCompositingReasons); |
+ |
+ struct ClipCacheEntry { |
+ const ClipAndTransform clipAndTransform; |
+ const FloatClipRect clipRect; |
+ ClipCacheEntry(const ClipAndTransform& clipAndTransformArg, |
+ const FloatClipRect& clipRectArg) |
+ : clipAndTransform(clipAndTransformArg), clipRect(clipRectArg) {} |
+ }; |
+ |
+ Vector<ClipCacheEntry>* getClipCacheEntries(); |
+ |
+ // For access to getCachedClip() and setCachedClip. |
+ friend class GeometryMapper; |
+ friend class GeometryMapperTest; |
+ |
+ // Returns the "clip visual rect" (See GeometryMapper.h) of |this| |
+ // in the space of |ancestors|, if there is one cached. Otherwise returns |
+ // null. |
+ const FloatClipRect* getCachedClip(const ClipAndTransform& ancestors) const; |
+ // Stores the "clip visual rect" of |this in the space of |ancestors|, |
+ // into a local cache. |
+ |
pdr.
2017/03/07 23:25:43
nit: extra newline
|
+ void setCachedClip(const ClipAndTransform&, const FloatClipRect&) const; |
RefPtr<const ClipPaintPropertyNode> m_parent; |
RefPtr<const TransformPaintPropertyNode> m_localTransformSpace; |
FloatRoundedRect m_clipRect; |
CompositingReasons m_directCompositingReasons; |
+ |
+ std::unique_ptr<Vector<ClipCacheEntry>> m_clipCache; |
+ unsigned m_cacheGeneration; |
+ const FloatClipRect m_infiniteClip; |
pdr.
2017/03/07 23:25:43
I don't quite understand this. What is it used for
|
}; |
// Redeclared here to avoid ODR issues. |