Title: [219216] trunk/Source/WebCore
Revision
219216
Author
za...@apple.com
Date
2017-07-06 14:13:24 -0700 (Thu, 06 Jul 2017)

Log Message

Use WTFLogAlways for debug logging so that it shows up in device system logs
https://bugs.webkit.org/show_bug.cgi?id=173450

Reviewed by Simon Fraser.

If you want to showRenderTree() on-device, the result doesn't show in system log so you can't see it.
Switch to WTFLogAlways to fix this, for showRenderTree and its dependencies.

* platform/text/TextStream.cpp:
(WebCore::writeIndent):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::showLineTreeAndMark):
(WebCore::InlineBox::showLineBox):
* rendering/InlineBox.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::showLineTreeAndMark):
* rendering/InlineFlowBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::showLineBox):
* rendering/InlineTextBox.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::showLineTreeAndMark):
* rendering/RenderBlockFlow.h:
* rendering/RenderObject.cpp:
(WebCore::showRenderTreeLegend):
(WebCore::RenderObject::showRenderTreeForThis):
(WebCore::RenderObject::showLineTreeForThis):
(WebCore::RenderObject::showRegionsInformation):
(WebCore::RenderObject::showRenderObject):
(WebCore::RenderObject::showRenderSubTreeAndMark):
* rendering/RenderObject.h:
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::printPrefix):
(WebCore::SimpleLineLayout::showLineLayoutForFlow):
* rendering/SimpleLineLayoutFunctions.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219215 => 219216)


--- trunk/Source/WebCore/ChangeLog	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/ChangeLog	2017-07-06 21:13:24 UTC (rev 219216)
@@ -1,3 +1,41 @@
+2017-07-06  Zalan Bujtas  <za...@apple.com>
+
+        Use WTFLogAlways for debug logging so that it shows up in device system logs
+        https://bugs.webkit.org/show_bug.cgi?id=173450
+
+        Reviewed by Simon Fraser.
+
+        If you want to showRenderTree() on-device, the result doesn't show in system log so you can't see it.
+        Switch to WTFLogAlways to fix this, for showRenderTree and its dependencies.
+        
+        * platform/text/TextStream.cpp:
+        (WebCore::writeIndent):
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::showLineTreeAndMark):
+        (WebCore::InlineBox::showLineBox):
+        * rendering/InlineBox.h:
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::showLineTreeAndMark):
+        * rendering/InlineFlowBox.h:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::showLineBox):
+        * rendering/InlineTextBox.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::showLineTreeAndMark):
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::showRenderTreeLegend):
+        (WebCore::RenderObject::showRenderTreeForThis):
+        (WebCore::RenderObject::showLineTreeForThis):
+        (WebCore::RenderObject::showRegionsInformation):
+        (WebCore::RenderObject::showRenderObject):
+        (WebCore::RenderObject::showRenderSubTreeAndMark):
+        * rendering/RenderObject.h:
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::printPrefix):
+        (WebCore::SimpleLineLayout::showLineLayoutForFlow):
+        * rendering/SimpleLineLayoutFunctions.h:
+
 2017-07-06  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Unify FontCascadeFonts::glyphDataForVariant() and FontCascadeFonts::glyphDataForNormalVariant()

Modified: trunk/Source/WebCore/platform/text/TextStream.cpp (219215 => 219216)


--- trunk/Source/WebCore/platform/text/TextStream.cpp	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/platform/text/TextStream.cpp	2017-07-06 21:13:24 UTC (rev 219216)
@@ -186,7 +186,7 @@
 
 void writeIndent(TextStream& ts, int indent)
 {
-    for (int i = 0; i != indent; ++i)
+    for (int i = 0; i < indent; ++i)
         ts << "  ";
 }
 

Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (219215 => 219216)


--- trunk/Source/WebCore/rendering/InlineBox.cpp	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp	2017-07-06 21:13:24 UTC (rev 219216)
@@ -27,6 +27,7 @@
 #include "RenderBlockFlow.h"
 #include "RenderLineBreak.h"
 #include "RootInlineBox.h"
+#include "TextStream.h"
 
 #if ENABLE(TREE_DEBUGGING)
 #include <stdio.h>
@@ -100,22 +101,23 @@
     m_renderer.containingBlock()->showLineTreeForThis();
 }
 
