2011-03-14 Daniel Sievers <sievers@google.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 01:56:37 +0000 (01:56 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 01:56:37 +0000 (01:56 +0000)
        Reviewed by Simon Fraser.

        [Chromium] Make RenderAsTextBehavior and LayerTreeAsTextBehavior tweakable from the DumpRenderTree commandline
        https://bugs.webkit.org/show_bug.cgi?id=56139

        * WebCore.exp.in:
        * WebCore.order:
        * page/Frame.cpp:
        (WebCore::Frame::layerTreeAsText):
        * page/Frame.h:
        * rendering/RenderLayerCompositor.cpp:
        (WebCore::RenderLayerCompositor::layerTreeAsText):
        * rendering/RenderLayerCompositor.h:
2011-03-14  Daniel Sievers  <sievers@google.com>

        Reviewed by Simon Fraser.

        [Chromium] Make RenderAsTextBehavior and LayerTreeAsTextBehavior tweakable from the DumpRenderTree commandline
        https://bugs.webkit.org/show_bug.cgi?id=56139

        * public/WebFrame.h:
        * src/WebFrameImpl.cpp:
        (WebKit::WebFrameImpl::renderTreeAsText):
        (WebKit::WebFrameImpl::layerTreeAsText):
        * src/WebFrameImpl.h:
2011-03-14  Daniel Sievers  <sievers@google.com>

        Reviewed by Simon Fraser.

        [Chromium] Make RenderAsTextBehavior and LayerTreeAsTextBehavior tweakable from the DumpRenderTree commandline
        https://bugs.webkit.org/show_bug.cgi?id=56139

        * DumpRenderTree/chromium/DumpRenderTree.cpp:
        (main):
        * DumpRenderTree/chromium/LayoutTestController.cpp:
        (LayoutTestController::LayoutTestController):
        (LayoutTestController::layerTreeAsText):
        * DumpRenderTree/chromium/LayoutTestController.h:
        (LayoutTestController::setShowDebugLayerTree):
        * DumpRenderTree/chromium/TestShell.cpp:
        (TestShell::runFileTest):
        (TestShell::dump):
        * DumpRenderTree/chromium/TestShell.h:
        (TestParams::TestParams):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81094 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.order
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebFrame.h
Source/WebKit/chromium/src/WebFrameImpl.cpp
Source/WebKit/chromium/src/WebFrameImpl.h
Tools/ChangeLog
Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
Tools/DumpRenderTree/chromium/LayoutTestController.cpp
Tools/DumpRenderTree/chromium/LayoutTestController.h
Tools/DumpRenderTree/chromium/TestShell.cpp
Tools/DumpRenderTree/chromium/TestShell.h

index 34abc50..5667fc8 100644 (file)
@@ -1,3 +1,19 @@
+2011-03-14  Daniel Sievers  <sievers@google.com>
+
+        Reviewed by Simon Fraser.
+
+        [Chromium] Make RenderAsTextBehavior and LayerTreeAsTextBehavior tweakable from the DumpRenderTree commandline
+        https://bugs.webkit.org/show_bug.cgi?id=56139
+
+        * WebCore.exp.in:
+        * WebCore.order:
+        * page/Frame.cpp:
+        (WebCore::Frame::layerTreeAsText):
+        * page/Frame.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::layerTreeAsText):
+        * rendering/RenderLayerCompositor.h:
+
 2011-03-14  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Dimitri Glazkov.
index d13cf52..c35228f 100644 (file)
@@ -1179,7 +1179,7 @@ __ZNK7WebCore5Color7getRGBAERdS1_S1_S1_
 __ZNK7WebCore5Frame13ownerRendererEv
 __ZNK7WebCore5Frame14selectionImageEb
 __ZNK7WebCore5Frame15contentRendererEv
-__ZNK7WebCore5Frame15layerTreeAsTextEv
+__ZNK7WebCore5Frame15layerTreeAsTextEb
 __ZNK7WebCore5Frame18documentTypeStringEv
 __ZNK7WebCore5Frame8settingsEv
 __ZNK7WebCore5Frame9domWindowEv
