Title: [173226] trunk/Source/WebCore
Revision
173226
Author
simon.fra...@apple.com
Date
2014-09-03 14:18:05 -0700 (Wed, 03 Sep 2014)

Log Message

Dump SimpleLineLayout info in showRenderTree() output
https://bugs.webkit.org/show_bug.cgi?id=136489

Reviewed by Zalan Bujtas.

Include info about SimpleLineLayout to showRenderTree() output.

Also show RenderText length, and truncate the RenderText contents
to 80 chars (since the string is replicated in inline boxes or simple line layout output).

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::showLineTreeAndMark):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::showRenderObject):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::printPrefix):
(WebCore::SimpleLineLayout::showLineTreeForFlow):
* rendering/SimpleLineLayoutFunctions.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173225 => 173226)


--- trunk/Source/WebCore/ChangeLog	2014-09-03 21:01:43 UTC (rev 173225)
+++ trunk/Source/WebCore/ChangeLog	2014-09-03 21:18:05 UTC (rev 173226)
@@ -1,3 +1,24 @@
+2014-09-03  Simon Fraser  <simon.fra...@apple.com>
+
+        Dump SimpleLineLayout info in showRenderTree() output
+        https://bugs.webkit.org/show_bug.cgi?id=136489
+
+        Reviewed by Zalan Bujtas.
+        
+        Include info about SimpleLineLayout to showRenderTree() output.
+        
+        Also show RenderText length, and truncate the RenderText contents
+        to 80 chars (since the string is replicated in inline boxes or simple line layout output).
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::showLineTreeAndMark):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::showRenderObject):
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::printPrefix):
+        (WebCore::SimpleLineLayout::showLineTreeForFlow):
+        * rendering/SimpleLineLayoutFunctions.h:
+
 2014-09-03  Tim Horton  <timothy_hor...@apple.com>
 
         iOS build fix after r173217 

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (173225 => 173226)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-09-03 21:01:43 UTC (rev 173225)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-09-03 21:18:05 UTC (rev 173226)
@@ -3507,6 +3507,9 @@
 {
     for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox())
         root->showLineTreeAndMark(markedBox, depth);
+
+    if (auto simpleLineLayout = this->simpleLineLayout())
+        SimpleLineLayout::showLineLayoutForFlow(*this, *simpleLineLayout, depth);
 }
 #endif
 

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (173225 => 173226)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2014-09-03 21:01:43 UTC (rev 173225)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2014-09-03 21:18:05 UTC (rev 173226)
@@ -1549,9 +1549,17 @@
         fprintf(stderr, " node->(%p)", node());
         if (node()->isTextNode()) {
             String value = node()->nodeValue();
+            fprintf(stderr, " length->(%u)", value.length());
+
             value.replaceWithLiteral('\\', "\\\\");
             value.replaceWithLiteral('\n', "\\n");
-            fprintf(stderr, " \"%s\"", value.utf8().data());
+            
+            const int maxPrintedLength = 80;
+            if (value.length() > maxPrintedLength) {
+                String substring = value.substring(0, maxPrintedLength);
+                fprintf(stderr, " \"%s\"...", substring.utf8().data());
+            } else
+                fprintf(stderr, " \"%s\"", value.utf8().data());
         }
     }
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (173225 => 173226)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2014-09-03 21:01:43 UTC (rev 173225)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2014-09-03 21:18:05 UTC (rev 173226)
@@ -200,5 +200,33 @@
     return quads;
 }
 
+#ifndef NDEBUG
+static void printPrefix(int& printedCharacters, int depth)
+{
+    fprintf(stderr, "------- --");
+    printedCharacters = 0;
+    while (++printedCharacters <= depth * 2)
+        fputc(' ', stderr);
 }
+
+void showLineLayoutForFlow(const RenderBlockFlow& flow, const Layout& layout, int depth)
+{
+    int printedCharacters = 0;
+    printPrefix(printedCharacters, depth);
+
+    fprintf(stderr, "SimpleLineLayout (%u lines, %u runs) (%p)\n", layout.lineCount(), layout.runCount(), &layout);
+    ++depth;
+
+    auto resolver = runResolver(flow, layout);
+    for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
+        const auto& run = *it;
+        LayoutRect r = run.rect();
+        printPrefix(printedCharacters, depth);
+        fprintf(stderr, "line %u run(%u, %u) (%.2f, %.2f) (%.2f, %.2f) \"%s\"\n", run.lineIndex(), run.start(), run.end(),
+            r.x().toFloat(), r.y().toFloat(), r.width().toFloat(), r.height().toFloat(), run.text().utf8().data());
+    }
 }
+#endif
+
+}
+}

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h (173225 => 173226)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h	2014-09-03 21:01:43 UTC (rev 173225)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h	2014-09-03 21:18:05 UTC (rev 173226)
@@ -63,6 +63,10 @@
 LayoutUnit lineHeightFromFlow(const RenderBlockFlow&);
 LayoutUnit baselineFromFlow(const RenderBlockFlow&);
 
+#ifndef NDEBUG
+void showLineLayoutForFlow(const RenderBlockFlow&, const Layout&, int depth);
+#endif
+
 }
 
 namespace SimpleLineLayout {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to