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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp

Issue 2330863003: Switch to null root property tree nodes [spv2] (Closed)
Patch Set: Rebase from space Created 4 years, 3 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 #include "core/paint/PaintPropertyTreePrinter.h" 5 #include "core/paint/PaintPropertyTreePrinter.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/layout/LayoutPart.h" 9 #include "core/layout/LayoutPart.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 HashMap<const PropertyTreeNode*, String> m_nodeToDebugString; 89 HashMap<const PropertyTreeNode*, String> m_nodeToDebugString;
90 }; 90 };
91 91
92 template <> 92 template <>
93 class PropertyTreePrinterTraits<TransformPaintPropertyNode> { 93 class PropertyTreePrinterTraits<TransformPaintPropertyNode> {
94 public: 94 public:
95 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<TransformPaintPropertyNode>& printer) 95 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<TransformPaintPropertyNode>& printer)
96 { 96 {
97 if (const TransformPaintPropertyNode* rootTransform = frameView.rootTran sform())
98 printer.addPropertyNode(rootTransform, "RootTransform (FrameView)");
99 if (const TransformPaintPropertyNode* preTranslation = frameView.preTran slation()) 97 if (const TransformPaintPropertyNode* preTranslation = frameView.preTran slation())
100 printer.addPropertyNode(preTranslation, "PreTranslation (FrameView)" ); 98 printer.addPropertyNode(preTranslation, "PreTranslation (FrameView)" );
101 if (const TransformPaintPropertyNode* scrollTranslation = frameView.scro llTranslation()) 99 if (const TransformPaintPropertyNode* scrollTranslation = frameView.scro llTranslation())
102 printer.addPropertyNode(scrollTranslation, "ScrollTranslation (Frame View)"); 100 printer.addPropertyNode(scrollTranslation, "ScrollTranslation (Frame View)");
103 } 101 }
104 102
105 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<TransformPaintPropertyNod e>& printer) 103 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<TransformPaintPropertyNod e>& printer)
106 { 104 {
107 if (const TransformPaintPropertyNode* paintOffsetTranslation = paintProp erties.paintOffsetTranslation()) 105 if (const TransformPaintPropertyNode* paintOffsetTranslation = paintProp erties.paintOffsetTranslation())
108 printer.addPropertyNode(paintOffsetTranslation, "PaintOffsetTranslat ion (" + object.debugName() + ")"); 106 printer.addPropertyNode(paintOffsetTranslation, "PaintOffsetTranslat ion (" + object.debugName() + ")");
(...skipping 28 matching lines...) Expand all
137 stringBuilder.append(String::format(", quaternion=%f,%f,%f,%f", decompos ition.quaternionX, decomposition.quaternionY, decomposition.quaternionZ, decompo sition.quaternionW)); 135 stringBuilder.append(String::format(", quaternion=%f,%f,%f,%f", decompos ition.quaternionX, decomposition.quaternionY, decomposition.quaternionZ, decompo sition.quaternionW));
138 stringBuilder.append(String::format(", perspective=%f,%f,%f,%f", decompo sition.perspectiveX, decomposition.perspectiveY, decomposition.perspectiveZ, dec omposition.perspectiveW)); 136 stringBuilder.append(String::format(", perspective=%f,%f,%f,%f", decompo sition.perspectiveX, decomposition.perspectiveY, decomposition.perspectiveZ, dec omposition.perspectiveW));
139 } 137 }
140 }; 138 };
141 139
142 template <> 140 template <>
143 class PropertyTreePrinterTraits<ClipPaintPropertyNode> { 141 class PropertyTreePrinterTraits<ClipPaintPropertyNode> {
144 public: 142 public:
145 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<ClipPaintPropertyNode>& printer) 143 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<ClipPaintPropertyNode>& printer)
146 { 144 {
147 if (const ClipPaintPropertyNode* rootClip = frameView.rootClip())
148 printer.addPropertyNode(rootClip, "RootClip (FrameView)");
149 if (const ClipPaintPropertyNode* contentClip = frameView.contentClip()) 145 if (const ClipPaintPropertyNode* contentClip = frameView.contentClip())
150 printer.addPropertyNode(contentClip, "ContentClip (FrameView)"); 146 printer.addPropertyNode(contentClip, "ContentClip (FrameView)");
151 } 147 }
152 148
153 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<ClipPaintPropertyNode>& p rinter) 149 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<ClipPaintPropertyNode>& p rinter)
154 { 150 {
155 if (const ClipPaintPropertyNode* cssClip = paintProperties.cssClip()) 151 if (const ClipPaintPropertyNode* cssClip = paintProperties.cssClip())
156 printer.addPropertyNode(cssClip, "CssClip (" + object.debugName() + ")"); 152 printer.addPropertyNode(cssClip, "CssClip (" + object.debugName() + ")");
157 if (const ClipPaintPropertyNode* cssClipFixedPosition = paintProperties. cssClipFixedPosition()) 153 if (const ClipPaintPropertyNode* cssClipFixedPosition = paintProperties. cssClipFixedPosition())
158 printer.addPropertyNode(cssClipFixedPosition, "CssClipFixedPosition (" + object.debugName() + ")"); 154 printer.addPropertyNode(cssClipFixedPosition, "CssClipFixedPosition (" + object.debugName() + ")");
159 if (const ClipPaintPropertyNode* overflowClip = paintProperties.overflow Clip()) 155 if (const ClipPaintPropertyNode* overflowClip = paintProperties.overflow Clip())
160 printer.addPropertyNode(overflowClip, "OverflowClip (" + object.debu gName() + ")"); 156 printer.addPropertyNode(overflowClip, "OverflowClip (" + object.debu gName() + ")");
161 } 157 }
162 158
163 static void printNodeAsString(const ClipPaintPropertyNode* node, StringBuild er& stringBuilder) 159 static void printNodeAsString(const ClipPaintPropertyNode* node, StringBuild er& stringBuilder)
164 { 160 {
165 stringBuilder.append(String::format(" localTransformSpace=%p ", node->lo calTransformSpace())); 161 stringBuilder.append(String::format(" localTransformSpace=%p ", node->lo calTransformSpace()));
166 stringBuilder.append(String::format("rect=%f,%f,%f,%f", 162 stringBuilder.append(String::format("rect=%f,%f,%f,%f",
167 node->clipRect().rect().x(), node->clipRect().rect().y(), 163 node->clipRect().rect().x(), node->clipRect().rect().y(),
168 node->clipRect().rect().width(), node->clipRect().rect().height())); 164 node->clipRect().rect().width(), node->clipRect().rect().height()));
169 } 165 }
170 }; 166 };
171 167
172 template <> 168 template <>
173 class PropertyTreePrinterTraits<EffectPaintPropertyNode> { 169 class PropertyTreePrinterTraits<EffectPaintPropertyNode> {
174 public: 170 public:
175 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<EffectPaintPropertyNode>& printer) 171 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<EffectPaintPropertyNode>& printer)
176 { 172 {
177 if (const EffectPaintPropertyNode* rootEffect = frameView.rootEffect())
178 printer.addPropertyNode(rootEffect, "RootEffect (FrameView)");
179 } 173 }
180 174
181 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<EffectPaintPropertyNode>& printer) 175 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<EffectPaintPropertyNode>& printer)
182 { 176 {
183 if (const EffectPaintPropertyNode* effect = paintProperties.effect()) 177 if (const EffectPaintPropertyNode* effect = paintProperties.effect())
184 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ") "); 178 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ") ");
185 } 179 }
186 180
187 static void printNodeAsString(const EffectPaintPropertyNode* node, StringBui lder& stringBuilder) 181 static void printNodeAsString(const EffectPaintPropertyNode* node, StringBui lder& stringBuilder)
188 { 182 {
189 stringBuilder.append(String::format(" opacity=%f", node->opacity())); 183 stringBuilder.append(String::format(" opacity=%f", node->opacity()));
190 } 184 }
191 }; 185 };
192 186
193 template <> 187 template <>
194 class PropertyTreePrinterTraits<ScrollPaintPropertyNode> { 188 class PropertyTreePrinterTraits<ScrollPaintPropertyNode> {
195 public: 189 public:
196 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<ScrollPaintPropertyNode>& printer) 190 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<ScrollPaintPropertyNode>& printer)
197 { 191 {
198 if (const ScrollPaintPropertyNode* rootScroll = frameView.rootScroll())
199 printer.addPropertyNode(rootScroll, "RootScroll (FrameView)");
200 if (const ScrollPaintPropertyNode* scroll = frameView.scroll()) 192 if (const ScrollPaintPropertyNode* scroll = frameView.scroll())
201 printer.addPropertyNode(scroll, "Scroll (FrameView)"); 193 printer.addPropertyNode(scroll, "Scroll (FrameView)");
202 } 194 }
203 195
204 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<ScrollPaintPropertyNode>& printer) 196 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<ScrollPaintPropertyNode>& printer)
205 { 197 {
206 if (const ScrollPaintPropertyNode* scroll = paintProperties.scroll()) 198 if (const ScrollPaintPropertyNode* scroll = paintProperties.scroll())
207 printer.addPropertyNode(scroll, "Scroll (" + object.debugName() + ") "); 199 printer.addPropertyNode(scroll, "Scroll (" + object.debugName() + ") ");
208 } 200 }
209 201
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 const EffectPaintPropertyNode* effect = properties->effect(); 372 const EffectPaintPropertyNode* effect = properties->effect();
381 if (effect) 373 if (effect)
382 writePaintPropertyNode(*effect, &object, "effect"); 374 writePaintPropertyNode(*effect, &object, "effect");
383 const ClipPaintPropertyNode* cssClip = properties->cssClip(); 375 const ClipPaintPropertyNode* cssClip = properties->cssClip();
384 if (cssClip) 376 if (cssClip)
385 writePaintPropertyNode(*cssClip, &object, "cssClip"); 377 writePaintPropertyNode(*cssClip, &object, "cssClip");
386 const ClipPaintPropertyNode* cssClipFixedPosition = properties->cssClipF ixedPosition(); 378 const ClipPaintPropertyNode* cssClipFixedPosition = properties->cssClipF ixedPosition();
387 if (cssClipFixedPosition) 379 if (cssClipFixedPosition)
388 writePaintPropertyNode(*cssClipFixedPosition, &object, "cssClipFixed Position"); 380 writePaintPropertyNode(*cssClipFixedPosition, &object, "cssClipFixed Position");
389 const ClipPaintPropertyNode* overflowClip = properties->overflowClip(); 381 const ClipPaintPropertyNode* overflowClip = properties->overflowClip();
390 if (overflowClip) { 382 if (overflowClip)
391 writePaintPropertyNode(*overflowClip, &object, "overflowClip"); 383 writePaintPropertyNode(*overflowClip, &object, "overflowClip");
392 if (object.isLayoutView() && overflowClip->parent())
393 writePaintPropertyNode(*overflowClip->parent(), nullptr, "rootCl ip");
394 }
395 const ScrollPaintPropertyNode* scroll = properties->scroll(); 384 const ScrollPaintPropertyNode* scroll = properties->scroll();
396 if (scroll) 385 if (scroll)
397 writePaintPropertyNode(*scroll, &object, "scroll"); 386 writePaintPropertyNode(*scroll, &object, "scroll");
398 } 387 }
399 388
400 void writeFrameViewPaintPropertyNodes(const FrameView& frameView) 389 void writeFrameViewPaintPropertyNodes(const FrameView& frameView)
401 { 390 {
402 TransformPaintPropertyNode* rootTransform = frameView.rootTransform();
403 if (rootTransform)
404 writePaintPropertyNode(*rootTransform, &frameView, "rootTransform");
405 ClipPaintPropertyNode* rootClip = frameView.rootClip();
406 if (rootClip)
407 writePaintPropertyNode(*rootClip, &frameView, "rootClip");
408 EffectPaintPropertyNode* rootEffect = frameView.rootEffect();
409 if (rootEffect)
410 writePaintPropertyNode(*rootEffect, &frameView, "rootEffect");
411 TransformPaintPropertyNode* preTranslation = frameView.preTranslation(); 391 TransformPaintPropertyNode* preTranslation = frameView.preTranslation();
412 if (preTranslation) 392 if (preTranslation)
413 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation" ); 393 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation" );
414 TransformPaintPropertyNode* scrollTranslation = frameView.scrollTranslat ion(); 394 TransformPaintPropertyNode* scrollTranslation = frameView.scrollTranslat ion();
415 if (scrollTranslation) 395 if (scrollTranslation)
416 writePaintPropertyNode(*scrollTranslation, &frameView, "scrollTransl ation"); 396 writePaintPropertyNode(*scrollTranslation, &frameView, "scrollTransl ation");
417 ClipPaintPropertyNode* contentClip = frameView.contentClip(); 397 ClipPaintPropertyNode* contentClip = frameView.contentClip();
418 if (contentClip) 398 if (contentClip)
419 writePaintPropertyNode(*contentClip, &frameView, "contentClip"); 399 writePaintPropertyNode(*contentClip, &frameView, "contentClip");
420 ScrollPaintPropertyNode* scroll = frameView.scroll(); 400 ScrollPaintPropertyNode* scroll = frameView.scroll();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 505
526 String paintPropertyTreeGraph(const blink::FrameView& frameView) 506 String paintPropertyTreeGraph(const blink::FrameView& frameView)
527 { 507 {
528 blink::PaintPropertyTreeGraphBuilder builder; 508 blink::PaintPropertyTreeGraphBuilder builder;
529 StringBuilder stringBuilder; 509 StringBuilder stringBuilder;
530 builder.generateTreeGraph(frameView, stringBuilder); 510 builder.generateTreeGraph(frameView, stringBuilder);
531 return stringBuilder.toString(); 511 return stringBuilder.toString();
532 } 512 }
533 513
534 #endif 514 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698