index 65c7d84..af1a2ab 100644 (file)
@@ -16003,7 +16003,7 @@ __ZNK7WebCore16PDFDocumentImage4sizeEv
 __ZN7WebCore5Image26nativeImageForCurrentFrameEv
 __ZN7WebCore5Image14resetAnimationEv
 __ZN7WebCore11RenderLayer29updateRepaintRectsAfterScrollEb
-__ZNK7WebCore5Frame15layerTreeAsTextEv
+__ZNK7WebCore5Frame15layerTreeAsTextEb
 __ZNK7WebCore13GraphicsLayer15layerTreeAsTextEj
 __ZNK7WebCore13GraphicsLayer9dumpLayerERNS_10TextStreamEij
 __ZN7WebCoreL11writeIndentERNS_10TextStreamEi
index 3e4bb2e..191ce29 100644 (file)
@@ -906,7 +906,7 @@ Color Frame::tiledBackingStoreBackgroundColor() const
 }
 #endif
 
-String Frame::layerTreeAsText() const
+String Frame::layerTreeAsText(bool showDebugInfo) const
 {
 #if USE(ACCELERATED_COMPOSITING)
     document()->updateLayout();
@@ -914,7 +914,7 @@ String Frame::layerTreeAsText() const
     if (!contentRenderer())
         return String();
 
-    return contentRenderer()->compositor()->layerTreeAsText();
+    return contentRenderer()->compositor()->layerTreeAsText(showDebugInfo);
 #else
     return String();
 #endif
index 25f8aac..f22fcb8 100644 (file)
@@ -127,7 +127,7 @@ namespace WebCore {
 
         void injectUserScripts(UserScriptInjectionTime);
         
-        String layerTreeAsText() const;
+        String layerTreeAsText(bool showDebugInfo = false) const;
 
         // Unlike most accessors in this class, domWindow() always creates a new DOMWindow if m_domWindow is null.
         // Callers that don't need a new DOMWindow to be created should use existingDOMWindow().
index 37f1b9e..d5878f4 100644 (file)
@@ -880,7 +880,7 @@ void RenderLayerCompositor::frameViewDidScroll(const IntPoint& scrollPosition)
         m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
 }
 
-String RenderLayerCompositor::layerTreeAsText()
+String RenderLayerCompositor::layerTreeAsText(bool showDebugInfo)
 {
     if (compositingLayerUpdatePending())
         updateCompositingLayers();
@@ -890,7 +890,7 @@ String RenderLayerCompositor::layerTreeAsText()
 
     // We skip dumping the scroll and clip layers to keep layerTreeAsText output
     // similar between platforms.
-    return m_rootPlatformLayer->layerTreeAsText();
+    return m_rootPlatformLayer->layerTreeAsText(showDebugInfo ? LayerTreeAsTextDebug : LayerTreeAsTextBehaviorNormal);
 }
 
 RenderLayerCompositor* RenderLayerCompositor::iframeContentsCompositor(RenderIFrame* renderer)
index 32d64d3..a5011ef 100644 (file)
@@ -175,7 +175,7 @@ public:
     void frameViewDidChangeSize(const IntPoint& contentsOffset = IntPoint());
     void frameViewDidScroll(const IntPoint& = IntPoint());
 
-    String layerTreeAsText();
+    String layerTreeAsText(bool showDebugInfo = false);
 
     // These are named to avoid conflicts with the functions in GraphicsLayerClient
     // These return the actual internal variables.
index 2fa7b4c..fe30ae3 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-14  Daniel Sievers  <sievers@google.com>
+
+        Reviewed by Simon Fraser.
+
+        [Chromium] Make RenderAsTextBehavior and LayerTreeAsTextBehavior tweakable from the DumpRenderTree commandline
+        https://bugs.webkit.org/show_bug.cgi?id=56139
+
+        * public/WebFrame.h:
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::renderTreeAsText):
+        (WebKit::WebFrameImpl::layerTreeAsText):
+        * src/WebFrameImpl.h:
+
 2011-03-14  John Knottenbelt  <jknotten@chromium.org>
 
         Reviewed by Steve Block.
index f3f5ba6..db90c54 100644 (file)
@@ -549,7 +549,7 @@ public:
 
     // Returns a text representation of the render tree.  This method is used
     // to support layout tests.
