| 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 #ifndef FindPropertiesNeedingUpdate_h | 5 #ifndef FindPropertiesNeedingUpdate_h |
| 6 #define FindPropertiesNeedingUpdate_h | 6 #define FindPropertiesNeedingUpdate_h |
| 7 | 7 |
| 8 #if DCHECK_IS_ON() | 8 #if DCHECK_IS_ON() |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // No need to check if an update was already needed. | 111 // No need to check if an update was already needed. |
| 112 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate) | 112 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 // Mark the properties as needing an update to ensure they are rebuilt. | 115 // Mark the properties as needing an update to ensure they are rebuilt. |
| 116 m_object.getMutableForPainting() | 116 m_object.getMutableForPainting() |
| 117 .setOnlyThisNeedsPaintPropertyUpdateForTesting(); | 117 .setOnlyThisNeedsPaintPropertyUpdateForTesting(); |
| 118 | 118 |
| 119 if (const auto* properties = m_object.paintProperties()) | 119 if (const auto* properties = m_object.paintProperties()) |
| 120 m_originalProperties = properties->clone(); | 120 m_originalProperties = properties->clone(); |
| 121 |
| 122 if (const auto* localBorderBox = m_object.localBorderBoxProperties()) { |
| 123 m_originalLocalBorderBoxProperties = |
| 124 WTF::wrapUnique(new PropertyTreeState(*localBorderBox)); |
| 125 } |
| 121 } | 126 } |
| 122 | 127 |
| 123 ~FindObjectPropertiesNeedingUpdateScope() { | 128 ~FindObjectPropertiesNeedingUpdateScope() { |
| 124 // No need to check if an update was already needed. | 129 // No need to check if an update was already needed. |
| 125 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate) | 130 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate) |
| 126 return; | 131 return; |
| 127 | 132 |
| 128 // If these checks fail, the paint properties changed unexpectedly. This is | 133 // If these checks fail, the paint properties changed unexpectedly. This is |
| 129 // due to missing one of these paint property invalidations: | 134 // due to missing one of these paint property invalidations: |
| 130 // 1) The LayoutObject should have been marked as needing an update with | 135 // 1) The LayoutObject should have been marked as needing an update with |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 objectProperties->perspective()); | 167 objectProperties->perspective()); |
| 163 DCHECK_OBJECT_PROPERTY_EQ( | 168 DCHECK_OBJECT_PROPERTY_EQ( |
| 164 m_object, m_originalProperties->svgLocalToBorderBoxTransform(), | 169 m_object, m_originalProperties->svgLocalToBorderBoxTransform(), |
| 165 objectProperties->svgLocalToBorderBoxTransform()); | 170 objectProperties->svgLocalToBorderBoxTransform()); |
| 166 DCHECK_OBJECT_PROPERTY_EQ(m_object, | 171 DCHECK_OBJECT_PROPERTY_EQ(m_object, |
| 167 m_originalProperties->scrollTranslation(), | 172 m_originalProperties->scrollTranslation(), |
| 168 objectProperties->scrollTranslation()); | 173 objectProperties->scrollTranslation()); |
| 169 DCHECK_OBJECT_PROPERTY_EQ(m_object, | 174 DCHECK_OBJECT_PROPERTY_EQ(m_object, |
| 170 m_originalProperties->scrollbarPaintOffset(), | 175 m_originalProperties->scrollbarPaintOffset(), |
| 171 objectProperties->scrollbarPaintOffset()); | 176 objectProperties->scrollbarPaintOffset()); |
| 172 const auto* originalBorderBox = | |
| 173 m_originalProperties->localBorderBoxProperties(); | |
| 174 const auto* objectBorderBox = | |
| 175 objectProperties->localBorderBoxProperties(); | |
| 176 if (originalBorderBox && objectBorderBox) { | |
| 177 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->transform(), | |
| 178 objectBorderBox->transform()); | |
| 179 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->clip(), | |
| 180 objectBorderBox->clip()); | |
| 181 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->effect(), | |
| 182 objectBorderBox->effect()); | |
| 183 } else { | |
| 184 DCHECK_EQ(!!originalBorderBox, !!objectBorderBox) | |
| 185 << " Object: " << m_object.debugName(); | |
| 186 } | |
| 187 } else { | 177 } else { |
| 188 DCHECK_EQ(!!m_originalProperties, !!objectProperties) | 178 DCHECK_EQ(!!m_originalProperties, !!objectProperties) |
| 189 << " Object: " << m_object.debugName(); | 179 << " Object: " << m_object.debugName(); |
| 190 } | 180 } |
| 181 |
| 182 const auto* objectBorderBox = m_object.localBorderBoxProperties(); |
| 183 if (m_originalLocalBorderBoxProperties && objectBorderBox) { |
| 184 DCHECK_OBJECT_PROPERTY_EQ(m_object, |
| 185 m_originalLocalBorderBoxProperties->transform(), |
| 186 objectBorderBox->transform()); |
| 187 DCHECK_OBJECT_PROPERTY_EQ(m_object, |
| 188 m_originalLocalBorderBoxProperties->clip(), |
| 189 objectBorderBox->clip()); |
| 190 DCHECK_OBJECT_PROPERTY_EQ(m_object, |
| 191 m_originalLocalBorderBoxProperties->effect(), |
| 192 objectBorderBox->effect()); |
| 193 } else { |
| 194 DCHECK_EQ(!!m_originalLocalBorderBoxProperties, !!objectBorderBox) |
| 195 << " Object: " << m_object.debugName(); |
| 196 } |
| 197 |
| 198 // Instead of checking that the contents properties are unchanged here, |
| 199 // we check them on every access in LayoutObject::contentsProperties. |
| 200 |
| 191 // Restore original clean bit. | 201 // Restore original clean bit. |
| 192 m_object.getMutableForPainting().clearNeedsPaintPropertyUpdateForTesting(); | 202 m_object.getMutableForPainting().clearNeedsPaintPropertyUpdateForTesting(); |
| 193 } | 203 } |
| 194 | 204 |
| 195 private: | 205 private: |
| 196 const LayoutObject& m_object; | 206 const LayoutObject& m_object; |
| 197 bool m_neededPaintPropertyUpdate; | 207 bool m_neededPaintPropertyUpdate; |
| 198 bool m_neededForcedSubtreeUpdate; | 208 bool m_neededForcedSubtreeUpdate; |
| 199 LayoutPoint m_originalPaintOffset; | 209 LayoutPoint m_originalPaintOffset; |
| 200 std::unique_ptr<const ObjectPaintProperties> m_originalProperties; | 210 std::unique_ptr<const ObjectPaintProperties> m_originalProperties; |
| 211 std::unique_ptr<const PropertyTreeState> m_originalLocalBorderBoxProperties; |
| 201 }; | 212 }; |
| 202 | 213 |
| 203 } // namespace blink | 214 } // namespace blink |
| 204 #endif // DCHECK_IS_ON() | 215 #endif // DCHECK_IS_ON() |
| 205 | 216 |
| 206 #endif // FindPropertiesNeedingUpdate_h | 217 #endif // FindPropertiesNeedingUpdate_h |
| OLD | NEW |