Title: [279958] trunk/Source/WebCore
Revision
279958
Author
simon.fra...@apple.com
Date
2021-07-15 13:30:36 -0700 (Thu, 15 Jul 2021)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279957 => 279958)


--- trunk/Source/WebCore/ChangeLog	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/ChangeLog	2021-07-15 20:30:36 UTC (rev 279958)
@@ -1,3 +1,30 @@
+2021-07-15  Simon Fraser  <simon.fra...@apple.com>
+
+        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):
+
 2021-07-15  Brady Eidson  <beid...@apple.com>
 
         MemoryIDBBackingStore cleanup.

Modified: trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp (279957 => 279958)


--- trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/rendering/RenderFragmentContainer.cpp	2021-07-15 20:30:36 UTC (rev 279958)
@@ -52,7 +52,6 @@
 RenderFragmentContainer::RenderFragmentContainer(Element& element, RenderStyle&& style, RenderFragmentedFlow* fragmentedFlow)
     : RenderBlockFlow(element, WTFMove(style))
     , m_fragmentedFlow(fragmentedFlow)
-    , m_isValid(false)
 {
 }
 
@@ -59,7 +58,6 @@
 RenderFragmentContainer::RenderFragmentContainer(Document& document, RenderStyle&& style, RenderFragmentedFlow* fragmentedFlow)
     : RenderBlockFlow(document, WTFMove(style))
     , m_fragmentedFlow(fragmentedFlow)
-    , m_isValid(false)
 {
 }
 

Modified: trunk/Source/WebCore/rendering/RenderFragmentContainer.h (279957 => 279958)


--- trunk/Source/WebCore/rendering/RenderFragmentContainer.h	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/rendering/RenderFragmentContainer.h	2021-07-15 20:30:36 UTC (rev 279958)
@@ -164,7 +164,7 @@
     typedef HashMap<const RenderBox*, std::unique_ptr<RenderBoxFragmentInfo>> RenderBoxFragmentInfoMap;
     RenderBoxFragmentInfoMap m_renderBoxFragmentInfo;
 
-    bool m_isValid : 1;
+    bool m_isValid { false };
 };
 
 class CurrentRenderFragmentContainerMaintainer {

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp (279957 => 279958)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp	2021-07-15 20:30:36 UTC (rev 279958)
@@ -43,15 +43,6 @@
 RenderMultiColumnFlow::RenderMultiColumnFlow(Document& document, RenderStyle&& style)
     : RenderFragmentedFlow(document, WTFMove(style))
     , m_spannerMap(makeUnique<SpannerMap>())
-    , m_lastSetWorkedOn(nullptr)
-    , m_columnCount(1)
-    , m_columnWidth(0)
-    , m_columnHeightAvailable(0)
-    , m_inLayout(false)
-    , m_inBalancingPass(false)
-    , m_needsHeightsRecalculation(false)
-    , m_progressionIsInline(false)
-    , m_progressionIsReversed(false)
 {
     setFragmentedFlowState(InsideInFragmentedFlow);
 }

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h (279957 => 279958)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h	2021-07-15 20:30:36 UTC (rev 279958)
@@ -120,18 +120,18 @@
     // The last set we worked on. It's not to be used as the "current set". The concept of a
     // "current set" is difficult, since layout may jump back and forth in the tree, due to wrong
     // top location estimates (due to e.g. margin collapsing), and possibly for other reasons.
-    RenderMultiColumnSet* m_lastSetWorkedOn;
+    RenderMultiColumnSet* m_lastSetWorkedOn { nullptr };
 
-    unsigned m_columnCount; // The default column count/width that are based off our containing block width. These values represent only the default,
-    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.
+    unsigned m_columnCount { 1 }; // The default column count/width that are based off our containing block width. These values represent only the default,
+    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.
 
     LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto.
-    bool m_inLayout; // Set while we're laying out the flow thread, during which colum set heights are unknown.
-    bool m_inBalancingPass; // Guard to avoid re-entering column balancing.
-    bool m_needsHeightsRecalculation;
+    bool m_inLayout { false }; // Set while we're laying out the flow thread, during which colum set heights are unknown.
+    bool m_inBalancingPass { false }; // Guard to avoid re-entering column balancing.
+    bool m_needsHeightsRecalculation { false };
     
-    bool m_progressionIsInline;
-    bool m_progressionIsReversed;
+    bool m_progressionIsInline { false };
+    bool m_progressionIsReversed { false };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (279957 => 279958)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2021-07-15 20:30:36 UTC (rev 279958)
@@ -42,15 +42,8 @@
 
 RenderMultiColumnSet::RenderMultiColumnSet(RenderFragmentedFlow& fragmentedFlow, RenderStyle&& style)
     : RenderFragmentContainerSet(fragmentedFlow.document(), WTFMove(style), fragmentedFlow)
-    , m_computedColumnCount(1)
-    , m_computedColumnWidth(0)
-    , m_computedColumnHeight(0)
-    , m_availableColumnHeight(0)
-    , m_columnHeightComputed(false)
     , m_maxColumnHeight(RenderFragmentedFlow::maxLogicalHeight())
     , m_minSpaceShortage(RenderFragmentedFlow::maxLogicalHeight())
-    , m_minimumColumnHeight(0)
-    , m_spaceShortageForSizeContainment(0)
 {
 }
 

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (279957 => 279958)


--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h	2021-07-15 20:30:36 UTC (rev 279958)
@@ -138,6 +138,8 @@
     LayoutRect columnRectAt(unsigned index) const;
     unsigned columnCount() const;
 
+    LayoutUnit columnGap() const;
+
 private:
     void addOverflowFromChildren() override;
     
@@ -168,7 +170,6 @@
     const char* renderName() const override;
 
     LayoutUnit calculateMaxColumnHeight() const;
-    LayoutUnit columnGap() const;
 
     LayoutUnit columnLogicalLeft(unsigned) const;
     LayoutUnit columnLogicalTop(unsigned) const;
@@ -197,11 +198,11 @@
 
     LayoutUnit calculateBalancedHeight(bool initial) const;
 
-    unsigned m_computedColumnCount; // Used column count (the resulting 'N' from the pseudo-algorithm in the multicol spec)
+    unsigned m_computedColumnCount { 1 }; // Used column count (the resulting 'N' from the pseudo-algorithm in the multicol spec)
     LayoutUnit m_computedColumnWidth; // Used column width (the resulting 'W' from the pseudo-algorithm in the multicol spec)
     LayoutUnit m_computedColumnHeight;
     LayoutUnit m_availableColumnHeight;
-    bool m_columnHeightComputed;
+    bool m_columnHeightComputed { false };
 
     // The following variables are used when balancing the column set.
     LayoutUnit m_maxColumnHeight; // Maximum column height allowed.
@@ -220,7 +221,7 @@
     public:
         ContentRun(LayoutUnit breakOffset)
             : m_breakOffset(breakOffset)
-            , m_assumedImplicitBreaks(0) { }
+        { }
 
         unsigned assumedImplicitBreaks() const { return m_assumedImplicitBreaks; }
         void assumeAnotherImplicitBreak() { m_assumedImplicitBreaks++; }
@@ -232,7 +233,7 @@
 
     private:
         LayoutUnit m_breakOffset; // Flow thread offset where this run ends.
-        unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this run assumed so far.
+        unsigned m_assumedImplicitBreaks { 0 }; // Number of implicit breaks in this run assumed so far.
     };
     Vector<ContentRun, 1> m_contentRuns;
 };

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (279957 => 279958)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2021-07-15 20:15:56 UTC (rev 279957)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2021-07-15 20:30:36 UTC (rev 279958)
@@ -56,6 +56,7 @@
 #include "RenderLayerCompositor.h"
 #include "RenderLineBreak.h"
 #include "RenderMultiColumnFlow.h"
