Title: [278765] trunk
Revision
278765
Author
cathiec...@igalia.com
Date
2021-06-11 10:41:18 -0700 (Fri, 11 Jun 2021)

Log Message

Use HTMLDimension to parse different HTML attribute length values
https://bugs.webkit.org/show_bug.cgi?id=226810

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/html/rendering/dimension-attributes-expected.txt:
* web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:

Source/WebCore:

This patch uses HTMLDimension to parse different kind of html length values which are defined in [1].
Then according the length types to determine if the value is valid.

[1] https://www.w3.org/TR/html4/sgml/dtd.html#Length

* html/HTMLElement.cpp:
(WebCore::HTMLElement::addHTMLLengthToStyle):
(WebCore::HTMLElement::addHTMLLengthToStyle): Add HTMLLength (including percentage values and pixel values) to style.
(WebCore::HTMLElement::addHTMLMultiLengthToStyle): Add MultiLength (including percentage, pixel and relative values) to style.
(WebCore::HTMLElement::addHTMLPixelsToStyle): Add pixel values to style.
(WebCore::HTMLElement::addHTMLNumberToStyle): Add number (including percentage values and numbers) to style.
* html/HTMLElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::collectPresentationalHintsForAttribute): <img>'s width and height attributes are multiLength.
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::collectPresentationalHintsForAttribute): scrolldelayAttr and loopAttr are numbers.
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::collectPresentationalHintsForAttribute): <col>'s width and height attributes are multiLength.
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::collectPresentationalHintsForAttribute): <table>'s cellspacingAttr only supports pixel values.
* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTMLDimensionInternal):
(WebCore::parseHTMLDimension):
(WebCore::parseHTMLMultiLength): MultiLength doesn't support relative_length (number + *), but make sure relative_length not be treated as a pixel value.
* html/parser/HTMLParserIdioms.h:

LayoutTests:

* platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278764 => 278765)


--- trunk/LayoutTests/ChangeLog	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/LayoutTests/ChangeLog	2021-06-11 17:41:18 UTC (rev 278765)
@@ -1,3 +1,12 @@
+2021-06-11  Cathie Chen  <cathiec...@igalia.com>
+
+        Use HTMLDimension to parse different HTML attribute length values
+        https://bugs.webkit.org/show_bug.cgi?id=226810
+
+        Reviewed by Darin Adler.
+
+        * platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:
+
 2021-06-11  Youenn Fablet  <you...@apple.com>
 
         getDisplayMedia API doesn't work

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (278764 => 278765)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-11 17:41:18 UTC (rev 278765)
@@ -1,3 +1,13 @@
+2021-06-11  Cathie Chen  <cathiec...@igalia.com>
+
+        Use HTMLDimension to parse different HTML attribute length values
+        https://bugs.webkit.org/show_bug.cgi?id=226810
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/html/rendering/dimension-attributes-expected.txt:
+        * web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:
+
 2021-06-10  Chris Dumez  <cdu...@apple.com>
 
         REGRESSION: service-workers/service-worker/credentials.https.html and content-security-policy/reporting/report-only-in-meta.sub.html failing together constantly.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/dimension-attributes-expected.txt (278764 => 278765)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/dimension-attributes-expected.txt	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/dimension-attributes-expected.txt	2021-06-11 17:41:18 UTC (rev 278765)
@@ -4,7 +4,7 @@
 PASS <hr width="   00523   "> mapping to width
 PASS <hr width="200.25"> mapping to width
 FAIL <hr width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <hr width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <hr width="200."> mapping to width
 PASS <hr width="200in"> mapping to width
 PASS <hr width="200.25in"> mapping to width
 PASS <hr width="200 %"> mapping to width
@@ -37,14 +37,14 @@
 PASS <hr width="."> mapping to width
 PASS <hr width=".%"> mapping to width
 PASS <hr width=".x"> mapping to width
-FAIL <hr width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <hr width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <hr width=".5"> mapping to width
+PASS <hr width=".5%"> mapping to width
 PASS <iframe width="200"> mapping to width
 PASS <iframe width="1007"> mapping to width
 PASS <iframe width="   00523   "> mapping to width
 PASS <iframe width="200.25"> mapping to width
 FAIL <iframe width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <iframe width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <iframe width="200."> mapping to width
 PASS <iframe width="200in"> mapping to width
 PASS <iframe width="200.25in"> mapping to width
 PASS <iframe width="200 %"> mapping to width
@@ -77,14 +77,14 @@
 PASS <iframe width="."> mapping to width
 PASS <iframe width=".%"> mapping to width
 PASS <iframe width=".x"> mapping to width
-FAIL <iframe width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <iframe width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <iframe width=".5"> mapping to width
+PASS <iframe width=".5%"> mapping to width
 PASS <iframe height="200"> mapping to height
 PASS <iframe height="1007"> mapping to height
 PASS <iframe height="   00523   "> mapping to height
 PASS <iframe height="200.25"> mapping to height
 FAIL <iframe height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <iframe height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <iframe height="200."> mapping to height
 PASS <iframe height="200in"> mapping to height
 PASS <iframe height="200.25in"> mapping to height
 PASS <iframe height="200 %"> mapping to height
@@ -117,14 +117,14 @@
 PASS <iframe height="."> mapping to height
 PASS <iframe height=".%"> mapping to height
 PASS <iframe height=".x"> mapping to height
-FAIL <iframe height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <iframe height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <iframe height=".5"> mapping to height
+PASS <iframe height=".5%"> mapping to height
 PASS <input width="200"> mapping to width
 PASS <input width="1007"> mapping to width
 PASS <input width="   00523   "> mapping to width
 PASS <input width="200.25"> mapping to width
 FAIL <input width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <input width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <input width="200."> mapping to width
 PASS <input width="200in"> mapping to width
 PASS <input width="200.25in"> mapping to width
 PASS <input width="200 %"> mapping to width
@@ -157,14 +157,14 @@
 PASS <input width="."> mapping to width
 PASS <input width=".%"> mapping to width
 PASS <input width=".x"> mapping to width
-FAIL <input width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <input width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <input width=".5"> mapping to width
+PASS <input width=".5%"> mapping to width
 PASS <input height="200"> mapping to height
 PASS <input height="1007"> mapping to height
 PASS <input height="   00523   "> mapping to height
 PASS <input height="200.25"> mapping to height
 FAIL <input height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <input height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <input height="200."> mapping to height
 PASS <input height="200in"> mapping to height
 PASS <input height="200.25in"> mapping to height
 PASS <input height="200 %"> mapping to height
@@ -197,14 +197,14 @@
 PASS <input height="."> mapping to height
 PASS <input height=".%"> mapping to height
 PASS <input height=".x"> mapping to height
