Title: [288103] trunk
Revision
288103
Author
[email protected]
Date
2022-01-17 13:32:38 -0800 (Mon, 17 Jan 2022)

Log Message

Fractional td width is not rendering correctly
https://bugs.webkit.org/show_bug.cgi?id=234745
<rdar://problem/87162997>

Reviewed by Darin Adler.

Source/WebCore:

This is based on the following Blink commit
   https://chromium.googlesource.com/chromium/src/+/bfade5f8c943d322f5aca3ab0341824e4ae885a1

The code that ignores a width of zero was incorrectly parsing as an integer and ignoring fractional values.

Test: fast/table/table-cell-percent-width-between-0-and-1.html

* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::collectPresentationalHintsForAttribute):

LayoutTests:

* fast/table/table-cell-percent-width-between-0-and-1-expected.html: Added.
* fast/table/table-cell-percent-width-between-0-and-1.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288102 => 288103)


--- trunk/LayoutTests/ChangeLog	2022-01-17 20:17:20 UTC (rev 288102)
+++ trunk/LayoutTests/ChangeLog	2022-01-17 21:32:38 UTC (rev 288103)
@@ -1,3 +1,14 @@
+2022-01-17  Alan Bujtas  <[email protected]>
+
+        Fractional td width is not rendering correctly
+        https://bugs.webkit.org/show_bug.cgi?id=234745
+        <rdar://problem/87162997>
+
+        Reviewed by Darin Adler.
+
+        * fast/table/table-cell-percent-width-between-0-and-1-expected.html: Added.
+        * fast/table/table-cell-percent-width-between-0-and-1.html: Added.
+
 2022-01-17  Sepand Parhami  <[email protected]>
 
         AX: Expose toggle buttons using role="button" as form controls.

Added: trunk/LayoutTests/fast/table/hidpi-table-cell-percent-width-between-0-and-1-expected.html (0 => 288103)


--- trunk/LayoutTests/fast/table/hidpi-table-cell-percent-width-between-0-and-1-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/hidpi-table-cell-percent-width-between-0-and-1-expected.html	2022-01-17 21:32:38 UTC (rev 288103)
@@ -0,0 +1,12 @@
+<style>
+div {
+  height: 20px;
+  background-color: green;
+}
+</style>
+<div style="width: 2px"></div>
+<div style="width: 2.5px"></div>
+<div style="width: 4.5px"></div>
+<div style="width: 5px"></div>
+<div style="width: 25px"></div>
+<div style="width: 50px"></div>

Added: trunk/LayoutTests/fast/table/hidpi-table-cell-percent-width-between-0-and-1.html (0 => 288103)


--- trunk/LayoutTests/fast/table/hidpi-table-cell-percent-width-between-0-and-1.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/hidpi-table-cell-percent-width-between-0-and-1.html	2022-01-17 21:32:38 UTC (rev 288103)
@@ -0,0 +1,20 @@
+<style>
+table {
+  width: 500px;
+  border-spacing: 0px;
+}
+
+td {
+  height: 20px;
+}
+
+td:nth-child(1) {
+  background-color: green;
+}
+</style>
+<table><td width="0.1%"></td><td> </td></table>
+<table><td width="0.5%"></td><td> </td></table>
+<table><td width="0.9%"></td><td> </td></table>
+<table><td width="1%"></td><td> </td></table>
+<table><td width="5%"></td><td> </td></table>
+<table><td width="10%"></td><td> </td></table>

Modified: trunk/Source/WebCore/ChangeLog (288102 => 288103)


--- trunk/Source/WebCore/ChangeLog	2022-01-17 20:17:20 UTC (rev 288102)
+++ trunk/Source/WebCore/ChangeLog	2022-01-17 21:32:38 UTC (rev 288103)
@@ -1,3 +1,21 @@
+2022-01-17  Alan Bujtas  <[email protected]>
+
+        Fractional td width is not rendering correctly
+        https://bugs.webkit.org/show_bug.cgi?id=234745
+        <rdar://problem/87162997>
+
+        Reviewed by Darin Adler.
+
+        This is based on the following Blink commit
+           https://chromium.googlesource.com/chromium/src/+/bfade5f8c943d322f5aca3ab0341824e4ae885a1
+
+        The code that ignores a width of zero was incorrectly parsing as an integer and ignoring fractional values.
+
+        Test: fast/table/table-cell-percent-width-between-0-and-1.html
+
+        * html/HTMLTableCellElement.cpp:
+        (WebCore::HTMLTableCellElement::collectPresentationalHintsForAttribute):
+
 2022-01-17  Wenson Hsieh  <[email protected]>
 
         ImageAnalysisQueue should analyze image elements that are loaded after the call to enqueueAllImages()

Modified: trunk/Source/WebCore/html/HTMLTableCellElement.cpp (288102 => 288103)


--- trunk/Source/WebCore/html/HTMLTableCellElement.cpp	2022-01-17 20:17:20 UTC (rev 288102)
+++ trunk/Source/WebCore/html/HTMLTableCellElement.cpp	2022-01-17 21:32:38 UTC (rev 288103)
@@ -103,11 +103,11 @@
     if (name == nowrapAttr)
         addPropertyToPresentationalHintStyle(style, CSSPropertyWhiteSpace, CSSValueWebkitNowrap);
     else if (name == widthAttr) {
-        if (parseHTMLInteger(value).value_or(0) > 0) // width="0" is ignored for compatibility with WinIE.
-            addHTMLLengthToStyle(style, CSSPropertyWidth, value);
+        // width="0" is not allowed for compatibility with WinIE.
+        addHTMLLengthToStyle(style, CSSPropertyWidth, value, AllowZeroValue::No);
     } else if (name == heightAttr) {
-        if (parseHTMLInteger(value).value_or(0) > 0) // height="0" is ignored for compatibility with WinIE.
-            addHTMLLengthToStyle(style, CSSPropertyHeight, value);
+        // width="0" is not allowed for compatibility with WinIE.
+        addHTMLLengthToStyle(style, CSSPropertyHeight, value, AllowZeroValue::No);
     } else
         HTMLTablePartElement::collectPresentationalHintsForAttribute(name, value, style);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to