Changeset 173226 in webkit


Ignore:
Timestamp:
Sep 3, 2014, 2:18:05 PM (11 years ago)
Author:
Simon Fraser
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:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r173221 r173226  
     12014-09-03  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Dump SimpleLineLayout info in showRenderTree() output
     4        https://bugs.webkit.org/show_bug.cgi?id=136489
     5
     6        Reviewed by Zalan Bujtas.
     7       
     8        Include info about SimpleLineLayout to showRenderTree() output.
     9       
     10        Also show RenderText length, and truncate the RenderText contents
     11        to 80 chars (since the string is replicated in inline boxes or simple line layout output).
     12
     13        * rendering/RenderBlockFlow.cpp:
     14        (WebCore::RenderBlockFlow::showLineTreeAndMark):
     15        * rendering/RenderObject.cpp:
     16        (WebCore::RenderObject::showRenderObject):
     17        * rendering/SimpleLineLayoutFunctions.cpp:
     18        (WebCore::SimpleLineLayout::printPrefix):
     19        (WebCore::SimpleLineLayout::showLineTreeForFlow):
     20        * rendering/SimpleLineLayoutFunctions.h:
     21
    1222014-09-03  Tim Horton  <timothy_horton@apple.com>
    223
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r173217 r173226  
    35083508    for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox())
    35093509        root->showLineTreeAndMark(markedBox, depth);
     3510
     3511    if (auto simpleLineLayout = this->simpleLineLayout())
     3512        SimpleLineLayout::showLineLayoutForFlow(*this, *simpleLineLayout, depth);
    35103513}
    35113514#endif
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r173114 r173226  
    15501550        if (node()->isTextNode()) {
    15511551            String value = node()->nodeValue();
     1552            fprintf(stderr, " length->(%u)", value.length());
     1553
    15521554            value.replaceWithLiteral('\\', "\\\\");
    15531555            value.replaceWithLiteral('\n', "\\n");
    1554             fprintf(stderr, " \"%s\"", value.utf8().data());
     1556           
     1557            const int maxPrintedLength = 80;
     1558            if (value.length() > maxPrintedLength) {
     1559                String substring = value.substring(0, maxPrintedLength);
     1560                fprintf(stderr, " \"%s\"...", substring.utf8().data());
     1561            } else
     1562                fprintf(stderr, " \"%s\"", value.utf8().data());
    15551563        }
    15561564    }
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp

    r173047 r173226  
    201201}
    202202
    203 }
    204 }
     203#ifndef NDEBUG
     204static void printPrefix(int& printedCharacters, int depth)
     205{
     206    fprintf(stderr, "------- --");
     207    printedCharacters = 0;
     208    while (++printedCharacters <= depth * 2)
     209        fputc(' ', stderr);
     210}
     211
     212void showLineLayoutForFlow(const RenderBlockFlow& flow, const Layout& layout, int depth)
     213{
     214    int printedCharacters = 0;
     215    printPrefix(printedCharacters, depth);
     216
     217    fprintf(stderr, "SimpleLineLayout (%u lines, %u runs) (%p)\n", layout.lineCount(), layout.runCount(), &layout);
     218    ++depth;
     219
     220    auto resolver = runResolver(flow, layout);
     221    for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
     222        const auto& run = *it;
     223        LayoutRect r = run.rect();
     224        printPrefix(printedCharacters, depth);
     225        fprintf(stderr, "line %u run(%u, %u) (%.2f, %.2f) (%.2f, %.2f) \"%s\"\n", run.lineIndex(), run.start(), run.end(),
     226            r.x().toFloat(), r.y().toFloat(), r.width().toFloat(), r.height().toFloat(), run.text().utf8().data());
     227    }
     228}
     229#endif
     230
     231}
     232}
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h

    r167568 r173226  
    6363LayoutUnit lineHeightFromFlow(const RenderBlockFlow&);
    6464LayoutUnit baselineFromFlow(const RenderBlockFlow&);
     65
     66#ifndef NDEBUG
     67void showLineLayoutForFlow(const RenderBlockFlow&, const Layout&, int depth);
     68#endif
    6569
    6670}
Note: See TracChangeset for help on using the changeset viewer.