| OLD | NEW |
| 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 #include "platform/graphics/paint/GeometryMapper.h" | 5 #include "platform/graphics/paint/GeometryMapper.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 void GeometryMapper::sourceToDestinationVisualRect( | 12 FloatClipRect GeometryMapper::sourceToDestinationVisualRect( |
| 13 const FloatRect& rect, |
| 14 const PropertyTreeState& sourceState, |
| 15 const PropertyTreeState& destinationState) { |
| 16 bool success = false; |
| 17 FloatClipRect result = sourceToDestinationVisualRectInternal( |
| 18 rect, sourceState, destinationState, success); |
| 19 DCHECK(success); |
| 20 return result; |
| 21 } |
| 22 |
| 23 FloatClipRect GeometryMapper::sourceToDestinationVisualRectInternal( |
| 24 const FloatRect& rect, |
| 13 const PropertyTreeState& sourceState, | 25 const PropertyTreeState& sourceState, |
| 14 const PropertyTreeState& destinationState, | 26 const PropertyTreeState& destinationState, |
| 15 FloatRect& rect) { | |
| 16 bool success = false; | |
| 17 sourceToDestinationVisualRectInternal(sourceState, destinationState, rect, | |
| 18 success); | |
| 19 DCHECK(success); | |
| 20 } | |
| 21 | |
| 22 void GeometryMapper::sourceToDestinationVisualRectInternal( | |
| 23 const PropertyTreeState& sourceState, | |
| 24 const PropertyTreeState& destinationState, | |
| 25 FloatRect& mappingRect, | |
| 26 bool& success) { | 27 bool& success) { |
| 27 localToAncestorVisualRectInternal(sourceState, destinationState, mappingRect, | 28 FloatClipRect result = localToAncestorVisualRectInternal( |
| 28 success); | 29 rect, sourceState, destinationState, success); |
| 29 // Success if destinationState is an ancestor state. | 30 // Success if destinationState is an ancestor state. |
| 30 if (success) | 31 if (success) |
| 31 return; | 32 return result; |
| 32 | 33 |
| 33 // Otherwise first map to the lowest common ancestor, then map to destination. | 34 // Otherwise first map to the lowest common ancestor, then map to destination. |
| 34 const TransformPaintPropertyNode* lcaTransform = lowestCommonAncestor( | 35 const TransformPaintPropertyNode* lcaTransform = lowestCommonAncestor( |
| 35 sourceState.transform(), destinationState.transform()); | 36 sourceState.transform(), destinationState.transform()); |
| 36 DCHECK(lcaTransform); | 37 DCHECK(lcaTransform); |
| 37 | 38 |
| 38 // Assume that the clip of destinationState is an ancestor of the clip of | 39 // Assume that the clip of destinationState is an ancestor of the clip of |
| 39 // sourceState and is under the space of lcaTransform. Otherwise | 40 // sourceState and is under the space of lcaTransform. Otherwise |
| 40 // localToAncestorVisualRect() will fail. | 41 // localToAncestorVisualRect() will fail. |
| 41 PropertyTreeState lcaState = destinationState; | 42 PropertyTreeState lcaState = destinationState; |
| 42 lcaState.setTransform(lcaTransform); | 43 lcaState.setTransform(lcaTransform); |
| 43 | 44 |
| 44 localToAncestorVisualRectInternal(sourceState, lcaState, mappingRect, | 45 result = |
| 45 success); | 46 localToAncestorVisualRectInternal(rect, sourceState, lcaState, success); |
| 46 if (!success) | 47 if (!success) |
| 47 return; | 48 return result; |
| 48 | 49 if (!result.isInfinite()) { |
| 49 ancestorToLocalRect(lcaTransform, destinationState.transform(), mappingRect); | 50 FloatRect final = ancestorToLocalRect(result.rect(), lcaTransform, |
| 51 destinationState.transform()); |
| 52 result.setRect(final); |
| 53 } |
| 54 return result; |
| 50 } | 55 } |
| 51 | 56 |
| 52 void GeometryMapper::sourceToDestinationRect( | 57 FloatRect GeometryMapper::sourceToDestinationRect( |
| 58 const FloatRect& rect, |
| 53 const TransformPaintPropertyNode* sourceTransformNode, | 59 const TransformPaintPropertyNode* sourceTransformNode, |
| 54 const TransformPaintPropertyNode* destinationTransformNode, | 60 const TransformPaintPropertyNode* destinationTransformNode) { |
| 55 FloatRect& mappingRect) { | |
| 56 bool success = false; | 61 bool success = false; |
| 57 localToAncestorRectInternal(sourceTransformNode, destinationTransformNode, | 62 FloatRect result = localToAncestorRectInternal( |
| 58 mappingRect, success); | 63 rect, sourceTransformNode, destinationTransformNode, success); |
| 59 // Success if destinationTransformNode is an ancestor of sourceTransformNode. | 64 // Success if destinationTransformNode is an ancestor of sourceTransformNode. |
| 60 if (success) | 65 if (success) |
| 61 return; | 66 return result; |
| 62 | 67 |
| 63 // Otherwise first map to the least common ancestor, then map to destination. | 68 // Otherwise first map to the least common ancestor, then map to destination. |
| 64 const TransformPaintPropertyNode* lcaTransform = | 69 const TransformPaintPropertyNode* lcaTransform = |
| 65 lowestCommonAncestor(sourceTransformNode, destinationTransformNode); | 70 lowestCommonAncestor(sourceTransformNode, destinationTransformNode); |
| 66 DCHECK(lcaTransform); | 71 DCHECK(lcaTransform); |
| 67 | 72 |
| 68 localToAncestorRect(sourceTransformNode, lcaTransform, mappingRect); | 73 FloatRect lcaRect = |
| 69 ancestorToLocalRect(lcaTransform, destinationTransformNode, mappingRect); | 74 localToAncestorRect(rect, sourceTransformNode, lcaTransform); |
| 75 return ancestorToLocalRect(lcaRect, lcaTransform, destinationTransformNode); |
| 70 } | 76 } |
| 71 | 77 |
| 72 void GeometryMapper::localToAncestorVisualRect( | 78 FloatClipRect GeometryMapper::localToAncestorVisualRect( |
| 79 const FloatRect& rect, |
| 80 const PropertyTreeState& localState, |
| 81 const PropertyTreeState& ancestorState) { |
| 82 bool success = false; |
| 83 FloatClipRect result = localToAncestorVisualRectInternal( |
| 84 rect, localState, ancestorState, success); |
| 85 DCHECK(success); |
| 86 return result; |
| 87 } |
| 88 |
| 89 FloatClipRect GeometryMapper::localToAncestorVisualRectInternal( |
| 90 const FloatRect& rect, |
| 73 const PropertyTreeState& localState, | 91 const PropertyTreeState& localState, |
| 74 const PropertyTreeState& ancestorState, | 92 const PropertyTreeState& ancestorState, |
| 75 FloatRect& mappingRect) { | |
| 76 bool success = false; | |
| 77 localToAncestorVisualRectInternal(localState, ancestorState, mappingRect, | |
| 78 success); | |
| 79 DCHECK(success); | |
| 80 } | |
| 81 | |
| 82 void GeometryMapper::localToAncestorVisualRectInternal( | |
| 83 const PropertyTreeState& localState, | |
| 84 const PropertyTreeState& ancestorState, | |
| 85 FloatRect& rectToMap, | |
| 86 bool& success) { | 93 bool& success) { |
| 87 if (localState == ancestorState) { | 94 if (localState == ancestorState) { |
| 88 success = true; | 95 success = true; |
| 89 return; | 96 return rect; |
| 90 } | 97 } |
| 91 | 98 |
| 92 if (localState.effect() != ancestorState.effect()) { | 99 if (localState.effect() != ancestorState.effect()) { |
| 93 slowLocalToAncestorVisualRectWithEffects(localState, ancestorState, | 100 return slowLocalToAncestorVisualRectWithEffects(rect, localState, |
| 94 rectToMap, success); | 101 ancestorState, success); |
| 95 return; | |
| 96 } | 102 } |
| 97 | 103 |
| 98 const auto& transformMatrix = localToAncestorMatrixInternal( | 104 const auto& transformMatrix = localToAncestorMatrixInternal( |
| 99 localState.transform(), ancestorState.transform(), success); | 105 localState.transform(), ancestorState.transform(), success); |
| 100 if (!success) { | 106 if (!success) |
| 101 return; | 107 return rect; |
| 102 } | |
| 103 | 108 |
| 104 FloatRect mappedRect = transformMatrix.mapRect(rectToMap); | 109 FloatRect mappedRect = transformMatrix.mapRect(rect); |
| 105 | 110 |
| 106 const FloatClipRect& clipRect = | 111 FloatClipRect clipRect = |
| 107 localToAncestorClipRectInternal(localState.clip(), ancestorState.clip(), | 112 localToAncestorClipRectInternal(localState.clip(), ancestorState.clip(), |
| 108 ancestorState.transform(), success); | 113 ancestorState.transform(), success); |
| 109 | 114 |
| 110 if (success) { | 115 if (success) { |
| 111 rectToMap = clipRect.rect(); | 116 clipRect.intersect(mappedRect); |
| 112 rectToMap.intersect(mappedRect); | |
| 113 } else if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 117 } else if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 114 // On SPv1 we may fail when the paint invalidation container creates an | 118 // On SPv1 we may fail when the paint invalidation container creates an |
| 115 // overflow clip (in ancestorState) which is not in localState of an | 119 // overflow clip (in ancestorState) which is not in localState of an |
| 116 // out-of-flow positioned descendant. See crbug.com/513108 and layout test | 120 // out-of-flow positioned descendant. See crbug.com/513108 and layout test |
| 117 // compositing/overflow/handle-non-ancestor-clip-parent.html (run with | 121 // compositing/overflow/handle-non-ancestor-clip-parent.html (run with |
| 118 // --enable-prefer-compositing-to-lcd-text) for details. | 122 // --enable-prefer-compositing-to-lcd-text) for details. |
| 119 // Ignore it for SPv1 for now. | 123 // Ignore it for SPv1 for now. |
| 120 success = true; | 124 success = true; |
| 121 } | 125 } |
| 126 |
| 127 return clipRect; |
| 122 } | 128 } |
| 123 | 129 |
| 124 void GeometryMapper::slowLocalToAncestorVisualRectWithEffects( | 130 FloatClipRect GeometryMapper::slowLocalToAncestorVisualRectWithEffects( |
| 131 const FloatRect& rect, |
| 125 const PropertyTreeState& localState, | 132 const PropertyTreeState& localState, |
| 126 const PropertyTreeState& ancestorState, | 133 const PropertyTreeState& ancestorState, |
| 127 FloatRect& mappingRect, | |
| 128 bool& success) { | 134 bool& success) { |
| 129 PropertyTreeState lastTransformAndClipState(localState.transform(), | 135 PropertyTreeState lastTransformAndClipState(localState.transform(), |
| 130 localState.clip(), nullptr); | 136 localState.clip(), nullptr); |
| 137 FloatClipRect result(rect); |
| 131 | 138 |
| 132 for (const auto* effect = localState.effect(); | 139 for (const auto* effect = localState.effect(); |
| 133 effect && effect != ancestorState.effect(); effect = effect->parent()) { | 140 effect && effect != ancestorState.effect(); effect = effect->parent()) { |
| 134 if (!effect->hasFilterThatMovesPixels()) | 141 if (!effect->hasFilterThatMovesPixels()) |
| 135 continue; | 142 continue; |
| 136 | 143 |
| 137 PropertyTreeState transformAndClipState(effect->localTransformSpace(), | 144 PropertyTreeState transformAndClipState(effect->localTransformSpace(), |
| 138 effect->outputClip(), nullptr); | 145 effect->outputClip(), nullptr); |
| 139 sourceToDestinationVisualRectInternal( | 146 bool hasRadius = result.hasRadius(); |
| 140 lastTransformAndClipState, transformAndClipState, mappingRect, success); | 147 result = sourceToDestinationVisualRectInternal( |
| 141 if (!success) | 148 result.rect(), lastTransformAndClipState, transformAndClipState, |
| 142 return; | 149 success); |
| 150 hasRadius |= result.hasRadius(); |
| 151 if (!success) { |
| 152 if (hasRadius) |
| 153 result.setHasRadius(); |
| 154 return result; |
| 155 } |
| 143 | 156 |
| 144 mappingRect = effect->mapRect(mappingRect); | 157 result = effect->mapRect(result.rect()); |
| 158 if (hasRadius) |
| 159 result.setHasRadius(); |
| 145 lastTransformAndClipState = transformAndClipState; | 160 lastTransformAndClipState = transformAndClipState; |
| 146 } | 161 } |
| 147 | 162 |
| 148 PropertyTreeState finalTransformAndClipState(ancestorState.transform(), | 163 PropertyTreeState finalTransformAndClipState(ancestorState.transform(), |
| 149 ancestorState.clip(), nullptr); | 164 ancestorState.clip(), nullptr); |
| 150 sourceToDestinationVisualRectInternal(lastTransformAndClipState, | 165 bool hasRadius = result.hasRadius(); |
| 151 finalTransformAndClipState, mappingRect, | 166 result = sourceToDestinationVisualRectInternal( |
| 152 success); | 167 result.rect(), lastTransformAndClipState, finalTransformAndClipState, |
| 168 success); |
| 169 if (hasRadius || result.hasRadius()) |
| 170 result.setHasRadius(); |
| 171 return result; |
| 153 } | 172 } |
| 154 | 173 |
| 155 void GeometryMapper::localToAncestorRect( | 174 FloatRect GeometryMapper::localToAncestorRect( |
| 175 const FloatRect& rect, |
| 176 const TransformPaintPropertyNode* localTransformNode, |
| 177 const TransformPaintPropertyNode* ancestorTransformNode) { |
| 178 bool success = false; |
| 179 FloatRect result = localToAncestorRectInternal( |
| 180 rect, localTransformNode, ancestorTransformNode, success); |
| 181 DCHECK(success); |
| 182 return result; |
| 183 } |
| 184 |
| 185 FloatRect GeometryMapper::localToAncestorRectInternal( |
| 186 const FloatRect& rect, |
| 156 const TransformPaintPropertyNode* localTransformNode, | 187 const TransformPaintPropertyNode* localTransformNode, |
| 157 const TransformPaintPropertyNode* ancestorTransformNode, | 188 const TransformPaintPropertyNode* ancestorTransformNode, |
| 158 FloatRect& mappingRect) { | |
| 159 bool success = false; | |
| 160 localToAncestorRectInternal(localTransformNode, ancestorTransformNode, | |
| 161 mappingRect, success); | |
| 162 DCHECK(success); | |
| 163 } | |
| 164 | |
| 165 void GeometryMapper::localToAncestorRectInternal( | |
| 166 const TransformPaintPropertyNode* localTransformNode, | |
| 167 const TransformPaintPropertyNode* ancestorTransformNode, | |
| 168 FloatRect& mappingRect, | |
| 169 bool& success) { | 189 bool& success) { |
| 170 if (localTransformNode == ancestorTransformNode) { | 190 if (localTransformNode == ancestorTransformNode) { |
| 171 success = true; | 191 success = true; |
| 172 return; | 192 return rect; |
| 173 } | 193 } |
| 174 | 194 |
| 175 const auto& transformMatrix = localToAncestorMatrixInternal( | 195 const auto& transformMatrix = localToAncestorMatrixInternal( |
| 176 localTransformNode, ancestorTransformNode, success); | 196 localTransformNode, ancestorTransformNode, success); |
| 177 if (!success) | 197 if (!success) |
| 178 return; | 198 return rect; |
| 179 mappingRect = transformMatrix.mapRect(mappingRect); | 199 return transformMatrix.mapRect(rect); |
| 180 } | 200 } |
| 181 | 201 |
| 182 void GeometryMapper::ancestorToLocalRect( | 202 FloatRect GeometryMapper::ancestorToLocalRect( |
| 203 const FloatRect& rect, |
| 183 const TransformPaintPropertyNode* ancestorTransformNode, | 204 const TransformPaintPropertyNode* ancestorTransformNode, |
| 184 const TransformPaintPropertyNode* localTransformNode, | 205 const TransformPaintPropertyNode* localTransformNode) { |
| 185 FloatRect& rect) { | |
| 186 if (localTransformNode == ancestorTransformNode) | 206 if (localTransformNode == ancestorTransformNode) |
| 187 return; | 207 return rect; |
| 188 | 208 |
| 189 const auto& transformMatrix = | 209 const auto& transformMatrix = |
| 190 localToAncestorMatrix(localTransformNode, ancestorTransformNode); | 210 localToAncestorMatrix(localTransformNode, ancestorTransformNode); |
| 191 DCHECK(transformMatrix.isInvertible()); | 211 DCHECK(transformMatrix.isInvertible()); |
| 192 | 212 |
| 193 // TODO(chrishtr): Cache the inverse? | 213 // TODO(chrishtr): Cache the inverse? |
| 194 rect = transformMatrix.inverse().mapRect(rect); | 214 return transformMatrix.inverse().mapRect(rect); |
| 195 } | 215 } |
| 196 | 216 |
| 197 FloatClipRect GeometryMapper::localToAncestorClipRect( | 217 FloatClipRect GeometryMapper::localToAncestorClipRect( |
| 198 const PropertyTreeState& localState, | 218 const PropertyTreeState& localState, |
| 199 const PropertyTreeState& ancestorState) { | 219 const PropertyTreeState& ancestorState) { |
| 200 bool success = false; | 220 bool success = false; |
| 201 FloatClipRect result = | 221 FloatClipRect result = |
| 202 localToAncestorClipRectInternal(localState.clip(), ancestorState.clip(), | 222 localToAncestorClipRectInternal(localState.clip(), ancestorState.clip(), |
| 203 ancestorState.transform(), success); | 223 ancestorState.transform(), success); |
| 204 | 224 |
| 205 DCHECK(success); | 225 DCHECK(success); |
| 206 | 226 |
| 207 return result; | 227 return result; |
| 208 } | 228 } |
| 209 | 229 |
| 210 const FloatClipRect& GeometryMapper::sourceToDestinationClipRect( | 230 FloatClipRect GeometryMapper::sourceToDestinationClipRect( |
| 211 const PropertyTreeState& sourceState, | 231 const PropertyTreeState& sourceState, |
| 212 const PropertyTreeState& destinationState) { | 232 const PropertyTreeState& destinationState) { |
| 213 bool success = false; | 233 bool success = false; |
| 214 const FloatClipRect& result = sourceToDestinationClipRectInternal( | 234 FloatClipRect result = sourceToDestinationClipRectInternal( |
| 215 sourceState, destinationState, success); | 235 sourceState, destinationState, success); |
| 216 DCHECK(success); | 236 DCHECK(success); |
| 217 | 237 |
| 218 return result; | 238 return result; |
| 219 } | 239 } |
| 220 | 240 |
| 221 const FloatClipRect& GeometryMapper::sourceToDestinationClipRectInternal( | 241 FloatClipRect GeometryMapper::sourceToDestinationClipRectInternal( |
| 222 const PropertyTreeState& sourceState, | 242 const PropertyTreeState& sourceState, |
| 223 const PropertyTreeState& destinationState, | 243 const PropertyTreeState& destinationState, |
| 224 bool& success) { | 244 bool& success) { |
| 225 const FloatClipRect& result = localToAncestorClipRectInternal( | 245 FloatClipRect result = localToAncestorClipRectInternal( |
| 226 sourceState.clip(), destinationState.clip(), destinationState.transform(), | 246 sourceState.clip(), destinationState.clip(), destinationState.transform(), |
| 227 success); | 247 success); |
| 228 // Success if destinationState is an ancestor state. | 248 // Success if destinationState is an ancestor state. |
| 229 if (success) | 249 if (success) |
| 230 return result; | 250 return result; |
| 231 | 251 |
| 232 // Otherwise first map to the lowest common ancestor, then map to | 252 // Otherwise first map to the lowest common ancestor, then map to |
| 233 // destination. | 253 // destination. |
| 234 const TransformPaintPropertyNode* lcaTransform = lowestCommonAncestor( | 254 const TransformPaintPropertyNode* lcaTransform = lowestCommonAncestor( |
| 235 sourceState.transform(), destinationState.transform()); | 255 sourceState.transform(), destinationState.transform()); |
| 236 DCHECK(lcaTransform); | 256 DCHECK(lcaTransform); |
| 237 | 257 |
| 238 // Assume that the clip of destinationState is an ancestor of the clip of | 258 // Assume that the clip of destinationState is an ancestor of the clip of |
| 239 // sourceState and is under the space of lcaTransform. Otherwise | 259 // sourceState and is under the space of lcaTransform. Otherwise |
| 240 // localToAncestorClipRectInternal() will fail. | 260 // localToAncestorClipRectInternal() will fail. |
| 241 PropertyTreeState lcaState = destinationState; | 261 PropertyTreeState lcaState = destinationState; |
| 242 lcaState.setTransform(lcaTransform); | 262 lcaState.setTransform(lcaTransform); |
| 243 | 263 |
| 244 const FloatClipRect& result2 = localToAncestorClipRectInternal( | 264 result = localToAncestorClipRectInternal(sourceState.clip(), lcaState.clip(), |
| 245 sourceState.clip(), lcaState.clip(), lcaState.transform(), success); | 265 lcaState.transform(), success); |
| 246 if (!success) { | 266 if (!success) { |
| 247 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 267 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 248 // On SPv1 we may fail when the paint invalidation container creates an | 268 // On SPv1 we may fail when the paint invalidation container creates an |
| 249 // overflow clip (in ancestorState) which is not in localState of an | 269 // overflow clip (in ancestorState) which is not in localState of an |
| 250 // out-of-flow positioned descendant. See crbug.com/513108 and layout | 270 // out-of-flow positioned descendant. See crbug.com/513108 and layout |
| 251 // test compositing/overflow/handle-non-ancestor-clip-parent.html (run | 271 // test compositing/overflow/handle-non-ancestor-clip-parent.html (run |
| 252 // with --enable-prefer-compositing-to-lcd-text) for details. | 272 // with --enable-prefer-compositing-to-lcd-text) for details. |
| 253 // Ignore it for SPv1 for now. | 273 // Ignore it for SPv1 for now. |
| 254 success = true; | 274 success = true; |
| 255 } | 275 } |
| 256 return result2; | 276 return result; |
| 257 } | 277 } |
| 258 if (!result2.isInfinite()) { | 278 if (!result.isInfinite()) { |
| 259 FloatRect rect = result2.rect(); | 279 FloatRect final = ancestorToLocalRect(result.rect(), lcaTransform, |
| 260 ancestorToLocalRect(lcaTransform, destinationState.transform(), rect); | 280 destinationState.transform()); |
| 261 m_tempRect.setRect(rect); | 281 result.setRect(final); |
| 262 if (result2.hasRadius()) | |
| 263 m_tempRect.setHasRadius(); | |
| 264 return m_tempRect; | |
| 265 } | 282 } |
| 266 return result2; | 283 return result; |
| 267 } | 284 } |
| 268 | 285 |
| 269 const FloatClipRect& GeometryMapper::localToAncestorClipRectInternal( | 286 const FloatClipRect& GeometryMapper::localToAncestorClipRectInternal( |
| 270 const ClipPaintPropertyNode* descendant, | 287 const ClipPaintPropertyNode* descendant, |
| 271 const ClipPaintPropertyNode* ancestorClip, | 288 const ClipPaintPropertyNode* ancestorClip, |
| 272 const TransformPaintPropertyNode* ancestorTransform, | 289 const TransformPaintPropertyNode* ancestorTransform, |
| 273 bool& success) { | 290 bool& success) { |
| 274 FloatClipRect clip; | 291 FloatClipRect clip; |
| 275 if (descendant == ancestorClip) { | 292 if (descendant == ancestorClip) { |
| 276 success = true; | 293 success = true; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 305 ++it) { | 322 ++it) { |
| 306 success = false; | 323 success = false; |
| 307 const TransformationMatrix& transformMatrix = localToAncestorMatrixInternal( | 324 const TransformationMatrix& transformMatrix = localToAncestorMatrixInternal( |
| 308 (*it)->localTransformSpace(), ancestorTransform, success); | 325 (*it)->localTransformSpace(), ancestorTransform, success); |
| 309 if (!success) | 326 if (!success) |
| 310 return m_infiniteClip; | 327 return m_infiniteClip; |
| 311 FloatRect mappedRect = transformMatrix.mapRect((*it)->clipRect().rect()); | 328 FloatRect mappedRect = transformMatrix.mapRect((*it)->clipRect().rect()); |
| 312 clip.intersect(mappedRect); | 329 clip.intersect(mappedRect); |
| 313 if ((*it)->clipRect().isRounded()) | 330 if ((*it)->clipRect().isRounded()) |
| 314 clip.setHasRadius(); | 331 clip.setHasRadius(); |
| 315 | |
| 316 (*it)->getClipCache().setCachedClip(clipAndTransform, clip); | 332 (*it)->getClipCache().setCachedClip(clipAndTransform, clip); |
| 317 } | 333 } |
| 318 | 334 |
| 319 success = true; | 335 success = true; |
| 320 | 336 |
| 321 const FloatClipRect* cachedClip = | 337 const FloatClipRect* cachedClip = |
| 322 descendant->getClipCache().getCachedClip(clipAndTransform); | 338 descendant->getClipCache().getCachedClip(clipAndTransform); |
| 323 DCHECK(cachedClip); | 339 DCHECK(cachedClip); |
| 324 CHECK(clip.hasRadius() == cachedClip->hasRadius()); | |
| 325 return *cachedClip; | 340 return *cachedClip; |
| 326 } | 341 } |
| 327 | 342 |
| 328 const TransformationMatrix& GeometryMapper::localToAncestorMatrix( | 343 const TransformationMatrix& GeometryMapper::localToAncestorMatrix( |
| 329 const TransformPaintPropertyNode* localTransformNode, | 344 const TransformPaintPropertyNode* localTransformNode, |
| 330 const TransformPaintPropertyNode* ancestorTransformNode) { | 345 const TransformPaintPropertyNode* ancestorTransformNode) { |
| 331 bool success = false; | 346 bool success = false; |
| 332 const auto& result = localToAncestorMatrixInternal( | 347 const auto& result = localToAncestorMatrixInternal( |
| 333 localTransformNode, ancestorTransformNode, success); | 348 localTransformNode, ancestorTransformNode, success); |
| 334 DCHECK(success); | 349 DCHECK(success); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 const TransformPaintPropertyNode*, | 456 const TransformPaintPropertyNode*, |
| 442 const TransformPaintPropertyNode*); | 457 const TransformPaintPropertyNode*); |
| 443 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor( | 458 template const ClipPaintPropertyNode* GeometryMapper::lowestCommonAncestor( |
| 444 const ClipPaintPropertyNode*, | 459 const ClipPaintPropertyNode*, |
| 445 const ClipPaintPropertyNode*); | 460 const ClipPaintPropertyNode*); |
| 446 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor( | 461 template const ScrollPaintPropertyNode* GeometryMapper::lowestCommonAncestor( |
| 447 const ScrollPaintPropertyNode*, | 462 const ScrollPaintPropertyNode*, |
| 448 const ScrollPaintPropertyNode*); | 463 const ScrollPaintPropertyNode*); |
| 449 | 464 |
| 450 } // namespace blink | 465 } // namespace blink |
| OLD | NEW |