-FAIL <input height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <input height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <input height=".5"> mapping to height
+PASS <input height=".5%"> mapping to height
 PASS <marquee width="200"> mapping to width
 PASS <marquee width="1007"> mapping to width
 PASS <marquee width="   00523   "> mapping to width
 PASS <marquee width="200.25"> mapping to width
 FAIL <marquee width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <marquee width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <marquee width="200."> mapping to width
 PASS <marquee width="200in"> mapping to width
 PASS <marquee width="200.25in"> mapping to width
 PASS <marquee width="200 %"> mapping to width
@@ -237,14 +237,14 @@
 PASS <marquee width="."> mapping to width
 PASS <marquee width=".%"> mapping to width
 PASS <marquee width=".x"> mapping to width
-FAIL <marquee width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <marquee width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <marquee width=".5"> mapping to width
+PASS <marquee width=".5%"> mapping to width
 PASS <marquee height="200"> mapping to height
 PASS <marquee height="1007"> mapping to height
 PASS <marquee height="   00523   "> mapping to height
 PASS <marquee height="200.25"> mapping to height
 FAIL <marquee height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <marquee height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <marquee height="200."> mapping to height
 PASS <marquee height="200in"> mapping to height
 PASS <marquee height="200.25in"> mapping to height
 PASS <marquee height="200 %"> mapping to height
@@ -277,14 +277,14 @@
 PASS <marquee height="."> mapping to height
 PASS <marquee height=".%"> mapping to height
 PASS <marquee height=".x"> mapping to height
-FAIL <marquee height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <marquee height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <marquee height=".5"> mapping to height
+PASS <marquee height=".5%"> mapping to height
 PASS <video width="200"> mapping to width
 PASS <video width="1007"> mapping to width
 PASS <video width="   00523   "> mapping to width
 PASS <video width="200.25"> mapping to width
 FAIL <video width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <video width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <video width="200."> mapping to width
 PASS <video width="200in"> mapping to width
 PASS <video width="200.25in"> mapping to width
 PASS <video width="200 %"> mapping to width
@@ -317,14 +317,14 @@
 PASS <video width="."> mapping to width
 PASS <video width=".%"> mapping to width
 PASS <video width=".x"> mapping to width
-FAIL <video width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <video width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <video width=".5"> mapping to width
+PASS <video width=".5%"> mapping to width
 PASS <video height="200"> mapping to height
 PASS <video height="1007"> mapping to height
 PASS <video height="   00523   "> mapping to height
 PASS <video height="200.25"> mapping to height
 FAIL <video height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <video height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <video height="200."> mapping to height
 PASS <video height="200in"> mapping to height
 PASS <video height="200.25in"> mapping to height
 PASS <video height="200 %"> mapping to height
@@ -357,14 +357,14 @@
 PASS <video height="."> mapping to height
 PASS <video height=".%"> mapping to height
 PASS <video height=".x"> mapping to height
-FAIL <video height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <video height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <video height=".5"> mapping to height
+PASS <video height=".5%"> mapping to height
 PASS <object width="200"> mapping to width
 PASS <object width="1007"> mapping to width
 PASS <object width="   00523   "> mapping to width
 PASS <object width="200.25"> mapping to width
 FAIL <object width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <object width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <object width="200."> mapping to width
 PASS <object width="200in"> mapping to width
 PASS <object width="200.25in"> mapping to width
 PASS <object width="200 %"> mapping to width
@@ -397,14 +397,14 @@
 PASS <object width="."> mapping to width
 PASS <object width=".%"> mapping to width
 PASS <object width=".x"> mapping to width
-FAIL <object width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <object width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <object width=".5"> mapping to width
+PASS <object width=".5%"> mapping to width
 PASS <object height="200"> mapping to height
 PASS <object height="1007"> mapping to height
 PASS <object height="   00523   "> mapping to height
 PASS <object height="200.25"> mapping to height
 FAIL <object height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <object height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <object height="200."> mapping to height
 PASS <object height="200in"> mapping to height
 PASS <object height="200.25in"> mapping to height
 PASS <object height="200 %"> mapping to height
@@ -437,14 +437,14 @@
 PASS <object height="."> mapping to height
 PASS <object height=".%"> mapping to height
 PASS <object height=".x"> mapping to height
-FAIL <object height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <object height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <object height=".5"> mapping to height
+PASS <object height=".5%"> mapping to height
 PASS <embed width="200"> mapping to width
 PASS <embed width="1007"> mapping to width
 PASS <embed width="   00523   "> mapping to width
 PASS <embed width="200.25"> mapping to width
 FAIL <embed width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <embed width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <embed width="200."> mapping to width
 PASS <embed width="200in"> mapping to width
 PASS <embed width="200.25in"> mapping to width
 PASS <embed width="200 %"> mapping to width
@@ -477,14 +477,14 @@
 PASS <embed width="."> mapping to width
 PASS <embed width=".%"> mapping to width
 PASS <embed width=".x"> mapping to width
-FAIL <embed width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <embed width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <embed width=".5"> mapping to width
+PASS <embed width=".5%"> mapping to width
 PASS <embed height="200"> mapping to height
 PASS <embed height="1007"> mapping to height
 PASS <embed height="   00523   "> mapping to height
 PASS <embed height="200.25"> mapping to height
 FAIL <embed height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <embed height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <embed height="200."> mapping to height
 PASS <embed height="200in"> mapping to height
 PASS <embed height="200.25in"> mapping to height
 PASS <embed height="200 %"> mapping to height
@@ -517,14 +517,14 @@
 PASS <embed height="."> mapping to height
 PASS <embed height=".%"> mapping to height
 PASS <embed height=".x"> mapping to height
-FAIL <embed height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <embed height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <embed height=".5"> mapping to height
+PASS <embed height=".5%"> mapping to height
 PASS <img width="200"> mapping to width
 PASS <img width="1007"> mapping to width
 PASS <img width="   00523   "> mapping to width
 PASS <img width="200.25"> mapping to width
 FAIL <img width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <img width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <img width="200."> mapping to width
 PASS <img width="200in"> mapping to width
 PASS <img width="200.25in"> mapping to width
 PASS <img width="200 %"> mapping to width
@@ -557,14 +557,14 @@
 PASS <img width="."> mapping to width
 PASS <img width=".%"> mapping to width
 PASS <img width=".x"> mapping to width
-FAIL <img width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <img width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <img width=".5"> mapping to width
+PASS <img width=".5%"> mapping to width
 PASS <img height="200"> mapping to height
 PASS <img height="1007"> mapping to height
 PASS <img height="   00523   "> mapping to height
 PASS <img height="200.25"> mapping to height
 FAIL <img height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <img height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <img height="200."> mapping to height
 PASS <img height="200in"> mapping to height
 PASS <img height="200.25in"> mapping to height
 PASS <img height="200 %"> mapping to height
@@ -597,14 +597,14 @@
 PASS <img height="."> mapping to height
 PASS <img height=".%"> mapping to height
 PASS <img height=".x"> mapping to height
