Title: [265694] branches/safari-610.1-branch
Revision
265694
Author
[email protected]
Date
2020-08-14 12:48:33 -0700 (Fri, 14 Aug 2020)

Log Message

Cherry-pick r265499. rdar://problem/67084446

    [AutoTableLayout] REGRESSION(r263855) Paypal email is rendered right aligned on Safari
    https://bugs.webkit.org/show_bug.cgi?id=215340
    <rdar://problem/66540254>

    Reviewed by Simon Fraser.

    Source/WebCore:

    Prior to r263855, these zero-length, non-empty columns had the preferred width value of 1px and the available space got distributed based on this made-up 1px value.
    In this patch, we distribute the available horizontal space evenly among these zero-length, 'width: auto' columns.

    Test: fast/table/zero-length-non-empty-columns-with-auto-width.html

    * rendering/AutoTableLayout.cpp:
    (WebCore::AutoTableLayout::layout):

    LayoutTests:

    * fast/table/zero-length-non-empty-columns-with-auto-width-expected.html: Added.
    * fast/table/zero-length-non-empty-columns-with-auto-width.html: Added.
    * platform/mac/fast/table/empty-cells-expected.txt: progression

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265499 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-610.1-branch/LayoutTests/ChangeLog (265693 => 265694)


--- branches/safari-610.1-branch/LayoutTests/ChangeLog	2020-08-14 19:48:29 UTC (rev 265693)
+++ branches/safari-610.1-branch/LayoutTests/ChangeLog	2020-08-14 19:48:33 UTC (rev 265694)
@@ -1,3 +1,44 @@
+2020-08-14  Alan Coon  <[email protected]>
+
+        Cherry-pick r265499. rdar://problem/67084446
+
+    [AutoTableLayout] REGRESSION(r263855) Paypal email is rendered right aligned on Safari
+    https://bugs.webkit.org/show_bug.cgi?id=215340
+    <rdar://problem/66540254>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Prior to r263855, these zero-length, non-empty columns had the preferred width value of 1px and the available space got distributed based on this made-up 1px value.
+    In this patch, we distribute the available horizontal space evenly among these zero-length, 'width: auto' columns.
+    
+    Test: fast/table/zero-length-non-empty-columns-with-auto-width.html
+    
+    * rendering/AutoTableLayout.cpp:
+    (WebCore::AutoTableLayout::layout):
+    
+    LayoutTests:
+    
+    * fast/table/zero-length-non-empty-columns-with-auto-width-expected.html: Added.
+    * fast/table/zero-length-non-empty-columns-with-auto-width.html: Added.
+    * platform/mac/fast/table/empty-cells-expected.txt: progression
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-11  Zalan Bujtas  <[email protected]>
+
+            [AutoTableLayout] REGRESSION(r263855) Paypal email is rendered right aligned on Safari
+            https://bugs.webkit.org/show_bug.cgi?id=215340
+            <rdar://problem/66540254>
+
+            Reviewed by Simon Fraser.
+
+            * fast/table/zero-length-non-empty-columns-with-auto-width-expected.html: Added.
+            * fast/table/zero-length-non-empty-columns-with-auto-width.html: Added.
+            * platform/mac/fast/table/empty-cells-expected.txt: progression
+
 2020-08-12  Alan Coon  <[email protected]>
 
         Cherry-pick r265515. rdar://problem/66943894

Added: branches/safari-610.1-branch/LayoutTests/fast/table/zero-length-non-empty-columns-with-auto-width-expected.html (0 => 265694)


--- branches/safari-610.1-branch/LayoutTests/fast/table/zero-length-non-empty-columns-with-auto-width-expected.html	                        (rev 0)
+++ branches/safari-610.1-branch/LayoutTests/fast/table/zero-length-non-empty-columns-with-auto-width-expected.html	2020-08-14 19:48:33 UTC (rev 265694)
@@ -0,0 +1,12 @@
+<title>This tests that zero width, but non-empty columns get horizontal space. PASS if the green cell on the right is visible</title>
+<style>
+div {
+  font-size: 20px;
+  font-family: ahem;
+  height: 40px;
+  position: relative;
+}
+</style>
+<div style="background-color: green; width: 200px;"></div>
+<div style="background-color: yellow; width: 400px; top: -40px; left: 200px;">PASS if green is visible-></div>
+<div style="background-color: green; width: 200px; top: -80px; left: 600px;"></div>

Added: branches/safari-610.1-branch/LayoutTests/fast/table/zero-length-non-empty-columns-with-auto-width.html (0 => 265694)


