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

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

Issue 2268773002: Support css clip on fixed-position GeometryMapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Support css clip on fixed-position GeometryMapper Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GeometryMapper_h 5 #ifndef GeometryMapper_h
6 #define GeometryMapper_h 6 #define GeometryMapper_h
7 7
8 #include "platform/geometry/FloatRect.h" 8 #include "platform/geometry/FloatRect.h"
9 #include "platform/graphics/paint/PropertyTreeState.h" 9 #include "platform/graphics/paint/PropertyTreeState.h"
10 #include "platform/transforms/TransformationMatrix.h" 10 #include "platform/transforms/TransformationMatrix.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // then flattening into 2D space, then intersecting by the "clip visual rect " for |localTransformState|'s clips. 69 // then flattening into 2D space, then intersecting by the "clip visual rect " for |localTransformState|'s clips.
70 // See above for the definition of "clip visual rect". 70 // See above for the definition of "clip visual rect".
71 // 71 //
72 // Note that the clip of |ancestorState| is *not* applied. 72 // Note that the clip of |ancestorState| is *not* applied.
73 // 73 //
74 // If any of the paint property tree nodes in |localTransformState| are not equal 74 // If any of the paint property tree nodes in |localTransformState| are not equal
75 // to or a descendant of that in |ancestorState|, returns the passed-in rect and sets |success| to false. Otherwise, 75 // to or a descendant of that in |ancestorState|, returns the passed-in rect and sets |success| to false. Otherwise,
76 // sets |success| to true. 76 // sets |success| to true.
77 FloatRect localToVisualRectInAncestorSpace(const FloatRect&, 77 FloatRect localToVisualRectInAncestorSpace(const FloatRect&,
78 const PropertyTreeState& localTransformState, 78 const PropertyTreeState& localTransformState,
79 const PropertyTreeState& ancestorState, bool& success); 79 const PropertyTreeState& ancestorState,
80 bool& success);
80 81
81 // Maps from a rect in |localTransformSpace| to its transformed rect in |anc estorSpace|. This is computed 82 // Maps from a rect in |localTransformSpace| to its transformed rect in |anc estorSpace|. This is computed
82 // by multiplying the rect by the combined transform between |localTransform State| and |ancestorState|, 83 // by multiplying the rect by the combined transform between |localTransform State| and |ancestorState|,
83 // then flattening into 2D space. 84 // then flattening into 2D space.
84 // 85 //
85 // If any of the paint property tree nodes in |localTransformState| are not equal 86 // If any of the paint property tree nodes in |localTransformState| are not equal
86 // to or a descendant of that in |ancestorState|, returns the passed-in rec and sets |success| to false. Otherwise, 87 // to or a descendant of that in |ancestorState|, returns the passed-in rec and sets |success| to false. Otherwise,
87 // sets |success| to true. 88 // sets |success| to true.
88 // 89 //
89 // If any of the paint property tree nodes in |localTransformState| are not equal 90 // If any of the paint property tree nodes in |localTransformState| are not equal
90 // to or a descendant of that in |ancestorState|, returns the passed-in rect and sets |success| to false. Otherwise, 91 // to or a descendant of that in |ancestorState|, returns the passed-in rect and sets |success| to false. Otherwise,
91 // sets |success| to true. 92 // sets |success| to true.
92 FloatRect localToAncestorRect(const FloatRect&, 93 FloatRect localToAncestorRect(const FloatRect&,
93 const PropertyTreeState& localTransformState, 94 const PropertyTreeState& localTransformState,
94 const PropertyTreeState& ancestorState, bool& success); 95 const PropertyTreeState& ancestorState,
96 bool& success);
95 97
96 // Maps from a rect in |ancestorSpace| to its transformed rect in |localTran sformSpace|. This is computed 98 // Maps from a rect in |ancestorSpace| to its transformed rect in |localTran sformSpace|. This is computed
97 // by multiplying the rect by the inverse combined transform between |localT ransformState| and |ancestorState|, 99 // by multiplying the rect by the inverse combined transform between |localT ransformState| and |ancestorState|,
98 // if the transform is invertible. 100 // if the transform is invertible.
99 // 101 //
100 // If any of the paint property tree nodes in |localTransformState| are not equal 102 // If any of the paint property tree nodes in |localTransformState| are not equal
101 // to or a descendant of that in |ancestorState|, returns the passed-in rect and sets |success| to false. Otherwise, 103 // to or a descendant of that in |ancestorState|, returns the passed-in rect and sets |success| to false. Otherwise,
102 // sets |success| to true. 104 // sets |success| to true.
103 FloatRect ancestorToLocalRect(const FloatRect&, 105 FloatRect ancestorToLocalRect(const FloatRect&,
104 const PropertyTreeState& localTransformState, 106 const PropertyTreeState& localTransformState,
105 const PropertyTreeState& ancestorState, bool& success); 107 const PropertyTreeState& ancestorState,
108 bool& success);
106 109
107 private: 110 private:
108 // Used by mapToVisualRectInDestinationSpace() and mapRectToDestinationSpace () after fast mapping 111 // Used by mapToVisualRectInDestinationSpace() after fast mapping (assuming destination is an ancestor of source) failed.
109 // (assuming destination is an ancestor of source) failed. 112 FloatRect slowMapToVisualRectInDestinationSpace(const FloatRect&,
chrishtr 2016/08/22 22:27:32 Please add a direct unittest to GeometryMapperTest
Xianzhu 2016/08/22 23:30:20 Done.
113 const PropertyTreeState& sourceState,
114 const PropertyTreeState& destinationState,
115 bool& success);
116
117 // Used by mapRectToDestinationSpace() after fast mapping (assuming destinat ion is an ancestor of source) failed.
110 FloatRect slowMapRectToDestinationSpace(const FloatRect&, 118 FloatRect slowMapRectToDestinationSpace(const FloatRect&,
111 const PropertyTreeState& sourceState, 119 const PropertyTreeState& sourceState,
112 const PropertyTreeState& destinationState, 120 const PropertyTreeState& destinationState,
113 bool& success); 121 bool& success);
114 122
115 // Returns the matrix used in |LocalToAncestorRect|. Sets |success| to fails e iff |localTransformNode| is not 123 // Returns the matrix used in |LocalToAncestorRect|. Sets |success| to fails e iff |localTransformNode| is not
116 // equal to or a descendant of |ancestorState.transform|. 124 // equal to or a descendant of |ancestorState.transform|.
117 const TransformationMatrix& localToAncestorMatrix( 125 const TransformationMatrix& localToAncestorMatrix(
118 const TransformPaintPropertyNode* localTransformNode, 126 const TransformPaintPropertyNode* localTransformNode,
119 const PropertyTreeState& ancestorState, bool& success); 127 const PropertyTreeState& ancestorState,
128 bool& success);
120 129
121 // Returns the "clip visual rect" between |localTransformState| and |ancesto rState|. See above for the definition 130 // Returns the "clip visual rect" between |localTransformState| and |ancesto rState|. See above for the definition
122 // of "clip visual rect". 131 // of "clip visual rect".
123 const FloatRect& localToAncestorClipRect( 132 FloatRect localToAncestorClipRect(
124 const PropertyTreeState& localTransformState, 133 const PropertyTreeState& localTransformState,
125 const PropertyTreeState& ancestorState); 134 const PropertyTreeState& ancestorState,
135 bool& success);
126 136
127 // Returns the precomputed data if already set, or adds and memoizes a new P recomputedDataForAncestor otherwise. 137 // Returns the precomputed data if already set, or adds and memoizes a new P recomputedDataForAncestor otherwise.
128 PrecomputedDataForAncestor& getPrecomputedDataForAncestor(const PropertyTree State&); 138 PrecomputedDataForAncestor& getPrecomputedDataForAncestor(const PropertyTree State&);
129 139
130 // Returns the least common ancestor in the transform tree. 140 // Returns the least common ancestor in the transform tree.
131 PassRefPtr<TransformPaintPropertyNode> leastCommonAncestor(PassRefPtr<Transf ormPaintPropertyNode>, PassRefPtr<TransformPaintPropertyNode>); 141 PassRefPtr<TransformPaintPropertyNode> leastCommonAncestor(PassRefPtr<Transf ormPaintPropertyNode>, PassRefPtr<TransformPaintPropertyNode>);
132 142
133 friend class GeometryMapperTest; 143 friend class GeometryMapperTest;
134 144
135 HashMap<const TransformPaintPropertyNode*, std::unique_ptr<PrecomputedDataFo rAncestor>> m_data; 145 HashMap<const TransformPaintPropertyNode*, std::unique_ptr<PrecomputedDataFo rAncestor>> m_data;
136 146
137 const TransformationMatrix m_identity; 147 const TransformationMatrix m_identity;
138 148
139 DISALLOW_COPY_AND_ASSIGN(GeometryMapper); 149 DISALLOW_COPY_AND_ASSIGN(GeometryMapper);
140 }; 150 };
141 151
142 } // namespace blink 152 } // namespace blink
143 153
144 #endif // GeometryMapper_h 154 #endif // GeometryMapper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698