-FAIL <img height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <img height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <img height=".5"> mapping to height
+PASS <img height=".5%"> mapping to height
 PASS <td width="200"> mapping to width
 PASS <td width="1007"> mapping to width
 PASS <td width="   00523   "> mapping to width
 PASS <td width="200.25"> mapping to width
 FAIL <td width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <td width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <td width="200."> mapping to width
 PASS <td width="200in"> mapping to width
 PASS <td width="200.25in"> mapping to width
 PASS <td width="200 %"> mapping to width
@@ -644,7 +644,7 @@
 PASS <td height="   00523   "> mapping to height
 PASS <td height="200.25"> mapping to height
 FAIL <td height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <td height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <td height="200."> mapping to height
 PASS <td height="200in"> mapping to height
 PASS <td height="200.25in"> mapping to height
 PASS <td height="200 %"> mapping to height
@@ -684,7 +684,7 @@
 PASS <table width="   00523   "> mapping to width
 PASS <table width="200.25"> mapping to width
 FAIL <table width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <table width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <table width="200."> mapping to width
 PASS <table width="200in"> mapping to width
 PASS <table width="200.25in"> mapping to width
 PASS <table width="200 %"> mapping to width
@@ -714,8 +714,8 @@
 PASS <table width="."> mapping to width
 PASS <table width=".%"> mapping to width
 PASS <table width=".x"> mapping to width
-FAIL <table width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <table width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <table width=".5"> mapping to width
+PASS <table width=".5%"> mapping to width
 FAIL <table width="0"> mapping to width assert_equals: expected "auto" but got "0px"
 FAIL <table width="0%"> mapping to width assert_equals: expected "auto" but got "0%"
 FAIL <table width="0px"> mapping to width assert_equals: expected "auto" but got "0px"
@@ -724,7 +724,7 @@
 PASS <table height="   00523   "> mapping to height
 PASS <table height="200.25"> mapping to height
 FAIL <table height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <table height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <table height="200."> mapping to height
 PASS <table height="200in"> mapping to height
 PASS <table height="200.25in"> mapping to height
 PASS <table height="200 %"> mapping to height
@@ -754,8 +754,8 @@
 PASS <table height="."> mapping to height
 PASS <table height=".%"> mapping to height
 PASS <table height=".x"> mapping to height
-FAIL <table height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <table height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <table height=".5"> mapping to height
+PASS <table height=".5%"> mapping to height
 FAIL <table height="0"> mapping to height assert_equals: expected "auto" but got "0px"
 FAIL <table height="0%"> mapping to height assert_equals: expected "auto" but got "0%"
 FAIL <table height="0px"> mapping to height assert_equals: expected "auto" but got "0px"
@@ -764,7 +764,7 @@
 PASS <tr height="   00523   "> mapping to height
 PASS <tr height="200.25"> mapping to height
 FAIL <tr height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <tr height="200."> mapping to height assert_equals: expected "200px" but got "auto"
+PASS <tr height="200."> mapping to height
 PASS <tr height="200in"> mapping to height
 PASS <tr height="200.25in"> mapping to height
 PASS <tr height="200 %"> mapping to height
@@ -794,8 +794,8 @@
 PASS <tr height="."> mapping to height
 PASS <tr height=".%"> mapping to height
 PASS <tr height=".x"> mapping to height
-FAIL <tr height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
-FAIL <tr height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
+PASS <tr height=".5"> mapping to height
+PASS <tr height=".5%"> mapping to height
 FAIL <tr height="0"> mapping to height assert_equals: expected "auto" but got "0px"
 FAIL <tr height="0%"> mapping to height assert_equals: expected "auto" but got "0%"
 FAIL <tr height="0px"> mapping to height assert_equals: expected "auto" but got "0px"
@@ -804,7 +804,7 @@
 PASS <col width="   00523   "> mapping to width
 PASS <col width="200.25"> mapping to width
 FAIL <col width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <col width="200."> mapping to width assert_equals: expected "200px" but got "auto"
+PASS <col width="200."> mapping to width
 PASS <col width="200in"> mapping to width
 PASS <col width="200.25in"> mapping to width
 PASS <col width="200 %"> mapping to width
@@ -834,8 +834,8 @@
 PASS <col width="."> mapping to width
 PASS <col width=".%"> mapping to width
 PASS <col width=".x"> mapping to width
-FAIL <col width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
-FAIL <col width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
+PASS <col width=".5"> mapping to width
+PASS <col width=".5%"> mapping to width
 FAIL <col width="0"> mapping to width assert_equals: expected "auto" but got "0px"
 FAIL <col width="0%"> mapping to width assert_equals: expected "auto" but got "0%"
 FAIL <col width="0px"> mapping to width assert_equals: expected "auto" but got "0px"
@@ -844,7 +844,7 @@
 PASS <embed hspace="   00523   "> mapping to marginLeft
 PASS <embed hspace="200.25"> mapping to marginLeft
 FAIL <embed hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <embed hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
+PASS <embed hspace="200."> mapping to marginLeft
 PASS <embed hspace="200in"> mapping to marginLeft
 PASS <embed hspace="200.25in"> mapping to marginLeft
 PASS <embed hspace="200 %"> mapping to marginLeft
@@ -877,14 +877,14 @@
 PASS <embed hspace="."> mapping to marginLeft
 PASS <embed hspace=".%"> mapping to marginLeft
 PASS <embed hspace=".x"> mapping to marginLeft
-FAIL <embed hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
-FAIL <embed hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
+PASS <embed hspace=".5"> mapping to marginLeft
+PASS <embed hspace=".5%"> mapping to marginLeft
 PASS <embed hspace="200"> mapping to marginRight
 PASS <embed hspace="1007"> mapping to marginRight
 PASS <embed hspace="   00523   "> mapping to marginRight
 PASS <embed hspace="200.25"> mapping to marginRight
 FAIL <embed hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <embed hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
+PASS <embed hspace="200."> mapping to marginRight
 PASS <embed hspace="200in"> mapping to marginRight
 PASS <embed hspace="200.25in"> mapping to marginRight
 PASS <embed hspace="200 %"> mapping to marginRight
@@ -917,14 +917,14 @@
 PASS <embed hspace="."> mapping to marginRight
 PASS <embed hspace=".%"> mapping to marginRight
 PASS <embed hspace=".x"> mapping to marginRight
-FAIL <embed hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
-FAIL <embed hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
+PASS <embed hspace=".5"> mapping to marginRight
+PASS <embed hspace=".5%"> mapping to marginRight
 PASS <embed vspace="200"> mapping to marginTop
 PASS <embed vspace="1007"> mapping to marginTop
 PASS <embed vspace="   00523   "> mapping to marginTop
 PASS <embed vspace="200.25"> mapping to marginTop
 FAIL <embed vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <embed vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
+PASS <embed vspace="200."> mapping to marginTop
 PASS <embed vspace="200in"> mapping to marginTop
 PASS <embed vspace="200.25in"> mapping to marginTop
 PASS <embed vspace="200 %"> mapping to marginTop
