diff options
Diffstat (limited to 'WebCore/platform/graphics/GraphicsLayer.cpp')
-rw-r--r-- | WebCore/platform/graphics/GraphicsLayer.cpp | 74 |
1 files changed, 56 insertions, 18 deletions
diff --git a/WebCore/platform/graphics/GraphicsLayer.cpp b/WebCore/platform/graphics/GraphicsLayer.cpp index 2336d0b..b7567bf 100644 --- a/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/WebCore/platform/graphics/GraphicsLayer.cpp @@ -32,6 +32,11 @@ #include "FloatPoint.h" #include "RotateTransformOperation.h" #include "TextStream.h" +#include <wtf/text/CString.h> + +#ifndef NDEBUG +#include <stdio.h> +#endif namespace WebCore { @@ -388,17 +393,23 @@ static void writeIndent(TextStream& ts, int indent) ts << " "; } -void GraphicsLayer::dumpLayer(TextStream& ts, int indent) const +void GraphicsLayer::dumpLayer(TextStream& ts, int indent, LayerTreeAsTextBehavior behavior) const { writeIndent(ts, indent); - ts << "(" << "GraphicsLayer" << " " << static_cast<void*>(const_cast<GraphicsLayer*>(this)); - ts << " \"" << m_name << "\"\n"; - dumpProperties(ts, indent); + ts << "(" << "GraphicsLayer"; + + if (behavior & LayerTreeAsTextDebug) { + ts << " " << static_cast<void*>(const_cast<GraphicsLayer*>(this)); + ts << " \"" << m_name << "\""; + } + + ts << "\n"; + dumpProperties(ts, indent, behavior); writeIndent(ts, indent); ts << ")\n"; } -void GraphicsLayer::dumpProperties(TextStream& ts, int indent) const +void GraphicsLayer::dumpProperties(TextStream& ts, int indent, LayerTreeAsTextBehavior behavior) const { writeIndent(ts, indent + 1); ts << "(position " << m_position.x() << " " << m_position.y() << ")\n"; @@ -416,21 +427,23 @@ void GraphicsLayer::dumpProperties(TextStream& ts, int indent) const ts << "(usingTiledLayer " << m_usingTiledLayer << ")\n"; writeIndent(ts, indent + 1); - ts << "(m_preserves3D " << m_preserves3D << ")\n"; + ts << "(preserves3D " << m_preserves3D << ")\n"; writeIndent(ts, indent + 1); ts << "(drawsContent " << m_drawsContent << ")\n"; writeIndent(ts, indent + 1); - ts << "(m_backfaceVisibility " << (m_backfaceVisibility ? "visible" : "hidden") << ")\n"; + ts << "(backfaceVisibility " << (m_backfaceVisibility ? "visible" : "hidden") << ")\n"; - writeIndent(ts, indent + 1); - ts << "(client "; - if (m_client) - ts << static_cast<void*>(m_client); - else - ts << "none"; - ts << ")\n"; + if (behavior & LayerTreeAsTextDebug) { + writeIndent(ts, indent + 1); + ts << "("; + if (m_client) + ts << "client " << static_cast<void*>(m_client); + else + ts << "no client"; + ts << ")\n"; + } writeIndent(ts, indent + 1); ts << "(backgroundColor "; @@ -466,13 +479,19 @@ void GraphicsLayer::dumpProperties(TextStream& ts, int indent) const if (m_replicaLayer) { writeIndent(ts, indent + 1); - ts << "(replica layer " << m_replicaLayer << ")\n"; - m_replicaLayer->dumpLayer(ts, indent+2); + ts << "(replica layer"; + if (behavior & LayerTreeAsTextDebug) + ts << " " << m_replicaLayer; + ts << ")\n"; + m_replicaLayer->dumpLayer(ts, indent + 2, behavior); } if (m_replicatedLayer) { writeIndent(ts, indent + 1); - ts << "(replicated layer " << m_replicatedLayer << ")\n"; + ts << "(replicated layer"; + if (behavior & LayerTreeAsTextDebug) + ts << " " << m_replicatedLayer;; + ts << ")\n"; } if (m_children.size()) { @@ -481,12 +500,31 @@ void GraphicsLayer::dumpProperties(TextStream& ts, int indent) const unsigned i; for (i = 0; i < m_children.size(); i++) - m_children[i]->dumpLayer(ts, indent+2); + m_children[i]->dumpLayer(ts, indent + 2, behavior); writeIndent(ts, indent + 1); ts << ")\n"; } } +String GraphicsLayer::layerTreeAsText(LayerTreeAsTextBehavior behavior) const +{ + TextStream ts; + + dumpLayer(ts, 0, behavior); + return ts.release(); +} + } // namespace WebCore +#ifndef NDEBUG +void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) +{ + if (!layer) + return; + + WebCore::String output = layer->layerTreeAsText(LayerTreeAsTextDebug); + fprintf(stderr, "%s\n", output.utf8().data()); +} +#endif + #endif // USE(ACCELERATED_COMPOSITING) |