| Index: Source/core/layout/LayoutTreeAsText.cpp
|
| diff --git a/Source/core/layout/LayoutTreeAsText.cpp b/Source/core/layout/LayoutTreeAsText.cpp
|
| index 8dc7c93b5ae6a51a6900a890fdca7c108dc7b303..7c213b27104ca8cb38f410b9ab44b4396a2a30ea 100644
|
| --- a/Source/core/layout/LayoutTreeAsText.cpp
|
| +++ b/Source/core/layout/LayoutTreeAsText.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/frame/Settings.h"
|
| #include "core/html/HTMLElement.h"
|
| +#include "core/layout/LayoutBlockFlow.h"
|
| #include "core/layout/LayoutDetailsMarker.h"
|
| #include "core/layout/LayoutFileUploadControl.h"
|
| #include "core/layout/LayoutInline.h"
|
| @@ -55,6 +56,7 @@
|
| #include "core/layout/svg/SVGLayoutTreeAsText.h"
|
| #include "core/page/PrintContext.h"
|
| #include "core/paint/DeprecatedPaintLayer.h"
|
| +#include "platform/LayoutUnit.h"
|
| #include "wtf/HexNumber.h"
|
| #include "wtf/Vector.h"
|
| #include "wtf/unicode/CharacterNames.h"
|
| @@ -404,6 +406,52 @@ void LayoutTreeAsText::writeLayoutObject(TextStream& ts, const LayoutObject& o,
|
| }
|
| }
|
|
|
| +static void writeInlineBox(TextStream& ts, const InlineBox& box, int indent)
|
| +{
|
| + writeIndent(ts, indent);
|
| + ts << "+ ";
|
| + ts << box.boxName() << " {" << box.layoutObject().debugName() << "}"
|
| + << " pos=(" << box.x() << "," << box.y() << ")"
|
| + << " size=(" << box.width() << "," << box.height() << ")"
|
| + << " baseline=" << box.baselinePosition(AlphabeticBaseline)
|
| + << "/" << box.baselinePosition(IdeographicBaseline);
|
| +}
|
| +
|
| +static void writeInlineTextBox(TextStream& ts, const InlineTextBox& textBox, int indent)
|
| +{
|
| + writeInlineBox(ts, textBox, indent);
|
| + String value = textBox.text();
|
| + value.replaceWithLiteral('\\', "\\\\");
|
| + value.replaceWithLiteral('\n', "\\n");
|
| + value.replaceWithLiteral('"', "\\\"");
|
| + ts << " range=(" << textBox.start() << "," << (textBox.start() + textBox.len()) << ")"
|
| + << " \"" << value << "\"";
|
| +}
|
| +
|
| +static void writeInlineFlowBox(TextStream& ts, const InlineFlowBox& rootBox, int indent)
|
| +{
|
| + writeInlineBox(ts, rootBox, indent);
|
| + ts << "\n";
|
| + for (const InlineBox* box = rootBox.firstChild(); box; box = box->nextOnLine()) {
|
| + if (box->isInlineFlowBox()) {
|
| + writeInlineFlowBox(ts, static_cast<const InlineFlowBox&>(*box), indent + 1);
|
| + continue;
|
| + }
|
| + if (box->isInlineTextBox())
|
| + writeInlineTextBox(ts, static_cast<const InlineTextBox&>(*box), indent + 1);
|
| + else
|
| + writeInlineBox(ts, *box, indent + 1);
|
| + ts << "\n";
|
| + }
|
| +}
|
| +
|
| +void LayoutTreeAsText::writeLineBoxTree(TextStream& ts, const LayoutBlockFlow& o, int indent)
|
| +{
|
| + for (const InlineFlowBox* rootBox = o.firstLineBox(); rootBox; rootBox = rootBox->nextLineBox()) {
|
| + writeInlineFlowBox(ts, *rootBox, indent);
|
| + }
|
| +}
|
| +
|
| static void writeTextRun(TextStream& ts, const LayoutText& o, const InlineTextBox& run)
|
| {
|
| // FIXME: For now use an "enclosingIntRect" model for x, y and logicalWidth, although this makes it harder
|
| @@ -469,6 +517,10 @@ void write(TextStream& ts, const LayoutObject& o, int indent, LayoutAsTextBehavi
|
| LayoutTreeAsText::writeLayoutObject(ts, o, behavior);
|
| ts << "\n";
|
|
|
| + if ((behavior & LayoutAsTextShowLineTrees) && o.isLayoutBlockFlow()) {
|
| + LayoutTreeAsText::writeLineBoxTree(ts, toLayoutBlockFlow(o), indent + 1);
|
| + }
|
| +
|
| if (o.isText() && !o.isBR()) {
|
| const LayoutText& text = toLayoutText(o);
|
| for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
|
|
|