-void InlineBox::showLineTreeAndMark(const InlineBox* markedBox, int depth) const
+void InlineBox::outputLineTreeAndMark(TextStream& stream, const InlineBox* markedBox, int depth) const
 {
-    showLineBox(markedBox == this, depth);
+    outputLineBox(stream, markedBox == this, depth);
 }
 
-void InlineBox::showLineBox(bool mark, int depth) const
+void InlineBox::outputLineBox(TextStream& stream, bool mark, int depth) const
 {
-    fprintf(stderr, "-------- %c-", isDirty() ? 'D' : '-');
+    stream << "-------- " << (isDirty() ? "D" : "-") << "-";
     int printedCharacters = 0;
     if (mark) {
-        fprintf(stderr, "*");
+        stream << "*";
         ++printedCharacters;
     }
     while (++printedCharacters <= depth * 2)
-        fputc(' ', stderr);
-    fprintf(stderr, "%s  (%.2f, %.2f) (%.2f, %.2f) (%p) renderer->(%p)\n", boxName(), x(), y(), width(), height(), this, &renderer());
+        stream << " ";
+    stream << boxName() << " " << FloatRect(x(), y(), width(), height()) << " (" << this << ") renderer->(" << &renderer() << ")";
+    stream.nextLine();
 }
 
 #endif // ENABLE(TREE_DEBUGGING)

Modified: trunk/Source/WebCore/rendering/InlineBox.h (219215 => 219216)


--- trunk/Source/WebCore/rendering/InlineBox.h	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/InlineBox.h	2017-07-06 21:13:24 UTC (rev 219216)
@@ -76,8 +76,8 @@
     void showNodeTreeForThis() const;
     void showLineTreeForThis() const;
     
-    virtual void showLineTreeAndMark(const InlineBox* markedBox, int depth) const;
-    virtual void showLineBox(bool mark, int depth) const;
+    virtual void outputLineTreeAndMark(TextStream&, const InlineBox* markedBox, int depth) const;
+    virtual void outputLineBox(TextStream&, bool mark, int depth) const;
     virtual const char* boxName() const;
 #endif
 

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (219215 => 219216)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2017-07-06 21:13:24 UTC (rev 219216)
@@ -1735,11 +1735,11 @@
     return "InlineFlowBox";
 }
 
-void InlineFlowBox::showLineTreeAndMark(const InlineBox* markedBox, int depth) const
+void InlineFlowBox::outputLineTreeAndMark(TextStream& stream, const InlineBox* markedBox, int depth) const
 {
-    InlineBox::showLineTreeAndMark(markedBox, depth);
+    InlineBox::outputLineTreeAndMark(stream, markedBox, depth);
     for (const InlineBox* box = firstChild(); box; box = box->nextOnLine())
-        box->showLineTreeAndMark(markedBox, depth + 1);
+        box->outputLineTreeAndMark(stream, markedBox, depth + 1);
 }
 
 #endif

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (219215 => 219216)


--- trunk/Source/WebCore/rendering/InlineFlowBox.h	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h	2017-07-06 21:13:24 UTC (rev 219216)
@@ -71,7 +71,7 @@
 #endif
 
 #if ENABLE(TREE_DEBUGGING)
-    void showLineTreeAndMark(const InlineBox* markedBox, int depth) const override;
+    void outputLineTreeAndMark(TextStream&, const InlineBox* markedBox, int depth) const override;
     const char* boxName() const override;
 #endif
 

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (219215 => 219216)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2017-07-06 21:13:24 UTC (rev 219216)
@@ -48,6 +48,7 @@
 #include "TextDecorationPainter.h"
 #include "TextPaintStyle.h"
 #include "TextPainter.h"
+#include "TextStream.h"
 #include <stdio.h>
 #include <wtf/text/CString.h>
 
@@ -1123,23 +1124,24 @@
     return "InlineTextBox";
 }
 
