[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

simon.fraser at apple.com simon.fraser at apple.com
Thu Feb 4 21:28:30 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 177ee68c48c966954029a900502995471fe5fa12
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 27 01:08:04 2010 +0000

    2010-01-26  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Adele Peterson.
    
            Enhance externalRepresentation() to make it more useful for layer debugging
            https://bugs.webkit.org/show_bug.cgi?id=34143
    
            Enhance externalRepresentation() to output additional information about layers when certain flags are passed.
            The new flags allow you to show all layers (not just those that would paint), to the structure of the z-order
            and normal flow lists, and to show which layers are composited.
    
            * WebCore.base.exp: The signature of externalRepresentation() changed.
    
            * platform/text/TextStream.h: Add operator<<(void*)
            * platform/text/TextStream.cpp: Implement operator<<(void*)
    
            * rendering/RenderLayer.h:
            * rendering/RenderLayer.cpp:
            (showLayerTree): New method outside the WebCore namespace, for ease of calling from gdb.
    
            * rendering/RenderTreeAsText.h: New behavior flags for externalRepresentation().
            * rendering/RenderTreeAsText.cpp:
            (WebCore::write): Output compositing information if requested. Also clean up some -1/1 magic
            numbers with an enum.
            (WebCore::writeLayers): If requested, show layer nesting via the z-order and normal flow lists.
            (WebCore::externalRepresentation): New arguments
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53874 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bc996c0..41a9f9c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-01-26  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Adele Peterson.
+
+        Enhance externalRepresentation() to make it more useful for layer debugging
+        https://bugs.webkit.org/show_bug.cgi?id=34143
+
+        Enhance externalRepresentation() to output additional information about layers when certain flags are passed.
+        The new flags allow you to show all layers (not just those that would paint), to the structure of the z-order
+        and normal flow lists, and to show which layers are composited.
+
+        * WebCore.base.exp: The signature of externalRepresentation() changed.
+
+        * platform/text/TextStream.h: Add operator<<(void*)
+        * platform/text/TextStream.cpp: Implement operator<<(void*)
+
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayer.cpp:
+        (showLayerTree): New method outside the WebCore namespace, for ease of calling from gdb.
+
+        * rendering/RenderTreeAsText.h: New behavior flags for externalRepresentation().
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::write): Output compositing information if requested. Also clean up some -1/1 magic
+        numbers with an enum.
+        (WebCore::writeLayers): If requested, show layer nesting via the z-order and normal flow lists.
+        (WebCore::externalRepresentation): New arguments
+
 2010-01-26  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index e234868..8eabfae 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -436,7 +436,7 @@ __ZN7WebCore22ScriptExecutionContext26canSuspendActiveDOMObjectsEv
 __ZN7WebCore22applicationIsAppleMailEv
 __ZN7WebCore22counterValueForElementEPNS_7ElementE
 __ZN7WebCore22createFragmentFromTextEPNS_5RangeERKNS_6StringE
-__ZN7WebCore22externalRepresentationEPNS_5FrameE
+__ZN7WebCore22externalRepresentationEPNS_5FrameEj
 __ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
 __ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE
 __ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE
diff --git a/WebCore/platform/text/TextStream.cpp b/WebCore/platform/text/TextStream.cpp
index 57c1328..baaa8b9 100644
--- a/WebCore/platform/text/TextStream.cpp
+++ b/WebCore/platform/text/TextStream.cpp
@@ -90,6 +90,13 @@ TextStream& TextStream::operator<<(const char* string)
     return *this;
 }
 
+TextStream& TextStream::operator<<(void* p)
+{
+    char buffer[printBufferSize];
+    snprintf(buffer, sizeof(buffer) - 1, "%p", p);
+    return *this << buffer;
+}
+
 TextStream& TextStream::operator<<(const String& string)
 {
     append(m_text, string);
diff --git a/WebCore/platform/text/TextStream.h b/WebCore/platform/text/TextStream.h
index b6bcea8..dfaa048 100644
--- a/WebCore/platform/text/TextStream.h
+++ b/WebCore/platform/text/TextStream.h
@@ -43,6 +43,7 @@ public:
     TextStream& operator<<(float);
     TextStream& operator<<(double);
     TextStream& operator<<(const char*);
+    TextStream& operator<<(void*);
     TextStream& operator<<(const String&);
 #if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC)
     TextStream& operator<<(unsigned __int64);
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index cab19d0..baf0f52 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -73,11 +73,13 @@
 #include "RenderScrollbar.h"
 #include "RenderScrollbarPart.h"
 #include "RenderTheme.h"
+#include "RenderTreeAsText.h"
 #include "RenderView.h"
 #include "ScaleTransformOperation.h"
 #include "Scrollbar.h"
 #include "ScrollbarTheme.h"
 #include "SelectionController.h"
+#include "TextStream.h"
 #include "TransformationMatrix.h"
 #include "TransformState.h"
 #include "TranslateTransformOperation.h"
@@ -3498,3 +3500,16 @@ void RenderLayer::updateReflectionStyle()
 }
 
 } // namespace WebCore
+
+#ifndef NDEBUG
+void showLayerTree(const WebCore::RenderLayer* layer)
+{
+    if (!layer)
+        return;
+
+    if (WebCore::Frame* frame = layer->renderer()->document()->frame()) {
+        WebCore::String output = externalRepresentation(frame, WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers);
+        fprintf(stderr, "%s\n", output.utf8().data());
+    }
+}
+#endif
diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h
index 92f6927..3cdad3a 100644
--- a/WebCore/rendering/RenderLayer.h
+++ b/WebCore/rendering/RenderLayer.h
@@ -664,4 +664,9 @@ private:
 
 } // namespace WebCore
 
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showLayerTree(const WebCore::RenderLayer* layer);
+#endif
+
 #endif // RenderLayer_h
diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp
index a6f5144..ad6b1d3 100644
--- a/WebCore/rendering/RenderTreeAsText.cpp
+++ b/WebCore/rendering/RenderTreeAsText.cpp
@@ -57,6 +57,10 @@
 #include "SVGRenderTreeAsText.h"
 #endif
 
+#if USE(ACCELERATED_COMPOSITING)
+#include "RenderLayerBacking.h"
+#endif
+
 #if PLATFORM(QT)
 #include <QWidget>
 #endif
@@ -65,7 +69,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 +448,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 +482,26 @@ 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() << ")";
+    }
+#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 +511,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 +596,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 +610,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();
diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h
index b00f7c9..13525e7 100644
--- a/WebCore/rendering/RenderTreeAsText.h
+++ b/WebCore/rendering/RenderTreeAsText.h
@@ -34,7 +34,15 @@ class RenderObject;
 class String;
 class TextStream;
 
-String externalRepresentation(Frame*);
+enum RenderAsTextBehaviorFlags {
+    RenderAsTextBehaviorNormal = 0,
+    RenderAsTextShowAllLayers = 1 << 0, // Dump all layers, not just those that would paint.
+    RenderAsTextShowLayerNesting = 1 << 1, // Annotate the layer lists.
+    RenderAsTextShowCompositedLayers = 1 << 2 // Show which layers are composited.
+};
+typedef unsigned RenderAsTextBehavior;
+
+String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
 void write(TextStream&, const RenderObject&, int indent = 0);
 
 // Helper function shared with SVGRenderTreeAsText

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list