Diff
Modified: trunk/LayoutTests/ChangeLog (260008 => 260009)
--- trunk/LayoutTests/ChangeLog 2020-04-13 15:23:31 UTC (rev 260008)
+++ trunk/LayoutTests/ChangeLog 2020-04-13 15:58:26 UTC (rev 260009)
@@ -1,3 +1,13 @@
+2020-04-13 Zalan Bujtas <[email protected]>
+
+ [LFC][TFC] Pre-fill columnIntrinsicWidths vector
+ https://bugs.webkit.org/show_bug.cgi?id=210415
+
+ Reviewed by Antti Koivisto.
+
+ * fast/layoutformattingcontext/table-with-column-spanner-first-row-expected.txt: Added.
+ * fast/layoutformattingcontext/table-with-column-spanner-first-row.html: Added.
+
2020-04-13 Yusuke Suzuki <[email protected]>
module's default cross-origin value should be "anonymous"
Added: trunk/LayoutTests/fast/layoutformattingcontext/table-with-column-spanner-first-row-expected.txt (0 => 260009)
--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-column-spanner-first-row-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-column-spanner-first-row-expected.txt 2020-04-13 15:58:26 UTC (rev 260009)
@@ -0,0 +1,28 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x69
+ RenderBlock {HTML} at (0,0) size 800x69
+ RenderBody {BODY} at (8,8) size 784x53
+ RenderTable {TABLE} at (0,0) size 600x53
+ RenderTableSection {TBODY} at (0,0) size 600x53
+ RenderTableRow {TR} at (0,2) size 600x15
+ RenderTableCell {TD} at (2,2) size 597x15 [r=0 c=0 rs=1 cs=3]
+ RenderText {#text} at (1,1) size 65x13
+ text run at (1,1) width 65: "#############"
+ RenderTableRow {TR} at (0,19) size 600x15
+ RenderTableCell {TD} at (2,19) size 455x15 [r=1 c=0 rs=1 cs=2]
+ RenderText {#text} at (1,1) size 30x13
+ text run at (1,1) width 30: "######"
+ RenderTableCell {TD} at (458,19) size 141x15 [r=1 c=2 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 10x13
+ text run at (1,1) width 10: "##"
+ RenderTableRow {TR} at (0,36) size 600x15
+ RenderTableCell {TD} at (2,36) size 314x15 [r=2 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 25x13
+ text run at (1,1) width 25: "#####"
+ RenderTableCell {TD} at (317,36) size 140x15 [r=2 c=1 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 10x13
+ text run at (1,1) width 10: "##"
+ RenderTableCell {TD} at (458,36) size 141x15 [r=2 c=2 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 5x13
+ text run at (1,1) width 5: "#"
Added: trunk/LayoutTests/fast/layoutformattingcontext/table-with-column-spanner-first-row.html (0 => 260009)
--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-column-spanner-first-row.html (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-column-spanner-first-row.html 2020-04-13 15:58:26 UTC (rev 260009)
@@ -0,0 +1,11 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+ font-size: 10px;
+}
+</style>
+<table style="width: 600px;">
+<tr><td colspan=3">#############</td></tr>
+<tr><td colspan=2">######</td><td>##</td></tr>
+<tr><td>#####</td><td>##</td><td>#</td></tr>
+</table>
Modified: trunk/Source/WebCore/ChangeLog (260008 => 260009)
--- trunk/Source/WebCore/ChangeLog 2020-04-13 15:23:31 UTC (rev 260008)
+++ trunk/Source/WebCore/ChangeLog 2020-04-13 15:58:26 UTC (rev 260009)
@@ -1,3 +1,19 @@
+2020-04-13 Zalan Bujtas <[email protected]>
+
+ [LFC][TFC] Pre-fill columnIntrinsicWidths vector
+ https://bugs.webkit.org/show_bug.cgi?id=210415
+
+ Reviewed by Antti Koivisto.
+
+ Vector<ColumnMinimumWidth> has a fixed number of entries (number of columns in the table).
+ (This patch also flips the shouldFlex flag to isFixedWidth. It reads better in the context of minimum _widths_).
+
+ Test: fast/layoutformattingcontext/table-with-column-spanner-first-row.html
+
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
+ (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
+
2020-04-13 Adrian Perez de Castro <[email protected]>
[GTK4] Fix usage of GDK event functions in PlatformWheelEventGtk
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (260008 => 260009)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-04-13 15:23:31 UTC (rev 260008)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-04-13 15:58:26 UTC (rev 260009)
@@ -277,11 +277,10 @@
fixedWidthColumns.append(fixedWidth());
}
- Vector<FormattingContext::IntrinsicWidthConstraints> columnIntrinsicWidths;
+ Vector<FormattingContext::IntrinsicWidthConstraints> columnIntrinsicWidths(columnList.size());
// 3. Collect he min/max width for each column but ignore column spans for now.
Vector<SlotPosition> spanningCellPositionList;
for (size_t columnIndex = 0; columnIndex < columnList.size(); ++columnIndex) {
- columnIntrinsicWidths.append(FormattingContext::IntrinsicWidthConstraints { });
for (size_t rowIndex = 0; rowIndex < grid.rows().size(); ++rowIndex) {
auto& slot = *grid.slot({ columnIndex, rowIndex });
if (slot.hasColumnSpan()) {
@@ -335,9 +334,9 @@
// 1. Collect minimum widths driven by <td> across columns but ignore spanning cells first.
struct ColumnMinimumWidth {
float value { 0 };
- bool shouldFlex { true };
+ bool isFixed { false };
};
- Vector<ColumnMinimumWidth> columnMinimumWidths;
+ Vector<ColumnMinimumWidth> columnMinimumWidths(columnList.size());
Vector<SlotPosition> spanningCellPositionList;
for (size_t rowIndex = 0; rowIndex < rows.size(); ++rowIndex) {
for (size_t columnIndex = 0; columnIndex < columns.size(); ++columnIndex) {
@@ -348,13 +347,10 @@
}
if (slot.isColumnSpanned())
continue;
- if (!rowIndex)
- columnMinimumWidths.append({ slot.widthConstraints().minimum, !columns.list()[columnIndex].isFixedWidth() });
- else
- columnMinimumWidths[columnIndex].value = std::max<float>(columnMinimumWidths[columnIndex].value, slot.widthConstraints().minimum);
+ columnMinimumWidths[columnIndex].value = std::max<float>(columnMinimumWidths[columnIndex].value, slot.widthConstraints().minimum);
}
}
- // 2. Adjust the minimum width with fixed column widths (<col> vs. <td>) and also manage all-fixed-width-column content.
+ // 2. Adjust the <td> minimum widths with fixed column widths (<col> vs. <td>) and also manage all-fixed-width-column content.
auto hasFixedColumnsOnly = columns.hasFixedColumnsOnly();
for (size_t columnIndex = 0; columnIndex < columnList.size(); ++columnIndex) {
auto& column = columnList[columnIndex];
@@ -363,8 +359,8 @@
// This is the column width based on <col width=""> and not <td style="width: ">.
auto columnFixedWidth = column.box() ? column.box()->columnWidth() : WTF::nullopt;
columnMinimumWidths[columnIndex].value = std::max(columnMinimumWidths[columnIndex].value, columnFixedWidth.valueOr(0).toFloat());
- // Fixed columns flex when there are no other flexable columns.
- columnMinimumWidths[columnIndex].shouldFlex = hasFixedColumnsOnly | columnMinimumWidths[columnIndex].shouldFlex;
+ // Fixed columns flex when there are no other flexing columns.
+ columnMinimumWidths[columnIndex].isFixed = !hasFixedColumnsOnly;
}
// 3. Distribute the spanning cells' mimimum widths across the columns using the non-spanning minimum widths.
@@ -396,7 +392,7 @@
// Unless there are no flexing column at all, then they start flexing as if they were not fixed at all.
float adjustabledHorizontalSpace = 0;
for (auto& columnMinimumWidth : columnMinimumWidths) {
- if (!columnMinimumWidth.shouldFlex)
+ if (columnMinimumWidth.isFixed)
continue;
adjustabledHorizontalSpace += columnMinimumWidth.value;
}
@@ -406,7 +402,7 @@
for (size_t columnIndex = 0; columnIndex < columns.size(); ++columnIndex) {
auto& column = columns.list()[columnIndex];
auto minimumWidth = columnMinimumWidths[columnIndex].value;
- if (!columnMinimumWidths[columnIndex].shouldFlex) {
+ if (columnMinimumWidths[columnIndex].isFixed) {
column.setLogicalWidth(LayoutUnit { minimumWidth });
continue;
}