-void InlineTextBox::showLineBox(bool mark, int depth) const
+void InlineTextBox::outputLineBox(TextStream& stream, bool mark, int depth) const
 {
-    fprintf(stderr, "-------- %c-", isDirty() ? 'D' : '-');
+    stream << "-------- " << (isDirty() ? "D" : "-") << "-";
 
     int printedCharacters = 0;
     if (mark) {
-        fprintf(stderr, "*");
+        stream << "*";
         ++printedCharacters;
     }
     while (++printedCharacters <= depth * 2)
-        fputc(' ', stderr);
+        stream << " ";
 
     String value = renderer().text();
     value = value.substring(start(), len());
     value.replaceWithLiteral('\\', "\\\\");
     value.replaceWithLiteral('\n', "\\n");
-    fprintf(stderr, "%s  (%.2f, %.2f) (%.2f, %.2f) (%p) renderer->(%p) run(%d, %d) \"%s\"\n", boxName(), x(), y(), width(), height(), this, &renderer(), start(), start() + len(), value.utf8().data());
+    stream << boxName() << " " << FloatRect(x(), y(), width(), height()) << " (" << this << ") renderer->(" << &renderer() << ") run(" << start() << ", " << start() + len() << ") \"" << value.utf8().data() << "\"";
+    stream.nextLine();
 }
 
 #endif

Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (219215 => 219216)


--- trunk/Source/WebCore/rendering/InlineTextBox.h	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h	2017-07-06 21:13:24 UTC (rev 219216)
@@ -97,7 +97,7 @@
     virtual void dirtyOwnLineBoxes() { dirtyLineBoxes(); }
 
 #if ENABLE(TREE_DEBUGGING)
-    void showLineBox(bool mark, int depth) const final;
+    void outputLineBox(TextStream&, bool mark, int depth) const final;
     const char* boxName() const final;
 #endif
 

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (219215 => 219216)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2017-07-06 21:13:24 UTC (rev 219216)
@@ -3769,13 +3769,13 @@
 }
 
 #if ENABLE(TREE_DEBUGGING)
-void RenderBlockFlow::showLineTreeAndMark(const InlineBox* markedBox, int depth) const
+void RenderBlockFlow::outputLineTreeAndMark(TextStream& stream, const InlineBox* markedBox, int depth) const
 {
     for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox())
-        root->showLineTreeAndMark(markedBox, depth);
+        root->outputLineTreeAndMark(stream, markedBox, depth);
 
     if (auto simpleLineLayout = this->simpleLineLayout())
-        SimpleLineLayout::showLineLayoutForFlow(*this, *simpleLineLayout, depth);
+        SimpleLineLayout::outputLineLayoutForFlow(stream, *this, *simpleLineLayout, depth);
 }
 #endif
 

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (219215 => 219216)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2017-07-06 21:13:24 UTC (rev 219216)
@@ -372,7 +372,7 @@
     void ensureLineBoxes();
 
 #if ENABLE(TREE_DEBUGGING)
-    void showLineTreeAndMark(const InlineBox* markedBox, int depth) const;
+    void outputLineTreeAndMark(TextStream&, const InlineBox* markedBox, int depth) const;
 #endif
 
     // Returns the logicalOffset at the top of the next page. If the offset passed in is already at the top of the current page,

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (219215 => 219216)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2017-07-06 21:13:24 UTC (rev 219216)
@@ -69,6 +69,7 @@
 #include "RenderWidget.h"
 #include "SVGRenderSupport.h"
 #include "StyleResolver.h"
+#include "TextStream.h"
 #include "TransformState.h"
 #include <algorithm>
 #include <stdio.h>
@@ -1007,9 +1008,11 @@
 
 #if ENABLE(TREE_DEBUGGING)
 
-static void showRenderTreeLegend()
+static void outputRenderTreeLegend(TextStream& stream)
 {
-    fprintf(stderr, "\n(B)lock/(I)nline/I(N)line-block, (A)bsolute/Fi(X)ed/(R)elative/Stic(K)y, (F)loating, (O)verflow clip, Anon(Y)mous, (G)enerated, has(L)ayer, (C)omposited, (+)Dirty style, (+)Dirty layout\n");
+    stream.nextLine();
+    stream << "(B)lock/(I)nline/I(N)line-block, (A)bsolute/Fi(X)ed/(R)elative/Stic(K)y, (F)loating, (O)verflow clip, Anon(Y)mous, (G)enerated, has(L)ayer, (C)omposited, (+)Dirty style, (+)Dirty layout";
+    stream.nextLine();
 }
 
 void RenderObject::showNodeTreeForThis() const
@@ -1024,8 +1027,10 @@
     const WebCore::RenderObject* root = this;
     while (root->parent())
         root = root->parent();
