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

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

Issue 2657863004: Move scroll paint property nodes to be owned by the transform tree (Closed)
Patch Set: Rebase & remove parens Created 3 years, 10 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 // Mark the properties as needing an update to ensure they are rebuilt. 56 // Mark the properties as needing an update to ensure they are rebuilt.
57 m_frameView->setOnlyThisNeedsPaintPropertyUpdateForTesting(); 57 m_frameView->setOnlyThisNeedsPaintPropertyUpdateForTesting();
58 58
59 if (auto* preTranslation = m_frameView->preTranslation()) 59 if (auto* preTranslation = m_frameView->preTranslation())
60 m_originalPreTranslation = preTranslation->clone(); 60 m_originalPreTranslation = preTranslation->clone();
61 if (auto* contentClip = m_frameView->contentClip()) 61 if (auto* contentClip = m_frameView->contentClip())
62 m_originalContentClip = contentClip->clone(); 62 m_originalContentClip = contentClip->clone();
63 if (auto* scrollTranslation = m_frameView->scrollTranslation()) 63 if (auto* scrollTranslation = m_frameView->scrollTranslation())
64 m_originalScrollTranslation = scrollTranslation->clone(); 64 m_originalScrollTranslation = scrollTranslation->clone();
65 if (auto* scroll = m_frameView->scroll())
66 m_originalScroll = scroll->clone();
67 } 65 }
68 66
69 ~FindFrameViewPropertiesNeedingUpdateScope() { 67 ~FindFrameViewPropertiesNeedingUpdateScope() {
70 // No need to check if an update was already needed. 68 // No need to check if an update was already needed.
71 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate) 69 if (m_neededPaintPropertyUpdate || m_neededForcedSubtreeUpdate)
72 return; 70 return;
73 71
74 // If these checks fail, the paint properties changed unexpectedly. This is 72 // If these checks fail, the paint properties changed unexpectedly. This is
75 // due to missing one of these paint property invalidations: 73 // due to missing one of these paint property invalidations:
76 // 1) The FrameView should have been marked as needing an update with 74 // 1) The FrameView should have been marked as needing an update with
77 // FrameView::setNeedsPaintPropertyUpdate(). 75 // FrameView::setNeedsPaintPropertyUpdate().
78 // 2) The PrePaintTreeWalk should have had a forced subtree update (see: 76 // 2) The PrePaintTreeWalk should have had a forced subtree update (see:
79 // PaintPropertyTreeBuilderContext::forceSubtreeUpdate). 77 // PaintPropertyTreeBuilderContext::forceSubtreeUpdate).
80 DCHECK_FRAMEVIEW_PROPERTY_EQ(m_originalPreTranslation, 78 DCHECK_FRAMEVIEW_PROPERTY_EQ(m_originalPreTranslation,
81 m_frameView->preTranslation()); 79 m_frameView->preTranslation());
82 DCHECK_FRAMEVIEW_PROPERTY_EQ(m_originalContentClip, 80 DCHECK_FRAMEVIEW_PROPERTY_EQ(m_originalContentClip,
83 m_frameView->contentClip()); 81 m_frameView->contentClip());
84 DCHECK_FRAMEVIEW_PROPERTY_EQ(m_originalScrollTranslation, 82 DCHECK_FRAMEVIEW_PROPERTY_EQ(m_originalScrollTranslation,
85 m_frameView->scrollTranslation()); 83 m_frameView->scrollTranslation());
86 DCHECK_FRAMEVIEW_PROPERTY_EQ(m_originalScroll, m_frameView->scroll());
87 84
88 // Restore original clean bit. 85 // Restore original clean bit.
89 m_frameView->clearNeedsPaintPropertyUpdate(); 86 m_frameView->clearNeedsPaintPropertyUpdate();
90 } 87 }
91 88
92 private: 89 private:
93 Persistent<FrameView> m_frameView; 90 Persistent<FrameView> m_frameView;
94 bool m_neededPaintPropertyUpdate; 91 bool m_neededPaintPropertyUpdate;
95 bool m_neededForcedSubtreeUpdate; 92 bool m_neededForcedSubtreeUpdate;
96 RefPtr<TransformPaintPropertyNode> m_originalPreTranslation; 93 RefPtr<TransformPaintPropertyNode> m_originalPreTranslation;
97 RefPtr<ClipPaintPropertyNode> m_originalContentClip; 94 RefPtr<ClipPaintPropertyNode> m_originalContentClip;
98 RefPtr<TransformPaintPropertyNode> m_originalScrollTranslation; 95 RefPtr<TransformPaintPropertyNode> m_originalScrollTranslation;
99 RefPtr<ScrollPaintPropertyNode> m_originalScroll;
100 }; 96 };
101 97
102 #define DCHECK_OBJECT_PROPERTY_EQ(object, original, updated) \ 98 #define DCHECK_OBJECT_PROPERTY_EQ(object, original, updated) \
103 CHECK_PROPERTY_EQ("the layout object (" << object.debugName() << ")", \ 99 CHECK_PROPERTY_EQ("the layout object (" << object.debugName() << ")", \
104 original, updated) 100 original, updated)
105 101
106 class FindObjectPropertiesNeedingUpdateScope { 102 class FindObjectPropertiesNeedingUpdateScope {
107 public: 103 public:
108 FindObjectPropertiesNeedingUpdateScope( 104 FindObjectPropertiesNeedingUpdateScope(
109 const LayoutObject& object, 105 const LayoutObject& object,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 objectProperties->overflowClip()); 154 objectProperties->overflowClip());
159 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->perspective(), 155 DCHECK_OBJECT_PROPERTY_EQ(m_object, m_originalProperties->perspective(),
160 objectProperties->perspective()); 156 objectProperties->perspective());
161 DCHECK_OBJECT_PROPERTY_EQ( 157 DCHECK_OBJECT_PROPERTY_EQ(
162 m_object, m_originalProperties->svgLocalToBorderBoxTransform(), 158 m_object, m_originalProperties->svgLocalToBorderBoxTransform(),
163 objectProperties->svgLocalToBorderBoxTransform()); 159 objectProperties->svgLocalToBorderBoxTransform());
164 DCHECK_OBJECT_PROPERTY_EQ(m_object, 160 DCHECK_OBJECT_PROPERTY_EQ(m_object,
165 m_originalProperties->scrollTranslation(), 161 m_originalProperties->scrollTranslation(),
166 objectProperties->scrollTranslation()); 162 objectProperties->scrollTranslation());
167 DCHECK_OBJECT_PROPERTY_EQ(m_object, 163 DCHECK_OBJECT_PROPERTY_EQ(m_object,
168 m_originalProperties->scrollTranslation(),
169 objectProperties->scrollTranslation());
170 DCHECK_OBJECT_PROPERTY_EQ(m_object,
171 m_originalProperties->scrollbarPaintOffset(), 164 m_originalProperties->scrollbarPaintOffset(),
172 objectProperties->scrollbarPaintOffset()); 165 objectProperties->scrollbarPaintOffset());
173 const auto* originalBorderBox = 166 const auto* originalBorderBox =
174 m_originalProperties->localBorderBoxProperties(); 167 m_originalProperties->localBorderBoxProperties();
175 const auto* objectBorderBox = 168 const auto* objectBorderBox =
176 objectProperties->localBorderBoxProperties(); 169 objectProperties->localBorderBoxProperties();
177 if (originalBorderBox && objectBorderBox) { 170 if (originalBorderBox && objectBorderBox) {
178 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->transform(), 171 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->transform(),
179 objectBorderBox->transform()); 172 objectBorderBox->transform());
180 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->clip(), 173 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->clip(),
181 objectBorderBox->clip()); 174 objectBorderBox->clip());
182 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->effect(), 175 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->effect(),
183 objectBorderBox->effect()); 176 objectBorderBox->effect());
184 DCHECK_OBJECT_PROPERTY_EQ(m_object, originalBorderBox->scroll(),
185 objectBorderBox->scroll());
186 } else { 177 } else {
187 DCHECK_EQ(!!originalBorderBox, !!objectBorderBox) 178 DCHECK_EQ(!!originalBorderBox, !!objectBorderBox)
188 << " Object: " << m_object.debugName(); 179 << " Object: " << m_object.debugName();
189 } 180 }
190 } else { 181 } else {
191 DCHECK_EQ(!!m_originalProperties, !!objectProperties) 182 DCHECK_EQ(!!m_originalProperties, !!objectProperties)
192 << " Object: " << m_object.debugName(); 183 << " Object: " << m_object.debugName();
193 } 184 }
194 // Restore original clean bit. 185 // Restore original clean bit.
195 m_object.getMutableForPainting().clearNeedsPaintPropertyUpdateForTesting(); 186 m_object.getMutableForPainting().clearNeedsPaintPropertyUpdateForTesting();
196 } 187 }
197 188
198 private: 189 private:
199 const LayoutObject& m_object; 190 const LayoutObject& m_object;
200 bool m_neededPaintPropertyUpdate; 191 bool m_neededPaintPropertyUpdate;
201 bool m_neededForcedSubtreeUpdate; 192 bool m_neededForcedSubtreeUpdate;
202 LayoutPoint m_originalPaintOffset; 193 LayoutPoint m_originalPaintOffset;
203 std::unique_ptr<const ObjectPaintProperties> m_originalProperties; 194 std::unique_ptr<const ObjectPaintProperties> m_originalProperties;
204 }; 195 };
205 196
206 } // namespace blink 197 } // namespace blink
207 #endif // DCHECK_IS_ON() 198 #endif // DCHECK_IS_ON()
208 199
209 #endif // FindPropertiesNeedingUpdate_h 200 #endif // FindPropertiesNeedingUpdate_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BlockPainter.cpp ('k') | third_party/WebKit/Source/core/paint/FramePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698