@@ -957,14 +957,14 @@
 PASS <embed vspace="."> mapping to marginTop
 PASS <embed vspace=".%"> mapping to marginTop
 PASS <embed vspace=".x"> mapping to marginTop
-FAIL <embed vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
-FAIL <embed vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
+PASS <embed vspace=".5"> mapping to marginTop
+PASS <embed vspace=".5%"> mapping to marginTop
 PASS <embed vspace="200"> mapping to marginBottom
 PASS <embed vspace="1007"> mapping to marginBottom
 PASS <embed vspace="   00523   "> mapping to marginBottom
 PASS <embed vspace="200.25"> mapping to marginBottom
 FAIL <embed vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <embed vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
+PASS <embed vspace="200."> mapping to marginBottom
 PASS <embed vspace="200in"> mapping to marginBottom
 PASS <embed vspace="200.25in"> mapping to marginBottom
 PASS <embed vspace="200 %"> mapping to marginBottom
@@ -997,14 +997,14 @@
 PASS <embed vspace="."> mapping to marginBottom
 PASS <embed vspace=".%"> mapping to marginBottom
 PASS <embed vspace=".x"> mapping to marginBottom
-FAIL <embed vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
-FAIL <embed vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
+PASS <embed vspace=".5"> mapping to marginBottom
+PASS <embed vspace=".5%"> mapping to marginBottom
 PASS <img hspace="200"> mapping to marginLeft
 PASS <img hspace="1007"> mapping to marginLeft
 PASS <img hspace="   00523   "> mapping to marginLeft
 PASS <img hspace="200.25"> mapping to marginLeft
 FAIL <img hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <img hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
+PASS <img hspace="200."> mapping to marginLeft
 PASS <img hspace="200in"> mapping to marginLeft
 PASS <img hspace="200.25in"> mapping to marginLeft
 PASS <img hspace="200 %"> mapping to marginLeft
@@ -1037,14 +1037,14 @@
 PASS <img hspace="."> mapping to marginLeft
 PASS <img hspace=".%"> mapping to marginLeft
 PASS <img hspace=".x"> mapping to marginLeft
-FAIL <img hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
-FAIL <img hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
+PASS <img hspace=".5"> mapping to marginLeft
+PASS <img hspace=".5%"> mapping to marginLeft
 PASS <img hspace="200"> mapping to marginRight
 PASS <img hspace="1007"> mapping to marginRight
 PASS <img hspace="   00523   "> mapping to marginRight
 PASS <img hspace="200.25"> mapping to marginRight
 FAIL <img hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <img hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
+PASS <img hspace="200."> mapping to marginRight
 PASS <img hspace="200in"> mapping to marginRight
 PASS <img hspace="200.25in"> mapping to marginRight
 PASS <img hspace="200 %"> mapping to marginRight
@@ -1077,14 +1077,14 @@
 PASS <img hspace="."> mapping to marginRight
 PASS <img hspace=".%"> mapping to marginRight
 PASS <img hspace=".x"> mapping to marginRight
-FAIL <img hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
-FAIL <img hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
+PASS <img hspace=".5"> mapping to marginRight
+PASS <img hspace=".5%"> mapping to marginRight
 PASS <img vspace="200"> mapping to marginTop
 PASS <img vspace="1007"> mapping to marginTop
 PASS <img vspace="   00523   "> mapping to marginTop
 PASS <img vspace="200.25"> mapping to marginTop
 FAIL <img vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <img vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
+PASS <img vspace="200."> mapping to marginTop
 PASS <img vspace="200in"> mapping to marginTop
 PASS <img vspace="200.25in"> mapping to marginTop
 PASS <img vspace="200 %"> mapping to marginTop
@@ -1117,14 +1117,14 @@
 PASS <img vspace="."> mapping to marginTop
 PASS <img vspace=".%"> mapping to marginTop
 PASS <img vspace=".x"> mapping to marginTop
-FAIL <img vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
-FAIL <img vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
+PASS <img vspace=".5"> mapping to marginTop
+PASS <img vspace=".5%"> mapping to marginTop
 PASS <img vspace="200"> mapping to marginBottom
 PASS <img vspace="1007"> mapping to marginBottom
 PASS <img vspace="   00523   "> mapping to marginBottom
 PASS <img vspace="200.25"> mapping to marginBottom
 FAIL <img vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <img vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
+PASS <img vspace="200."> mapping to marginBottom
 PASS <img vspace="200in"> mapping to marginBottom
 PASS <img vspace="200.25in"> mapping to marginBottom
 PASS <img vspace="200 %"> mapping to marginBottom
@@ -1157,14 +1157,14 @@
 PASS <img vspace="."> mapping to marginBottom
 PASS <img vspace=".%"> mapping to marginBottom
 PASS <img vspace=".x"> mapping to marginBottom
-FAIL <img vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
-FAIL <img vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
+PASS <img vspace=".5"> mapping to marginBottom
+PASS <img vspace=".5%"> mapping to marginBottom
 PASS <object hspace="200"> mapping to marginLeft
 PASS <object hspace="1007"> mapping to marginLeft
 PASS <object hspace="   00523   "> mapping to marginLeft
 PASS <object hspace="200.25"> mapping to marginLeft
 FAIL <object hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <object hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
+PASS <object hspace="200."> mapping to marginLeft
 PASS <object hspace="200in"> mapping to marginLeft
 PASS <object hspace="200.25in"> mapping to marginLeft
 PASS <object hspace="200 %"> mapping to marginLeft
@@ -1197,14 +1197,14 @@
 PASS <object hspace="."> mapping to marginLeft
 PASS <object hspace=".%"> mapping to marginLeft
 PASS <object hspace=".x"> mapping to marginLeft
-FAIL <object hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
-FAIL <object hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
+PASS <object hspace=".5"> mapping to marginLeft
+PASS <object hspace=".5%"> mapping to marginLeft
 PASS <object hspace="200"> mapping to marginRight
 PASS <object hspace="1007"> mapping to marginRight
 PASS <object hspace="   00523   "> mapping to marginRight
 PASS <object hspace="200.25"> mapping to marginRight
 FAIL <object hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <object hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
+PASS <object hspace="200."> mapping to marginRight
 PASS <object hspace="200in"> mapping to marginRight
 PASS <object hspace="200.25in"> mapping to marginRight
 PASS <object hspace="200 %"> mapping to marginRight
@@ -1237,14 +1237,14 @@
 PASS <object hspace="."> mapping to marginRight
 PASS <object hspace=".%"> mapping to marginRight
 PASS <object hspace=".x"> mapping to marginRight
-FAIL <object hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
-FAIL <object hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
+PASS <object hspace=".5"> mapping to marginRight
+PASS <object hspace=".5%"> mapping to marginRight
 PASS <object vspace="200"> mapping to marginTop
 PASS <object vspace="1007"> mapping to marginTop
 PASS <object vspace="   00523   "> mapping to marginTop
 PASS <object vspace="200.25"> mapping to marginTop
 FAIL <object vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <object vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
