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

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

Issue 2377183002: Add paint property path printers and test them (Closed)
Patch Set: Created 4 years, 2 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 23 matching lines...) Expand all
34 return ""; 34 return "";
35 35
36 if (!m_nodeToDebugString.contains(rootNode)) 36 if (!m_nodeToDebugString.contains(rootNode))
37 addPropertyNode(rootNode, "root"); 37 addPropertyNode(rootNode, "root");
38 38
39 StringBuilder stringBuilder; 39 StringBuilder stringBuilder;
40 addAllPropertyNodes(stringBuilder, rootNode); 40 addAllPropertyNodes(stringBuilder, rootNode);
41 return stringBuilder.toString(); 41 return stringBuilder.toString();
42 } 42 }
43 43
44 String pathAsString(const PropertyTreeNode* lastNode)
45 {
46 const PropertyTreeNode* node = lastNode;
47 while (!node->isRoot()) {
48 addPropertyNode(node, "");
49 node = node->parent();
50 }
51 addPropertyNode(node, "root");
52
53 StringBuilder stringBuilder;
54 addAllPropertyNodes(stringBuilder, node);
55 return stringBuilder.toString();
56 }
57
44 void addPropertyNode(const PropertyTreeNode* node, String debugInfo) 58 void addPropertyNode(const PropertyTreeNode* node, String debugInfo)
45 { 59 {
46 m_nodeToDebugString.set(node, debugInfo); 60 m_nodeToDebugString.set(node, debugInfo);
47 } 61 }
48 62
49 private: 63 private:
50 using Traits = PropertyTreePrinterTraits<PropertyTreeNode>; 64 using Traits = PropertyTreePrinterTraits<PropertyTreeNode>;
51 65
52 void collectPropertyNodes(const FrameView& frameView) 66 void collectPropertyNodes(const FrameView& frameView)
53 { 67 {
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 String effectPropertyTreeAsString(const blink::FrameView& rootFrame) 555 String effectPropertyTreeAsString(const blink::FrameView& rootFrame)
542 { 556 {
543 return blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().treeAsSt ring(rootFrame); 557 return blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().treeAsSt ring(rootFrame);
544 } 558 }
545 559
546 String scrollPropertyTreeAsString(const blink::FrameView& rootFrame) 560 String scrollPropertyTreeAsString(const blink::FrameView& rootFrame)
547 { 561 {
548 return blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>().treeAsSt ring(rootFrame); 562 return blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>().treeAsSt ring(rootFrame);
549 } 563 }
550 564
565 String transformPaintPropertyPathAsString(const blink::TransformPaintPropertyNod e* node)
566 {
567 return blink::PropertyTreePrinter<blink::TransformPaintPropertyNode>().pathA sString(node);
568 }
569
570 String clipPaintPropertyPathAsString(const blink::ClipPaintPropertyNode* node)
571 {
572 return blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().pathAsStri ng(node);
573 }
574
575 String effectPaintPropertyPathAsString(const blink::EffectPaintPropertyNode* nod e)
576 {
577 return blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().pathAsSt ring(node);
578 }
579
580 String scrollPaintPropertyPathAsString(const blink::ScrollPaintPropertyNode* nod e)
581 {
582 return blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>().pathAsSt ring(node);
583 }
584
585 void showPaintPropertyPath(const blink::TransformPaintPropertyNode* node)
586 {
587 fprintf(stderr, "%s\n", transformPaintPropertyPathAsString(node).utf8().data ());
588 }
589
590 void showPaintPropertyPath(const blink::ClipPaintPropertyNode* node)
591 {
592 fprintf(stderr, "%s\n", clipPaintPropertyPathAsString(node).utf8().data());
593 }
594
595 void showPaintPropertyPath(const blink::EffectPaintPropertyNode* node)
596 {
597 fprintf(stderr, "%s\n", effectPaintPropertyPathAsString(node).utf8().data()) ;
598 }
599
600 void showPaintPropertyPath(const blink::ScrollPaintPropertyNode* node)
601 {
602 fprintf(stderr, "%s\n", scrollPaintPropertyPathAsString(node).utf8().data()) ;
603 }
604
551 String paintPropertyTreeGraph(const blink::FrameView& frameView) 605 String paintPropertyTreeGraph(const blink::FrameView& frameView)
552 { 606 {
553 blink::PaintPropertyTreeGraphBuilder builder; 607 blink::PaintPropertyTreeGraphBuilder builder;
554 StringBuilder stringBuilder; 608 StringBuilder stringBuilder;
555 builder.generateTreeGraph(frameView, stringBuilder); 609 builder.generateTreeGraph(frameView, stringBuilder);
556 return stringBuilder.toString(); 610 return stringBuilder.toString();
557 } 611 }
558 612
559 #endif 613 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698