Bug 1298844 - Add PrintDisplayItemToStdout and PrintDisplayListToStdout helper functions for debugging. r=jrmuizel
authorMarkus Stange <mstange@themasta.com>
Mon, 22 Aug 2016 15:49:09 -0400
changeset 311658 8d88c281d140b6b9858ea3906464f0b293908c32
parent 311657 d150958ab3de1a9455065d1925913d27a3c2d559
child 311659 f18100fdf2aee6704a5183741d737bd376efdf13
push id30618
push userkwierso@gmail.com
push dateTue, 30 Aug 2016 00:41:06 +0000
treeherdermozilla-central@6c0d74730bd5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1298844
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1298844 - Add PrintDisplayItemToStdout and PrintDisplayListToStdout helper functions for debugging. r=jrmuizel MozReview-Commit-ID: 3Uv0H9z2aLk
layout/base/nsLayoutDebugger.cpp
--- a/layout/base/nsLayoutDebugger.cpp
+++ b/layout/base/nsLayoutDebugger.cpp
@@ -12,16 +12,17 @@
 
 #include "nsAttrValue.h"
 #include "nsFrame.h"
 #include "nsDisplayList.h"
 #include "FrameLayerBuilder.h"
 #include "nsPrintfCString.h"
 #include "DisplayItemScrollClip.h"
 
+#include <iostream>
 #include <stdio.h>
 
 using namespace mozilla;
 using namespace mozilla::layers;
 
 #ifdef DEBUG
 class nsLayoutDebugger : public nsILayoutDebugger {
 public:
@@ -243,16 +244,35 @@ void
 nsFrame::PrintDisplayList(nsDisplayListBuilder* aBuilder,
                           const nsDisplayList& aList,
                           std::stringstream& aStream,
                           bool aDumpHtml)
 {
   PrintDisplayListTo(aBuilder, aList, aStream, 0, aDumpHtml);
 }
 
+/**
+ * The two functions below are intended to be called from a debugger.
+ */
+void
+PrintDisplayItemToStdout(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem)
+{
+  std::stringstream stream;
+  PrintDisplayItemTo(aBuilder, aItem, stream, 0, true, false);
+  std::cout << stream.str() << std::endl;
+}
+
+void
+PrintDisplayListToStdout(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList)
+{
+  std::stringstream stream;
+  PrintDisplayListTo(aBuilder, aList, stream, 0, false);
+  std::cout << stream.str() << std::endl;
+}
+
 #ifdef MOZ_DUMP_PAINTING
 static void
 PrintDisplayListSetItem(nsDisplayListBuilder* aBuilder,
                         const char* aItemName,
                         const nsDisplayList& aList,
                         std::stringstream& aStream,
                         bool aDumpHtml)
 {