Chromium Code Reviews| 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 a39c75d1eca5c60a8def570548b692ada677e558..9bd5d998aa936daf84b88851eb83298b79d49f05 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h |
| @@ -45,14 +45,14 @@ struct PrecomputedDataForAncestor { |
| class PLATFORM_EXPORT GeometryMapper { |
| public: |
| GeometryMapper() {} |
| - // The runtime of m calls among localToVisualRectInAncestorSpace, |
| - // localToAncestorRect or ancestorToLocalRect with the same |ancestorState| |
| - // parameter is guaranteed to be O(n + m), where n is the number of transform |
| - // and clip nodes in their respective property trees. |
| + // 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 |
| + // nodes in their respective property trees. |
| // If the clips and transforms of |sourceState| are equal to or descendants of |
| // those of |destinationState|, returns the same value as |
| - // localToVisualRectInAncestorSpace. Otherwise, maps the input rect to the |
| + // localToAncestorVisualRect. Otherwise, maps the input rect to the |
| // transform state which is the least common ancestor of |
| // |sourceState.transform| and |destinationState.transform|, then multiplies |
| // it by the the inverse transform mapping from the least common ancestor to |
| @@ -60,18 +60,19 @@ class PLATFORM_EXPORT GeometryMapper { |
| // |
| // Sets |success| to whether that inverse transform is invertible. If it is |
| // not, returns the input rect. |
| - FloatRect mapToVisualRectInDestinationSpace( |
| + FloatRect sourceToDestinationVisualRect( |
| const FloatRect&, |
| const PropertyTreeState& sourceState, |
| const PropertyTreeState& destinationState, |
| bool& success); |
| - // Same as mapToVisualRectInDestinationSpace() except that *no* clip is |
| + // Same as sourceToDestinationVisualRect() except that only transforms are |
| // applied. |
| - FloatRect mapRectToDestinationSpace(const FloatRect&, |
| - const PropertyTreeState& sourceState, |
| - const PropertyTreeState& destinationState, |
| - bool& success); |
| + FloatRect sourceToDestinationRect( |
| + const FloatRect&, |
| + const TransformPaintPropertyNode* sourceTransformNode, |
|
chrishtr
2017/01/11 22:23:08
Curious: what is the new call site you're planning
Xianzhu
2017/01/11 22:51:32
I will use this for handle geometry effects of fil
|
| + const TransformPaintPropertyNode* destinationTransformNode, |
| + bool& success); |
| // Maps from a rect in |localTransformSpace| to its visual rect in |
| // |ancestorState|. This is computed by multiplying the rect by its combined |
| @@ -85,44 +86,46 @@ class PLATFORM_EXPORT GeometryMapper { |
| // If any of the paint property tree nodes in |localTransformState| are not |
| // equal to or a descendant of that in |ancestorState|, returns the passed-in |
| // rect and sets |success| to false. Otherwise, sets |success| to true. |
| - FloatRect localToVisualRectInAncestorSpace( |
| + FloatRect localToAncestorVisualRect( |
| const FloatRect&, |
| const PropertyTreeState& localTransformState, |
| const PropertyTreeState& ancestorState, |
| bool& success); |
| - // Maps from a rect in |localTransformSpace| to its transformed rect in |
| - // |ancestorSpace|. This is computed by multiplying the rect by the combined |
| - // transform between |localTransformState| and |ancestorState|, then |
| - // flattening into 2D space. |
| + // Maps from a rect in |localTransformNode| space to its transformed rect in |
| + // |ancestorTransformNode| space. This is computed by multiplying the rect by |
| + // the combined transform between |localTransformNode| and |
| + // |ancestorTransformNode|, then flattening into 2D space. |
| // |
| - // If any of the paint property tree nodes in |localTransformState| are not |
| - // equal to or a descendant of that in |ancestorState|, returns the passed-in |
| - // rec and sets |success| to false. Otherwise, sets |success| to true. |
| - FloatRect localToAncestorRect(const FloatRect&, |
| - const PropertyTreeState& localTransformState, |
| - const PropertyTreeState& ancestorState, |
| - bool& success); |
| - |
| - // Maps from a rect in |ancestorSpace| to its transformed rect in |
| - // |localTransformSpace|. This is computed by multiplying the rect by the |
| - // inverse combined transform between |localTransformState| and |
| - // |ancestorState|, if the transform is invertible. |
| + // If |localTransformNode| is not equal to or a descendant of |
| + // |ancestorTransformNode|, returns the passed-in rec and sets |success| to |
| + // false. Otherwise, sets |success| to true. |
| + FloatRect localToAncestorRect( |
| + const FloatRect&, |
| + const TransformPaintPropertyNode* localTransformNode, |
| + const TransformPaintPropertyNode* ancestorTransformNode, |
| + bool& success); |
| + |
| + // Maps from a rect in |ancestorTransformNode| space to its transformed rect |
| + // in |localTransformNode| space. This is computed by multiplying the rect by |
| + // the inverse combined transform between |localTransformNode| and |
| + // |ancestorTransformNode|, if the transform is invertible. |
| // |
| - // If any of the paint property tree nodes in |localTransformState| are not |
| - // equal to or a descendant of that in |ancestorState|, returns the passed-in |
| + // If the combined transform is not invertible, or |localTransformNode| is not |
| + // equal to or a descendant of |ancestorTransformNode|, returns the passed-in |
| // rect and sets |success| to false. Otherwise, sets |success| to true. |
| - FloatRect ancestorToLocalRect(const FloatRect&, |
| - const PropertyTreeState& localTransformState, |
| - const PropertyTreeState& ancestorState, |
| - bool& success); |
| + FloatRect ancestorToLocalRect( |
| + const FloatRect&, |
| + const TransformPaintPropertyNode* ancestorTransformNode, |
| + const TransformPaintPropertyNode* localTransformNode, |
| + bool& success); |
| // Returns the matrix used in |LocalToAncestorRect|. Sets |success| to false |
| // iff |localTransformNode| is not equal to or a descendant of |
| - // |ancestorState.transform|. |
| + // |ancestorTransformNode|. |
| const TransformationMatrix& localToAncestorMatrix( |
| const TransformPaintPropertyNode* localTransformNode, |
| - const PropertyTreeState& ancestorState, |
| + const TransformPaintPropertyNode* ancestorTransformNode, |
| bool& success); |
| // Returns the "clip visual rect" between |localTransformState| and |
| @@ -133,26 +136,26 @@ class PLATFORM_EXPORT GeometryMapper { |
| bool& success); |
| private: |
| - // Used by mapToVisualRectInDestinationSpace() after fast mapping (assuming |
| + // Used by sourceToDestinationVisualRect() after fast mapping (assuming |
| // destination is an ancestor of source) failed. |
| - FloatRect slowMapToVisualRectInDestinationSpace( |
| + FloatRect slowSourceToDestinationVisualRect( |
| const FloatRect&, |
| const PropertyTreeState& sourceState, |
| const PropertyTreeState& destinationState, |
| bool& success); |
| - // Used by mapRectToDestinationSpace() after fast mapping (assuming |
| - // destination is an ancestor of source) failed. |
| - FloatRect slowMapRectToDestinationSpace( |
| + // Used by sourceToDestinationRect() after fast mapping (assuming destination |
| + // is an ancestor of source) failed. |
| + FloatRect slowSourceToDestinationRect( |
| const FloatRect&, |
| - const PropertyTreeState& sourceState, |
| - const PropertyTreeState& destinationState, |
| + const TransformPaintPropertyNode* sourceTransformNode, |
| + const TransformPaintPropertyNode* destinationTransformNode, |
| bool& success); |
| // Returns the precomputed data if already set, or adds and memoizes a new |
| // PrecomputedDataForAncestor otherwise. |
| PrecomputedDataForAncestor& getPrecomputedDataForAncestor( |
| - const PropertyTreeState&); |
| + const TransformPaintPropertyNode*); |
| // Returns the least common ancestor in the transform tree. |
| static const TransformPaintPropertyNode* leastCommonAncestor( |