Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1196)

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h

Issue 2798513002: Revert of Make GeometryMapper fully static (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f69e3da86c7f3aa2dac7fd38f4be09ce9bf4dc12..75ac9799bafeef67317dcd37296b903183a8cbd2 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h
@@ -31,6 +31,10 @@
USING_FAST_MALLOC(GeometryMapper);
public:
+ static std::unique_ptr<GeometryMapper> create() {
+ return WTF::wrapUnique(new GeometryMapper());
+ }
+
// The runtime of m calls among localToAncestorVisualRect, localToAncestorRect
// or ancestorToLocalRect with the same |ancestorState| parameter is
// guaranteed to be O(n + m), where n is the number of transform and clip
@@ -48,16 +52,15 @@
// clip of |sourceState|, or the inverse transform is not invertible.
//
// |mappingRect| is both input and output.
- static void sourceToDestinationVisualRect(
- const PropertyTreeState& sourceState,
- const PropertyTreeState& destinationState,
- FloatRect& mappingRect);
+ void sourceToDestinationVisualRect(const PropertyTreeState& sourceState,
+ const PropertyTreeState& destinationState,
+ FloatRect& mappingRect);
// Same as sourceToDestinationVisualRect() except that only transforms are
// applied.
//
// |mappingRect| is both input and output.
- static void sourceToDestinationRect(
+ void sourceToDestinationRect(
const TransformPaintPropertyNode* sourceTransformNode,
const TransformPaintPropertyNode* destinationTransformNode,
FloatRect& mappingRect);
@@ -76,10 +79,9 @@
// |ancestorState|.
//
// |mappingRect| is both input and output.
- static void localToAncestorVisualRect(
- const PropertyTreeState& localTransformState,
- const PropertyTreeState& ancestorState,
- FloatRect& mappingRect);
+ void localToAncestorVisualRect(const PropertyTreeState& localTransformState,
+ const PropertyTreeState& ancestorState,
+ FloatRect& mappingRect);
// Maps from a rect in |localTransformNode| space to its transformed rect in
// |ancestorTransformNode| space. This is computed by multiplying the rect by
@@ -90,7 +92,7 @@
// |ancestorTransformNode|.
//
//|mappingRect| is both input and output.
- static void localToAncestorRect(
+ void localToAncestorRect(
const TransformPaintPropertyNode* localTransformNode,
const TransformPaintPropertyNode* ancestorTransformNode,
FloatRect& mappingRect);
@@ -105,7 +107,7 @@
// |ancestorTransformNode|.
//
// |mappingRect| is both input and output.
- static void ancestorToLocalRect(
+ void ancestorToLocalRect(
const TransformPaintPropertyNode* ancestorTransformNode,
const TransformPaintPropertyNode* localTransformNode,
FloatRect& mappingRect);
@@ -117,19 +119,19 @@
// flattened ancestor spaces, the returned matrix must be flattened to have
// the correct semantics (calling mapRect() on it implicitly applies
// flattening to the input; flattenTo2d() does it explicitly to tme matrix).
- static const TransformationMatrix& localToAncestorMatrix(
+ const TransformationMatrix& localToAncestorMatrix(
const TransformPaintPropertyNode* localTransformNode,
const TransformPaintPropertyNode* ancestorTransformNode);
// Returns the "clip visual rect" between |localTransformState| and
// |ancestorState|. See above for the definition of "clip visual rect".
- static FloatClipRect localToAncestorClipRect(
+ FloatClipRect localToAncestorClipRect(
const PropertyTreeState& localTransformState,
const PropertyTreeState& ancestorState);
// Like localToAncestorClipRect, except it can handle destination transform
// spaces which are not direct ancestors of the source transform space.
- static const FloatClipRect& sourceToDestinationClipRect(
+ const FloatClipRect& sourceToDestinationClipRect(
const PropertyTreeState& sourceState,
const PropertyTreeState& destinationState);
@@ -138,7 +140,10 @@
static PLATFORM_EXPORT const NodeType* lowestCommonAncestor(const NodeType*,
const NodeType*);
- static void clearCache();
+ void clearCache();
+
+ protected:
+ GeometryMapper() {}
private:
// The internal methods do the same things as their public counterparts, but
@@ -146,53 +151,55 @@
// successful on return. See comments of the public functions for failure
// conditions.
- static void sourceToDestinationVisualRectInternal(
+ void sourceToDestinationVisualRectInternal(
const PropertyTreeState& sourceState,
const PropertyTreeState& destinationState,
FloatRect& mappingRect,
bool& success);
- static void localToAncestorVisualRectInternal(
+ void localToAncestorVisualRectInternal(
const PropertyTreeState& localTransformState,
const PropertyTreeState& ancestorState,
FloatRect& mappingRect,
bool& success);
- static void localToAncestorRectInternal(
+ void localToAncestorRectInternal(
const TransformPaintPropertyNode* localTransformNode,
const TransformPaintPropertyNode* ancestorTransformNode,
FloatRect&,
bool& success);
- static const TransformationMatrix& localToAncestorMatrixInternal(
- const TransformPaintPropertyNode* localTransformNode,
- const TransformPaintPropertyNode* ancestorTransformNode,
- bool& success);
-
- static const FloatClipRect& localToAncestorClipRectInternal(
+ const TransformationMatrix& localToAncestorMatrixInternal(
+ const TransformPaintPropertyNode* localTransformNode,
+ const TransformPaintPropertyNode* ancestorTransformNode,
+ bool& success);
+
+ const FloatClipRect& localToAncestorClipRectInternal(
const ClipPaintPropertyNode* descendant,
const ClipPaintPropertyNode* ancestorClip,
const TransformPaintPropertyNode* ancestorTransform,
bool& success);
- static const FloatClipRect& sourceToDestinationClipRectInternal(
+ const FloatClipRect& sourceToDestinationClipRectInternal(
const PropertyTreeState& sourceState,
const PropertyTreeState& destinationState,
bool& success);
- static void slowLocalToAncestorVisualRectWithEffects(
+ void slowLocalToAncestorVisualRectWithEffects(
const PropertyTreeState& localState,
const PropertyTreeState& ancestorState,
FloatRect& mappingRect,
bool& success);
- static const TransformationMatrix& identityMatrix();
- static const FloatClipRect& infiniteClip();
- static FloatClipRect& tempRect();
-
friend class GeometryMapperTest;
friend class PaintLayerClipperTest;
+ // These are used to represent various return values of the above
+ // methods.
+ const TransformationMatrix m_identity;
+ const FloatClipRect m_infiniteClip;
+ FloatClipRect m_tempRect;
+
DISALLOW_COPY_AND_ASSIGN(GeometryMapper);
};

Powered by Google App Engine
This is Rietveld 408576698