Index: third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h |
index 05514071738a79c7bf089d3533fdddf7725f2f62..dfa25c6db71ee7a697e5d86a15064531be6e2bbc 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h |
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h |
@@ -156,7 +156,7 @@ class PLATFORM_EXPORT GeometryMapper { |
const TransformPaintPropertyNode* ancestorTransformNode, |
bool& success); |
- FloatClipRect localToAncestorClipRectInternal( |
+ const FloatClipRect& localToAncestorClipRectInternal( |
const ClipPaintPropertyNode* descendant, |
const ClipPaintPropertyNode* ancestorClip, |
const TransformPaintPropertyNode* ancestorTransform, |
@@ -173,45 +173,72 @@ class PLATFORM_EXPORT GeometryMapper { |
const PropertyTreeState& ancestorState, |
bool& success); |
- // Maps from a transform node that is a descendant of the implied ancestor |
- // transform node to the combined transform between the descendant's and the |
- // ancestor's coordinate space. |
- // The "implied ancestor" is the key of the m_transformCache object for which |
- // this TransformCache is a value. |
- using TransformCache = |
- HashMap<const TransformPaintPropertyNode*, TransformationMatrix>; |
- |
- // Returns the transform cache for the given ancestor transform node. |
- TransformCache& getTransformCache(const TransformPaintPropertyNode* ancestor); |
- |
- // Maps from a descendant clip node to its equivalent "clip visual rect" in |
- // the local transform space of the implied ancestor clip node. The clip |
- // visual rect is defined as the intersection of all clips between the |
- // descendant and the ancestor (*not* including the ancestor) in the clip |
- // tree, individually transformed from their localTransformSpace into the |
- // ancestor's localTransformSpace. If one of the clips that contributes to it |
- // has a border radius, the hasRadius() field is set to true. |
- // The "implied ancestor" is the key of the TransformToClip cachefor which |
- // this ClipCache is a value. |
- using ClipCache = HashMap<const ClipPaintPropertyNode*, FloatClipRect>; |
- |
- using TransformToClip = |
- HashMap<const TransformPaintPropertyNode*, std::unique_ptr<ClipCache>>; |
- |
- // Returns the clip cache for the given transform space relative to the |
- // given ancestor clip node. |
- ClipCache& getClipCache(const ClipPaintPropertyNode* ancestorClip, |
- const TransformPaintPropertyNode* ancestorTransform); |
+ 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) {} |
+ }; |
+ |
+ struct ClipCacheEntry { |
+ const ClipAndTransform clipAndTransform; |
+ const FloatClipRect clipRect; |
+ ClipCacheEntry(const ClipAndTransform& clipAndTransformArg, |
+ const FloatClipRect& clipRectArg) |
+ : clipAndTransform(clipAndTransformArg), clipRect(clipRectArg) {} |
+ }; |
+ |
+ Vector<ClipCacheEntry>* getClipCacheEntries( |
+ const ClipPaintPropertyNode* descendantClip); |
+ |
+ const FloatClipRect* getClip(const ClipPaintPropertyNode* descendantClip, |
+ const ClipAndTransform& ancestors); |
+ |
+ void setClip(const ClipPaintPropertyNode* descendantClip, |
+ const ClipAndTransform&, |
+ const FloatClipRect&); |
+ |
+ struct TransformCacheEntry { |
+ const TransformPaintPropertyNode* ancestorNode; |
+ TransformationMatrix toAncestor; |
+ TransformCacheEntry(const TransformPaintPropertyNode* ancestorNodeArg, |
+ const TransformationMatrix& toAncestorArg) |
+ : ancestorNode(ancestorNodeArg), toAncestor(toAncestorArg) {} |
+ }; |
+ |
+ Vector<TransformCacheEntry>* getTransformCacheEntries( |
+ const TransformPaintPropertyNode* descendantTransform); |
+ |
+ const TransformationMatrix* getTransform( |
+ const TransformPaintPropertyNode* descendantTransform, |
+ const TransformPaintPropertyNode* ancestorTransform); |
+ |
+ void setTransform(const TransformPaintPropertyNode* descendantTransform, |
+ const TransformPaintPropertyNode* ancestorTransform, |
+ const TransformationMatrix& toAncestor); |
friend class GeometryMapperTest; |
friend class PaintLayerClipperTest; |
- HashMap<const TransformPaintPropertyNode*, std::unique_ptr<TransformCache>> |
+ // Maps from a descendant transform node to a list of all ancestor transform |
+ // nodes for which there is a cached transform from the descendant. |
+ HashMap<const TransformPaintPropertyNode*, |
+ std::unique_ptr<Vector<TransformCacheEntry>>> |
m_transformCache; |
- HashMap<const ClipPaintPropertyNode*, std::unique_ptr<TransformToClip>> |
+ |
+ // Maps from a descendant clip node to a list of all <transform, clip> |
+ // ancestor pairs for which there is a cached clip rect from the descendant. |
+ HashMap<const ClipPaintPropertyNode*, std::unique_ptr<Vector<ClipCacheEntry>>> |
m_clipCache; |
const TransformationMatrix m_identity; |
+ const FloatClipRect m_infiniteClip; |
DISALLOW_COPY_AND_ASSIGN(GeometryMapper); |
}; |