+PASS <object vspace="200."> mapping to marginTop
 PASS <object vspace="200in"> mapping to marginTop
 PASS <object vspace="200.25in"> mapping to marginTop
 PASS <object vspace="200 %"> mapping to marginTop
@@ -1277,14 +1277,14 @@
 PASS <object vspace="."> mapping to marginTop
 PASS <object vspace=".%"> mapping to marginTop
 PASS <object vspace=".x"> mapping to marginTop
-FAIL <object vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
-FAIL <object vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
+PASS <object vspace=".5"> mapping to marginTop
+PASS <object vspace=".5%"> mapping to marginTop
 PASS <object vspace="200"> mapping to marginBottom
 PASS <object vspace="1007"> mapping to marginBottom
 PASS <object vspace="   00523   "> mapping to marginBottom
 PASS <object vspace="200.25"> mapping to marginBottom
 FAIL <object vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <object vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
+PASS <object vspace="200."> mapping to marginBottom
 PASS <object vspace="200in"> mapping to marginBottom
 PASS <object vspace="200.25in"> mapping to marginBottom
 PASS <object vspace="200 %"> mapping to marginBottom
@@ -1317,14 +1317,14 @@
 PASS <object vspace="."> mapping to marginBottom
 PASS <object vspace=".%"> mapping to marginBottom
 PASS <object vspace=".x"> mapping to marginBottom
-FAIL <object vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
-FAIL <object vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
+PASS <object vspace=".5"> mapping to marginBottom
+PASS <object vspace=".5%"> mapping to marginBottom
 PASS <input hspace="200"> mapping to marginLeft
 PASS <input hspace="1007"> mapping to marginLeft
 PASS <input hspace="   00523   "> mapping to marginLeft
 PASS <input hspace="200.25"> mapping to marginLeft
 FAIL <input hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <input hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
+PASS <input hspace="200."> mapping to marginLeft
 PASS <input hspace="200in"> mapping to marginLeft
 PASS <input hspace="200.25in"> mapping to marginLeft
 PASS <input hspace="200 %"> mapping to marginLeft
@@ -1357,14 +1357,14 @@
 PASS <input hspace="."> mapping to marginLeft
 PASS <input hspace=".%"> mapping to marginLeft
 PASS <input hspace=".x"> mapping to marginLeft
-FAIL <input hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
-FAIL <input hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
+PASS <input hspace=".5"> mapping to marginLeft
+PASS <input hspace=".5%"> mapping to marginLeft
 PASS <input hspace="200"> mapping to marginRight
 PASS <input hspace="1007"> mapping to marginRight
 PASS <input hspace="   00523   "> mapping to marginRight
 PASS <input hspace="200.25"> mapping to marginRight
 FAIL <input hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <input hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
+PASS <input hspace="200."> mapping to marginRight
 PASS <input hspace="200in"> mapping to marginRight
 PASS <input hspace="200.25in"> mapping to marginRight
 PASS <input hspace="200 %"> mapping to marginRight
@@ -1397,14 +1397,14 @@
 PASS <input hspace="."> mapping to marginRight
 PASS <input hspace=".%"> mapping to marginRight
 PASS <input hspace=".x"> mapping to marginRight
-FAIL <input hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
-FAIL <input hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
+PASS <input hspace=".5"> mapping to marginRight
+PASS <input hspace=".5%"> mapping to marginRight
 PASS <input vspace="200"> mapping to marginTop
 PASS <input vspace="1007"> mapping to marginTop
 PASS <input vspace="   00523   "> mapping to marginTop
 PASS <input vspace="200.25"> mapping to marginTop
 FAIL <input vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <input vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
+PASS <input vspace="200."> mapping to marginTop
 PASS <input vspace="200in"> mapping to marginTop
 PASS <input vspace="200.25in"> mapping to marginTop
 PASS <input vspace="200 %"> mapping to marginTop
@@ -1437,14 +1437,14 @@
 PASS <input vspace="."> mapping to marginTop
 PASS <input vspace=".%"> mapping to marginTop
 PASS <input vspace=".x"> mapping to marginTop
-FAIL <input vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
-FAIL <input vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
+PASS <input vspace=".5"> mapping to marginTop
+PASS <input vspace=".5%"> mapping to marginTop
 PASS <input vspace="200"> mapping to marginBottom
 PASS <input vspace="1007"> mapping to marginBottom
 PASS <input vspace="   00523   "> mapping to marginBottom
 PASS <input vspace="200.25"> mapping to marginBottom
 FAIL <input vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <input vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
+PASS <input vspace="200."> mapping to marginBottom
 PASS <input vspace="200in"> mapping to marginBottom
 PASS <input vspace="200.25in"> mapping to marginBottom
 PASS <input vspace="200 %"> mapping to marginBottom
@@ -1477,14 +1477,14 @@
 PASS <input vspace="."> mapping to marginBottom
 PASS <input vspace=".%"> mapping to marginBottom
 PASS <input vspace=".x"> mapping to marginBottom
-FAIL <input vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
-FAIL <input vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
+PASS <input vspace=".5"> mapping to marginBottom
+PASS <input vspace=".5%"> mapping to marginBottom
 PASS <marquee hspace="200"> mapping to marginLeft
 PASS <marquee hspace="1007"> mapping to marginLeft
 PASS <marquee hspace="   00523   "> mapping to marginLeft
 PASS <marquee hspace="200.25"> mapping to marginLeft
 FAIL <marquee hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <marquee hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
+PASS <marquee hspace="200."> mapping to marginLeft
 PASS <marquee hspace="200in"> mapping to marginLeft
 PASS <marquee hspace="200.25in"> mapping to marginLeft
 PASS <marquee hspace="200 %"> mapping to marginLeft
@@ -1517,14 +1517,14 @@
 PASS <marquee hspace="."> mapping to marginLeft
 PASS <marquee hspace=".%"> mapping to marginLeft
 PASS <marquee hspace=".x"> mapping to marginLeft
-FAIL <marquee hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
-FAIL <marquee hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
+PASS <marquee hspace=".5"> mapping to marginLeft
+PASS <marquee hspace=".5%"> mapping to marginLeft
 PASS <marquee hspace="200"> mapping to marginRight
 PASS <marquee hspace="1007"> mapping to marginRight
 PASS <marquee hspace="   00523   "> mapping to marginRight
 PASS <marquee hspace="200.25"> mapping to marginRight
 FAIL <marquee hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <marquee hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
+PASS <marquee hspace="200."> mapping to marginRight
 PASS <marquee hspace="200in"> mapping to marginRight
 PASS <marquee hspace="200.25in"> mapping to marginRight
 PASS <marquee hspace="200 %"> mapping to marginRight
