| 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/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 FloatRect GeometryMapper::mapToVisualRectInDestinationSpace( | 12 FloatRect GeometryMapper::mapToVisualRectInDestinationSpace( |
| 12 const FloatRect& rect, | 13 const FloatRect& rect, |
| 13 const PropertyTreeState& sourceState, | 14 const PropertyTreeState& sourceState, |
| 14 const PropertyTreeState& destinationState, | 15 const PropertyTreeState& destinationState, |
| 15 bool& success) { | 16 bool& success) { |
| 16 FloatRect result = localToVisualRectInAncestorSpace( | 17 FloatRect result = localToVisualRectInAncestorSpace( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool& success) { | 101 bool& success) { |
| 101 const auto& transformMatrix = | 102 const auto& transformMatrix = |
| 102 localToAncestorMatrix(localState.transform(), ancestorState, success); | 103 localToAncestorMatrix(localState.transform(), ancestorState, success); |
| 103 if (!success) | 104 if (!success) |
| 104 return rect; | 105 return rect; |
| 105 | 106 |
| 106 FloatRect mappedRect = transformMatrix.mapRect(rect); | 107 FloatRect mappedRect = transformMatrix.mapRect(rect); |
| 107 | 108 |
| 108 const auto clipRect = | 109 const auto clipRect = |
| 109 localToAncestorClipRect(localState, ancestorState, success); | 110 localToAncestorClipRect(localState, ancestorState, success); |
| 110 DCHECK(success); | |
| 111 | 111 |
| 112 mappedRect.intersect(clipRect); | 112 if (success) { |
| 113 mappedRect.intersect(clipRect); |
| 114 } else if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 115 // On SPv1 we may fail when the paint invalidation container creates an |
| 116 // overflow clip (in ancestorState) which is not in localState of an |
| 117 // out-of-flow positioned descendant. See crbug.com/513108 and layout test |
| 118 // compositing/overflow/handle-non-ancestor-clip-parent.html (run with |
| 119 // --enable-prefer-compositing-to-lcd-text) for details. |
| 120 // Ignore it for SPv1 for now. |
| 121 success = true; |
| 122 } else { |
| 123 DCHECK(success); |
| 124 } |
| 125 |
| 113 return mappedRect; | 126 return mappedRect; |
| 114 } | 127 } |
| 115 | 128 |
| 116 FloatRect GeometryMapper::localToAncestorRect( | 129 FloatRect GeometryMapper::localToAncestorRect( |
| 117 const FloatRect& rect, | 130 const FloatRect& rect, |
| 118 const PropertyTreeState& localState, | 131 const PropertyTreeState& localState, |
| 119 const PropertyTreeState& ancestorState, | 132 const PropertyTreeState& ancestorState, |
| 120 bool& success) { | 133 bool& success) { |
| 121 const auto& transformMatrix = | 134 const auto& transformMatrix = |
| 122 localToAncestorMatrix(localState.transform(), ancestorState, success); | 135 localToAncestorMatrix(localState.transform(), ancestorState, success); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 304 |
| 292 // Walk up until we find the ancestor. | 305 // Walk up until we find the ancestor. |
| 293 while (a != b) { | 306 while (a != b) { |
| 294 a = a->parent(); | 307 a = a->parent(); |
| 295 b = b->parent(); | 308 b = b->parent(); |
| 296 } | 309 } |
| 297 return a; | 310 return a; |
| 298 } | 311 } |
| 299 | 312 |
| 300 } // namespace blink | 313 } // namespace blink |
| OLD | NEW |