Changeset 225185 in webkit


Ignore:
Timestamp:
Nov 27, 2017, 12:02:09 PM (8 years ago)
Author:
Simon Fraser
Message:

Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
https://bugs.webkit.org/show_bug.cgi?id=180027

Reviewed by Jon Lee.

Remove all the indent arguments, and make use of TextStream::IndentScope to control
output indentation.
Source/WebCore:

Add an indent stream manipulator so you can say

ts << indent << "text"

to write the indent.

  • platform/graphics/filters/FEBlend.cpp:

(WebCore::FEBlend::externalRepresentation const):

  • platform/graphics/filters/FEBlend.h:
  • platform/graphics/filters/FEColorMatrix.cpp:

(WebCore::FEColorMatrix::externalRepresentation const):

  • platform/graphics/filters/FEColorMatrix.h:
  • platform/graphics/filters/FEComponentTransfer.cpp:

(WebCore::FEComponentTransfer::externalRepresentation const):

  • platform/graphics/filters/FEComponentTransfer.h:
  • platform/graphics/filters/FEComposite.cpp:

(WebCore::FEComposite::externalRepresentation const):

  • platform/graphics/filters/FEComposite.h:
  • platform/graphics/filters/FEConvolveMatrix.cpp:

(WebCore::FEConvolveMatrix::externalRepresentation const):

  • platform/graphics/filters/FEConvolveMatrix.h:
  • platform/graphics/filters/FEDiffuseLighting.cpp:

(WebCore::FEDiffuseLighting::externalRepresentation const):

  • platform/graphics/filters/FEDiffuseLighting.h:
  • platform/graphics/filters/FEDisplacementMap.cpp:

(WebCore::FEDisplacementMap::externalRepresentation const):

  • platform/graphics/filters/FEDisplacementMap.h:
  • platform/graphics/filters/FEDropShadow.cpp:

(WebCore::FEDropShadow::externalRepresentation const):

  • platform/graphics/filters/FEDropShadow.h:
  • platform/graphics/filters/FEFlood.cpp:

(WebCore::FEFlood::externalRepresentation const):

  • platform/graphics/filters/FEFlood.h:
  • platform/graphics/filters/FEGaussianBlur.cpp:

(WebCore::FEGaussianBlur::externalRepresentation const):

  • platform/graphics/filters/FEGaussianBlur.h:
  • platform/graphics/filters/FEMerge.cpp:

(WebCore::FEMerge::externalRepresentation const):

  • platform/graphics/filters/FEMerge.h:
  • platform/graphics/filters/FEMorphology.cpp:

(WebCore::FEMorphology::externalRepresentation const):

  • platform/graphics/filters/FEMorphology.h:
  • platform/graphics/filters/FEOffset.cpp:

(WebCore::FEOffset::externalRepresentation const):

  • platform/graphics/filters/FEOffset.h:
  • platform/graphics/filters/FESpecularLighting.cpp:

(WebCore::FESpecularLighting::externalRepresentation const):

  • platform/graphics/filters/FESpecularLighting.h:
  • platform/graphics/filters/FETile.cpp:

(WebCore::FETile::externalRepresentation const):

  • platform/graphics/filters/FETile.h:
  • platform/graphics/filters/FETurbulence.cpp:

(WebCore::FETurbulence::externalRepresentation const):

  • platform/graphics/filters/FETurbulence.h:
  • platform/graphics/filters/FilterEffect.cpp:

(WebCore::FilterEffect::externalRepresentation const):

  • platform/graphics/filters/FilterEffect.h:
  • platform/graphics/filters/SourceAlpha.cpp:

(WebCore::SourceAlpha::externalRepresentation const):

  • platform/graphics/filters/SourceAlpha.h:
  • platform/graphics/filters/SourceGraphic.cpp:

(WebCore::SourceGraphic::externalRepresentation const):

  • platform/graphics/filters/SourceGraphic.h:
  • rendering/RenderTreeAsText.cpp:

(WebCore::write):
(WebCore::writeLayer):
(WebCore::writeLayerRenderers):
(WebCore::writeLayers):
(WebCore::externalRepresentation):

  • rendering/RenderTreeAsText.h:
  • rendering/svg/SVGRenderTreeAsText.cpp:

(WebCore::writeSVGInlineTextBox):
(WebCore::writeSVGInlineTextBoxes):
(WebCore::writeStandardPrefix):
(WebCore::writeChildren):
(WebCore::writeSVGResourceContainer):
(WebCore::writeSVGContainer):
(WebCore::write):
(WebCore::writeSVGText):
(WebCore::writeSVGInlineText):
(WebCore::writeSVGImage):
(WebCore::writeSVGGradientStop):
(WebCore::writeResources):

  • rendering/svg/SVGRenderTreeAsText.h:
  • svg/graphics/filters/SVGFEImage.cpp:

(WebCore::FEImage::externalRepresentation const):

  • svg/graphics/filters/SVGFEImage.h:

Source/WTF:

Add an indent stream manipulator so you can say

ts << indent << "text"

to write the indent.

  • wtf/text/TextStream.h:

(WTF::TextStream::IndentScope::IndentScope):
(WTF::TextStream::IndentScope::~IndentScope):