-    showRenderTreeLegend();
-    root->showRenderSubTreeAndMark(this, 1);
+    TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect);
+    outputRenderTreeLegend(stream);
+    root->outputRenderSubTreeAndMark(stream, this, 1);
+    WTFLogAlways("%s", stream.release().utf8().data());
 }
 
 void RenderObject::showLineTreeForThis() const
@@ -1032,9 +1037,11 @@
 {
     if (!is<RenderBlockFlow>(*this))
         return;
-    showRenderTreeLegend();
-    showRenderObject(false, 1);
-    downcast<RenderBlockFlow>(*this).showLineTreeAndMark(nullptr, 2);
+    TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect);
+    outputRenderTreeLegend(stream);
+    outputRenderObject(stream, false, 1);
+    downcast<RenderBlockFlow>(*this).outputLineTreeAndMark(stream, nullptr, 2);
+    WTFLogAlways("%s", stream.release().utf8().data());
 }
 
 static const RenderFlowThread* flowThreadContainingBlockFromRenderer(const RenderObject* renderer)
@@ -1054,7 +1061,7 @@
     return nullptr;
 }
 
-void RenderObject::showRegionsInformation() const
+void RenderObject::outputRegionsInformation(TextStream& stream) const
 {
     const RenderFlowThread* ftcb = flowThreadContainingBlockFromRenderer(this);
 
@@ -1072,93 +1079,93 @@
     RenderRegion* startRegion = nullptr;
     RenderRegion* endRegion = nullptr;
     ftcb->getRegionRangeForBox(downcast<RenderBox>(this), startRegion, endRegion);
-    fprintf(stderr, " [Rs:%p Re:%p]", startRegion, endRegion);
+    stream << " [Rs:" << startRegion << " Re:" << endRegion << "]";
 }
 
