Fractional td width is not rendering correctly.

Blink failed to parsing of width HTML attribute,
and mapping it to CSS width.
Pass every value includes zero to AddHTMLLengthToStyle,
and pass kDontAllowZeroValues hence it can reject the zero.

Bug: 1283025
Change-Id: I1210286608444891c5924785000a2f03074b8a54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3376745
Reviewed-by: Aleks Totic <atotic@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#959539}
diff --git a/third_party/blink/renderer/core/html/html_table_cell_element.cc b/third_party/blink/renderer/core/html/html_table_cell_element.cc
index ccfadda..b980db6 100644
--- a/third_party/blink/renderer/core/html/html_table_cell_element.cc
+++ b/third_party/blink/renderer/core/html/html_table_cell_element.cc
@@ -102,16 +102,13 @@
                                             CSSValueID::kNowrap);
   } else if (name == html_names::kWidthAttr) {
     if (!value.IsEmpty()) {
-      int width_int = value.ToInt();
-      if (width_int > 0)  // width="0" is ignored for compatibility with WinIE.
-        AddHTMLLengthToStyle(style, CSSPropertyID::kWidth, value);
+      AddHTMLLengthToStyle(style, CSSPropertyID::kWidth, value,
+                           kAllowPercentageValues, kDontAllowZeroValues);
     }
   } else if (name == html_names::kHeightAttr) {
     if (!value.IsEmpty()) {
-      int height_int = value.ToInt();
-      if (height_int >
-          0)  // height="0" is ignored for compatibility with WinIE.
-        AddHTMLLengthToStyle(style, CSSPropertyID::kHeight, value);
+      AddHTMLLengthToStyle(style, CSSPropertyID::kHeight, value,
+                           kAllowPercentageValues, kDontAllowZeroValues);
     }
   } else {
     HTMLTablePartElement::CollectStyleForPresentationAttribute(name, value,
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
index 6bba103..405fd266 100644
--- a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
+++ b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
@@ -1600,3 +1600,6 @@
 # on LayoutNG. We accept failures of those specific tests when LayoutNG is
 # disabled.
 crbug.com/1225606 external/wpt/sanitizer-api/sanitizer-names.https.tentative.html [ Failure Pass ]
+
+# broken by https://chromium-review.googlesource.com/c/chromium/src/+/3376745
+crbug.com/1283025 external/wpt/css/css-tables/fractional-percent-width.html [ Failure ]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-tables/fractional-percent-width.html b/third_party/blink/web_tests/external/wpt/css/css-tables/fractional-percent-width.html
new file mode 100644
index 0000000..cd032eb
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-tables/fractional-percent-width.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/check-layout-th.js"></script>
+<link rel="author" title="Jihwan Marc Kim" href="mailto:bluewhale.marc@gmail.com" />
+<link rel="help" href="https://crbug.com/1283025" />
+<meta name="flags" content="" />
+<meta name="assert" content="percent lengths of fractional td width should rendered correctly" />
+<style>
+  main div {
+    position: relative;
+    border: 1px solid black;
+    width: 400px;
+  }
+  .cell {
+    background-color: skyblue;
+    height: 20px;
+  }
+</style>
+<p>
+  Tests that percent lengths of fractional td width should rendered correctly
+  even it is smaller than 1.
+</p>
+
+<hr />
+<output id="log"></output>
+<main>
+  <div>
+    <table width="100%">
+      <tbody>
+        <tr>
+          <td class="cell" width="0.5%" data-expected-client-width="2"></td>
+          <td>0.5%</td>
+        </tr>
+      </tbody>
+    </table>
+    <table width="100%">
+      <tbody>
+        <tr>
+          <td class="cell" width="1%" data-expected-client-width="4"></td>
+          <td>1%</td>
+        </tr>
+      </tbody>
+    </table>
+    <table width="100%">
+      <tbody>
+        <tr>
+          <td class="cell" width="5%" data-expected-client-width="20"></td>
+          <td>5%</td>
+        </tr>
+      </tbody>
+    </table>
+  </div>
+</main>
+<script>
+  checkLayout(".cell");
+</script>
+