Title: [260903] trunk/Source/WebCore
Revision
260903
Author
[email protected]
Date
2020-04-29 10:20:17 -0700 (Wed, 29 Apr 2020)

Log Message

[LFC][TFC] Take row span into account when checking for missing cells
https://bugs.webkit.org/show_bug.cgi?id=211184

Reviewed by Antti Koivisto.

The tree builder looks for missing cells in the table grid and fills in the gaps with empty cells.
This patch takes row spanning into account and make sure we don't end up adding an extra, redundant cell.

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::buildTableStructure):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260902 => 260903)


--- trunk/Source/WebCore/ChangeLog	2020-04-29 16:55:10 UTC (rev 260902)
+++ trunk/Source/WebCore/ChangeLog	2020-04-29 17:20:17 UTC (rev 260903)
@@ -1,3 +1,16 @@
+2020-04-29  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Take row span into account when checking for missing cells
+        https://bugs.webkit.org/show_bug.cgi?id=211184
+
+        Reviewed by Antti Koivisto.
+
+        The tree builder looks for missing cells in the table grid and fills in the gaps with empty cells.
+        This patch takes row spanning into account and make sure we don't end up adding an extra, redundant cell.
+
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::TreeBuilder::buildTableStructure):
+
 2020-04-29  Youenn Fablet  <[email protected]>
 
         Update SWServer.cpp originURL after https://trac.webkit.org/changeset/260707

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (260902 => 260903)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-04-29 16:55:10 UTC (rev 260902)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-04-29 17:20:17 UTC (rev 260903)
@@ -311,12 +311,18 @@
         // Find the max number of columns and fill in the gaps.
         size_t maximumColumns = 0;
         Vector<size_t> numberOfCellsPerRow;
+        size_t currentRow = 0;
         for (auto& rowBox : childrenOfType<ContainerBox>(tableBody)) {
-            size_t numberOfCells = 0;
-            for (auto& cellBox : childrenOfType<ContainerBox>(rowBox))
-                numberOfCells += cellBox.columnSpan();
-            numberOfCellsPerRow.append(numberOfCells);
-            maximumColumns = std::max(maximumColumns, numberOfCells);
+            for (auto& cellBox : childrenOfType<ContainerBox>(rowBox)) {
+                for (size_t rowSpan = 0; rowSpan < cellBox.rowSpan(); ++rowSpan) {
+                    if (numberOfCellsPerRow.size() <= currentRow + rowSpan)
+                        numberOfCellsPerRow.append(cellBox.columnSpan());
+                    else
+                        numberOfCellsPerRow[currentRow + rowSpan] += cellBox.columnSpan();
+                }
+            }
+            maximumColumns = std::max(maximumColumns, numberOfCellsPerRow[currentRow]);
+            ++currentRow;
         }
         // Fill in the gaps.
         size_t rowIndex = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to