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

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

Issue 2299533002: WIP: Construct SPV2's scroll paint property tree (Closed)
Patch Set: Plumb scroll offset to cc 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/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/ObjectPaintProperties.h" 10 #include "core/paint/ObjectPaintProperties.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (const EffectPaintPropertyNode* effect = paintProperties.effect()) 185 if (const EffectPaintPropertyNode* effect = paintProperties.effect())
186 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ") "); 186 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ") ");
187 } 187 }
188 188
189 static void printNodeAsString(const EffectPaintPropertyNode* node, StringBui lder& stringBuilder) 189 static void printNodeAsString(const EffectPaintPropertyNode* node, StringBui lder& stringBuilder)
190 { 190 {
191 stringBuilder.append(String::format(" opacity=%f", node->opacity())); 191 stringBuilder.append(String::format(" opacity=%f", node->opacity()));
192 } 192 }
193 }; 193 };
194 194
195 template <>
196 class PropertyTreePrinterTraits<ScrollPaintPropertyNode> {
197 public:
198 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<ScrollPaintPropertyNode>& printer)
199 {
200 if (const ScrollPaintPropertyNode* rootScroll = frameView.rootScroll())
201 printer.addPropertyNode(rootScroll, "RootScroll (FrameView)");
202 if (const ScrollPaintPropertyNode* scroll = frameView.scroll())
203 printer.addPropertyNode(scroll, "Scroll (FrameView)");
204 }
205
206 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<ScrollPaintPropertyNode>& printer)
207 {
208 if (const ScrollPaintPropertyNode* scroll = paintProperties.scroll())
209 printer.addPropertyNode(scroll, "Scroll (" + object.debugName() + ") ");
210 }
211
212 static void printNodeAsString(const ScrollPaintPropertyNode* node, StringBui lder& stringBuilder)
213 {
214 // TODO(pdr): Fill this out.
215 stringBuilder.append(String::format(" transform=%p ", node->transform()) );
216 }
217 };
218
195 class PaintPropertyTreeGraphBuilder { 219 class PaintPropertyTreeGraphBuilder {
196 public: 220 public:
197 PaintPropertyTreeGraphBuilder() { } 221 PaintPropertyTreeGraphBuilder() { }
198 222
199 void generateTreeGraph(const FrameView& frameView, StringBuilder& stringBuil der) 223 void generateTreeGraph(const FrameView& frameView, StringBuilder& stringBuil der)
200 { 224 {
201 m_layout.str(""); 225 m_layout.str("");
202 m_properties.str(""); 226 m_properties.str("");
203 m_ownerEdges.str(""); 227 m_ownerEdges.str("");
204 m_properties << std::setprecision(2) << std::setiosflags(std::ios_base:: fixed); 228 m_properties << std::setprecision(2) << std::setiosflags(std::ios_base:: fixed);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 std::ostream& os = m_properties; 335 std::ostream& os = m_properties;
312 os << "n" << &node << " [shape=diamond, label=\"" << label << "\\n"; 336 os << "n" << &node << " [shape=diamond, label=\"" << label << "\\n";
313 os << "opacity=" << node.opacity() << "\"];" << std::endl; 337 os << "opacity=" << node.opacity() << "\"];" << std::endl;
314 338
315 if (owner) 339 if (owner)
316 writeOwnerEdge(&node, owner); 340 writeOwnerEdge(&node, owner);
317 if (node.parent()) 341 if (node.parent())
318 writeParentEdge(&node, node.parent(), s_effectNodeColor, os); 342 writeParentEdge(&node, node.parent(), s_effectNodeColor, os);
319 } 343 }
320 344
345 void writePaintPropertyNode(const ScrollPaintPropertyNode&, const void*, con st char*)
346 {
347 // TODO(pdr): fill this out.
348 }
349
321 void writeObjectPaintPropertyNodes(const LayoutObject& object) 350 void writeObjectPaintPropertyNodes(const LayoutObject& object)
322 { 351 {
323 const ObjectPaintProperties* properties = object.objectPaintProperties() ; 352 const ObjectPaintProperties* properties = object.objectPaintProperties() ;
324 if (!properties) 353 if (!properties)
325 return; 354 return;
326 const TransformPaintPropertyNode* paintOffset = properties->paintOffsetT ranslation(); 355 const TransformPaintPropertyNode* paintOffset = properties->paintOffsetT ranslation();
327 if (paintOffset) 356 if (paintOffset)
328 writePaintPropertyNode(*paintOffset, &object, "paintOffset"); 357 writePaintPropertyNode(*paintOffset, &object, "paintOffset");
329 const TransformPaintPropertyNode* transform = properties->transform(); 358 const TransformPaintPropertyNode* transform = properties->transform();
330 if (transform) 359 if (transform)
(...skipping 18 matching lines...) Expand all
349 writePaintPropertyNode(*cssClip, &object, "cssClip"); 378 writePaintPropertyNode(*cssClip, &object, "cssClip");
350 const ClipPaintPropertyNode* cssClipFixedPosition = properties->cssClipF ixedPosition(); 379 const ClipPaintPropertyNode* cssClipFixedPosition = properties->cssClipF ixedPosition();
351 if (cssClipFixedPosition) 380 if (cssClipFixedPosition)
352 writePaintPropertyNode(*cssClipFixedPosition, &object, "cssClipFixed Position"); 381 writePaintPropertyNode(*cssClipFixedPosition, &object, "cssClipFixed Position");
353 const ClipPaintPropertyNode* overflowClip = properties->overflowClip(); 382 const ClipPaintPropertyNode* overflowClip = properties->overflowClip();
354 if (overflowClip) { 383 if (overflowClip) {
355 writePaintPropertyNode(*overflowClip, &object, "overflowClip"); 384 writePaintPropertyNode(*overflowClip, &object, "overflowClip");
356 if (object.isLayoutView() && overflowClip->parent()) 385 if (object.isLayoutView() && overflowClip->parent())
357 writePaintPropertyNode(*overflowClip->parent(), nullptr, "rootCl ip"); 386 writePaintPropertyNode(*overflowClip->parent(), nullptr, "rootCl ip");
358 } 387 }
388 const ScrollPaintPropertyNode* scroll = properties->scroll();
389 if (scroll)
390 writePaintPropertyNode(*scroll, &object, "scroll");
359 } 391 }
360 392
361 void writeFrameViewPaintPropertyNodes(const FrameView& frameView) 393 void writeFrameViewPaintPropertyNodes(const FrameView& frameView)
362 { 394 {
363 TransformPaintPropertyNode* rootTransform = frameView.rootTransform(); 395 TransformPaintPropertyNode* rootTransform = frameView.rootTransform();
364 if (rootTransform) 396 if (rootTransform)
365 writePaintPropertyNode(*rootTransform, &frameView, "rootTransform"); 397 writePaintPropertyNode(*rootTransform, &frameView, "rootTransform");
366 ClipPaintPropertyNode* rootClip = frameView.rootClip(); 398 ClipPaintPropertyNode* rootClip = frameView.rootClip();
367 if (rootClip) 399 if (rootClip)
368 writePaintPropertyNode(*rootClip, &frameView, "rootClip"); 400 writePaintPropertyNode(*rootClip, &frameView, "rootClip");
369 EffectPaintPropertyNode* rootEffect = frameView.rootEffect(); 401 EffectPaintPropertyNode* rootEffect = frameView.rootEffect();
370 if (rootEffect) 402 if (rootEffect)
371 writePaintPropertyNode(*rootEffect, &frameView, "rootEffect"); 403 writePaintPropertyNode(*rootEffect, &frameView, "rootEffect");
372 TransformPaintPropertyNode* preTranslation = frameView.preTranslation(); 404 TransformPaintPropertyNode* preTranslation = frameView.preTranslation();
373 if (preTranslation) 405 if (preTranslation)
374 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation" ); 406 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation" );
375 TransformPaintPropertyNode* scrollTranslation = frameView.scrollTranslat ion(); 407 TransformPaintPropertyNode* scrollTranslation = frameView.scrollTranslat ion();
376 if (scrollTranslation) 408 if (scrollTranslation)
377 writePaintPropertyNode(*scrollTranslation, &frameView, "scrollTransl ation"); 409 writePaintPropertyNode(*scrollTranslation, &frameView, "scrollTransl ation");
378 ClipPaintPropertyNode* contentClip = frameView.contentClip(); 410 ClipPaintPropertyNode* contentClip = frameView.contentClip();
379 if (contentClip) 411 if (contentClip)
380 writePaintPropertyNode(*contentClip, &frameView, "contentClip"); 412 writePaintPropertyNode(*contentClip, &frameView, "contentClip");
413 ScrollPaintPropertyNode* scroll = frameView.scroll();
414 if (scroll)
415 writePaintPropertyNode(*scroll, &frameView, "scroll");
381 } 416 }
382 417
383 void writeLayoutObjectNode(const LayoutObject& object) 418 void writeLayoutObjectNode(const LayoutObject& object)
384 { 419 {
385 std::ostream& os = m_layout; 420 std::ostream& os = m_layout;
386 os << "n" << &object 421 os << "n" << &object
387 << " [color=" << s_layoutNodeColor 422 << " [color=" << s_layoutNodeColor
388 << ", fontcolor=" << s_layoutNodeColor 423 << ", fontcolor=" << s_layoutNodeColor
389 << ", label=\"" << object.name(); 424 << ", label=\"" << object.name();
390 Node* node = object.node(); 425 Node* node = object.node();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 void showClipPropertyTree(const blink::FrameView& rootFrame) 484 void showClipPropertyTree(const blink::FrameView& rootFrame)
450 { 485 {
451 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showTree(rootFram e); 486 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showTree(rootFram e);
452 } 487 }
453 488
454 void showEffectPropertyTree(const blink::FrameView& rootFrame) 489 void showEffectPropertyTree(const blink::FrameView& rootFrame)
455 { 490 {
456 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showTree(rootFr ame); 491 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showTree(rootFr ame);
457 } 492 }
458 493
494 void showScrollPropertyTree(const blink::FrameView& rootFrame)
495 {
496 blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>().showTree(rootFr ame);
497 }
498
459 void showPaintPropertyPath(const blink::TransformPaintPropertyNode* node) 499 void showPaintPropertyPath(const blink::TransformPaintPropertyNode* node)
460 { 500 {
461 blink::PropertyTreePrinter<blink::TransformPaintPropertyNode>().showPath(nod e); 501 blink::PropertyTreePrinter<blink::TransformPaintPropertyNode>().showPath(nod e);
462 } 502 }
463 503
464 void showPaintPropertyPath(const blink::ClipPaintPropertyNode* node) 504 void showPaintPropertyPath(const blink::ClipPaintPropertyNode* node)
465 { 505 {
466 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showPath(node); 506 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showPath(node);
467 } 507 }
468 508
469 void showPaintPropertyPath(const blink::EffectPaintPropertyNode* node) 509 void showPaintPropertyPath(const blink::EffectPaintPropertyNode* node)
470 { 510 {
471 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showPath(node); 511 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showPath(node);
472 } 512 }
473 513
514 void showPaintPropertyPath(const blink::ScrollPaintPropertyNode* node)
515 {
516 blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>().showPath(node);
517 }
518
474 String paintPropertyTreeGraph(const blink::FrameView& frameView) 519 String paintPropertyTreeGraph(const blink::FrameView& frameView)
475 { 520 {
476 blink::PaintPropertyTreeGraphBuilder builder; 521 blink::PaintPropertyTreeGraphBuilder builder;
477 StringBuilder stringBuilder; 522 StringBuilder stringBuilder;
478 builder.generateTreeGraph(frameView, stringBuilder); 523 builder.generateTreeGraph(frameView, stringBuilder);
479 return stringBuilder.toString(); 524 return stringBuilder.toString();
480 } 525 }
481 526
482 #endif 527 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698