@@ -1557,14 +1557,14 @@
 PASS <marquee hspace="."> mapping to marginRight
 PASS <marquee hspace=".%"> mapping to marginRight
 PASS <marquee hspace=".x"> mapping to marginRight
-FAIL <marquee hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
-FAIL <marquee hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
+PASS <marquee hspace=".5"> mapping to marginRight
+PASS <marquee hspace=".5%"> mapping to marginRight
 PASS <marquee vspace="200"> mapping to marginTop
 PASS <marquee vspace="1007"> mapping to marginTop
 PASS <marquee vspace="   00523   "> mapping to marginTop
 PASS <marquee vspace="200.25"> mapping to marginTop
 FAIL <marquee vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <marquee vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
+PASS <marquee vspace="200."> mapping to marginTop
 PASS <marquee vspace="200in"> mapping to marginTop
 PASS <marquee vspace="200.25in"> mapping to marginTop
 PASS <marquee vspace="200 %"> mapping to marginTop
@@ -1597,14 +1597,14 @@
 PASS <marquee vspace="."> mapping to marginTop
 PASS <marquee vspace=".%"> mapping to marginTop
 PASS <marquee vspace=".x"> mapping to marginTop
-FAIL <marquee vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
-FAIL <marquee vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
+PASS <marquee vspace=".5"> mapping to marginTop
+PASS <marquee vspace=".5%"> mapping to marginTop
 PASS <marquee vspace="200"> mapping to marginBottom
 PASS <marquee vspace="1007"> mapping to marginBottom
 PASS <marquee vspace="   00523   "> mapping to marginBottom
 PASS <marquee vspace="200.25"> mapping to marginBottom
 FAIL <marquee vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
-FAIL <marquee vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
+PASS <marquee vspace="200."> mapping to marginBottom
 PASS <marquee vspace="200in"> mapping to marginBottom
 PASS <marquee vspace="200.25in"> mapping to marginBottom
 PASS <marquee vspace="200 %"> mapping to marginBottom
@@ -1637,6 +1637,6 @@
 PASS <marquee vspace="."> mapping to marginBottom
 PASS <marquee vspace=".%"> mapping to marginBottom
 PASS <marquee vspace=".x"> mapping to marginBottom
-FAIL <marquee vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
-FAIL <marquee vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
+PASS <marquee vspace=".5"> mapping to marginBottom
+PASS <marquee vspace=".5%"> mapping to marginBottom
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt (278764 => 278765)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt	2021-06-11 17:41:18 UTC (rev 278765)
@@ -170,7 +170,7 @@
 PASS <body marginwidth="200"> mapping to marginLeft
 PASS <body marginwidth="1007"> mapping to marginLeft
 PASS <body marginwidth="   00523   "> mapping to marginLeft
-FAIL <body marginwidth="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
+PASS <body marginwidth="200."> mapping to marginLeft
 FAIL <body marginwidth="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginwidth="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginwidth="0"> mapping to marginLeft
@@ -191,7 +191,7 @@
 PASS <body marginwidth="200"> mapping to marginRight
 PASS <body marginwidth="1007"> mapping to marginRight
 PASS <body marginwidth="   00523   "> mapping to marginRight
-FAIL <body marginwidth="200."> mapping to marginRight assert_equals: expected "200px" but got "8px"
+PASS <body marginwidth="200."> mapping to marginRight
 FAIL <body marginwidth="200.25"> mapping to marginRight assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginwidth="200.7"> mapping to marginRight assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginwidth="0"> mapping to marginRight
@@ -212,7 +212,7 @@
 PASS <body leftmargin="200"> mapping to marginLeft
 PASS <body leftmargin="1007"> mapping to marginLeft
 PASS <body leftmargin="   00523   "> mapping to marginLeft
-FAIL <body leftmargin="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
+PASS <body leftmargin="200."> mapping to marginLeft
 FAIL <body leftmargin="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
 FAIL <body leftmargin="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body leftmargin="0"> mapping to marginLeft
@@ -254,7 +254,7 @@
 PASS <body marginheight="200"> mapping to marginTop
 PASS <body marginheight="1007"> mapping to marginTop
 PASS <body marginheight="   00523   "> mapping to marginTop
-FAIL <body marginheight="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
+PASS <body marginheight="200."> mapping to marginTop
 FAIL <body marginheight="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginheight="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginheight="0"> mapping to marginTop
@@ -275,7 +275,7 @@
 PASS <body marginheight="200"> mapping to marginBottom
 PASS <body marginheight="1007"> mapping to marginBottom
 PASS <body marginheight="   00523   "> mapping to marginBottom
-FAIL <body marginheight="200."> mapping to marginBottom assert_equals: expected "200px" but got "8px"
+PASS <body marginheight="200."> mapping to marginBottom
 FAIL <body marginheight="200.25"> mapping to marginBottom assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginheight="200.7"> mapping to marginBottom assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginheight="0"> mapping to marginBottom
@@ -296,7 +296,7 @@
 PASS <body topmargin="200"> mapping to marginTop
 PASS <body topmargin="1007"> mapping to marginTop
 PASS <body topmargin="   00523   "> mapping to marginTop
-FAIL <body topmargin="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
+PASS <body topmargin="200."> mapping to marginTop
 FAIL <body topmargin="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
 FAIL <body topmargin="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body topmargin="0"> mapping to marginTop

Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt (278764 => 278765)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt	2021-06-11 17:41:18 UTC (rev 278765)
@@ -170,7 +170,7 @@
 PASS <body marginwidth="200"> mapping to marginLeft
 PASS <body marginwidth="1007"> mapping to marginLeft
 PASS <body marginwidth="   00523   "> mapping to marginLeft
-FAIL <body marginwidth="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
+PASS <body marginwidth="200."> mapping to marginLeft
 FAIL <body marginwidth="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginwidth="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginwidth="0"> mapping to marginLeft
@@ -191,7 +191,7 @@
 PASS <body marginwidth="200"> mapping to marginRight
 PASS <body marginwidth="1007"> mapping to marginRight
 PASS <body marginwidth="   00523   "> mapping to marginRight
-FAIL <body marginwidth="200."> mapping to marginRight assert_equals: expected "200px" but got "8px"
+PASS <body marginwidth="200."> mapping to marginRight
 FAIL <body marginwidth="200.25"> mapping to marginRight assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginwidth="200.7"> mapping to marginRight assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginwidth="0"> mapping to marginRight
@@ -212,7 +212,7 @@
 PASS <body leftmargin="200"> mapping to marginLeft
 PASS <body leftmargin="1007"> mapping to marginLeft
 PASS <body leftmargin="   00523   "> mapping to marginLeft
-FAIL <body leftmargin="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
+PASS <body leftmargin="200."> mapping to marginLeft
 FAIL <body leftmargin="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
 FAIL <body leftmargin="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body leftmargin="0"> mapping to marginLeft