-void RenderObject::showRenderObject(bool mark, int depth) const
+void RenderObject::outputRenderObject(TextStream& stream, bool mark, int depth) const
 {
     if (isInlineBlockOrInlineTable())
-        fputc('N', stderr);
+        stream << "N";
     else if (isInline())
-        fputc('I', stderr);
+        stream << "I";
     else
-        fputc('B', stderr);
-    
+        stream << "B";
+
     if (isPositioned()) {
         if (isRelPositioned())
-            fputc('R', stderr);
+            stream << "R";
         else if (isStickyPositioned())
-            fputc('K', stderr);
+            stream << "K";
         else if (isOutOfFlowPositioned()) {
             if (style().position() == AbsolutePosition)
-                fputc('A', stderr);
+                stream << "A";
             else
-                fputc('X', stderr);
+                stream << "X";
         }
     } else
-        fputc('-', stderr);
+        stream << "-";
 
     if (isFloating())
-        fputc('F', stderr);
+        stream << "F";
     else
-        fputc('-', stderr);
+        stream << "-";
 
     if (hasOverflowClip())
-        fputc('O', stderr);
+        stream << "O";
     else
-        fputc('-', stderr);
+        stream << "-";
 
     if (isAnonymous())
-        fputc('Y', stderr);
+        stream << "Y";
     else
-        fputc('-', stderr);
+        stream << "-";
 
     if (isPseudoElement() || isAnonymous())
-        fputc('G', stderr);
+        stream << "G";
     else
-        fputc('-', stderr);
+        stream << "-";
 
     if (hasLayer())
-        fputc('L', stderr);
+        stream << "L";
     else
-        fputc('-', stderr);
+        stream << "-";
 
     if (isComposited())
-        fputc('C', stderr);
+        stream << "C";
     else
-        fputc('-', stderr);
+        stream << "-";
 
-    fputc(' ', stderr);
+    stream << " ";
 
     if (node() && node()->needsStyleRecalc())
-        fputc('+', stderr);
+        stream << "+";
     else
-        fputc('-', stderr);
+        stream << "-";
 
     if (needsLayout())
-        fputc('+', stderr);
+        stream << "+";
     else
-        fputc('-', stderr);
+        stream << "-";
 
     int printedCharacters = 0;
     if (mark) {
-        fprintf(stderr, "*");
+        stream << "*";
         ++printedCharacters;
     }
 
     while (++printedCharacters <= depth * 2)
-        fputc(' ', stderr);
+        stream << " ";
 
     if (node())
-        fprintf(stderr, "%s ", node()->nodeName().utf8().data());
+        stream << node()->nodeName().utf8().data() << " ";
 
     String name = renderName();
     // FIXME: Renderer's name should not include property value listing.
     int pos = name.find('(');
     if (pos > 0)
-        fprintf(stderr, "%s", name.left(pos - 1).utf8().data());
+        stream << name.left(pos - 1).utf8().data();
     else
-        fprintf(stderr, "%s", name.utf8().data());
+        stream << name.utf8().data();
 
     if (is<RenderBox>(*this)) {
         auto& renderBox = downcast<RenderBox>(*this);
@@ -1165,18 +1172,18 @@
         FloatRect boxRect = renderBox.frameRect();
         if (renderBox.isInFlowPositioned())
             boxRect.move(renderBox.offsetForInFlowPosition());
-        fprintf(stderr, "  (%.2f, %.2f) (%.2f, %.2f)", boxRect.x(), boxRect.y(), boxRect.width(), boxRect.height());
+        stream << " " << boxRect;
     } else if (is<RenderInline>(*this) && isInFlowPositioned()) {
         FloatSize inlineOffset = downcast<RenderInline>(*this).offsetForInFlowPosition();
-        fprintf(stderr, "  (%.2f, %.2f)", inlineOffset.width(), inlineOffset.height());
+        stream << "  (" << inlineOffset.width() << ", " << inlineOffset.height() << ")";
     }
 
-    fprintf(stderr, " renderer->(%p)", this);
+    stream << " renderer->(" << this << ")";
     if (node()) {
-        fprintf(stderr, " node->(%p)", node());
+        stream << " node->(" << node() << ")";
         if (node()->isTextNode()) {
             String value = node()->nodeValue();
-            fprintf(stderr, " length->(%u)", value.length());
+            stream << " length->(" << value.length() << ")";
 
             value.replaceWithLiteral('\\', "\\\\");
             value.replaceWithLiteral('\n', "\\n");
@@ -1184,41 +1191,41 @@
             const int maxPrintedLength = 80;
             if (value.length() > maxPrintedLength) {
                 String substring = value.substring(0, maxPrintedLength);
-                fprintf(stderr, " \"%s\"...", substring.utf8().data());
+                stream << " \"" << substring.utf8().data() << "\"...";
             } else
-                fprintf(stderr, " \"%s\"", value.utf8().data());
+                stream << " \"" << value.utf8().data() << "\"";
         }
     }
     if (is<RenderBoxModelObject>(*this)) {
         auto& renderer = downcast<RenderBoxModelObject>(*this);
         if (renderer.hasContinuation())
-            fprintf(stderr, " continuation->(%p)", renderer.continuation());
+            stream << " continuation->(" << renderer.continuation() << ")";
     }
-    showRegionsInformation();
+    outputRegionsInformation(stream);
     if (needsLayout()) {
-        fprintf(stderr, " layout->");
+        stream << " layout->";
         if (selfNeedsLayout())
-            fprintf(stderr, "[self]");
+            stream << "[self]";
         if (normalChildNeedsLayout())
-            fprintf(stderr, "[normal child]");
+            stream << "[normal child]";
         if (posChildNeedsLayout())
-            fprintf(stderr, "[positioned child]");
+            stream << "[positioned child]";
         if (needsSimplifiedNormalFlowLayout())
-            fprintf(stderr, "[simplified]");
+            stream << "[simplified]";
         if (needsPositionedMovementLayout())
-            fprintf(stderr, "[positioned movement]");
+            stream << "[positioned movement]";
     }
-    fprintf(stderr, "\n");
+    stream.nextLine();
 }
 
-void RenderObject::showRenderSubTreeAndMark(const RenderObject* markedObject, int depth) const
+void RenderObject::outputRenderSubTreeAndMark(TextStream& stream, const RenderObject* markedObject, int depth) const
 {
-    showRenderObject(markedObject == this, depth);
+    outputRenderObject(stream, markedObject == this, depth);
     if (is<RenderBlockFlow>(*this))
-        downcast<RenderBlockFlow>(*this).showLineTreeAndMark(nullptr, depth + 1);
+        downcast<RenderBlockFlow>(*this).outputLineTreeAndMark(stream, nullptr, depth + 1);
 
-    for (const RenderObject* child = firstChildSlow(); child; child = child->nextSibling())
-        child->showRenderSubTreeAndMark(markedObject, depth + 1);
+    for (auto* child = firstChildSlow(); child; child = child->nextSibling())
+        child->outputRenderSubTreeAndMark(stream, markedObject, depth + 1);
 }
 
 #endif // NDEBUG

