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

Side by Side Diff: third_party/WebKit/Source/core/paint/FindPropertiesNeedingUpdate.h

Issue 2614093002: Combine LayoutObject::previousPaintOffset and paintOffset in paint properties (Closed)
Patch Set: Resolve conflict Created 3 years, 11 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 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 CHECK_PROPERTY_EQ("the layout object (" << object.debugName() << ")", \ 103 CHECK_PROPERTY_EQ("the layout object (" << object.debugName() << ")", \
104 original, updated) 104 original, updated)
105 105
106 class FindObjectPropertiesNeedingUpdateScope { 106 class FindObjectPropertiesNeedingUpdateScope {
107 public: 107 public:
108 FindObjectPropertiesNeedingUpdateScope( 108 FindObjectPropertiesNeedingUpdateScope(
109 const LayoutObject& object, 109 const LayoutObject& object,
110 PaintPropertyTreeBuilderContext& context) 110 PaintPropertyTreeBuilderContext& context)
111 : m_object(object), 111 : m_object(object),
112 m_neededPaintPropertyUpdate(object.needsPaintPropertyUpdate()), 112 m_neededPaintPropertyUpdate(object.needsPaintPropertyUpdate()),
113 m_neededForcedSubtreeUpdate(context.forceSubtreeUpdate) { 113 m_neededForcedSubtreeUpdate(context.forceSubtreeUpdate),
114 m_originalPaintOffset(object.paintOffset()) {
114 // No need to check if an update was already needed. 115 // No need to check if an update was already needed.
115 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate) 116 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate)
116 return; 117 return;
117 118
118 // Mark the properties as needing an update to ensure they are rebuilt. 119 // Mark the properties as needing an update to ensure they are rebuilt.
119 m_object.getMutableForPainting() 120 m_object.getMutableForPainting()
120 .setOnlyThisNeedsPaintPropertyUpdateForTesting(); 121 .setOnlyThisNeedsPaintPropertyUpdateForTesting();
121 122
122 if (const auto* properties = m_object.paintProperties()) 123 if (const auto* properties = m_object.paintProperties())
123 m_originalProperties = properties->clone(); 124 m_originalProperties = properties->clone();
124 } 125 }
125 126
126 ~FindObjectPropertiesNeedingUpdateScope() { 127 ~FindObjectPropertiesNeedingUpdateScope() {
127 // No need to check if an update was already needed. 128 // No need to check if an update was already needed.
128 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate) 129 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate)
129 return; 130 return;
130 131
131 // If these checks fail, the paint properties changed unexpectedly. This is 132 // If these checks fail, the paint properties changed unexpectedly. This is
132 // due to missing one of these paint property invalidations: 133 // due to missing one of these paint property invalidations:
133 // 1) The LayoutObject should have been marked as needing an update with 134 // 1) The LayoutObject should have been marked as needing an update with
134 // LayoutObject::setNeedsPaintPropertyUpdate(). 135 // LayoutObject::setNeedsPaintPropertyUpdate().
135 // 2) The PrePaintTreeWalk should have had a forced subtree update (see: 136 // 2) The PrePaintTreeWalk should have had a forced subtree update (see:
136 // PaintPropertyTreeBuilderContext::forceSubtreeUpdate). 137 // PaintPropertyTreeBuilderContext::forceSubtreeUpdate).
138 DCHECK_OBJECT_PROPERTY_EQ(m_object, &m_originalPaintOffset,
139 &m_object.paintOffset());
137 const auto* objectProperties = m_object.paintProperties(); 140 const auto* objectProperties = m_object.paintProperties();
138 if (m_originalProperties && objectProperties) { 141 if (m_originalProperties && objectProperties) {
139 DCHECK_OBJECT_PROPERTY_EQ(m_object, 142 DCHECK_OBJECT_PROPERTY_EQ(m_object,
140 m_originalProperties->paintOffsetTranslation(), 143 m_originalProperties->paintOffsetTranslation(),
141 objectProperties->paintOffsetTranslation()); 144 objectProperties->paintOffsetTranslation());
142 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->transform(), 145 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->transform(),
143 objectProperties->transform()); 146 objectProperties->transform());
144 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->effect(), 147 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->effect(),
145 objectProperties->effect()); 148 objectProperties->effect());
146 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->cssClip(), 149 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->cssClip(),
(...skipping 18 matching lines...) Expand all
165 m_originalProperties->scrollTranslation(), 168 m_originalProperties->scrollTranslation(),
166 objectProperties->scrollTranslation()); 169 objectProperties->scrollTranslation());
167 DCHECK_OBJECT_PROPERTY_EQ(m_object, 170 DCHECK_OBJECT_PROPERTY_EQ(m_object,
168 m_originalProperties->scrollbarPaintOffset(), 171 m_originalProperties->scrollbarPaintOffset(),
169 objectProperties->scrollbarPaintOffset()); 172 objectProperties->scrollbarPaintOffset());
170 const auto* originalBorderBox = 173 const auto* originalBorderBox =
171 m_originalProperties->localBorderBoxProperties(); 174 m_originalProperties->localBorderBoxProperties();
172 const auto* objectBorderBox = 175 const auto* objectBorderBox =
173 objectProperties->localBorderBoxProperties(); 176 objectProperties->localBorderBoxProperties();
174 if (originalBorderBox && objectBorderBox) { 177 if (originalBorderBox && objectBorderBox) {
175 DCHECK_OBJECT_PROPERTY_EQ(m_object, &originalBorderBox->paintOffset, 178 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->transform(),
176 &objectBorderBox->paintOffset); 179 objectBorderBox->transform());
177 DCHECK_OBJECT_PROPERTY_EQ( 180 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->clip(),
178 m_object, originalBorderBox->propertyTreeState.transform(), 181 objectBorderBox->clip());
179 objectBorderBox->propertyTreeState.transform()); 182 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->effect(),
180 DCHECK_OBJECT_PROPERTY_EQ(m_object, 183 objectBorderBox->effect());
181 originalBorderBox->propertyTreeState.clip(), 184 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->scroll(),
182 objectBorderBox->propertyTreeState.clip()); 185 objectBorderBox->scroll());
183 DCHECK_OBJECT_PROPERTY_EQ(m_object,
184 originalBorderBox->propertyTreeState.effect(),
185 objectBorderBox->propertyTreeState.effect());
186 DCHECK_OBJECT_PROPERTY_EQ(m_object,
187 originalBorderBox->propertyTreeState.scroll(),
188 objectBorderBox->propertyTreeState.scroll());
189 } else { 186 } else {
190 DCHECK_EQ(!!originalBorderBox, !!objectBorderBox) 187 DCHECK_EQ(!!originalBorderBox, !!objectBorderBox)
191 << " Object: " << m_object.debugName(); 188 << " Object: " << m_object.debugName();
192 } 189 }
193 } else { 190 } else {
194 DCHECK_EQ(!!m_originalProperties, !!objectProperties) 191 DCHECK_EQ(!!m_originalProperties, !!objectProperties)
195 << " Object: " << m_object.debugName(); 192 << " Object: " << m_object.debugName();
196 } 193 }
197 // Restore original clean bit. 194 // Restore original clean bit.
198 m_object.getMutableForPainting().clearNeedsPaintPropertyUpdateForTesting(); 195 m_object.getMutableForPainting().clearNeedsPaintPropertyUpdateForTesting();
199 } 196 }
200 197
201 private: 198 private:
202 const LayoutObject& m_object; 199 const LayoutObject& m_object;
203 bool m_neededPaintPropertyUpdate; 200 bool m_neededPaintPropertyUpdate;
204 bool m_neededForcedSubtreeUpdate; 201 bool m_neededForcedSubtreeUpdate;
202 LayoutPoint m_originalPaintOffset;
205 std::unique_ptr<const ObjectPaintProperties> m_originalProperties; 203 std::unique_ptr<const ObjectPaintProperties> m_originalProperties;
206 }; 204 };
207 205
208 } // namespace blink 206 } // namespace blink
209 #endif // DCHECK_IS_ON() 207 #endif // DCHECK_IS_ON()
210 208
211 #endif // FindPropertiesNeedingUpdate_h 209 #endif // FindPropertiesNeedingUpdate_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698