Location:
trunk/Source
Files:
47 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r225144 r225185  
     12017-11-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
     4        https://bugs.webkit.org/show_bug.cgi?id=180027
     5
     6        Reviewed by Jon Lee.
     7
     8        Remove all the indent arguments, and make use of TextStream::IndentScope to control
     9        output indentation.
     10
     11        Add an indent stream manipulator so you can say
     12          ts << indent << "text"
     13        to write the indent.
     14
     15        * wtf/text/TextStream.h:
     16        (WTF::TextStream::IndentScope::IndentScope):
     17        (WTF::TextStream::IndentScope::~IndentScope):
     18
    1192016-08-05  Darin Adler  <darin@apple.com>
    220
  • trunk/Source/WTF/wtf/text/TextStream.h

    r220503 r225185  
    9696    WTF_EXPORT_PRIVATE void writeIndent();
    9797
     98    // Stream manipulators.
     99    TextStream& operator<<(TextStream& (*func)(TextStream&))
     100    {
     101        return (*func)(*this);
     102    }
     103
     104    class IndentScope {
     105    public:
     106        IndentScope(TextStream& ts, int amount = 1)
     107            : m_stream(ts)
     108            , m_amount(amount)
     109        {
     110            m_stream.increaseIndent(m_amount);
     111        }
     112        ~IndentScope()
     113        {
     114            m_stream.decreaseIndent(m_amount);
     115        }
     116
     117    private:
     118        TextStream& m_stream;
     119        int m_amount;
     120    };
     121
    98122    class GroupScope {
    99123    public:
     
    119143};
    120144
     145inline TextStream& indent(TextStream& ts)
     146{
     147    ts.writeIndent();
     148    return ts;
     149}
     150
    121151template<typename Item>
    122152TextStream& operator<<(TextStream& ts, const Vector<Item>& vector)
     
    134164}
    135165
     166// Deprecated. Use TextStream::writeIndent() instead.
    136167WTF_EXPORT_PRIVATE void writeIndent(TextStream&, int indent);
    137168
     
    139170
    140171using WTF::TextStream;
     172using WTF::indent;
  • trunk/Source/WebCore/ChangeLog

    r225184 r225185  
     12017-11-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
     4        https://bugs.webkit.org/show_bug.cgi?id=180027
     5
     6        Reviewed by Jon Lee.
     7
     8        Remove all the indent arguments, and make use of TextStream::IndentScope to control
     9        output indentation.
     10       
     11        Add an indent stream manipulator so you can say
     12          ts << indent << "text"
     13        to write the indent.
     14
     15        * platform/graphics/filters/FEBlend.cpp:
     16        (WebCore::FEBlend::externalRepresentation const):
     17        * platform/graphics/filters/FEBlend.h:
     18        * platform/graphics/filters/FEColorMatrix.cpp:
     19        (WebCore::FEColorMatrix::externalRepresentation const):
     20        * platform/graphics/filters/FEColorMatrix.h:
     21        * platform/graphics/filters/FEComponentTransfer.cpp:
     22        (WebCore::FEComponentTransfer::externalRepresentation const):
     23        * platform/graphics/filters/FEComponentTransfer.h:
     24        * platform/graphics/filters/FEComposite.cpp:
     25        (WebCore::FEComposite::externalRepresentation const):
     26        * platform/graphics/filters/FEComposite.h:
     27        * platform/graphics/filters/FEConvolveMatrix.cpp:
     28        (WebCore::FEConvolveMatrix::externalRepresentation const):
     29        * platform/graphics/filters/FEConvolveMatrix.h:
     30        * platform/graphics/filters/FEDiffuseLighting.cpp:
     31        (WebCore::FEDiffuseLighting::externalRepresentation const):
     32        * platform/graphics/filters/FEDiffuseLighting.h:
     33        * platform/graphics/filters/FEDisplacementMap.cpp:
     34        (WebCore::FEDisplacementMap::externalRepresentation const):
     35        * platform/graphics/filters/FEDisplacementMap.h:
     36        * platform/graphics/filters/FEDropShadow.cpp:
     37        (WebCore::FEDropShadow::externalRepresentation const):
     38        * platform/graphics/filters/FEDropShadow.h:
     39        * platform/graphics/filters/FEFlood.cpp:
     40        (WebCore::FEFlood::externalRepresentation const):
     41        * platform/graphics/filters/FEFlood.h:
     42        * platform/graphics/filters/FEGaussianBlur.cpp:
     43        (WebCore::FEGaussianBlur::externalRepresentation const):
     44        * platform/graphics/filters/FEGaussianBlur.h:
     45        * platform/graphics/filters/FEMerge.cpp:
     46        (WebCore::FEMerge::externalRepresentation const):
     47        * platform/graphics/filters/FEMerge.h:
     48        * platform/graphics/filters/FEMorphology.cpp:
     49        (WebCore::FEMorphology::externalRepresentation const):
     50        * platform/graphics/filters/FEMorphology.h:
     51        * platform/graphics/filters/FEOffset.cpp:
     52        (WebCore::FEOffset::externalRepresentation const):
     53        * platform/graphics/filters/FEOffset.h:
     54        * platform/graphics/filters/FESpecularLighting.cpp:
     55        (WebCore::FESpecularLighting::externalRepresentation const):
     56        * platform/graphics/filters/FESpecularLighting.h:
     57        * platform/graphics/filters/FETile.cpp:
     58        (WebCore::FETile::externalRepresentation const):
     59        * platform/graphics/filters/FETile.h:
     60        * platform/graphics/filters/FETurbulence.cpp:
     61        (WebCore::FETurbulence::externalRepresentation const):
     62        * platform/graphics/filters/FETurbulence.h:
     63        * platform/graphics/filters/FilterEffect.cpp:
     64        (WebCore::FilterEffect::externalRepresentation const):
     65        * platform/graphics/filters/FilterEffect.h:
     66        * platform/graphics/filters/SourceAlpha.cpp:
     67        (WebCore::SourceAlpha::externalRepresentation const):
     68        * platform/graphics/filters/SourceAlpha.h:
     69        * platform/graphics/filters/SourceGraphic.cpp:
     70        (WebCore::SourceGraphic::externalRepresentation const):
     71        * platform/graphics/filters/SourceGraphic.h:
     72        * rendering/RenderTreeAsText.cpp:
     73        (WebCore::write):
     74        (WebCore::writeLayer):
     75        (WebCore::writeLayerRenderers):
     76        (WebCore::writeLayers):
     77        (WebCore::externalRepresentation):
     78        * rendering/RenderTreeAsText.h:
     79        * rendering/svg/SVGRenderTreeAsText.cpp:
     80        (WebCore::writeSVGInlineTextBox):
     81        (WebCore::writeSVGInlineTextBoxes):
     82        (WebCore::writeStandardPrefix):
     83        (WebCore::writeChildren):
     84        (WebCore::writeSVGResourceContainer):
     85        (WebCore::writeSVGContainer):
     86        (WebCore::write):
     87        (WebCore::writeSVGText):
     88        (WebCore::writeSVGInlineText):
     89        (WebCore::writeSVGImage):
     90        (WebCore::writeSVGGradientStop):
     91        (WebCore::writeResources):
     92        * rendering/svg/SVGRenderTreeAsText.h:
     93        * svg/graphics/filters/SVGFEImage.cpp:
     94        (WebCore::FEImage::externalRepresentation const):
     95        * svg/graphics/filters/SVGFEImage.h:
     96
    1972017-11-27  Chris Dumez  <cdumez@apple.com>
    298
  • trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp

    r225137 r225185  
    7676#endif
    7777
    78 TextStream& FEBlend::externalRepresentation(TextStream& ts, int indent) const
     78TextStream& FEBlend::externalRepresentation(TextStream& ts) const
    7979{
    80     writeIndent(ts, indent);
    81     ts << "[feBlend";
     80    ts << indent << "[feBlend";
    8281    FilterEffect::externalRepresentation(ts);
    8382    ts << " mode=\"" << (m_mode == BlendModeNormal ? "normal" : compositeOperatorName(CompositeSourceOver, m_mode)) << "\"]\n";
    84     inputEffect(0)->externalRepresentation(ts, indent + 1);
    85     inputEffect(1)->externalRepresentation(ts, indent + 1);
     83
     84    TextStream::IndentScope indentScope(ts);
     85    inputEffect(0)->externalRepresentation(ts);
     86    inputEffect(1)->externalRepresentation(ts);
    8687    return ts;
    8788}
  • trunk/Source/WebCore/platform/graphics/filters/FEBlend.h

    r225137 r225185  
    4545                           unsigned colorArrayLength);
    4646
    47     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     47    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    4848
    4949    FEBlend(Filter&, BlendMode);
  • trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp

    r225172 r225185  
    336336}
    337337
    338 TextStream& FEColorMatrix::externalRepresentation(TextStream& ts, int indent) const
    339 {
    340     writeIndent(ts, indent);
    341     ts << "[feColorMatrix";
     338TextStream& FEColorMatrix::externalRepresentation(TextStream& ts) const
     339{
     340    ts << indent << "[feColorMatrix";
    342341    FilterEffect::externalRepresentation(ts);
    343342    ts << " type=\"" << m_type << "\"";
     
    355354    }
    356355    ts << "]\n";
    357     inputEffect(0)->externalRepresentation(ts, indent + 1);
     356   
     357    TextStream::IndentScope indentScope(ts);
     358    inputEffect(0)->externalRepresentation(ts);
    358359    return ts;
    359360}
  • trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.h

    r225137 r225185  
    5757    void platformApplySoftware() override;
    5858
    59     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     59    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    6060
    6161    ColorMatrixType m_type;
  • trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp

    r225147 r225185  
    195195}
    196196
    197 TextStream& FEComponentTransfer::externalRepresentation(TextStream& ts, int indent) const
    198 {
    199     writeIndent(ts, indent);
    200     ts << "[feComponentTransfer";
     197TextStream& FEComponentTransfer::externalRepresentation(TextStream& ts) const
     198{
     199    ts << indent << "[feComponentTransfer";
    201200    FilterEffect::externalRepresentation(ts);
    202201    ts << " \n";
    203     writeIndent(ts, indent + 2);
    204     ts << "{red: " << m_redFunction << "}\n";
    205     writeIndent(ts, indent + 2);
    206     ts << "{green: " << m_greenFunction << "}\n";
    207     writeIndent(ts, indent + 2);
    208     ts << "{blue: " << m_blueFunction << "}\n";
    209     writeIndent(ts, indent + 2);
    210     ts << "{alpha: " << m_alphaFunction << "}]\n";
    211     inputEffect(0)->externalRepresentation(ts, indent + 1);
     202    {
     203        TextStream::IndentScope indentScope(ts, 2);
     204        ts << indent << "{red: " << m_redFunction << "}\n";
     205        ts << indent <<"{green: " << m_greenFunction << "}\n";
     206        ts << indent <<"{blue: " << m_blueFunction << "}\n";
     207        ts << indent <<"{alpha: " << m_alphaFunction << "}]\n";
     208    }
     209
     210    TextStream::IndentScope indentScope(ts);
     211    inputEffect(0)->externalRepresentation(ts);
    212212    return ts;
    213213}
  • trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h

    r225137 r225185  
    8080    void platformApplySoftware() override;
    8181
    82     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     82    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    8383
    8484    ComponentTransferFunction m_redFunction;
  • trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp

    r225147 r225185  
    328328}
    329329
    330 TextStream& FEComposite::externalRepresentation(TextStream& ts, int indent) const
    331 {
    332     writeIndent(ts, indent);
    333     ts << "[feComposite";
     330TextStream& FEComposite::externalRepresentation(TextStream& ts) const
     331{
     332    ts << indent << "[feComposite";
    334333    FilterEffect::externalRepresentation(ts);
    335334    ts << " operation=\"" << m_type << "\"";
     
    337336        ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\" k4=\"" << m_k4 << "\"";
    338337    ts << "]\n";
    339     inputEffect(0)->externalRepresentation(ts, indent + 1);
    340     inputEffect(1)->externalRepresentation(ts, indent + 1);
     338
     339    TextStream::IndentScope indentScope(ts);
     340    inputEffect(0)->externalRepresentation(ts);
     341    inputEffect(1)->externalRepresentation(ts);
    341342    return ts;
    342343}
  • trunk/Source/WebCore/platform/graphics/filters/FEComposite.h

    r225147 r225185  
    7171
    7272    void platformApplySoftware() override;
    73     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     73    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    7474
    7575    inline void platformArithmeticSoftware(const Uint8ClampedArray& source, Uint8ClampedArray& destination, float k1, float k2, float k3, float k4);
  • trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp

    r225147 r225185  
    456456}
    457457
    458 TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts, int indent) const
    459 {
    460     writeIndent(ts, indent);
    461     ts << "[feConvolveMatrix";
     458TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts) const
     459{
     460    ts << indent << "[feConvolveMatrix";
    462461    FilterEffect::externalRepresentation(ts);
    463462    ts << " order=\"" << m_kernelSize << "\" "
     
    469468       << "kernelUnitLength=\"" << m_kernelUnitLength << "\" "
    470469       << "preserveAlpha=\"" << m_preserveAlpha << "\"]\n";
    471     inputEffect(0)->externalRepresentation(ts, indent + 1);
     470
     471    TextStream::IndentScope indentScope(ts);
     472    inputEffect(0)->externalRepresentation(ts);
    472473    return ts;
    473474}
  • trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h

    r225147 r225185  
    8787    void platformApplySoftware() override;
    8888
    89     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     89    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    9090
    9191    template<bool preserveAlphaValues>
  • trunk/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp

    r225026 r225185  
    4848}
    4949
    50 TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts, int indent) const
     50TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts) const
    5151{
    52     writeIndent(ts, indent);
    53     ts << "[feDiffuseLighting";
     52    ts << indent << "[feDiffuseLighting";
    5453    FilterEffect::externalRepresentation(ts);
    5554    ts << " surfaceScale=\"" << m_surfaceScale << "\" "
    5655       << "diffuseConstant=\"" << m_diffuseConstant << "\" "
    5756       << "kernelUnitLength=\"" << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "\"]\n";
    58     inputEffect(0)->externalRepresentation(ts, indent + 1);
     57
     58    TextStream::IndentScope indentScope(ts);
     59    inputEffect(0)->externalRepresentation(ts);
    5960    return ts;
    6061}
  • trunk/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.h

    r225026 r225185  
    3636    bool setDiffuseConstant(float);
    3737
    38     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     38    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    3939
    4040private:
  • trunk/Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp

    r225183 r225185  
    167167}
    168168
    169 TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts, int indent) const
     169TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts) const
    170170{
    171     writeIndent(ts, indent);
    172     ts << "[feDisplacementMap";
     171    ts << indent << "[feDisplacementMap";
    173172    FilterEffect::externalRepresentation(ts);
    174173    ts << " scale=\"" << m_scale << "\" "
    175174       << "xChannelSelector=\"" << m_xChannelSelector << "\" "
    176175       << "yChannelSelector=\"" << m_yChannelSelector << "\"]\n";
    177     inputEffect(0)->externalRepresentation(ts, indent + 1);
    178     inputEffect(1)->externalRepresentation(ts, indent + 1);
     176
     177    TextStream::IndentScope indentScope(ts);
     178    inputEffect(0)->externalRepresentation(ts);
     179    inputEffect(1)->externalRepresentation(ts);
    179180    return ts;
    180181}
  • trunk/Source/WebCore/platform/graphics/filters/FEDisplacementMap.h

    r225183 r225185  
    6161    void determineAbsolutePaintRect() override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    6262
    63     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
    64    
    6563    int xChannelIndex() const { return m_xChannelSelector - 1; }
    6664    int yChannelIndex() const { return m_yChannelSelector - 1; }
     65
     66    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    6767
    6868    ChannelSelectorType m_xChannelSelector;
  • trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp

    r225147 r225185  
    115115}
    116116
    117 TextStream& FEDropShadow::externalRepresentation(TextStream& ts, int indent) const
     117TextStream& FEDropShadow::externalRepresentation(TextStream& ts) const
    118118{
    119     writeIndent(ts, indent);
    120     ts << "[feDropShadow";
     119    ts << indent <<"[feDropShadow";
    121120    FilterEffect::externalRepresentation(ts);
    122121    ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\" dx=\"" << m_dx << "\" dy=\"" << m_dy << "\" flood-color=\"" << m_shadowColor.nameForRenderTreeAsText() <<"\" flood-opacity=\"" << m_shadowOpacity << "]\n";
    123     inputEffect(0)->externalRepresentation(ts, indent + 1);
     122
     123    TextStream::IndentScope indentScope(ts);
     124    inputEffect(0)->externalRepresentation(ts);
    124125    return ts;
    125126}
  • trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.h

    r225137 r225185  
    5757    void determineAbsolutePaintRect() override;
    5858
    59     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     59    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    6060
    6161    float m_stdX;
  • trunk/Source/WebCore/platform/graphics/filters/FEFlood.cpp

    r225026 r225185  
    6868}
    6969
    70 TextStream& FEFlood::externalRepresentation(TextStream& ts, int indent) const
     70TextStream& FEFlood::externalRepresentation(TextStream& ts) const
    7171{
    72     writeIndent(ts, indent);
    73     ts << "[feFlood";
     72    ts << indent << "[feFlood";
    7473    FilterEffect::externalRepresentation(ts);
    7574    ts << " flood-color=\"" << floodColor().nameForRenderTreeAsText() << "\" "
  • trunk/Source/WebCore/platform/graphics/filters/FEFlood.h

    r225137 r225185  
    5454    void determineAbsolutePaintRect() override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    5555
    56     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     56    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    5757
    5858    Color m_floodColor;
  • trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp

    r225147 r225185  
    540540}
    541541
    542 TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts, int indent) const
    543 {
    544     writeIndent(ts, indent);
    545     ts << "[feGaussianBlur";
     542TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts) const
     543{
     544    ts << indent << "[feGaussianBlur";
    546545    FilterEffect::externalRepresentation(ts);
    547546    ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n";
    548     inputEffect(0)->externalRepresentation(ts, indent + 1);
     547
     548    TextStream::IndentScope indentScope(ts);
     549    inputEffect(0)->externalRepresentation(ts);
    549550    return ts;
    550551}
  • trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h

    r225147 r225185  
    6868    void determineAbsolutePaintRect() override;
    6969
    70     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     70    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    7171
    7272    static void platformApplyWorker(PlatformApplyParameters*);
  • trunk/Source/WebCore/platform/graphics/filters/FEMerge.cpp

    r225137 r225185  
    5757}
    5858
    59 TextStream& FEMerge::externalRepresentation(TextStream& ts, int indent) const
     59TextStream& FEMerge::externalRepresentation(TextStream& ts) const
    6060{
    61     writeIndent(ts, indent);
    62     ts << "[feMerge";
     61    ts << indent << "[feMerge";
    6362    FilterEffect::externalRepresentation(ts);
    6463    unsigned size = numberOfEffectInputs();
    6564    ASSERT(size > 0);
    6665    ts << " mergeNodes=\"" << size << "\"]\n";
     66
     67    TextStream::IndentScope indentScope(ts);
    6768    for (unsigned i = 0; i < size; ++i)
    68         inputEffect(i)->externalRepresentation(ts, indent + 1);
     69        inputEffect(i)->externalRepresentation(ts);
    6970    return ts;
    7071}
  • trunk/Source/WebCore/platform/graphics/filters/FEMerge.h

    r225137 r225185  
    3838    void platformApplySoftware() override;
    3939
    40     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     40    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    4141};
    4242
  • trunk/Source/WebCore/platform/graphics/filters/FEMorphology.cpp

    r225172 r225185  
    290290}
    291291
    292 TextStream& FEMorphology::externalRepresentation(TextStream& ts, int indent) const
    293 {
    294     writeIndent(ts, indent);
    295     ts << "[feMorphology";
     292TextStream& FEMorphology::externalRepresentation(TextStream& ts) const
     293{
     294    ts << indent << "[feMorphology";
    296295    FilterEffect::externalRepresentation(ts);
    297296    ts << " operator=\"" << morphologyOperator() << "\" "
    298297       << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n";
    299     inputEffect(0)->externalRepresentation(ts, indent + 1);
     298
     299    TextStream::IndentScope indentScope(ts);
     300    inputEffect(0)->externalRepresentation(ts);
    300301    return ts;
    301302}
  • trunk/Source/WebCore/platform/graphics/filters/FEMorphology.h

    r225172 r225185  
    5555    void determineAbsolutePaintRect() override;
    5656
    57     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     57    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    5858
    5959    bool platformApplyDegenerate(Uint8ClampedArray& dstPixelArray, const IntRect& imageRect, int radiusX, int radiusY);
  • trunk/Source/WebCore/platform/graphics/filters/FEOffset.cpp

    r225137 r225185  
    8282}
    8383
    84 TextStream& FEOffset::externalRepresentation(TextStream& ts, int indent) const
     84TextStream& FEOffset::externalRepresentation(TextStream& ts) const
    8585{
    86     writeIndent(ts, indent);
    87     ts << "[feOffset";
     86    ts << indent << "[feOffset";
    8887    FilterEffect::externalRepresentation(ts);
    8988    ts << " dx=\"" << dx() << "\" dy=\"" << dy() << "\"]\n";
    90     inputEffect(0)->externalRepresentation(ts, indent + 1);
     89
     90    TextStream::IndentScope indentScope(ts);
     91    inputEffect(0)->externalRepresentation(ts);
    9192    return ts;
    9293}
  • trunk/Source/WebCore/platform/graphics/filters/FEOffset.h

    r225137 r225185  
    4646    void determineAbsolutePaintRect() override;
    4747
    48     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     48    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    4949
    5050    float m_dx;
  • trunk/Source/WebCore/platform/graphics/filters/FESpecularLighting.cpp

    r225026 r225185  
    5656}
    5757
    58 TextStream& FESpecularLighting::externalRepresentation(TextStream& ts, int indent) const
     58TextStream& FESpecularLighting::externalRepresentation(TextStream& ts) const
    5959{
    60     writeIndent(ts, indent);
    61     ts << "[feSpecularLighting";
     60    ts << indent << "[feSpecularLighting";
    6261    FilterEffect::externalRepresentation(ts);
    6362    ts << " surfaceScale=\"" << m_surfaceScale << "\" "
    6463       << "specualConstant=\"" << m_specularConstant << "\" "
    6564       << "specularExponent=\"" << m_specularExponent << "\"]\n";
    66     inputEffect(0)->externalRepresentation(ts, indent + 1);
     65
     66    TextStream::IndentScope indentScope(ts);
     67    inputEffect(0)->externalRepresentation(ts);
    6768    return ts;
    6869}
  • trunk/Source/WebCore/platform/graphics/filters/FESpecularLighting.h

    r225026 r225185  
    3737    bool setSpecularExponent(float);
    3838
    39     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     39    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    4040
    4141private:
  • trunk/Source/WebCore/platform/graphics/filters/FETile.cpp

    r225137 r225185  
    8787}
    8888
    89 TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const
     89TextStream& FETile::externalRepresentation(TextStream& ts) const
    9090{
    91     writeIndent(ts, indent);
    92     ts << "[feTile";
     91    ts << indent << "[feTile";
    9392    FilterEffect::externalRepresentation(ts);
    9493    ts << "]\n";
    95     inputEffect(0)->externalRepresentation(ts, indent + 1);
     94
     95    TextStream::IndentScope indentScope(ts);
     96    inputEffect(0)->externalRepresentation(ts);
    9697
    9798    return ts;
  • trunk/Source/WebCore/platform/graphics/filters/FETile.h

    r225137 r225185  
    4242    void determineAbsolutePaintRect() override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    4343
    44     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     44    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    4545};
    4646
  • trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp

    r225147 r225185  
    468468}
    469469
    470 TextStream& FETurbulence::externalRepresentation(TextStream& ts, int indent) const
    471 {
    472     writeIndent(ts, indent);
    473     ts << "[feTurbulence";
     470TextStream& FETurbulence::externalRepresentation(TextStream& ts) const
     471{
     472    ts << indent << "[feTurbulence";
    474473    FilterEffect::externalRepresentation(ts);
    475474    ts << " type=\"" << type() << "\" "
  • trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h

    r225147 r225185  
    113113    void platformApplySoftware() override;
    114114    void determineAbsolutePaintRect() override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    115     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     115    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    116116
    117117    void initPaint(PaintingData&);
  • trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp

    r225147 r225185  
    504504}
    505505
    506 TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const
     506TextStream& FilterEffect::externalRepresentation(TextStream& ts) const
    507507{
    508508    // FIXME: We should dump the subRegions of the filter primitives here later. This isn't
  • trunk/Source/WebCore/platform/graphics/filters/FilterEffect.h

    r225147 r225185  
    115115    virtual FilterEffectType filterEffectType() const { return FilterEffectTypeUnknown; }
    116116
    117     virtual WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention = 0) const;
     117    virtual WTF::TextStream& externalRepresentation(WTF::TextStream&) const;
    118118
    119119    // The following functions are SVG specific and will move to RenderSVGResourceFilterPrimitive.
  • trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp

    r225137 r225185  
    6464}
    6565
    66 TextStream& SourceAlpha::externalRepresentation(TextStream& ts, int indent) const
     66TextStream& SourceAlpha::externalRepresentation(TextStream& ts) const
    6767{
    68     writeIndent(ts, indent);
    69     ts << "[SourceAlpha]\n";
     68    ts << indent << "[SourceAlpha]\n";
    7069    return ts;
    7170}
  • trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.h

    r225137 r225185  
    3939    void platformApplySoftware() override;
    4040    void determineAbsolutePaintRect() override;
    41     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     41    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    4242};
    4343
  • trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp

    r225026 r225185  
    6161}
    6262
    63 TextStream& SourceGraphic::externalRepresentation(TextStream& ts, int indent) const
     63TextStream& SourceGraphic::externalRepresentation(TextStream& ts) const
    6464{
    65     writeIndent(ts, indent);
    66     ts << "[SourceGraphic]\n";
     65    ts << indent << "[SourceGraphic]\n";
    6766    return ts;
    6867}
  • trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h

    r225137 r225185  
    4444    void determineAbsolutePaintRect() override;
    4545    void platformApplySoftware() override;
    46     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const override;
     46    WTF::TextStream& externalRepresentation(WTF::TextStream&) const override;
    4747
    4848    FilterEffectType filterEffectType() const override { return FilterEffectTypeSourceInput; }
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r224150 r225185  
    7979using namespace HTMLNames;
    8080
    81 static void writeLayers(TextStream&, const RenderLayer& rootLayer, RenderLayer&, const LayoutRect& paintDirtyRect, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
     81static void writeLayers(TextStream&, const RenderLayer& rootLayer, RenderLayer&, const LayoutRect& paintDirtyRect, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
    8282
    8383static void printBorderStyle(TextStream& ts, const EBorderStyle borderStyle)
     
    524524}
    525525
    526 void write(TextStream& ts, const RenderObject& o, int indent, RenderAsTextBehavior behavior)
     526void write(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior)
    527527{
    528528    if (is<RenderSVGShape>(o)) {
    529         write(ts, downcast<RenderSVGShape>(o), indent, behavior);
     529        write(ts, downcast<RenderSVGShape>(o), behavior);
    530530        return;
    531531    }
    532532    if (is<RenderSVGGradientStop>(o)) {
    533         writeSVGGradientStop(ts, downcast<RenderSVGGradientStop>(o), indent, behavior);
     533        writeSVGGradientStop(ts, downcast<RenderSVGGradientStop>(o), behavior);
    534534        return;
    535535    }
    536536    if (is<RenderSVGResourceContainer>(o)) {
    537         writeSVGResourceContainer(ts, downcast<RenderSVGResourceContainer>(o), indent, behavior);
     537        writeSVGResourceContainer(ts, downcast<RenderSVGResourceContainer>(o), behavior);
    538538        return;
    539539    }
    540540    if (is<RenderSVGContainer>(o)) {
    541         writeSVGContainer(ts, downcast<RenderSVGContainer>(o), indent, behavior);
     541        writeSVGContainer(ts, downcast<RenderSVGContainer>(o), behavior);
    542542        return;
    543543    }
    544544    if (is<RenderSVGRoot>(o)) {
    545         write(ts, downcast<RenderSVGRoot>(o), indent, behavior);
     545        write(ts, downcast<RenderSVGRoot>(o), behavior);
    546546        return;
    547547    }
    548548    if (is<RenderSVGText>(o)) {
    549         writeSVGText(ts, downcast<RenderSVGText>(o), indent, behavior);
     549        writeSVGText(ts, downcast<RenderSVGText>(o), behavior);
    550550        return;
    551551    }
    552552    if (is<RenderSVGInlineText>(o)) {
    553         writeSVGInlineText(ts, downcast<RenderSVGInlineText>(o), indent, behavior);
     553        writeSVGInlineText(ts, downcast<RenderSVGInlineText>(o), behavior);
    554554        return;
    555555    }
    556556    if (is<RenderSVGImage>(o)) {
    557         writeSVGImage(ts, downcast<RenderSVGImage>(o), indent, behavior);
    558         return;
    559     }
    560 
    561     writeIndent(ts, indent);
     557        writeSVGImage(ts, downcast<RenderSVGImage>(o), behavior);
     558        return;
     559    }
     560
     561    ts << indent;
    562562
    563563    RenderTreeAsText::writeRenderObject(ts, o, behavior);
    564564    ts << "\n";
     565
     566    TextStream::IndentScope indentScope(ts);
    565567
    566568    if (is<RenderText>(o)) {
     
    570572            auto resolver = runResolver(downcast<RenderBlockFlow>(*text.parent()), *layout);
    571573            for (auto run : resolver.rangeForRenderer(text)) {
    572                 writeIndent(ts, indent + 1);
     574                ts << indent;
    573575                writeSimpleLine(ts, text, run);
    574576            }
    575577        } else {
    576578            for (auto* box = text.firstTextBox(); box; box = box->nextTextBox()) {
    577                 writeIndent(ts, indent + 1);
     579                ts << indent;
    578580                writeTextRun(ts, text, *box);
    579581            }
     
    584586            if (child.hasLayer())
    585587                continue;
    586             write(ts, child, indent + 1, behavior);
     588            write(ts, child, behavior);
    587589        }
    588590    }
     
    596598                    view.layoutContext().layout();
    597599                if (RenderLayer* layer = root->layer())
    598                     writeLayers(ts, *layer, *layer, layer->rect(), indent + 1, behavior);
     600                    writeLayers(ts, *layer, *layer, layer->rect(), behavior);
    599601            }
    600602        }
     
    609611
    610612static void writeLayer(TextStream& ts, const RenderLayer& layer, const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const LayoutRect& clipRect,
    611     LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
     613    LayerPaintPhase paintPhase = LayerPaintPhaseAll, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
    612614{
    613615    IntRect adjustedLayoutBounds = snappedIntRect(layerBounds);
     
    615617    IntRect adjustedClipRect = snappedIntRect(clipRect);
    616618
    617     writeIndent(ts, indent);
    618 
    619     ts << "layer ";
     619    ts << indent << "layer ";
    620620   
    621621    if (behavior & RenderAsTextShowAddresses)
     
    672672}
    673673
    674 static void writeLayerRenderers(TextStream& ts, const RenderLayer& layer, LayerPaintPhase paintPhase, int indent, RenderAsTextBehavior behavior)
    675 {
    676     if (paintPhase != LayerPaintPhaseBackground)
    677         write(ts, layer.renderer(), indent + 1, behavior);
     674static void writeLayerRenderers(TextStream& ts, const RenderLayer& layer, LayerPaintPhase paintPhase, RenderAsTextBehavior behavior)
     675{
     676    if (paintPhase != LayerPaintPhaseBackground) {
     677        TextStream::IndentScope indentScope(ts);
     678        write(ts, layer.renderer(), behavior);
     679    }
    678680}
    679681
     
    684686}
    685687
    686 static void writeLayers(TextStream& ts, const RenderLayer& rootLayer, RenderLayer& layer, const LayoutRect& paintRect, int indent, RenderAsTextBehavior behavior)
     688static void writeLayers(TextStream& ts, const RenderLayer& rootLayer, RenderLayer& layer, const LayoutRect& paintRect, RenderAsTextBehavior behavior)
    687689{
    688690    // FIXME: Apply overflow to the root layer to not break every test. Complete hack. Sigh.
     
    708710    bool paintsBackgroundSeparately = negativeZOrderList && negativeZOrderList->size() > 0;
    709711    if (shouldPaint && paintsBackgroundSeparately) {
    710         writeLayer(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), LayerPaintPhaseBackground, indent, behavior);
    711         writeLayerRenderers(ts, layer, LayerPaintPhaseBackground, indent, behavior);
     712        writeLayer(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), LayerPaintPhaseBackground, behavior);
     713        writeLayerRenderers(ts, layer, LayerPaintPhaseBackground, behavior);
    712714    }
    713715       
    714716    if (negativeZOrderList) {
    715         int currIndent = indent;
    716717        if (behavior & RenderAsTextShowLayerNesting) {
    717             writeIndent(ts, indent);
    718             ts << " negative z-order list(" << negativeZOrderList->size() << ")\n";
    719             ++currIndent;
     718            ts << indent << " negative z-order list(" << negativeZOrderList->size() << ")\n";
     719            ts.increaseIndent();
    720720        }
    721721       
    722722        for (auto* currLayer : *negativeZOrderList)
    723             writeLayers(ts, rootLayer, *currLayer, paintDirtyRect, currIndent, behavior);
     723            writeLayers(ts, rootLayer, *currLayer, paintDirtyRect, behavior);
     724
     725        if (behavior & RenderAsTextShowLayerNesting)
     726            ts.decreaseIndent();
    724727    }
    725728
    726729    if (shouldPaint) {
    727         writeLayer(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
     730        writeLayer(ts, layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, behavior);
    728731       
    729732        if (behavior & RenderAsTextShowLayerFragments) {
     
    732735           
    733736            if (layerFragments.size() > 1) {
     737                TextStream::IndentScope indentScope(ts, 2);
    734738                for (unsigned i = 0; i < layerFragments.size(); ++i) {
    735739                    const auto& fragment = layerFragments[i];
    736                     writeIndent(ts, indent + 2);
    737                     ts << " fragment " << i << ": bounds in layer " << fragment.layerBounds << " fragment bounds " << fragment.boundingBox << "\n";
     740                    ts << indent << " fragment " << i << ": bounds in layer " << fragment.layerBounds << " fragment bounds " << fragment.boundingBox << "\n";
    738741                }
    739742            }
    740743        }
    741744       
    742         writeLayerRenderers(ts, layer, paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
     745        writeLayerRenderers(ts, layer, paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, behavior);
    743746    }
    744747   
    745748    if (auto* normalFlowList = layer.normalFlowList()) {
    746         int currIndent = indent;
    747749        if (behavior & RenderAsTextShowLayerNesting) {
    748             writeIndent(ts, indent);
    749             ts << " normal flow list(" << normalFlowList->size() << ")\n";
    750             ++currIndent;
     750            ts << indent << " normal flow list(" << normalFlowList->size() << ")\n";
     751            ts.increaseIndent();
    751752        }
    752753       
    753754        for (auto* currLayer : *normalFlowList)
    754             writeLayers(ts, rootLayer, *currLayer, paintDirtyRect, currIndent, behavior);
     755            writeLayers(ts, rootLayer, *currLayer, paintDirtyRect, behavior);
     756
     757        if (behavior & RenderAsTextShowLayerNesting)
     758            ts.decreaseIndent();
    755759    }
    756760
     
    759763
    760764        if (layerCount) {
    761             int currIndent = indent;
    762765            if (behavior & RenderAsTextShowLayerNesting) {
    763                 writeIndent(ts, indent);
    764                 ts << " positive z-order list(" << positiveZOrderList->size() << ")\n";
    765                 ++currIndent;
     766                ts << indent << " positive z-order list(" << positiveZOrderList->size() << ")\n";
     767                ts.increaseIndent();
    766768            }
    767769
    768770            for (auto* currLayer : *positiveZOrderList)
    769                 writeLayers(ts, rootLayer, *currLayer, paintDirtyRect, currIndent, behavior);
     771                writeLayers(ts, rootLayer, *currLayer, paintDirtyRect, behavior);
     772
     773            if (behavior & RenderAsTextShowLayerNesting)
     774                ts.decreaseIndent();
    770775        }
    771776    }
     
    835840
    836841    RenderLayer& layer = *renderer.layer();
    837     writeLayers(ts, layer, layer, layer.rect(), 0, behavior);
     842    writeLayers(ts, layer, layer, layer.rect(), behavior);
    838843    writeSelection(ts, renderer);
    839844    return ts.release();
  • trunk/Source/WebCore/rendering/RenderTreeAsText.h

    r220503 r225185  
    5757WEBCORE_EXPORT String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
    5858WEBCORE_EXPORT String externalRepresentation(Element*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
    59 void write(WTF::TextStream&, const RenderObject&, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
     59void write(WTF::TextStream&, const RenderObject&, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
    6060void writeDebugInfo(WTF::TextStream&, const RenderObject&, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
    6161
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp

    r220503 r225185  
    299299}
    300300
    301 static inline void writeSVGInlineTextBox(TextStream& ts, SVGInlineTextBox* textBox, int indent)
     301static inline void writeSVGInlineTextBox(TextStream& ts, SVGInlineTextBox* textBox)
    302302{
    303303    Vector<SVGTextFragment>& fragments = textBox->textFragments();
     
    308308    String text = textBox->renderer().text();
    309309
     310    TextStream::IndentScope indentScope(ts);
     311
    310312    unsigned fragmentsSize = fragments.size();
    311313    for (unsigned i = 0; i < fragmentsSize; ++i) {
    312314        SVGTextFragment& fragment = fragments.at(i);
    313         writeIndent(ts, indent + 1);
     315        ts << indent;
    314316
    315317        unsigned startOffset = fragment.characterOffset;
     
    353355}
    354356
    355 static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& text, int indent)
     357static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& text)
    356358{
    357359    for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
     
    359361            continue;
    360362
    361         writeSVGInlineTextBox(ts, downcast<SVGInlineTextBox>(box), indent);
    362     }
    363 }
    364 
    365 static void writeStandardPrefix(TextStream& ts, const RenderObject& object, int indent, RenderAsTextBehavior behavior)
    366 {
    367     writeIndent(ts, indent);
     363        writeSVGInlineTextBox(ts, downcast<SVGInlineTextBox>(box));
     364    }
     365}
     366
     367enum class WriteIndentOrNot {
     368    No,
     369    Yes
     370};
     371
     372static void writeStandardPrefix(TextStream& ts, const RenderObject& object, RenderAsTextBehavior behavior, WriteIndentOrNot writeIndent = WriteIndentOrNot::Yes)
     373{
     374    if (writeIndent == WriteIndentOrNot::Yes)
     375        ts << indent;
     376
    368377    ts << object.renderName();
    369378
     
    377386}
    378387
    379 static void writeChildren(TextStream& ts, const RenderElement& parent, int indent, RenderAsTextBehavior behavior)
    380 {
     388static void writeChildren(TextStream& ts, const RenderElement& parent, RenderAsTextBehavior behavior)
     389{
     390    TextStream::IndentScope indentScope(ts);
     391
    381392    for (const auto& child : childrenOfType<RenderObject>(parent))
    382         write(ts, child, indent + 1, behavior);
     393        write(ts, child, behavior);
    383394}
    384395
     
    394405}
    395406
    396 void writeSVGResourceContainer(TextStream& ts, const RenderSVGResourceContainer& resource, int indent, RenderAsTextBehavior behavior)
    397 {
    398     writeStandardPrefix(ts, resource, indent, behavior);
     407void writeSVGResourceContainer(TextStream& ts, const RenderSVGResourceContainer& resource, RenderAsTextBehavior behavior)
     408{
     409    writeStandardPrefix(ts, resource, behavior);
    399410
    400411    const AtomicString& id = resource.element().getIdAttribute();
     
    415426        RefPtr<SVGFilter> dummyFilter = SVGFilter::create(AffineTransform(), dummyRect, dummyRect, dummyRect, true);
    416427        if (auto builder = filter.buildPrimitives(*dummyFilter)) {
     428            TextStream::IndentScope indentScope(ts);
     429
    417430            if (FilterEffect* lastEffect = builder->lastEffect())
    418                 lastEffect->externalRepresentation(ts, indent + 1);
     431                lastEffect->externalRepresentation(ts);
    419432        }
    420433    } else if (resource.resourceType() == ClipperResourceType) {
     
    473486    } else
    474487        ts << "\n";
    475     writeChildren(ts, resource, indent, behavior);
    476 }
    477 
    478 void writeSVGContainer(TextStream& ts, const RenderSVGContainer& container, int indent, RenderAsTextBehavior behavior)
     488    writeChildren(ts, resource, behavior);
     489}
     490
     491void writeSVGContainer(TextStream& ts, const RenderSVGContainer& container, RenderAsTextBehavior behavior)
    479492{
    480493    // Currently RenderSVGResourceFilterPrimitive has no meaningful output.
    481494    if (container.isSVGResourceFilterPrimitive())
    482495        return;
    483     writeStandardPrefix(ts, container, indent, behavior);
     496    writeStandardPrefix(ts, container, behavior);
    484497    writePositionAndStyle(ts, container, behavior);
    485498    ts << "\n";
    486     writeResources(ts, container, indent, behavior);
    487     writeChildren(ts, container, indent, behavior);
    488 }
    489 
    490 void write(TextStream& ts, const RenderSVGRoot& root, int indent, RenderAsTextBehavior behavior)
    491 {
    492     writeStandardPrefix(ts, root, indent, behavior);
     499    writeResources(ts, container, behavior);
     500    writeChildren(ts, container, behavior);
     501}
     502
     503void write(TextStream& ts, const RenderSVGRoot& root, RenderAsTextBehavior behavior)
     504{
     505    writeStandardPrefix(ts, root, behavior);
    493506    writePositionAndStyle(ts, root, behavior);
    494507    ts << "\n";
    495     writeChildren(ts, root, indent, behavior);
    496 }
    497 
    498 void writeSVGText(TextStream& ts, const RenderSVGText& text, int indent, RenderAsTextBehavior behavior)
    499 {
    500     writeStandardPrefix(ts, text, indent, behavior);
     508    writeChildren(ts, root, behavior);
     509}
     510
     511void writeSVGText(TextStream& ts, const RenderSVGText& text, RenderAsTextBehavior behavior)
     512{
     513    writeStandardPrefix(ts, text, behavior);
    501514    writeRenderSVGTextBox(ts, text);
    502515    ts << "\n";
    503     writeResources(ts, text, indent, behavior);
    504     writeChildren(ts, text, indent, behavior);
    505 }
    506 
    507 void writeSVGInlineText(TextStream& ts, const RenderSVGInlineText& text, int indent, RenderAsTextBehavior behavior)
    508 {
    509     writeStandardPrefix(ts, text, indent, behavior);
     516    writeResources(ts, text, behavior);
     517    writeChildren(ts, text, behavior);
     518}
     519
     520void writeSVGInlineText(TextStream& ts, const RenderSVGInlineText& text, RenderAsTextBehavior behavior)
     521{
     522    writeStandardPrefix(ts, text, behavior);
    510523    ts << " " << enclosingIntRect(FloatRect(text.firstRunLocation(), text.floatLinesBoundingBox().size())) << "\n";
    511     writeResources(ts, text, indent, behavior);
    512     writeSVGInlineTextBoxes(ts, text, indent);
    513 }
    514 
    515 void writeSVGImage(TextStream& ts, const RenderSVGImage& image, int indent, RenderAsTextBehavior behavior)
    516 {
    517     writeStandardPrefix(ts, image, indent, behavior);
     524    writeResources(ts, text, behavior);
     525    writeSVGInlineTextBoxes(ts, text);
     526}
     527
     528void writeSVGImage(TextStream& ts, const RenderSVGImage& image, RenderAsTextBehavior behavior)
     529{
     530    writeStandardPrefix(ts, image, behavior);
    518531    writePositionAndStyle(ts, image, behavior);
    519532    ts << "\n";
    520     writeResources(ts, image, indent, behavior);
    521 }
    522 
    523 void write(TextStream& ts, const RenderSVGShape& shape, int indent, RenderAsTextBehavior behavior)
    524 {
    525     writeStandardPrefix(ts, shape, indent, behavior);
     533    writeResources(ts, image, behavior);
     534}
     535
     536void write(TextStream& ts, const RenderSVGShape& shape, RenderAsTextBehavior behavior)
     537{
     538    writeStandardPrefix(ts, shape, behavior);
    526539    ts << shape << "\n";
    527     writeResources(ts, shape, indent, behavior);
    528 }
    529 
    530 void writeSVGGradientStop(TextStream& ts, const RenderSVGGradientStop& stop, int indent, RenderAsTextBehavior behavior)
    531 {
    532     writeStandardPrefix(ts, stop, indent, behavior);
     540    writeResources(ts, shape, behavior);
     541}
     542
     543void writeSVGGradientStop(TextStream& ts, const RenderSVGGradientStop& stop, RenderAsTextBehavior behavior)
     544{
     545    writeStandardPrefix(ts, stop, behavior);
    533546
    534547    ts << " [offset=" << stop.element().offset() << "] [color=" << stop.element().stopColorIncludingOpacity() << "]\n";
    535548}
    536549
    537 void writeResources(TextStream& ts, const RenderObject& renderer, int indent, RenderAsTextBehavior behavior)
     550void writeResources(TextStream& ts, const RenderObject& renderer, RenderAsTextBehavior behavior)
    538551{
    539552    const RenderStyle& style = renderer.style();
     
    544557    if (!svgStyle.maskerResource().isEmpty()) {
    545558        if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(renderer.document(), svgStyle.maskerResource())) {
    546             writeIndent(ts, indent);
    547             ts << " ";
     559            ts << indent << " ";
    548560            writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource());
    549561            ts << " ";
    550             writeStandardPrefix(ts, *masker, 0, behavior);
     562            writeStandardPrefix(ts, *masker, behavior, WriteIndentOrNot::No);
    551563            ts << " " << masker->resourceBoundingBox(renderer) << "\n";
    552564        }
     
    554566    if (!svgStyle.clipperResource().isEmpty()) {
    555567        if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(renderer.document(), svgStyle.clipperResource())) {
    556             writeIndent(ts, indent);
    557             ts << " ";
     568            ts << indent << " ";
    558569            writeNameAndQuotedValue(ts, "clipPath", svgStyle.clipperResource());
    559570            ts << " ";
    560             writeStandardPrefix(ts, *clipper, 0, behavior);
     571            writeStandardPrefix(ts, *clipper, behavior, WriteIndentOrNot::No);
    561572            ts << " " << clipper->resourceBoundingBox(renderer) << "\n";
    562573        }
     
    570581                AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString(referenceFilterOperation.url(), renderer.document());
    571582                if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(renderer.document(), id)) {
    572                     writeIndent(ts, indent);
    573                     ts << " ";
     583                    ts << indent << " ";
    574584                    writeNameAndQuotedValue(ts, "filter", id);
    575585                    ts << " ";
    576                     writeStandardPrefix(ts, *filter, 0, behavior);
     586                    writeStandardPrefix(ts, *filter, behavior, WriteIndentOrNot::No);
    577587                    ts << " " << filter->resourceBoundingBox(renderer) << "\n";
    578588                }
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h

    r220503 r225185  
    4949
    5050// functions used by the main RenderTreeAsText code
    51 void write(WTF::TextStream&, const RenderSVGShape&, int indent, RenderAsTextBehavior);
    52 void write(WTF::TextStream&, const RenderSVGRoot&, int indent, RenderAsTextBehavior);
    53 void writeSVGGradientStop(WTF::TextStream&, const RenderSVGGradientStop&, int indent, RenderAsTextBehavior);
    54 void writeSVGResourceContainer(WTF::TextStream&, const RenderSVGResourceContainer&, int indent, RenderAsTextBehavior);
    55 void writeSVGContainer(WTF::TextStream&, const RenderSVGContainer&, int indent, RenderAsTextBehavior);
    56 void writeSVGImage(WTF::TextStream&, const RenderSVGImage&, int indent, RenderAsTextBehavior);
    57 void writeSVGInlineText(WTF::TextStream&, const RenderSVGInlineText&, int indent, RenderAsTextBehavior);
    58 void writeSVGText(WTF::TextStream&, const RenderSVGText&, int indent, RenderAsTextBehavior);
    59 void writeResources(WTF::TextStream&, const RenderObject&, int indent, RenderAsTextBehavior);
     51void write(WTF::TextStream&, const RenderSVGShape&, RenderAsTextBehavior);
     52void write(WTF::TextStream&, const RenderSVGRoot&, RenderAsTextBehavior);
     53void writeSVGGradientStop(WTF::TextStream&, const RenderSVGGradientStop&, RenderAsTextBehavior);
     54void writeSVGResourceContainer(WTF::TextStream&, const RenderSVGResourceContainer&, RenderAsTextBehavior);
     55void writeSVGContainer(WTF::TextStream&, const RenderSVGContainer&, RenderAsTextBehavior);
     56void writeSVGImage(WTF::TextStream&, const RenderSVGImage&, RenderAsTextBehavior);
     57void writeSVGInlineText(WTF::TextStream&, const RenderSVGInlineText&, RenderAsTextBehavior);
     58void writeSVGText(WTF::TextStream&, const RenderSVGText&, RenderAsTextBehavior);
     59void writeResources(WTF::TextStream&, const RenderObject&, RenderAsTextBehavior);
    6060
    6161// helper operators specific to dumping the render tree. these are used in various classes to dump the render tree
  • trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp

    r225152 r225185  
    138138}
    139139
    140 TextStream& FEImage::externalRepresentation(TextStream& ts, int indent) const
     140TextStream& FEImage::externalRepresentation(TextStream& ts) const
    141141{
    142142    FloatSize imageSize;
     
    145145    else if (RenderObject* renderer = referencedRenderer())
    146146        imageSize = enclosingIntRect(renderer->repaintRectInLocalCoordinates()).size();
    147     writeIndent(ts, indent);
    148     ts << "[feImage";
     147    ts << indent << "[feImage";
    149148    FilterEffect::externalRepresentation(ts);
    150149    ts << " image-size=\"" << imageSize.width() << "x" << imageSize.height() << "\"]\n";
  • trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h

    r225137 r225185  
    5050    void platformApplySoftware() final;
    5151    void determineAbsolutePaintRect() final;
    52     WTF::TextStream& externalRepresentation(WTF::TextStream&, int indention) const final;
     52    WTF::TextStream& externalRepresentation(WTF::TextStream&) const final;
    5353
    5454    RefPtr<Image> m_image;
Note: See TracChangeset for help on using the changeset viewer.