2011-03-21 Daniel Sievers <sievers@google.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Mar 2011 20:01:57 +0000 (20:01 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Mar 2011 20:01:57 +0000 (20:01 +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-21  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-21  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@81603 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 d4a92a3..f2cdd6f 100644 (file)
@@ -1,3 +1,19 @@
+2011-03-21  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-21  Chang Shu  <cshu@webkit.org>
 
         Reviewed by Alexey Proskuryakov.
index 983dea5..3e68b54 100644 (file)
@@ -1182,7 +1182,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 c036755..04415f9 100644 (file)
@@ -891,7 +891,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();
@@ -901,7 +901,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 7383891..71e55d9 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 da5ec73..0088d2c 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-21  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-21  Eric Uhrhane <ericu@chromium.org>
 
         Reviewed by David Levin.
index bbb3c59..571d958 100644 (file)
@@ -545,7 +545,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.
@@ -578,7 +578,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 0301114..688e677 100644 (file)
@@ -1737,9 +1737,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
@@ -1809,11 +1818,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 f181904..19eb6d3 100644 (file)
@@ -186,7 +186,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,
@@ -198,7 +198,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 98f9078..941869f 100644 (file)
@@ -1,3 +1,23 @@
+2011-03-21  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-21  Adam Roben  <aroben@apple.com>
 
         Try again to get buildbot to show run-javascriptcore-tests's actual.html as an HTML file
index fa7e91d..95fcd58 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";
@@ -150,7 +151,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 f0f1028..96ea31c 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)
 {
 
@@ -1601,7 +1602,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 25a9638..f92d995 100644 (file)
@@ -384,6 +384,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; }
@@ -557,6 +558,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 1a4eb39..05998cc 100644 (file)
@@ -190,6 +190,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);
@@ -456,7 +459,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 ecf19e5..d84d642 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) {}
 };