@@ -254,7 +254,7 @@
 PASS <body marginheight="200"> mapping to marginTop
 PASS <body marginheight="1007"> mapping to marginTop
 PASS <body marginheight="   00523   "> mapping to marginTop
-FAIL <body marginheight="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
+PASS <body marginheight="200."> mapping to marginTop
 FAIL <body marginheight="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginheight="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginheight="0"> mapping to marginTop
@@ -275,7 +275,7 @@
 PASS <body marginheight="200"> mapping to marginBottom
 PASS <body marginheight="1007"> mapping to marginBottom
 PASS <body marginheight="   00523   "> mapping to marginBottom
-FAIL <body marginheight="200."> mapping to marginBottom assert_equals: expected "200px" but got "8px"
+PASS <body marginheight="200."> mapping to marginBottom
 FAIL <body marginheight="200.25"> mapping to marginBottom assert_equals: expected "200px" but got "200.25px"
 FAIL <body marginheight="200.7"> mapping to marginBottom assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body marginheight="0"> mapping to marginBottom
@@ -296,7 +296,7 @@
 PASS <body topmargin="200"> mapping to marginTop
 PASS <body topmargin="1007"> mapping to marginTop
 PASS <body topmargin="   00523   "> mapping to marginTop
-FAIL <body topmargin="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
+PASS <body topmargin="200."> mapping to marginTop
 FAIL <body topmargin="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
 FAIL <body topmargin="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
 PASS <body topmargin="0"> mapping to marginTop

Modified: trunk/Source/WebCore/ChangeLog (278764 => 278765)


--- trunk/Source/WebCore/ChangeLog	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/ChangeLog	2021-06-11 17:41:18 UTC (rev 278765)
@@ -1,3 +1,36 @@
+2021-06-11  Cathie Chen  <cathiec...@igalia.com>
+
+        Use HTMLDimension to parse different HTML attribute length values
+        https://bugs.webkit.org/show_bug.cgi?id=226810
+
+        Reviewed by Darin Adler.
+
+        This patch uses HTMLDimension to parse different kind of html length values which are defined in [1].
+        Then according the length types to determine if the value is valid.
+
+        [1] https://www.w3.org/TR/html4/sgml/dtd.html#Length
+
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::addHTMLLengthToStyle):
+        (WebCore::HTMLElement::addHTMLLengthToStyle): Add HTMLLength (including percentage values and pixel values) to style.
+        (WebCore::HTMLElement::addHTMLMultiLengthToStyle): Add MultiLength (including percentage, pixel and relative values) to style.
+        (WebCore::HTMLElement::addHTMLPixelsToStyle): Add pixel values to style.
+        (WebCore::HTMLElement::addHTMLNumberToStyle): Add number (including percentage values and numbers) to style.
+        * html/HTMLElement.h:
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::collectPresentationalHintsForAttribute): <img>'s width and height attributes are multiLength.
+        * html/HTMLMarqueeElement.cpp:
+        (WebCore::HTMLMarqueeElement::collectPresentationalHintsForAttribute): scrolldelayAttr and loopAttr are numbers.
+        * html/HTMLTableColElement.cpp:
+        (WebCore::HTMLTableColElement::collectPresentationalHintsForAttribute): <col>'s width and height attributes are multiLength.
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::collectPresentationalHintsForAttribute): <table>'s cellspacingAttr only supports pixel values.
+        * html/parser/HTMLParserIdioms.cpp:
+        (WebCore::parseHTMLDimensionInternal):
+        (WebCore::parseHTMLDimension):
+        (WebCore::parseHTMLMultiLength): MultiLength doesn't support relative_length (number + *), but make sure relative_length not be treated as a pixel value.
+        * html/parser/HTMLParserIdioms.h:
+
 2021-06-11  Youenn Fablet  <you...@apple.com>
 
         getDisplayMedia API doesn't work

Modified: trunk/Source/WebCore/html/HTMLElement.cpp (278764 => 278765)


--- trunk/Source/WebCore/html/HTMLElement.cpp	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/HTMLElement.cpp	2021-06-11 17:41:18 UTC (rev 278765)
@@ -1016,36 +1016,44 @@
     }
 }
 
-void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, const String& value)
+void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value, AllowPercentage allowPercentage, UseCSSPXAsUnitType useCSSPX, IsMultiLength isMultiLength)
 {
-    // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct
-    // length unit and make the appropriate parsed value.
+    auto dimensionValue = isMultiLength == IsMultiLength::No ? parseHTMLDimension(value) : parseHTMLMultiLength(value);
+    if (!dimensionValue)
+        return;
+    if (dimensionValue->type == HTMLDimension::Type::Percentage) {
+        if (allowPercentage == AllowPercentage::Yes)
+            addPropertyToPresentationalHintStyle(style, propertyID, dimensionValue->number, CSSUnitType::CSS_PERCENTAGE);
+        return;
+    }
+    if (useCSSPX == UseCSSPXAsUnitType::Yes)
+        addPropertyToPresentationalHintStyle(style, propertyID, dimensionValue->number, CSSUnitType::CSS_PX);
+    else
+        addPropertyToPresentationalHintStyle(style, propertyID, dimensionValue->number, CSSUnitType::CSS_NUMBER);
+}
 
-    if (StringImpl* string = value.impl()) {
-        unsigned parsedLength = 0;
+// https://www.w3.org/TR/html4/sgml/dtd.html#Length, including pixel and percentage values.
+void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
+{
+    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::Yes, IsMultiLength::No);
+}
 
-        while (parsedLength < string->length() && (*string)[parsedLength] <= ' ')
-            ++parsedLength;
+// https://www.w3.org/TR/html4/sgml/dtd.html#MultiLength, including pixel, percentage, and relative values.
+void HTMLElement::addHTMLMultiLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
+{
+    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::Yes, IsMultiLength::Yes);
+}
 
-        for (; parsedLength < string->length(); ++parsedLength) {
-            UChar cc = (*string)[parsedLength];
-            if (cc > '9')
-                break;
-            if (cc < '0') {
-                if (cc == '%' || cc == '*')
-                    ++parsedLength;
-                if (cc != '.')
-                    break;
-            }
-        }
+// https://www.w3.org/TR/html4/sgml/dtd.html#Pixels, including pixel value.
+void HTMLElement::addHTMLPixelsToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
+{
+    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::No, UseCSSPXAsUnitType::Yes, IsMultiLength::No);
+}
 
-        if (parsedLength != string->length()) {
-            addPropertyToPresentationalHintStyle(style, propertyID, string->substring(0, parsedLength));
-            return;
-        }
-    }
-
-    addPropertyToPresentationalHintStyle(style, propertyID, value);
+// This is specific to <marquee> attributes, including pixel and CSS_NUMBER values.
+void HTMLElement::addHTMLNumberToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
+{
+    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::No, IsMultiLength::No);
 }
 
 // Color parsing that matches HTML's "rules for parsing a legacy color value"

