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

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

Issue 2572783004: Dump properties in FindPropertiesNeedingUpdate (Closed)
Patch Set: Format Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 // This file contains two scope classes for catching cases where paint 11 // This file contains two scope classes for catching cases where paint
12 // properties need an update but where not marked as such. If paint properties 12 // properties need an update but where not marked as such. If paint properties
13 // will change, the object must be marked as needing a paint property update 13 // will change, the object must be marked as needing a paint property update
14 // using {FrameView, LayoutObject}::setNeedsPaintPropertyUpdate() or by forcing 14 // using {FrameView, LayoutObject}::setNeedsPaintPropertyUpdate() or by forcing
15 // a subtree update (see: PaintPropertyTreeBuilderContext::forceSubtreeupdate). 15 // a subtree update (see: PaintPropertyTreeBuilderContext::forceSubtreeupdate).
16 // 16 //
17 // Both scope classes work by recording the paint property state of an object 17 // Both scope classes work by recording the paint property state of an object
18 // before rebuilding properties, forcing the properties to get updated, then 18 // before rebuilding properties, forcing the properties to get updated, then
19 // checking that the updated properties match the original properties. 19 // checking that the updated properties match the original properties.
20 20
21 #define DCHECK_FRAMEVIEW_PROPERTY_EQ(original, updated) \ 21 #define DUMP_PROPERTIES(original, updated) \
22 do { \ 22 "\nOriginal:\n" \
23 DCHECK(!!original == !!updated) << "Property was created or deleted " \ 23 << (original ? (original)->toString().ascii().data() : "null") \
24 "without the FrameView needing a " \ 24 << "\nUpdated:\n" \
25 "paint property update."; \ 25 << (updated ? (updated)->toString().ascii().data() : "null")
26 if (!!original && !!updated) { \ 26
27 DCHECK(*original == *updated) << "Property was updated without the " \ 27 #define CHECK_PROPERTY_EQ(thing, original, updated) \
28 "FrameView needing a paint property " \ 28 do { \
29 "update."; \ 29 DCHECK(!!original == !!updated) << "Property was created or deleted " \
30 } \ 30 << "without " << thing \
31 } while (0); 31 << " needing a paint property update." \
32 << DUMP_PROPERTIES(original, updated); \
33 if (!!original && !!updated) { \
34 DCHECK(*original == *updated) << "Property was updated without " \
35 << thing \
36 << " needing a paint property update." \
37 << DUMP_PROPERTIES(original, updated); \
38 } \
39 } while (0)
40
41 #define DCHECK_FRAMEVIEW_PROPERTY_EQ(original, updated) \
42 CHECK_PROPERTY_EQ("the FrameView", original, updated)
32 43
33 class FindFrameViewPropertiesNeedingUpdateScope { 44 class FindFrameViewPropertiesNeedingUpdateScope {
34 public: 45 public:
35 FindFrameViewPropertiesNeedingUpdateScope( 46 FindFrameViewPropertiesNeedingUpdateScope(
36 FrameView* frameView, 47 FrameView* frameView,
37 PaintPropertyTreeBuilderContext& context) 48 PaintPropertyTreeBuilderContext& context)
38 : m_frameView(frameView), 49 : m_frameView(frameView),
39 m_neededPaintPropertyUpdate(frameView->needsPaintPropertyUpdate()), 50 m_neededPaintPropertyUpdate(frameView->needsPaintPropertyUpdate()),
40 m_neededForcedSubtreeUpdate(context.forceSubtreeUpdate) { 51 m_neededForcedSubtreeUpdate(context.forceSubtreeUpdate) {
41 // No need to check if an update was already needed. 52 // No need to check if an update was already needed.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 private: 92 private:
82 Persistent<FrameView> m_frameView; 93 Persistent<FrameView> m_frameView;
83 bool m_neededPaintPropertyUpdate; 94 bool m_neededPaintPropertyUpdate;
84 bool m_neededForcedSubtreeUpdate; 95 bool m_neededForcedSubtreeUpdate;
85 RefPtr<TransformPaintPropertyNode> m_originalPreTranslation; 96 RefPtr<TransformPaintPropertyNode> m_originalPreTranslation;
86 RefPtr<ClipPaintPropertyNode> m_originalContentClip; 97 RefPtr<ClipPaintPropertyNode> m_originalContentClip;
87 RefPtr<TransformPaintPropertyNode> m_originalScrollTranslation; 98 RefPtr<TransformPaintPropertyNode> m_originalScrollTranslation;
88 RefPtr<ScrollPaintPropertyNode> m_originalScroll; 99 RefPtr<ScrollPaintPropertyNode> m_originalScroll;
89 }; 100 };
90 101
91 #define DCHECK_OBJECT_PROPERTY_EQ(object, original, updated) \ 102 #define DCHECK_OBJECT_PROPERTY_EQ(object, original, updated) \
92 do { \ 103 CHECK_PROPERTY_EQ("the layout object (" << object.debugName() << ")", \
93 DCHECK(!!original == !!updated) << "Property was created or deleted " \ 104 original, updated)
94 "without the layout object (" \
95 << object.debugName() \
96 << ") needing a paint property update."; \
97 if (!!original && !!updated) { \
98 DCHECK(*original == *updated) << "Property was updated without the " \
99 "layout object (" \
100 << object.debugName() \
101 << ") needing a paint property update."; \
102 } \
103 } while (0);
104 105
105 class FindObjectPropertiesNeedingUpdateScope { 106 class FindObjectPropertiesNeedingUpdateScope {
106 public: 107 public:
107 FindObjectPropertiesNeedingUpdateScope( 108 FindObjectPropertiesNeedingUpdateScope(
108 const LayoutObject& object, 109 const LayoutObject& object,
109 PaintPropertyTreeBuilderContext& context) 110 PaintPropertyTreeBuilderContext& context)
110 : m_object(object), 111 : m_object(object),
111 m_neededPaintPropertyUpdate(object.needsPaintPropertyUpdate()), 112 m_neededPaintPropertyUpdate(object.needsPaintPropertyUpdate()),
112 m_neededForcedSubtreeUpdate(context.forceSubtreeUpdate) { 113 m_neededForcedSubtreeUpdate(context.forceSubtreeUpdate) {
113 // No need to check if an update was already needed. 114 // No need to check if an update was already needed.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 m_originalProperties->scrollTranslation(), 165 m_originalProperties->scrollTranslation(),
165 objectProperties->scrollTranslation()); 166 objectProperties->scrollTranslation());
166 DCHECK_OBJECT_PROPERTY_EQ(m_object, 167 DCHECK_OBJECT_PROPERTY_EQ(m_object,
167 m_originalProperties->scrollbarPaintOffset(), 168 m_originalProperties->scrollbarPaintOffset(),
168 objectProperties->scrollbarPaintOffset()); 169 objectProperties->scrollbarPaintOffset());
169 const auto* originalBorderBox = 170 const auto* originalBorderBox =
170 m_originalProperties->localBorderBoxProperties(); 171 m_originalProperties->localBorderBoxProperties();
171 const auto* objectBorderBox = 172 const auto* objectBorderBox =
172 objectProperties->localBorderBoxProperties(); 173 objectProperties->localBorderBoxProperties();
173 if (originalBorderBox && objectBorderBox) { 174 if (originalBorderBox && objectBorderBox) {
174 DCHECK(originalBorderBox->paintOffset == objectBorderBox->paintOffset) 175 DCHECK_OBJECT_PROPERTY_EQ(m_object, &originalBorderBox->paintOffset,
175 << "Border box paint offset was updated without the layout object (" 176 &objectBorderBox->paintOffset);
176 << m_object.debugName() << ") needing a paint property update.";
177 DCHECK_OBJECT_PROPERTY_EQ( 177 DCHECK_OBJECT_PROPERTY_EQ(
178 m_object, originalBorderBox->propertyTreeState.transform(), 178 m_object, originalBorderBox->propertyTreeState.transform(),
179 objectBorderBox->propertyTreeState.transform()); 179 objectBorderBox->propertyTreeState.transform());
180 DCHECK_OBJECT_PROPERTY_EQ(m_object, 180 DCHECK_OBJECT_PROPERTY_EQ(m_object,
181 originalBorderBox->propertyTreeState.clip(), 181 originalBorderBox->propertyTreeState.clip(),
182 objectBorderBox->propertyTreeState.clip()); 182 objectBorderBox->propertyTreeState.clip());
183 DCHECK_OBJECT_PROPERTY_EQ(m_object, 183 DCHECK_OBJECT_PROPERTY_EQ(m_object,
184 originalBorderBox->propertyTreeState.effect(), 184 originalBorderBox->propertyTreeState.effect(),
185 objectBorderBox->propertyTreeState.effect()); 185 objectBorderBox->propertyTreeState.effect());
186 DCHECK_OBJECT_PROPERTY_EQ(m_object, 186 DCHECK_OBJECT_PROPERTY_EQ(m_object,
(...skipping 13 matching lines...) Expand all
200 const LayoutObject& m_object; 200 const LayoutObject& m_object;
201 bool m_neededPaintPropertyUpdate; 201 bool m_neededPaintPropertyUpdate;
202 bool m_neededForcedSubtreeUpdate; 202 bool m_neededForcedSubtreeUpdate;
203 std::unique_ptr<const ObjectPaintProperties> m_originalProperties; 203 std::unique_ptr<const ObjectPaintProperties> m_originalProperties;
204 }; 204 };
205 205
206 } // namespace blink 206 } // namespace blink
207 #endif // DCHECK_IS_ON() 207 #endif // DCHECK_IS_ON()
208 208
209 #endif // FindPropertiesNeedingUpdate_h 209 #endif // FindPropertiesNeedingUpdate_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698