summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderTreeAsText.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/RenderTreeAsText.cpp')
-rw-r--r--WebCore/rendering/RenderTreeAsText.cpp79
1 files changed, 58 insertions, 21 deletions
diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp
index a6f5144..ca4d9d1 100644
--- a/WebCore/rendering/RenderTreeAsText.cpp
+++ b/WebCore/rendering/RenderTreeAsText.cpp
@@ -45,6 +45,7 @@
#include "RenderWidget.h"
#include "SelectionController.h"
#include "TextStream.h"
+#include <wtf/UnusedParam.h>
#include <wtf/Vector.h>
#if ENABLE(SVG)
@@ -57,6 +58,10 @@
#include "SVGRenderTreeAsText.h"
#endif
+#if USE(ACCELERATED_COMPOSITING)
+#include "RenderLayerBacking.h"
+#endif
+
#if PLATFORM(QT)
#include <QWidget>
#endif
@@ -65,7 +70,7 @@ namespace WebCore {
using namespace HTMLNames;
-static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const IntRect& paintDirtyRect, int indent = 0);
+static void writeLayers(TextStream&, const RenderLayer* rootLayer, RenderLayer*, const IntRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal);
#if !ENABLE(SVG)
static TextStream &operator<<(TextStream& ts, const IntRect& r)
@@ -444,9 +449,15 @@ void write(TextStream& ts, const RenderObject& o, int indent)
}
}
+enum LayerPaintPhase {
+ LayerPaintPhaseAll = 0,
+ LayerPaintPhaseBackground = -1,
+ LayerPaintPhaseForeground = 1
+};
+
static void write(TextStream& ts, RenderLayer& l,
const IntRect& layerBounds, const IntRect& backgroundClipRect, const IntRect& clipRect, const IntRect& outlineClipRect,
- int layerType = 0, int indent = 0)
+ LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
{
writeIndent(ts, indent);
@@ -472,19 +483,28 @@ static void write(TextStream& ts, RenderLayer& l,
ts << " scrollHeight " << l.scrollHeight();
}
- if (layerType == -1)
+ if (paintPhase == LayerPaintPhaseBackground)
ts << " layerType: background only";
- else if (layerType == 1)
+ else if (paintPhase == LayerPaintPhaseForeground)
ts << " layerType: foreground only";
-
+
+#if USE(ACCELERATED_COMPOSITING)
+ if (behavior & RenderAsTextShowCompositedLayers) {
+ if (l.isComposited())
+ ts << " (composited, bounds " << l.backing()->compositedBounds() << ")";
+ }
+#else
+ UNUSED_PARAM(behavior);
+#endif
+
ts << "\n";
- if (layerType != -1)
+ if (paintPhase != LayerPaintPhaseBackground)
write(ts, *l.renderer(), indent + 1);
}
static void writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* l,
- const IntRect& paintDirtyRect, int indent)
+ const IntRect& paintDirtyRect, int indent, RenderAsTextBehavior behavior)
{
// Calculate the clip rects we should use.
IntRect layerBounds, damageRect, clipRectToApply, outlineRect;
@@ -494,29 +514,46 @@ static void writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLaye
l->updateZOrderLists();
l->updateNormalFlowList();
- bool shouldPaint = l->intersectsDamageRect(layerBounds, damageRect, rootLayer);
+ bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : l->intersectsDamageRect(layerBounds, damageRect, rootLayer);
Vector<RenderLayer*>* negList = l->negZOrderList();
- if (shouldPaint && negList && negList->size() > 0)
- write(ts, *l, layerBounds, damageRect, clipRectToApply, outlineRect, -1, indent);
+ bool paintsBackgroundSeparately = negList && negList->size() > 0;
+ if (shouldPaint && paintsBackgroundSeparately)
+ write(ts, *l, layerBounds, damageRect, clipRectToApply, outlineRect, LayerPaintPhaseBackground, indent, behavior);
if (negList) {
+ int currIndent = indent;
+ if (behavior & RenderAsTextShowLayerNesting) {
+ writeIndent(ts, indent);
+ ts << " negative z-order list(" << negList->size() << ")\n";
+ ++currIndent;
+ }
for (unsigned i = 0; i != negList->size(); ++i)
- writeLayers(ts, rootLayer, negList->at(i), paintDirtyRect, indent);
+ writeLayers(ts, rootLayer, negList->at(i), paintDirtyRect, currIndent, behavior);
}
if (shouldPaint)
- write(ts, *l, layerBounds, damageRect, clipRectToApply, outlineRect, negList && negList->size() > 0, indent);
-
- Vector<RenderLayer*>* normalFlowList = l->normalFlowList();
- if (normalFlowList) {
+ write(ts, *l, layerBounds, damageRect, clipRectToApply, outlineRect, paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
+
+ if (Vector<RenderLayer*>* normalFlowList = l->normalFlowList()) {
+ int currIndent = indent;
+ if (behavior & RenderAsTextShowLayerNesting) {
+ writeIndent(ts, indent);
+ ts << " normal flow list(" << normalFlowList->size() << ")\n";
+ ++currIndent;
+ }
for (unsigned i = 0; i != normalFlowList->size(); ++i)
- writeLayers(ts, rootLayer, normalFlowList->at(i), paintDirtyRect, indent);
+ writeLayers(ts, rootLayer, normalFlowList->at(i), paintDirtyRect, currIndent, behavior);
}
- Vector<RenderLayer*>* posList = l->posZOrderList();
- if (posList) {
+ if (Vector<RenderLayer*>* posList = l->posZOrderList()) {
+ int currIndent = indent;
+ if (behavior & RenderAsTextShowLayerNesting) {
+ writeIndent(ts, indent);
+ ts << " positive z-order list(" << posList->size() << ")\n";
+ ++currIndent;
+ }
for (unsigned i = 0; i != posList->size(); ++i)
- writeLayers(ts, rootLayer, posList->at(i), paintDirtyRect, indent);
+ writeLayers(ts, rootLayer, posList->at(i), paintDirtyRect, currIndent, behavior);
}
}
@@ -562,7 +599,7 @@ static void writeSelection(TextStream& ts, const RenderObject* o)
<< "selection end: position " << selection.end().deprecatedEditingOffset() << " of " << nodePosition(selection.end().node()) << "\n";
}
-String externalRepresentation(Frame* frame)
+String externalRepresentation(Frame* frame, RenderAsTextBehavior behavior)
{
frame->document()->updateLayout();
@@ -576,7 +613,7 @@ String externalRepresentation(Frame* frame)
#endif
if (o->hasLayer()) {
RenderLayer* l = toRenderBox(o)->layer();
- writeLayers(ts, l, l, IntRect(l->x(), l->y(), l->width(), l->height()));
+ writeLayers(ts, l, l, IntRect(l->x(), l->y(), l->width(), l->height()), 0, behavior);
writeSelection(ts, o);
}
return ts.release();