OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 } | 734 } |
735 } | 735 } |
736 } | 736 } |
737 | 737 |
738 void GraphicsLayer::writeIndent(TextStream& ts, int indent) | 738 void GraphicsLayer::writeIndent(TextStream& ts, int indent) |
739 { | 739 { |
740 for (int i = 0; i != indent; ++i) | 740 for (int i = 0; i != indent; ++i) |
741 ts << " "; | 741 ts << " "; |
742 } | 742 } |
743 | 743 |
744 void GraphicsLayer::dumpLayer(TextStream& ts, int indent, LayerTreeAsTextBehavio
r behavior) const | 744 void GraphicsLayer::dumpLayer(TextStream& ts, int indent, LayerTreeFlags flags)
const |
745 { | 745 { |
746 writeIndent(ts, indent); | 746 writeIndent(ts, indent); |
747 ts << "(" << "GraphicsLayer"; | 747 ts << "(" << "GraphicsLayer"; |
748 | 748 |
749 if (behavior & LayerTreeAsTextDebug) { | 749 if (flags & LayerTreeIncludesDebugInfo) { |
750 ts << " " << static_cast<void*>(const_cast<GraphicsLayer*>(this)); | 750 ts << " " << static_cast<void*>(const_cast<GraphicsLayer*>(this)); |
751 ts << " \"" << m_name << "\""; | 751 ts << " \"" << m_name << "\""; |
752 } | 752 } |
753 | 753 |
754 ts << "\n"; | 754 ts << "\n"; |
755 dumpProperties(ts, indent, behavior); | 755 dumpProperties(ts, indent, flags); |
756 writeIndent(ts, indent); | 756 writeIndent(ts, indent); |
757 ts << ")\n"; | 757 ts << ")\n"; |
758 } | 758 } |
759 | 759 |
760 void GraphicsLayer::dumpProperties(TextStream& ts, int indent, LayerTreeAsTextBe
havior behavior) const | 760 void GraphicsLayer::dumpProperties(TextStream& ts, int indent, LayerTreeFlags fl
ags) const |
761 { | 761 { |
762 if (m_position != FloatPoint()) { | 762 if (m_position != FloatPoint()) { |
763 writeIndent(ts, indent + 1); | 763 writeIndent(ts, indent + 1); |
764 ts << "(position " << m_position.x() << " " << m_position.y() << ")\n"; | 764 ts << "(position " << m_position.x() << " " << m_position.y() << ")\n"; |
765 } | 765 } |
766 | 766 |
767 if (m_boundsOrigin != FloatPoint()) { | 767 if (m_boundsOrigin != FloatPoint()) { |
768 writeIndent(ts, indent + 1); | 768 writeIndent(ts, indent + 1); |
769 ts << "(bounds origin " << m_boundsOrigin.x() << " " << m_boundsOrigin.y
() << ")\n"; | 769 ts << "(bounds origin " << m_boundsOrigin.x() << " " << m_boundsOrigin.y
() << ")\n"; |
770 } | 770 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 if (!m_contentsVisible) { | 802 if (!m_contentsVisible) { |
803 writeIndent(ts, indent + 1); | 803 writeIndent(ts, indent + 1); |
804 ts << "(contentsVisible " << m_contentsVisible << ")\n"; | 804 ts << "(contentsVisible " << m_contentsVisible << ")\n"; |
805 } | 805 } |
806 | 806 |
807 if (!m_backfaceVisibility) { | 807 if (!m_backfaceVisibility) { |
808 writeIndent(ts, indent + 1); | 808 writeIndent(ts, indent + 1); |
809 ts << "(backfaceVisibility " << (m_backfaceVisibility ? "visible" : "hid
den") << ")\n"; | 809 ts << "(backfaceVisibility " << (m_backfaceVisibility ? "visible" : "hid
den") << ")\n"; |
810 } | 810 } |
811 | 811 |
812 if (behavior & LayerTreeAsTextDebug) { | 812 if (flags & LayerTreeIncludesDebugInfo) { |
813 writeIndent(ts, indent + 1); | 813 writeIndent(ts, indent + 1); |
814 ts << "("; | 814 ts << "("; |
815 if (m_client) | 815 if (m_client) |
816 ts << "client " << static_cast<void*>(m_client); | 816 ts << "client " << static_cast<void*>(m_client); |
817 else | 817 else |
818 ts << "no client"; | 818 ts << "no client"; |
819 ts << ")\n"; | 819 ts << ")\n"; |
820 } | 820 } |
821 | 821 |
822 if (m_backgroundColor.isValid() && m_backgroundColor != Color::transparent)
{ | 822 if (m_backgroundColor.isValid() && m_backgroundColor != Color::transparent)
{ |
(...skipping 17 matching lines...) Expand all Loading... |
840 ts << "(childrenTransform "; | 840 ts << "(childrenTransform "; |
841 ts << "[" << m_childrenTransform.m11() << " " << m_childrenTransform.m12
() << " " << m_childrenTransform.m13() << " " << m_childrenTransform.m14() << "]
"; | 841 ts << "[" << m_childrenTransform.m11() << " " << m_childrenTransform.m12
() << " " << m_childrenTransform.m13() << " " << m_childrenTransform.m14() << "]
"; |
842 ts << "[" << m_childrenTransform.m21() << " " << m_childrenTransform.m22
() << " " << m_childrenTransform.m23() << " " << m_childrenTransform.m24() << "]
"; | 842 ts << "[" << m_childrenTransform.m21() << " " << m_childrenTransform.m22
() << " " << m_childrenTransform.m23() << " " << m_childrenTransform.m24() << "]
"; |
843 ts << "[" << m_childrenTransform.m31() << " " << m_childrenTransform.m32
() << " " << m_childrenTransform.m33() << " " << m_childrenTransform.m34() << "]
"; | 843 ts << "[" << m_childrenTransform.m31() << " " << m_childrenTransform.m32
() << " " << m_childrenTransform.m33() << " " << m_childrenTransform.m34() << "]
"; |
844 ts << "[" << m_childrenTransform.m41() << " " << m_childrenTransform.m42
() << " " << m_childrenTransform.m43() << " " << m_childrenTransform.m44() << "]
)\n"; | 844 ts << "[" << m_childrenTransform.m41() << " " << m_childrenTransform.m42
() << " " << m_childrenTransform.m43() << " " << m_childrenTransform.m44() << "]
)\n"; |
845 } | 845 } |
846 | 846 |
847 if (m_replicaLayer) { | 847 if (m_replicaLayer) { |
848 writeIndent(ts, indent + 1); | 848 writeIndent(ts, indent + 1); |
849 ts << "(replica layer"; | 849 ts << "(replica layer"; |
850 if (behavior & LayerTreeAsTextDebug) | 850 if (flags & LayerTreeIncludesDebugInfo) |
851 ts << " " << m_replicaLayer; | 851 ts << " " << m_replicaLayer; |
852 ts << ")\n"; | 852 ts << ")\n"; |
853 m_replicaLayer->dumpLayer(ts, indent + 2, behavior); | 853 m_replicaLayer->dumpLayer(ts, indent + 2, flags); |
854 } | 854 } |
855 | 855 |
856 if (m_replicatedLayer) { | 856 if (m_replicatedLayer) { |
857 writeIndent(ts, indent + 1); | 857 writeIndent(ts, indent + 1); |
858 ts << "(replicated layer"; | 858 ts << "(replicated layer"; |
859 if (behavior & LayerTreeAsTextDebug) | 859 if (flags & LayerTreeIncludesDebugInfo) |
860 ts << " " << m_replicatedLayer; | 860 ts << " " << m_replicatedLayer; |
861 ts << ")\n"; | 861 ts << ")\n"; |
862 } | 862 } |
863 | 863 |
864 if (behavior & LayerTreeAsTextIncludeRepaintRects && repaintRectMap().contai
ns(this) && !repaintRectMap().get(this).isEmpty()) { | 864 if ((flags & LayerTreeIncludesRepaintRects) && repaintRectMap().contains(thi
s) && !repaintRectMap().get(this).isEmpty()) { |
865 writeIndent(ts, indent + 1); | 865 writeIndent(ts, indent + 1); |
866 ts << "(repaint rects\n"; | 866 ts << "(repaint rects\n"; |
867 for (size_t i = 0; i < repaintRectMap().get(this).size(); ++i) { | 867 for (size_t i = 0; i < repaintRectMap().get(this).size(); ++i) { |
868 if (repaintRectMap().get(this)[i].isEmpty()) | 868 if (repaintRectMap().get(this)[i].isEmpty()) |
869 continue; | 869 continue; |
870 writeIndent(ts, indent + 2); | 870 writeIndent(ts, indent + 2); |
871 ts << "(rect "; | 871 ts << "(rect "; |
872 ts << repaintRectMap().get(this)[i].x() << " "; | 872 ts << repaintRectMap().get(this)[i].x() << " "; |
873 ts << repaintRectMap().get(this)[i].y() << " "; | 873 ts << repaintRectMap().get(this)[i].y() << " "; |
874 ts << repaintRectMap().get(this)[i].width() << " "; | 874 ts << repaintRectMap().get(this)[i].width() << " "; |
875 ts << repaintRectMap().get(this)[i].height(); | 875 ts << repaintRectMap().get(this)[i].height(); |
876 ts << ")\n"; | 876 ts << ")\n"; |
877 } | 877 } |
878 writeIndent(ts, indent + 1); | 878 writeIndent(ts, indent + 1); |
879 ts << ")\n"; | 879 ts << ")\n"; |
880 } | 880 } |
881 | 881 |
882 if (behavior & LayerTreeAsTextIncludePaintingPhases && paintingPhase()) { | 882 if ((flags & LayerTreeIncludesPaintingPhases) && paintingPhase()) { |
883 writeIndent(ts, indent + 1); | 883 writeIndent(ts, indent + 1); |
884 ts << "(paintingPhases\n"; | 884 ts << "(paintingPhases\n"; |
885 if (paintingPhase() & GraphicsLayerPaintBackground) { | 885 if (paintingPhase() & GraphicsLayerPaintBackground) { |
886 writeIndent(ts, indent + 2); | 886 writeIndent(ts, indent + 2); |
887 ts << "GraphicsLayerPaintBackground\n"; | 887 ts << "GraphicsLayerPaintBackground\n"; |
888 } | 888 } |
889 if (paintingPhase() & GraphicsLayerPaintForeground) { | 889 if (paintingPhase() & GraphicsLayerPaintForeground) { |
890 writeIndent(ts, indent + 2); | 890 writeIndent(ts, indent + 2); |
891 ts << "GraphicsLayerPaintForeground\n"; | 891 ts << "GraphicsLayerPaintForeground\n"; |
892 } | 892 } |
893 if (paintingPhase() & GraphicsLayerPaintMask) { | 893 if (paintingPhase() & GraphicsLayerPaintMask) { |
894 writeIndent(ts, indent + 2); | 894 writeIndent(ts, indent + 2); |
895 ts << "GraphicsLayerPaintMask\n"; | 895 ts << "GraphicsLayerPaintMask\n"; |
896 } | 896 } |
897 if (paintingPhase() & GraphicsLayerPaintOverflowContents) { | 897 if (paintingPhase() & GraphicsLayerPaintOverflowContents) { |
898 writeIndent(ts, indent + 2); | 898 writeIndent(ts, indent + 2); |
899 ts << "GraphicsLayerPaintOverflowContents\n"; | 899 ts << "GraphicsLayerPaintOverflowContents\n"; |
900 } | 900 } |
901 if (paintingPhase() & GraphicsLayerPaintCompositedScroll) { | 901 if (paintingPhase() & GraphicsLayerPaintCompositedScroll) { |
902 writeIndent(ts, indent + 2); | 902 writeIndent(ts, indent + 2); |
903 ts << "GraphicsLayerPaintCompositedScroll\n"; | 903 ts << "GraphicsLayerPaintCompositedScroll\n"; |
904 } | 904 } |
905 writeIndent(ts, indent + 1); | 905 writeIndent(ts, indent + 1); |
906 ts << ")\n"; | 906 ts << ")\n"; |
907 } | 907 } |
908 | 908 |
909 dumpAdditionalProperties(ts, indent, behavior); | 909 dumpAdditionalProperties(ts, indent, flags); |
910 | 910 |
911 if (m_children.size()) { | 911 if (m_children.size()) { |
912 writeIndent(ts, indent + 1); | 912 writeIndent(ts, indent + 1); |
913 ts << "(children " << m_children.size() << "\n"; | 913 ts << "(children " << m_children.size() << "\n"; |
914 | 914 |
915 unsigned i; | 915 unsigned i; |
916 for (i = 0; i < m_children.size(); i++) | 916 for (i = 0; i < m_children.size(); i++) |
917 m_children[i]->dumpLayer(ts, indent + 2, behavior); | 917 m_children[i]->dumpLayer(ts, indent + 2, flags); |
918 writeIndent(ts, indent + 1); | 918 writeIndent(ts, indent + 1); |
919 ts << ")\n"; | 919 ts << ")\n"; |
920 } | 920 } |
921 } | 921 } |
922 | 922 |
923 String GraphicsLayer::layerTreeAsText(LayerTreeAsTextBehavior behavior) const | 923 String GraphicsLayer::layerTreeAsText(LayerTreeFlags flags) const |
924 { | 924 { |
925 TextStream ts; | 925 TextStream ts; |
926 | 926 |
927 dumpLayer(ts, 0, behavior); | 927 dumpLayer(ts, 0, flags); |
928 return ts.release(); | 928 return ts.release(); |
929 } | 929 } |
930 | 930 |
931 void GraphicsLayer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 931 void GraphicsLayer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
932 { | 932 { |
933 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Layers); | 933 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Layers); |
934 info.addMember(m_children, "children"); | 934 info.addMember(m_children, "children"); |
935 info.addMember(m_parent, "parent"); | 935 info.addMember(m_parent, "parent"); |
936 info.addMember(m_maskLayer, "maskLayer"); | 936 info.addMember(m_maskLayer, "maskLayer"); |
937 info.addMember(m_replicaLayer, "replicaLayer"); | 937 info.addMember(m_replicaLayer, "replicaLayer"); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 } | 1361 } |
1362 | 1362 |
1363 } // namespace WebCore | 1363 } // namespace WebCore |
1364 | 1364 |
1365 #ifndef NDEBUG | 1365 #ifndef NDEBUG |
1366 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 1366 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |
1367 { | 1367 { |
1368 if (!layer) | 1368 if (!layer) |
1369 return; | 1369 return; |
1370 | 1370 |
1371 String output = layer->layerTreeAsText(LayerTreeAsTextDebug | LayerTreeAsTex
tIncludeVisibleRects); | 1371 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |
1372 fprintf(stderr, "%s\n", output.utf8().data()); | 1372 fprintf(stderr, "%s\n", output.utf8().data()); |
1373 } | 1373 } |
1374 #endif | 1374 #endif |
OLD | NEW |