--- branches/safari-610.1-branch/LayoutTests/fast/table/zero-length-non-empty-columns-with-auto-width.html	                        (rev 0)
+++ branches/safari-610.1-branch/LayoutTests/fast/table/zero-length-non-empty-columns-with-auto-width.html	2020-08-14 19:48:33 UTC (rev 265694)
@@ -0,0 +1,14 @@
+<title>This tests that zero width, but non-empty columns get horizontal space. PASS if the green cell on the right is visible</title>
+<style>
+td {
+  font-size: 20px !important;
+  font-family: ahem;
+}
+</style>
+<table cellspacing="0" cellpadding="0" style="width: 800px">
+<tr>
+<td style="background-color: green; font-size: 0px;"></td>
+<td style="background-color: yellow; width: 400px;">PASS if green is visible-></td>
+<td style="background-color: green; font-size: 0px;"></td>
+</tr>
+</table>

Modified: branches/safari-610.1-branch/LayoutTests/platform/ios/fast/table/empty-cells-expected.txt (265693 => 265694)


--- branches/safari-610.1-branch/LayoutTests/platform/ios/fast/table/empty-cells-expected.txt	2020-08-14 19:48:29 UTC (rev 265693)
+++ branches/safari-610.1-branch/LayoutTests/platform/ios/fast/table/empty-cells-expected.txt	2020-08-14 19:48:33 UTC (rev 265694)
@@ -148,8 +148,8 @@
       RenderTable {TABLE} at (0,566) size 800x54 [border: (2px solid #000000)]
         RenderTableSection {TBODY} at (2,2) size 796x50
           RenderTableRow {TR} at (0,0) size 796x25
-            RenderTableCell {TD} at (0,12) size 398x0 [r=0 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (398,12) size 0x0 [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (0,12) size 199x0 [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (199,12) size 199x0 [r=0 c=1 rs=1 cs=1]
             RenderTableCell {TD} at (398,2) size 398x21 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
               RenderText {#text} at (0,0) size 238x20
                 text run at (0,1) width 238: "First row, first and second cell empty"

Modified: branches/safari-610.1-branch/LayoutTests/platform/mac/fast/table/empty-cells-expected.txt (265693 => 265694)


--- branches/safari-610.1-branch/LayoutTests/platform/mac/fast/table/empty-cells-expected.txt	2020-08-14 19:48:29 UTC (rev 265693)
+++ branches/safari-610.1-branch/LayoutTests/platform/mac/fast/table/empty-cells-expected.txt	2020-08-14 19:48:33 UTC (rev 265694)
@@ -148,8 +148,8 @@
       RenderTable {TABLE} at (0,566) size 785x54 [border: (2px solid #000000)]
         RenderTableSection {TBODY} at (2,2) size 781x50
           RenderTableRow {TR} at (0,0) size 781x25
-            RenderTableCell {TD} at (0,12) size 391x0 [r=0 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (390,12) size 0x0 [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (0,12) size 196x0 [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (195,12) size 196x0 [r=0 c=1 rs=1 cs=1]
             RenderTableCell {TD} at (390,3) size 391x19 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
               RenderText {#text} at (0,0) size 237x19
                 text run at (0,1) width 237: "First row, first and second cell empty"

Modified: branches/safari-610.1-branch/LayoutTests/platform/win/fast/table/empty-cells-expected.txt (265693 => 265694)


--- branches/safari-610.1-branch/LayoutTests/platform/win/fast/table/empty-cells-expected.txt	2020-08-14 19:48:29 UTC (rev 265693)
+++ branches/safari-610.1-branch/LayoutTests/platform/win/fast/table/empty-cells-expected.txt	2020-08-14 19:48:33 UTC (rev 265694)
@@ -148,8 +148,8 @@
       RenderTable {TABLE} at (0,566) size 785x54 [border: (2px solid #000000)]
         RenderTableSection {TBODY} at (2,2) size 781x50
           RenderTableRow {TR} at (0,0) size 781x25
-            RenderTableCell {TD} at (0,12) size 391x0 [r=0 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (390,12) size 0x0 [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (0,12) size 196x0 [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (195,12) size 196x0 [r=0 c=1 rs=1 cs=1]
             RenderTableCell {TD} at (390,3) size 391x19 [bgcolor=#FF0000] [r=0 c=2 rs=1 cs=1]
               RenderText {#text} at (0,0) size 233x19
                 text run at (0,1) width 233: "First row, first and second cell empty"

Modified: branches/safari-610.1-branch/Source/WebCore/ChangeLog (265693 => 265694)


--- branches/safari-610.1-branch/Source/WebCore/ChangeLog	2020-08-14 19:48:29 UTC (rev 265693)
+++ branches/safari-610.1-branch/Source/WebCore/ChangeLog	2020-08-14 19:48:33 UTC (rev 265694)
@@ -1,5 +1,50 @@
 2020-08-14  Alan Coon  <[email protected]>
 
+        Cherry-pick r265499. rdar://problem/67084446
+
+    [AutoTableLayout] REGRESSION(r263855) Paypal email is rendered right aligned on Safari
+    https://bugs.webkit.org/show_bug.cgi?id=215340
+    <rdar://problem/66540254>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Prior to r263855, these zero-length, non-empty columns had the preferred width value of 1px and the available space got distributed based on this made-up 1px value.
+    In this patch, we distribute the available horizontal space evenly among these zero-length, 'width: auto' columns.
+    
+    Test: fast/table/zero-length-non-empty-columns-with-auto-width.html
+    
+    * rendering/AutoTableLayout.cpp:
+    (WebCore::AutoTableLayout::layout):
+    
+    LayoutTests:
+    
+    * fast/table/zero-length-non-empty-columns-with-auto-width-expected.html: Added.
+    * fast/table/zero-length-non-empty-columns-with-auto-width.html: Added.
+    * platform/mac/fast/table/empty-cells-expected.txt: progression
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-11  Zalan Bujtas  <[email protected]>
+
+            [AutoTableLayout] REGRESSION(r263855) Paypal email is rendered right aligned on Safari
+            https://bugs.webkit.org/show_bug.cgi?id=215340
+            <rdar://problem/66540254>
+
+            Reviewed by Simon Fraser.
+
+            Prior to r263855, these zero-length, non-empty columns had the preferred width value of 1px and the available space got distributed based on this made-up 1px value.
+            In this patch, we distribute the available horizontal space evenly among these zero-length, 'width: auto' columns.
+
+            Test: fast/table/zero-length-non-empty-columns-with-auto-width.html
+
+            * rendering/AutoTableLayout.cpp:
+            (WebCore::AutoTableLayout::layout):
+
+2020-08-14  Alan Coon  <[email protected]>
+
         Cherry-pick r265420. rdar://problem/67083903
 
     REGRESSION (r260831): Web process crashes under Editor::setComposition() after navigating with marked text

Modified: branches/safari-610.1-branch/Source/WebCore/rendering/AutoTableLayout.cpp (265693 => 265694)


--- branches/safari-610.1-branch/Source/WebCore/rendering/AutoTableLayout.cpp	2020-08-14 19:48:29 UTC (rev 265693)
+++ branches/safari-610.1-branch/Source/WebCore/rendering/AutoTableLayout.cpp	2020-08-14 19:48:33 UTC (rev 265694)
@@ -530,6 +530,7 @@
     bool havePercent = false;
     float totalRelative = 0;
     int numFixed = 0;
+    size_t numberOfNonEmptyAuto = 0;
     Optional<float> totalAuto;
     float totalFixed = 0;
     float totalPercent = 0;
@@ -558,6 +559,7 @@
             if (m_layoutStruct[i].emptyCellsOnly)
                 numAutoEmptyCellsOnly++;
             else {
+                ++numberOfNonEmptyAuto;
                 totalAuto = totalAuto.valueOr(0.f) + m_layoutStruct[i].effectiveMaxLogicalWidth;
                 allocAuto += cellLogicalWidth;
             }
@@ -620,15 +622,23 @@
     }
 
     // now satisfy variable
-    if (available > 0 && totalAuto) {
-        available += allocAuto; // this gets redistributed
+    if (available > 0 && numberOfNonEmptyAuto) {
+        ASSERT(totalAuto);
+        available += allocAuto; // this gets redistributed.
+        auto equalWidthForZeroLengthColumns = Optional<float> { };
+        if (!*totalAuto) {
+            // All columns in this table are (non-empty)zero length with 'width: auto'.
+            equalWidthForZeroLengthColumns = available / numberOfNonEmptyAuto;
+        }
         for (size_t i = 0; i < nEffCols; ++i) {
-            Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
-            if (logicalWidth.isAuto() && !m_layoutStruct[i].emptyCellsOnly) {
-                auto cellLogicalWidth = std::max(m_layoutStruct[i].computedLogicalWidth, *totalAuto ? available * m_layoutStruct[i].effectiveMaxLogicalWidth / *totalAuto : available);
-                available -= cellLogicalWidth;
-                *totalAuto -= m_layoutStruct[i].effectiveMaxLogicalWidth;
-                m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
+            auto& column = m_layoutStruct[i];
+            if (!column.effectiveLogicalWidth.isAuto() || column.emptyCellsOnly)
+                continue;
+            auto columnWidthCandidate = equalWidthForZeroLengthColumns ? *equalWidthForZeroLengthColumns : available * column.effectiveMaxLogicalWidth / *totalAuto;
+            column.computedLogicalWidth = std::max(column.computedLogicalWidth, columnWidthCandidate);
+            available -= column.computedLogicalWidth;
+            if (!equalWidthForZeroLengthColumns) {
+                *totalAuto -= column.effectiveMaxLogicalWidth;
                 if (*totalAuto <= 0)
                     break;
             }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to