-    virtual WebString renderTreeAsText() const = 0;
+    virtual WebString renderTreeAsText(bool showDebugInfo = false) const = 0;
 
     // Returns the counter value for the specified element.  This method is
     // used to support layout tests.
@@ -582,7 +582,7 @@ public:
 
     // Dumps the layer tree, used by the accelerated compositor, in
     // text form. This is used only by layout tests.
-    virtual WebString layerTreeAsText() const = 0;
+    virtual WebString layerTreeAsText(bool showDebugInfo = false) const = 0;
 
 protected:
     ~WebFrame() { }
index 53e1d44..ed93d38 100644 (file)
@@ -1742,9 +1742,18 @@ WebString WebFrameImpl::contentAsMarkup() const
     return createFullMarkup(m_frame->document());
 }
 
-WebString WebFrameImpl::renderTreeAsText() const
+WebString WebFrameImpl::renderTreeAsText(bool showDebugInfo) const
 {
-    return externalRepresentation(m_frame);
+    RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal;
+
+    if (showDebugInfo) {
+        behavior |= RenderAsTextShowCompositedLayers
+            | RenderAsTextShowAddresses
+            | RenderAsTextShowIDAndClass
+            | RenderAsTextShowLayerNesting;
+    }
+
+    return externalRepresentation(m_frame, behavior);
 }
 
 WebString WebFrameImpl::counterValueForElementById(const WebString& id) const
@@ -1814,11 +1823,11 @@ bool WebFrameImpl::pauseSVGAnimation(const WebString& animationId, double time,
 #endif
 }
 
-WebString WebFrameImpl::layerTreeAsText() const
+WebString WebFrameImpl::layerTreeAsText(bool showDebugInfo) const
 {
     if (!m_frame)
         return WebString();
-    return WebString(m_frame->layerTreeAsText());
+    return WebString(m_frame->layerTreeAsText(showDebugInfo));
 }
 
 // WebFrameImpl public ---------------------------------------------------------
index 179051e..889c7bb 100644 (file)
@@ -187,7 +187,7 @@ public:
 
     virtual WebString contentAsText(size_t maxChars) const;
     virtual WebString contentAsMarkup() const;
-    virtual WebString renderTreeAsText() const;
+    virtual WebString renderTreeAsText(bool showDebugInfo = false) const;
     virtual WebString counterValueForElementById(const WebString& id) const;
     virtual WebString markerTextForListItem(const WebElement&) const;
     virtual int pageNumberForElementById(const WebString& id,
@@ -199,7 +199,7 @@ public:
     virtual bool pauseSVGAnimation(const WebString& animationId,
                                    double time,
                                    const WebString& elementId);
-    virtual WebString layerTreeAsText() const;
+    virtual WebString layerTreeAsText(bool showDebugInfo = false) const;
 
     static PassRefPtr<WebFrameImpl> create(WebFrameClient* client);
     ~WebFrameImpl();
index 366deea..3af4d80 100644 (file)
@@ -1,3 +1,23 @@
+2011-03-14  Daniel Sievers  <sievers@google.com>
+
+        Reviewed by Simon Fraser.
+
+        [Chromium] Make RenderAsTextBehavior and LayerTreeAsTextBehavior tweakable from the DumpRenderTree commandline
+        https://bugs.webkit.org/show_bug.cgi?id=56139
+
+        * DumpRenderTree/chromium/DumpRenderTree.cpp:
+        (main):
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController):
+        (LayoutTestController::layerTreeAsText):
+        * DumpRenderTree/chromium/LayoutTestController.h:
+        (LayoutTestController::setShowDebugLayerTree):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::runFileTest):
+        (TestShell::dump):
+        * DumpRenderTree/chromium/TestShell.h:
+        (TestParams::TestParams):
+
 2011-03-14  Balazs Kelemen  <kbalazs@webkit.org>
 
         Reviewed by Adam Roben.
index e008432..89c5407 100644 (file)
@@ -43,7 +43,8 @@ static const char optionDumpAllPixels[] = "--dump-all-pixels";
 static const char optionNotree[] = "--notree";
 static const char optionPixelTests[] = "--pixel-tests";
 static const char optionThreaded[] = "--threaded";