Modified: trunk/Source/WebCore/html/HTMLElement.h (278764 => 278765)


--- trunk/Source/WebCore/html/HTMLElement.h	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/HTMLElement.h	2021-06-11 17:41:18 UTC (rev 278765)
@@ -150,7 +150,11 @@
 protected:
     HTMLElement(const QualifiedName& tagName, Document&, ConstructionType);
 
-    void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, const String& value);
+    void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
+    void addHTMLMultiLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
+    void addHTMLPixelsToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
+    void addHTMLNumberToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
+
     void addHTMLColorToStyle(MutableStyleProperties&, CSSPropertyID, const String& color);
 
     void applyAspectRatioFromWidthAndHeightAttributesToStyle(MutableStyleProperties&);
@@ -182,6 +186,11 @@
 
     static void populateEventHandlerNameMap(EventHandlerNameMap&, const QualifiedName* const table[], size_t tableSize);
     static EventHandlerNameMap createEventHandlerNameMap();
+
+    enum class AllowPercentage : bool { No, Yes };
+    enum class UseCSSPXAsUnitType : bool { No, Yes };
+    enum class IsMultiLength : bool { No, Yes };
+    void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value, AllowPercentage, UseCSSPXAsUnitType, IsMultiLength);
 };
 
 inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document& document, ConstructionType type = CreateHTMLElement)

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (278764 => 278765)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2021-06-11 17:41:18 UTC (rev 278765)
@@ -116,10 +116,10 @@
 void HTMLImageElement::collectPresentationalHintsForAttribute(const QualifiedName& name, const AtomString& value, MutableStyleProperties& style)
 {
     if (name == widthAttr) {
-        addHTMLLengthToStyle(style, CSSPropertyWidth, value);
+        addHTMLMultiLengthToStyle(style, CSSPropertyWidth, value);
         applyAspectRatioFromWidthAndHeightAttributesToStyle(style);
     } else if (name == heightAttr) {
-        addHTMLLengthToStyle(style, CSSPropertyHeight, value);
+        addHTMLMultiLengthToStyle(style, CSSPropertyHeight, value);
         applyAspectRatioFromWidthAndHeightAttributesToStyle(style);
     } else if (name == borderAttr)
         applyBorderAttributeToStyle(value, style);

Modified: trunk/Source/WebCore/html/HTMLMarqueeElement.cpp (278764 => 278765)


--- trunk/Source/WebCore/html/HTMLMarqueeElement.cpp	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/HTMLMarqueeElement.cpp	2021-06-11 17:41:18 UTC (rev 278765)
@@ -95,13 +95,13 @@
             addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeIncrement, value);
     } else if (name == scrolldelayAttr) {
         if (!value.isEmpty())
-            addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeSpeed, value);
+            addHTMLNumberToStyle(style, CSSPropertyWebkitMarqueeSpeed, value);
     } else if (name == loopAttr) {
         if (!value.isEmpty()) {
             if (value == "-1" || equalLettersIgnoringASCIICase(value, "infinite"))
                 addPropertyToPresentationalHintStyle(style, CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite);
             else
-                addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeRepetition, value);
+                addHTMLNumberToStyle(style, CSSPropertyWebkitMarqueeRepetition, value);
         }
     } else if (name == behaviorAttr) {
         if (!value.isEmpty())

Modified: trunk/Source/WebCore/html/HTMLTableColElement.cpp (278764 => 278765)


--- trunk/Source/WebCore/html/HTMLTableColElement.cpp	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/HTMLTableColElement.cpp	2021-06-11 17:41:18 UTC (rev 278765)
@@ -64,7 +64,9 @@
 void HTMLTableColElement::collectPresentationalHintsForAttribute(const QualifiedName& name, const AtomString& value, MutableStyleProperties& style)
 {
     if (name == widthAttr)
-        addHTMLLengthToStyle(style, CSSPropertyWidth, value);
+        addHTMLMultiLengthToStyle(style, CSSPropertyWidth, value);
+    else if (name == heightAttr)
+        addHTMLMultiLengthToStyle(style, CSSPropertyHeight, value);
     else
         HTMLTablePartElement::collectPresentationalHintsForAttribute(name, value, style);
 }

Modified: trunk/Source/WebCore/html/HTMLTableElement.cpp (278764 => 278765)


--- trunk/Source/WebCore/html/HTMLTableElement.cpp	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/HTMLTableElement.cpp	2021-06-11 17:41:18 UTC (rev 278765)
@@ -326,7 +326,7 @@
             addPropertyToPresentationalHintStyle(style, CSSPropertyVerticalAlign, value);
     } else if (name == cellspacingAttr) {
         if (!value.isEmpty())
-            addHTMLLengthToStyle(style, CSSPropertyBorderSpacing, value);
+            addHTMLPixelsToStyle(style, CSSPropertyBorderSpacing, value);
     } else if (name == vspaceAttr) {
         addHTMLLengthToStyle(style, CSSPropertyMarginTop, value);
         addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value);

Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (278764 => 278765)


--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2021-06-11 17:41:18 UTC (rev 278765)
@@ -512,7 +512,8 @@
     return result;
 }
 
-std::optional<HTMLDimension> parseHTMLDimension(StringView dimensionString)
+enum class IsMultiLength : bool { No, Yes };
+static std::optional<HTMLDimension> parseHTMLDimensionInternal(StringView dimensionString, IsMultiLength isMultiLength)
 {
     std::optional<HTMLDimensionParsingResult> result;
     auto length = dimensionString.length();
@@ -523,6 +524,10 @@
     if (!result)
         return std::nullopt;
 
+    // The relative_length is not supported, here to make sure number + * does not map to number
+    if (isMultiLength == IsMultiLength::Yes && result->parsedLength < length && dimensionString[result->parsedLength] == '*')
+        return std::nullopt;
+
     HTMLDimension dimension;
     dimension.number = result->number;
     dimension.type = HTMLDimension::Type::Pixel;
@@ -531,4 +536,14 @@
     return dimension;
 }
 
+std::optional<HTMLDimension> parseHTMLDimension(StringView dimensionString)
+{
+    return parseHTMLDimensionInternal(dimensionString, IsMultiLength::No);
 }
+
+std::optional<HTMLDimension> parseHTMLMultiLength(StringView multiLengthString)
+{
+    return parseHTMLDimensionInternal(multiLengthString, IsMultiLength::Yes);
+}
+
+}

Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (278764 => 278765)


--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h	2021-06-11 17:25:40 UTC (rev 278764)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h	2021-06-11 17:41:18 UTC (rev 278765)
@@ -93,6 +93,7 @@
     Type type;
 };
 std::optional<HTMLDimension> parseHTMLDimension(StringView);
+std::optional<HTMLDimension> parseHTMLMultiLength(StringView);
 
 // Inline implementations of some of the functions declared above.
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to