+#include "RenderMultiColumnSet.h"
 #include "RenderRuby.h"
 #include "RenderSVGBlock.h"
 #include "RenderSVGInline.h"
@@ -1067,9 +1068,6 @@
     if (renderer->fragmentedFlowState() == RenderObject::NotInsideFragmentedFlow)
         return nullptr;
 
-    if (is<RenderFragmentedFlow>(*renderer))
-        return downcast<RenderFragmentedFlow>(renderer);
-
     if (is<RenderBlock>(*renderer))
         return downcast<RenderBlock>(*renderer).cachedEnclosingFragmentedFlow();
 
@@ -1078,23 +1076,38 @@
 
 void RenderObject::outputRegionsInformation(TextStream& stream) const
 {
-    const RenderFragmentedFlow* ftcb = enclosingFragmentedFlowFromRenderer(this);
+    if (is<RenderFragmentedFlow>(*this)) {
+        const auto& fragmentedFlow = downcast<RenderFragmentedFlow>(*this);
+        auto fragmentContainers = fragmentedFlow.renderFragmentContainerList();
 
-    if (!ftcb) {
+        stream << " [fragment containers ";
+        bool first = true;
+        for (const auto* fragment : fragmentContainers) {
+            if (!first)
+                stream << ", ";
+            first = false;
+            stream << fragment;
+        }
+        stream << "]";
+    }
+
+    const RenderFragmentedFlow* fragmentedFlow = enclosingFragmentedFlowFromRenderer(this);
+
+    if (!fragmentedFlow) {
         // Only the boxes have region range information.
         // Try to get the flow thread containing block information
         // from the containing block of this box.
         if (is<RenderBox>(*this))
-            ftcb = enclosingFragmentedFlowFromRenderer(containingBlock());
+            fragmentedFlow = enclosingFragmentedFlowFromRenderer(containingBlock());
     }
 
-    if (!ftcb)
+    if (!fragmentedFlow || !is<RenderBox>(*this))
         return;
 
-    RenderFragmentContainer* startRegion = nullptr;
-    RenderFragmentContainer* endRegion = nullptr;
-    ftcb->getFragmentRangeForBox(downcast<RenderBox>(this), startRegion, endRegion);
-    stream << " [Rs:" << startRegion << " Re:" << endRegion << "]";
+    RenderFragmentContainer* startContainer = nullptr;
+    RenderFragmentContainer* endContainer = nullptr;
+    fragmentedFlow->getFragmentRangeForBox(downcast<RenderBox>(this), startContainer, endContainer);
+    stream << " [spans fragment containers in flow " << fragmentedFlow << " from " << startContainer << " to " << endContainer << "]";
 }
 
 void RenderObject::outputRenderObject(TextStream& stream, bool mark, int depth) const
@@ -1234,7 +1247,13 @@
         }
     }
 
+    if (is<RenderMultiColumnSet>(*this)) {
+        const auto& multicolSet = downcast<RenderMultiColumnSet>(*this);
+        stream << " (column count " << multicolSet.computedColumnCount() << ", size " << multicolSet.computedColumnWidth() << "x" << multicolSet.computedColumnHeight() << ", gap " << multicolSet.columnGap() << ")";
+    }
+
     outputRegionsInformation(stream);
+
     if (needsLayout()) {
         stream << " layout->";
         if (selfNeedsLayout())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to