Title: [274627] trunk/Source/WebCore
Revision
274627
Author
[email protected]
Date
2021-03-18 02:29:54 -0700 (Thu, 18 Mar 2021)

Log Message

Pagination mode: Increase the amount of recursions allowed by RenderTable::layout()
https://bugs.webkit.org/show_bug.cgi?id=218575

Patch by Carlos Garcia Campos <[email protected]> on 2021-03-18
Reviewed by Zalan Bujtas.

In r219394 a recursion check was introduced to avoid infinite recursion when a section is always moved on
RenderTable::layout(). But sometimes it's needed to recurse more than once to layout the table when section move
due to the pagination. This patch limits the recursion level to the amount of sections in the table, instead of
just one.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
* rendering/RenderTable.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274626 => 274627)


--- trunk/Source/WebCore/ChangeLog	2021-03-18 09:18:40 UTC (rev 274626)
+++ trunk/Source/WebCore/ChangeLog	2021-03-18 09:29:54 UTC (rev 274627)
@@ -1,3 +1,19 @@
+2021-03-18  Carlos Garcia Campos  <[email protected]>
+
+        Pagination mode: Increase the amount of recursions allowed by RenderTable::layout()
+        https://bugs.webkit.org/show_bug.cgi?id=218575
+
+        Reviewed by Zalan Bujtas.
+
+        In r219394 a recursion check was introduced to avoid infinite recursion when a section is always moved on
+        RenderTable::layout(). But sometimes it's needed to recurse more than once to layout the table when section move
+        due to the pagination. This patch limits the recursion level to the amount of sections in the table, instead of
+        just one.
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::layout):
+        * rendering/RenderTable.h:
+
 2021-03-18  Frédéric Wang  <[email protected]>
 
         ASSERTION FAILED: node.isConnected() in matchSlottedPseudoElementRules

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (274626 => 274627)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2021-03-18 09:18:40 UTC (rev 274626)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2021-03-18 09:29:54 UTC (rev 274627)
@@ -437,6 +437,7 @@
     recalcBordersInRowDirection();
     bool sectionMoved = false;
     LayoutUnit movedSectionLogicalTop;
+    unsigned sectionCount = 0;
 
     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
     {
@@ -537,6 +538,7 @@
         // position the table sections
         RenderTableSection* section = topSection();
         while (section) {
+            sectionCount++;
             if (!sectionMoved && section->logicalTop() != logicalHeight()) {
                 sectionMoved = true;
                 movedSectionLogicalTop = std::min(logicalHeight(), section->logicalTop()) + (style().isHorizontalWritingMode() ? section->visualOverflowRect().y() : section->visualOverflowRect().x());
@@ -585,8 +587,8 @@
     bool paginated = layoutState && layoutState->isPaginated();
     if (sectionMoved && paginated) {
         // FIXME: Table layout should always stabilize even when section moves (see webkit.org/b/174412).
-        if (!m_inRecursiveSectionMovedWithPagination) {
-            SetForScope<bool> paginatedSectionMoved(m_inRecursiveSectionMovedWithPagination, true);
+        if (m_recursiveSectionMovedWithPaginationLevel < sectionCount) {
+            SetForScope<unsigned> recursiveSectionMovedWithPaginationLevel(m_recursiveSectionMovedWithPaginationLevel, m_recursiveSectionMovedWithPaginationLevel + 1);
             markForPaginationRelayoutIfNeeded();
             layoutIfNeeded();
         } else

Modified: trunk/Source/WebCore/rendering/RenderTable.h (274626 => 274627)


--- trunk/Source/WebCore/rendering/RenderTable.h	2021-03-18 09:18:40 UTC (rev 274626)
+++ trunk/Source/WebCore/rendering/RenderTable.h	2021-03-18 09:29:54 UTC (rev 274627)
@@ -369,7 +369,7 @@
     LayoutUnit m_borderEnd;
     mutable LayoutUnit m_columnOffsetTop;
     mutable LayoutUnit m_columnOffsetHeight;
-    bool m_inRecursiveSectionMovedWithPagination { false };
+    unsigned m_recursiveSectionMovedWithPaginationLevel { 0 };
 };
 
 inline bool isDirectionSame(const RenderBox* tableItem, const RenderBox* otherTableItem) { return tableItem && otherTableItem ? tableItem->style().direction() == otherTableItem->style().direction() : true; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to