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

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

Issue 2647063002: Move property tree debugging code to platform/graphics/paint/ (try #2) (Closed)
Patch Set: none Created 3 years, 11 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"
11 #include "core/paint/ObjectPaintProperties.h" 11 #include "core/paint/ObjectPaintProperties.h"
12 #include "platform/graphics/paint/PropertyTreeState.h" 12 #include "platform/graphics/paint/PropertyTreeState.h"
13 13
14 #include <iomanip> 14 #include <iomanip>
15 #include <sstream> 15 #include <sstream>
16 16
17 #ifndef NDEBUG 17 #if DCHECK_IS_ON()
18 18
19 namespace blink { 19 namespace blink {
20 namespace { 20 namespace {
21 21
22 template <typename PropertyTreeNode> 22 template <typename PropertyTreeNode>
23 class PropertyTreePrinterTraits; 23 class PropertyTreePrinterTraits;
24 24
25 template <typename PropertyTreeNode> 25 template <typename PropertyTreeNode>
26 class PropertyTreePrinter { 26 class PropertyTreePrinter {
27 public: 27 public:
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 String effectPropertyTreeAsString(const blink::FrameView& rootFrame) { 566 String effectPropertyTreeAsString(const blink::FrameView& rootFrame) {
567 return blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>() 567 return blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>()
568 .treeAsString(rootFrame); 568 .treeAsString(rootFrame);
569 } 569 }
570 570
571 String scrollPropertyTreeAsString(const blink::FrameView& rootFrame) { 571 String scrollPropertyTreeAsString(const blink::FrameView& rootFrame) {
572 return blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>() 572 return blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>()
573 .treeAsString(rootFrame); 573 .treeAsString(rootFrame);
574 } 574 }
575 575
576 String transformPaintPropertyPathAsString(
577 const blink::TransformPaintPropertyNode* node) {
578 return blink::PropertyTreePrinter<blink::TransformPaintPropertyNode>()
579 .pathAsString(node);
580 }
581
582 String clipPaintPropertyPathAsString(const blink::ClipPaintPropertyNode* node) {
583 return blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>()
584 .pathAsString(node);
585 }
586
587 String effectPaintPropertyPathAsString(
588 const blink::EffectPaintPropertyNode* node) {
589 return blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>()
590 .pathAsString(node);
591 }
592
593 String scrollPaintPropertyPathAsString(
594 const blink::ScrollPaintPropertyNode* node) {
595 return blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>()
596 .pathAsString(node);
597 }
598
599 void showPaintPropertyPath(const blink::TransformPaintPropertyNode* node) {
600 fprintf(stderr, "%s\n",
601 transformPaintPropertyPathAsString(node).utf8().data());
602 }
603
604 void showPaintPropertyPath(const blink::ClipPaintPropertyNode* node) {
605 fprintf(stderr, "%s\n", clipPaintPropertyPathAsString(node).utf8().data());
606 }
607
608 void showPaintPropertyPath(const blink::EffectPaintPropertyNode* node) {
609 fprintf(stderr, "%s\n", effectPaintPropertyPathAsString(node).utf8().data());
610 }
611
612 void showPaintPropertyPath(const blink::ScrollPaintPropertyNode* node) {
613 fprintf(stderr, "%s\n", scrollPaintPropertyPathAsString(node).utf8().data());
614 }
615
616 void showPropertyTreeState(const blink::PropertyTreeState& state) {
617 fprintf(stderr, "%s\n", propertyTreeStateAsString(state).utf8().data());
618 }
619
620 String propertyTreeStateAsString(const blink::PropertyTreeState& state) {
621 return transformPaintPropertyPathAsString(state.transform()) + "\n" +
622 clipPaintPropertyPathAsString(state.clip()) + "\n" +
623 effectPaintPropertyPathAsString(state.effect()) + "\n" +
624 scrollPaintPropertyPathAsString(state.scroll());
625 }
626
627 String paintPropertyTreeGraph(const blink::FrameView& frameView) { 576 String paintPropertyTreeGraph(const blink::FrameView& frameView) {
628 blink::PaintPropertyTreeGraphBuilder builder; 577 blink::PaintPropertyTreeGraphBuilder builder;
629 StringBuilder stringBuilder; 578 StringBuilder stringBuilder;
630 builder.generateTreeGraph(frameView, stringBuilder); 579 builder.generateTreeGraph(frameView, stringBuilder);
631 return stringBuilder.toString(); 580 return stringBuilder.toString();
632 } 581 }
633 582
634 #endif 583 #endif // DCHECK_IS_ON()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698