Changeset 279958 in webkit


Ignore:
Timestamp:
Jul 15, 2021, 1:30:36 PM (4 years ago)
Author:
Simon Fraser
Message:

Improve multicol logging in render tree dumps, and cleanup
https://bugs.webkit.org/show_bug.cgi?id=227994

Reviewed by Alan Bujtas.

For a RenderFragmentedFlow dump the list of fragment containers, and clean up the existing
dumping of containers for a renderer inside a fragmented flow. Also dump column information
for RenderMultiColumnSet.

Use initializers for member variables in various fragmentation-related renderers.

  • rendering/RenderFragmentContainer.cpp:

(WebCore::RenderFragmentContainer::RenderFragmentContainer):

  • rendering/RenderFragmentContainer.h:
  • rendering/RenderMultiColumnFlow.cpp:

(WebCore::RenderMultiColumnFlow::RenderMultiColumnFlow):

  • rendering/RenderMultiColumnFlow.h:
  • rendering/RenderMultiColumnSet.cpp:

(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):

  • rendering/RenderMultiColumnSet.h:
  • rendering/RenderObject.cpp:

(WebCore::enclosingFragmentedFlowFromRenderer):
(WebCore::RenderObject::outputRegionsInformation const):
(WebCore::RenderObject::outputRenderObject const):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r279956 r279958  
     12021-07-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Improve multicol logging in render tree dumps, and cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=227994
     5
     6        Reviewed by Alan Bujtas.
     7
     8        For a RenderFragmentedFlow dump the list of fragment containers, and clean up the existing
     9        dumping of containers for a renderer inside a fragmented flow. Also dump column information
     10        for RenderMultiColumnSet.
     11
     12        Use initializers for member variables in various fragmentation-related renderers.
     13
     14        * rendering/RenderFragmentContainer.cpp:
     15        (WebCore::RenderFragmentContainer::RenderFragmentContainer):
     16        * rendering/RenderFragmentContainer.h:
     17        * rendering/RenderMultiColumnFlow.cpp:
     18        (WebCore::RenderMultiColumnFlow::RenderMultiColumnFlow):
     19        * rendering/RenderMultiColumnFlow.h:
     20        * rendering/RenderMultiColumnSet.cpp:
     21        (WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
     22        * rendering/RenderMultiColumnSet.h:
     23        * rendering/RenderObject.cpp:
     24        (WebCore::enclosingFragmentedFlowFromRenderer):
     25        (WebCore::RenderObject::outputRegionsInformation const):
     26        (WebCore::RenderObject::outputRenderObject const):
     27
    1282021-07-15  Brady Eidson  <beidson@apple.com>
    229
  • trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp

    r279918 r279958  
    5353    : RenderBlockFlow(element, WTFMove(style))
    5454    , m_fragmentedFlow(fragmentedFlow)
    55     , m_isValid(false)
    5655{
    5756}
     
    6059    : RenderBlockFlow(document, WTFMove(style))
    6160    , m_fragmentedFlow(fragmentedFlow)
    62     , m_isValid(false)
    6361{
    6462}
  • trunk/Source/WebCore/rendering/RenderFragmentContainer.h

    r275478 r279958  
    165165    RenderBoxFragmentInfoMap m_renderBoxFragmentInfo;
    166166
    167     bool m_isValid : 1;
     167    bool m_isValid { false };
    168168};
    169169
  • trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp

    r277321 r279958  
    4444    : RenderFragmentedFlow(document, WTFMove(style))
    4545    , m_spannerMap(makeUnique<SpannerMap>())
    46     , m_lastSetWorkedOn(nullptr)
    47     , m_columnCount(1)
    48     , m_columnWidth(0)
    49     , m_columnHeightAvailable(0)
    50     , m_inLayout(false)
    51     , m_inBalancingPass(false)
    52     , m_needsHeightsRecalculation(false)
    53     , m_progressionIsInline(false)
    54     , m_progressionIsReversed(false)
    5546{
    5647    setFragmentedFlowState(InsideInFragmentedFlow);
  • trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h

    r277321 r279958  
    121121    // "current set" is difficult, since layout may jump back and forth in the tree, due to wrong
    122122    // top location estimates (due to e.g. margin collapsing), and possibly for other reasons.
    123     RenderMultiColumnSet* m_lastSetWorkedOn;
     123    RenderMultiColumnSet* m_lastSetWorkedOn { nullptr };
    124124
    125     unsigned m_columnCount; // The default column count/width that are based off our containing block width. These values represent only the default,
    126     LayoutUnit m_columnWidth; // A multi-column block that is split across variable width pages or fragments will have different column counts and widths in each. These values will be cached (eventually) for multi-column blocks.
     125    unsigned m_columnCount { 1 }; // The default column count/width that are based off our containing block width. These values represent only the default,
     126    LayoutUnit m_columnWidth { 0 }; // A multi-column block that is split across variable width pages or fragments will have different column counts and widths in each. These values will be cached (eventually) for multi-column blocks.
    127127
    128128    LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto.
    129     bool m_inLayout; // Set while we're laying out the flow thread, during which colum set heights are unknown.
    130     bool m_inBalancingPass; // Guard to avoid re-entering column balancing.
    131     bool m_needsHeightsRecalculation;
     129    bool m_inLayout { false }; // Set while we're laying out the flow thread, during which colum set heights are unknown.
     130    bool m_inBalancingPass { false }; // Guard to avoid re-entering column balancing.
     131    bool m_needsHeightsRecalculation { false };
    132132   
    133     bool m_progressionIsInline;
    134     bool m_progressionIsReversed;
     133    bool m_progressionIsInline { false };
     134    bool m_progressionIsReversed { false };
    135135};
    136136
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp

    r279918 r279958  
    4343RenderMultiColumnSet::RenderMultiColumnSet(RenderFragmentedFlow& fragmentedFlow, RenderStyle&& style)
    4444    : RenderFragmentContainerSet(fragmentedFlow.document(), WTFMove(style), fragmentedFlow)
    45     , m_computedColumnCount(1)
    46     , m_computedColumnWidth(0)
    47     , m_computedColumnHeight(0)
    48     , m_availableColumnHeight(0)
    49     , m_columnHeightComputed(false)
    5045    , m_maxColumnHeight(RenderFragmentedFlow::maxLogicalHeight())
    5146    , m_minSpaceShortage(RenderFragmentedFlow::maxLogicalHeight())
    52     , m_minimumColumnHeight(0)
    53     , m_spaceShortageForSizeContainment(0)
    5447{
    5548}
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.h

    r277321 r279958  
    139139    unsigned columnCount() const;
    140140
     141    LayoutUnit columnGap() const;
     142
    141143private:
    142144    void addOverflowFromChildren() override;
     
    169171
    170172    LayoutUnit calculateMaxColumnHeight() const;
    171     LayoutUnit columnGap() const;
    172173
    173174    LayoutUnit columnLogicalLeft(unsigned) const;
     
    198199    LayoutUnit calculateBalancedHeight(bool initial) const;
    199200
    200     unsigned m_computedColumnCount; // Used column count (the resulting 'N' from the pseudo-algorithm in the multicol spec)
     201    unsigned m_computedColumnCount { 1 }; // Used column count (the resulting 'N' from the pseudo-algorithm in the multicol spec)
    201202    LayoutUnit m_computedColumnWidth; // Used column width (the resulting 'W' from the pseudo-algorithm in the multicol spec)
    202203    LayoutUnit m_computedColumnHeight;
    203204    LayoutUnit m_availableColumnHeight;
    204     bool m_columnHeightComputed;
     205    bool m_columnHeightComputed { false };
    205206
    206207    // The following variables are used when balancing the column set.
     
    221222        ContentRun(LayoutUnit breakOffset)
    222223            : m_breakOffset(breakOffset)
    223             , m_assumedImplicitBreaks(0) { }
     224        { }
    224225
    225226        unsigned assumedImplicitBreaks() const { return m_assumedImplicitBreaks; }
     
    233234    private:
    234235        LayoutUnit m_breakOffset; // Flow thread offset where this run ends.
    235         unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this run assumed so far.
     236        unsigned m_assumedImplicitBreaks { 0 }; // Number of implicit breaks in this run assumed so far.
    236237    };
    237238    Vector<ContentRun, 1> m_contentRuns;
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r279918 r279958  
    5757#include "RenderLineBreak.h"
    5858#include "RenderMultiColumnFlow.h"
     59#include "RenderMultiColumnSet.h"
    5960#include "RenderRuby.h"
    6061#include "RenderSVGBlock.h"
     
    10681069        return nullptr;
    10691070
    1070     if (is<RenderFragmentedFlow>(*renderer))
    1071         return downcast<RenderFragmentedFlow>(renderer);
    1072 
    10731071    if (is<RenderBlock>(*renderer))
    10741072        return downcast<RenderBlock>(*renderer).cachedEnclosingFragmentedFlow();
     
    10791077void RenderObject::outputRegionsInformation(TextStream& stream) const
    10801078{
    1081     const RenderFragmentedFlow* ftcb = enclosingFragmentedFlowFromRenderer(this);
    1082 
    1083     if (!ftcb) {
     1079    if (is<RenderFragmentedFlow>(*this)) {
     1080        const auto& fragmentedFlow = downcast<RenderFragmentedFlow>(*this);
     1081        auto fragmentContainers = fragmentedFlow.renderFragmentContainerList();
     1082
     1083        stream << " [fragment containers ";
     1084        bool first = true;
     1085        for (const auto* fragment : fragmentContainers) {
     1086            if (!first)
     1087                stream << ", ";
     1088            first = false;
     1089            stream << fragment;
     1090        }
     1091        stream << "]";
     1092    }
     1093
     1094    const RenderFragmentedFlow* fragmentedFlow = enclosingFragmentedFlowFromRenderer(this);
     1095
     1096    if (!fragmentedFlow) {
    10841097        // Only the boxes have region range information.
    10851098        // Try to get the flow thread containing block information
    10861099        // from the containing block of this box.
    10871100        if (is<RenderBox>(*this))
    1088             ftcb = enclosingFragmentedFlowFromRenderer(containingBlock());
    1089     }
    1090 
    1091     if (!ftcb)
    1092         return;
    1093 
    1094     RenderFragmentContainer* startRegion = nullptr;
    1095     RenderFragmentContainer* endRegion = nullptr;
    1096     ftcb->getFragmentRangeForBox(downcast<RenderBox>(this), startRegion, endRegion);
    1097     stream << " [Rs:" << startRegion << " Re:" << endRegion << "]";
     1101            fragmentedFlow = enclosingFragmentedFlowFromRenderer(containingBlock());
     1102    }
     1103
     1104    if (!fragmentedFlow || !is<RenderBox>(*this))
     1105        return;
     1106
     1107    RenderFragmentContainer* startContainer = nullptr;
     1108    RenderFragmentContainer* endContainer = nullptr;
     1109    fragmentedFlow->getFragmentRangeForBox(downcast<RenderBox>(this), startContainer, endContainer);
     1110    stream << " [spans fragment containers in flow " << fragmentedFlow << " from " << startContainer << " to " << endContainer << "]";
    10981111}
    10991112
     
    12351248    }
    12361249
     1250    if (is<RenderMultiColumnSet>(*this)) {
     1251        const auto& multicolSet = downcast<RenderMultiColumnSet>(*this);
     1252        stream << " (column count " << multicolSet.computedColumnCount() << ", size " << multicolSet.computedColumnWidth() << "x" << multicolSet.computedColumnHeight() << ", gap " << multicolSet.columnGap() << ")";
     1253    }
     1254
    12371255    outputRegionsInformation(stream);
     1256
    12381257    if (needsLayout()) {
    12391258        stream << " layout->";
Note: See TracChangeset for help on using the changeset viewer.