-static const char optionTree[] = "--tree";
+static const char optionDebugRenderTree[] = "--debug-render-tree";
+static const char optionDebugLayerTree[] = "--debug-layer-tree";
 
 static const char optionPixelTestsWithName[] = "--pixel-tests=";
 static const char optionTestShell[] = "--test-shell";
@@ -148,7 +149,11 @@ int main(int argc, char* argv[])
         else if (!argument.find(optionPixelTestsWithName)) {
             params.dumpPixels = true;
             params.pixelFileName = argument.substr(strlen(optionPixelTestsWithName));
-        } else if (argument == optionTestShell) {
+        } else if (argument == optionDebugRenderTree)
+            params.debugRenderTree = true;
+        else if (argument == optionDebugLayerTree)
+            params.debugLayerTree = true;
+        else if (argument == optionTestShell) {
             testShellMode = true;
             serverMode = true;
         } else if (argument == optionAllowExternalPages)
index 01c9407..9897c26 100644 (file)
@@ -73,6 +73,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
     : m_shell(shell)
     , m_closeRemainingWindows(false)
     , m_deferMainResourceDataLoad(false)
+    , m_showDebugLayerTree(false)
     , m_workQueue(this)
 {
 
@@ -1593,7 +1594,7 @@ void LayoutTestController::addMockSpeechInputResult(const CppArgumentList& argum
 
 void LayoutTestController::layerTreeAsText(const CppArgumentList& args, CppVariant* result)
 {
-    result->set(m_shell->webView()->mainFrame()->layerTreeAsText().utf8());
+    result->set(m_shell->webView()->mainFrame()->layerTreeAsText(m_showDebugLayerTree).utf8());
 }
 
 void LayoutTestController::markerTextForListItem(const CppArgumentList& args, CppVariant* result)
index 87ccc97..4a51787 100644 (file)
@@ -378,6 +378,7 @@ public:
     bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
     bool stopProvisionalFrameLoads() { return m_stopProvisionalFrameLoads; }
     bool deferMainResourceDataLoad() { return m_deferMainResourceDataLoad; }
+    void setShowDebugLayerTree(bool value) { m_showDebugLayerTree = value; }
 
     bool testRepaint() const { return m_testRepaint; }
     bool sweepHorizontally() const { return m_sweepHorizontally; }
@@ -551,6 +552,9 @@ private:
     // If false, all new requests will not defer the main resource data load.
     bool m_deferMainResourceDataLoad;
 
+    // If true, we will show extended information in the graphics layer tree.
+    bool m_showDebugLayerTree;
+
     WorkQueue m_workQueue;
 
     CppVariant m_globalFlag;
index e1a86ef..9124f9d 100644 (file)
@@ -188,6 +188,9 @@ void TestShell::runFileTest(const TestParams& params)
         || testUrl.find("\\inspector\\") != string::npos)
         showDevTools();
 
+    if (m_params.debugLayerTree)
+        m_layoutTestController->setShowDebugLayerTree(true);
+
     if (m_dumpWhenFinished)
         m_printer->handleTestHeader(testUrl.c_str());
     loadURL(m_params.testUrl);
@@ -454,7 +457,7 @@ void TestShell::dump()
             if (fwrite(dataUtf8.c_str(), 1, dataUtf8.size(), stdout) != dataUtf8.size())
                 FATAL("Short write to stdout, disk full?\n");
         } else {
-            printf("%s", frame->renderTreeAsText().utf8().data());
+            printf("%s", frame->renderTreeAsText(m_params.debugRenderTree).utf8().data());
             bool recursive = m_layoutTestController->shouldDumpChildFrameScrollPositions();
             dumpFrameScrollPosition(frame, recursive);
         }
index ef9be7f..398d715 100644 (file)
@@ -65,6 +65,8 @@ class DRTDevToolsClient;
 struct TestParams {
     bool dumpTree;
     bool dumpPixels;
+    bool debugRenderTree;
+    bool debugLayerTree;
     bool printSeparators;
     WebKit::WebURL testUrl;
     // Resultant image file name. Required only if the test_shell mode.
@@ -74,6 +76,8 @@ struct TestParams {
     TestParams()
         : dumpTree(true)
         , dumpPixels(false)
+        , debugRenderTree(false)
+        , debugLayerTree(false)
         , printSeparators(false) {}
 };