Modified: trunk/Source/WebCore/rendering/RenderObject.h (219215 => 219216)


--- trunk/Source/WebCore/rendering/RenderObject.h	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2017-07-06 21:13:24 UTC (rev 219216)
@@ -205,9 +205,9 @@
     void showRenderTreeForThis() const;
     void showLineTreeForThis() const;
 
-    void showRenderObject(bool mark, int depth) const;
-    void showRenderSubTreeAndMark(const RenderObject* markedObject, int depth) const;
-    void showRegionsInformation() const;
+    void outputRenderObject(TextStream&, bool mark, int depth) const;
+    void outputRenderSubTreeAndMark(TextStream&, const RenderObject* markedObject, int depth) const;
+    void outputRegionsInformation(TextStream&) const;
 #endif
 
     bool isPseudoElement() const { return node() && node()->isPseudoElement(); }

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (219215 => 219216)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2017-07-06 21:13:24 UTC (rev 219216)
@@ -46,6 +46,7 @@
 #include "TextDecorationPainter.h"
 #include "TextPaintStyle.h"
 #include "TextPainter.h"
+#include "TextStream.h"
 
 #if ENABLE(TREE_DEBUGGING)
 #include <stdio.h>
@@ -261,33 +262,34 @@
 }
 
 #if ENABLE(TREE_DEBUGGING)
-static void printPrefix(int& printedCharacters, int depth)
+static void printPrefix(TextStream& stream, int& printedCharacters, int depth)
 {
-    fprintf(stderr, "-------- --");
+    stream << "-------- --";
     printedCharacters = 0;
     while (++printedCharacters <= depth * 2)
-        fputc(' ', stderr);
+        stream << " ";
 }
 
-void showLineLayoutForFlow(const RenderBlockFlow& flow, const Layout& layout, int depth)
+void outputLineLayoutForFlow(TextStream& stream, const RenderBlockFlow& flow, const Layout& layout, int depth)
 {
     int printedCharacters = 0;
-    printPrefix(printedCharacters, depth);
+    printPrefix(stream, printedCharacters, depth);
 
-    fprintf(stderr, "SimpleLineLayout (%u lines, %u runs) (%p)\n", layout.lineCount(), layout.runCount(), &layout);
+    stream << "SimpleLineLayout (" << layout.lineCount() << " lines, " << layout.runCount() << " runs) (" << &layout << ")";
+    stream.nextLine();
     ++depth;
 
     for (auto run : runResolver(flow, layout)) {
         FloatRect rect = run.rect();
-        printPrefix(printedCharacters, depth);
+        printPrefix(stream, printedCharacters, depth);
         if (run.start() < run.end()) {
-            fprintf(stderr, "line %u run(%u, %u) (%.2f, %.2f) (%.2f, %.2f) \"%s\"\n", run.lineIndex(), run.start(), run.end(),
-                rect.x(), rect.y(), rect.width(), rect.height(), run.text().toStringWithoutCopying().utf8().data());
+            stream << "line " << run.lineIndex() << " run(" << run.start() << ", " << run.end() << ") " << rect << " \"" << run.text().toStringWithoutCopying().utf8().data() << "\"";
         } else {
             ASSERT(run.start() == run.end());
-            fprintf(stderr, "line break %u run(%u, %u) (%.2f, %.2f) (%.2f, %.2f)\n", run.lineIndex(), run.start(), run.end(), rect.x(), rect.y(), rect.width(), rect.height());
+            stream << "line break " << run.lineIndex() << " run(" << run.start() << ", " << run.end() << ") " << rect;
         }
     }
+    stream.nextLine();
 }
 #endif
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h (219215 => 219216)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h	2017-07-06 21:07:19 UTC (rev 219215)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h	2017-07-06 21:13:24 UTC (rev 219216)
@@ -67,7 +67,7 @@
 const RenderObject& rendererForPosition(const FlowContents&, unsigned);
 
 #if ENABLE(TREE_DEBUGGING)
-void showLineLayoutForFlow(const RenderBlockFlow&, const Layout&, int depth);
+void outputLineLayoutForFlow(TextStream&, const RenderBlockFlow&, const Layout&, int depth);
 #endif
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to