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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173226 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 0e5f66f..58d0b3d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2014-09-03 Simon Fraser <simon.fraser@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_horton@apple.com>
iOS build fix after r173217
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 61e7ca6..83bf1ae 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -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
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index ea0eda6..cda881d 100644
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -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());
}
}
diff --git a/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp b/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
index 1cfdf31..3526407 100644
--- a/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
+++ b/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
@@ -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
+
}
}
diff --git a/Source/WebCore/rendering/SimpleLineLayoutFunctions.h b/Source/WebCore/rendering/SimpleLineLayoutFunctions.h
index 99d1aaf..2c3a79a 100644
--- a/Source/WebCore/rendering/SimpleLineLayoutFunctions.h
+++ b/Source/WebCore/rendering/SimpleLineLayoutFunctions.h
@@ -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 {