Changeset 278765 in webkit


Ignore:
Timestamp:
Jun 11, 2021, 10:41:18 AM (4 years ago)
Author:
cathiechen
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:
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r278764 r278765  
     12021-06-11  Cathie Chen  <cathiechen@igalia.com>
     2
     3        Use HTMLDimension to parse different HTML attribute length values
     4        https://bugs.webkit.org/show_bug.cgi?id=226810
     5
     6        Reviewed by Darin Adler.
     7
     8        * platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:
     9
    1102021-06-11  Youenn Fablet  <youenn@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r278742 r278765  
     12021-06-11  Cathie Chen  <cathiechen@igalia.com>
     2
     3        Use HTMLDimension to parse different HTML attribute length values
     4        https://bugs.webkit.org/show_bug.cgi?id=226810
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/html/rendering/dimension-attributes-expected.txt:
     9        * web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:
     10
    1112021-06-10  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/dimension-attributes-expected.txt

    r267646 r278765  
    55PASS <hr width="200.25"> mapping to width
    66FAIL <hr width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    7 FAIL <hr width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     7PASS <hr width="200."> mapping to width
    88PASS <hr width="200in"> mapping to width
    99PASS <hr width="200.25in"> mapping to width
     
    3838PASS <hr width=".%"> mapping to width
    3939PASS <hr width=".x"> mapping to width
    40 FAIL <hr width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    41 FAIL <hr width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     40PASS <hr width=".5"> mapping to width
     41PASS <hr width=".5%"> mapping to width
    4242PASS <iframe width="200"> mapping to width
    4343PASS <iframe width="1007"> mapping to width
     
    4545PASS <iframe width="200.25"> mapping to width
    4646FAIL <iframe width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    47 FAIL <iframe width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     47PASS <iframe width="200."> mapping to width
    4848PASS <iframe width="200in"> mapping to width
    4949PASS <iframe width="200.25in"> mapping to width
     
    7878PASS <iframe width=".%"> mapping to width
    7979PASS <iframe width=".x"> mapping to width
    80 FAIL <iframe width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    81 FAIL <iframe width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     80PASS <iframe width=".5"> mapping to width
     81PASS <iframe width=".5%"> mapping to width
    8282PASS <iframe height="200"> mapping to height
    8383PASS <iframe height="1007"> mapping to height
     
    8585PASS <iframe height="200.25"> mapping to height
    8686FAIL <iframe height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    87 FAIL <iframe height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     87PASS <iframe height="200."> mapping to height
    8888PASS <iframe height="200in"> mapping to height
    8989PASS <iframe height="200.25in"> mapping to height
     
    118118PASS <iframe height=".%"> mapping to height
    119119PASS <iframe height=".x"> mapping to height
    120 FAIL <iframe height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    121 FAIL <iframe height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     120PASS <iframe height=".5"> mapping to height
     121PASS <iframe height=".5%"> mapping to height
    122122PASS <input width="200"> mapping to width
    123123PASS <input width="1007"> mapping to width
     
    125125PASS <input width="200.25"> mapping to width
    126126FAIL <input width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    127 FAIL <input width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     127PASS <input width="200."> mapping to width
    128128PASS <input width="200in"> mapping to width
    129129PASS <input width="200.25in"> mapping to width
     
    158158PASS <input width=".%"> mapping to width
    159159PASS <input width=".x"> mapping to width
    160 FAIL <input width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    161 FAIL <input width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     160PASS <input width=".5"> mapping to width
     161PASS <input width=".5%"> mapping to width
    162162PASS <input height="200"> mapping to height
    163163PASS <input height="1007"> mapping to height
     
    165165PASS <input height="200.25"> mapping to height
    166166FAIL <input height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    167 FAIL <input height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     167PASS <input height="200."> mapping to height
    168168PASS <input height="200in"> mapping to height
    169169PASS <input height="200.25in"> mapping to height
     
    198198PASS <input height=".%"> mapping to height
    199199PASS <input height=".x"> mapping to height
    200 FAIL <input height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    201 FAIL <input height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     200PASS <input height=".5"> mapping to height
     201PASS <input height=".5%"> mapping to height
    202202PASS <marquee width="200"> mapping to width
    203203PASS <marquee width="1007"> mapping to width
     
    205205PASS <marquee width="200.25"> mapping to width
    206206FAIL <marquee width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    207 FAIL <marquee width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     207PASS <marquee width="200."> mapping to width
    208208PASS <marquee width="200in"> mapping to width
    209209PASS <marquee width="200.25in"> mapping to width
     
    238238PASS <marquee width=".%"> mapping to width
    239239PASS <marquee width=".x"> mapping to width
    240 FAIL <marquee width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    241 FAIL <marquee width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     240PASS <marquee width=".5"> mapping to width
     241PASS <marquee width=".5%"> mapping to width
    242242PASS <marquee height="200"> mapping to height
    243243PASS <marquee height="1007"> mapping to height
     
    245245PASS <marquee height="200.25"> mapping to height
    246246FAIL <marquee height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    247 FAIL <marquee height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     247PASS <marquee height="200."> mapping to height
    248248PASS <marquee height="200in"> mapping to height
    249249PASS <marquee height="200.25in"> mapping to height
     
    278278PASS <marquee height=".%"> mapping to height
    279279PASS <marquee height=".x"> mapping to height
    280 FAIL <marquee height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    281 FAIL <marquee height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     280PASS <marquee height=".5"> mapping to height
     281PASS <marquee height=".5%"> mapping to height
    282282PASS <video width="200"> mapping to width
    283283PASS <video width="1007"> mapping to width
     
    285285PASS <video width="200.25"> mapping to width
    286286FAIL <video width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    287 FAIL <video width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     287PASS <video width="200."> mapping to width
    288288PASS <video width="200in"> mapping to width
    289289PASS <video width="200.25in"> mapping to width
     
    318318PASS <video width=".%"> mapping to width
    319319PASS <video width=".x"> mapping to width
    320 FAIL <video width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    321 FAIL <video width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     320PASS <video width=".5"> mapping to width
     321PASS <video width=".5%"> mapping to width
    322322PASS <video height="200"> mapping to height
    323323PASS <video height="1007"> mapping to height
     
    325325PASS <video height="200.25"> mapping to height
    326326FAIL <video height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    327 FAIL <video height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     327PASS <video height="200."> mapping to height
    328328PASS <video height="200in"> mapping to height
    329329PASS <video height="200.25in"> mapping to height
     
    358358PASS <video height=".%"> mapping to height
    359359PASS <video height=".x"> mapping to height
    360 FAIL <video height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    361 FAIL <video height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     360PASS <video height=".5"> mapping to height
     361PASS <video height=".5%"> mapping to height
    362362PASS <object width="200"> mapping to width
    363363PASS <object width="1007"> mapping to width
     
    365365PASS <object width="200.25"> mapping to width
    366366FAIL <object width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    367 FAIL <object width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     367PASS <object width="200."> mapping to width
    368368PASS <object width="200in"> mapping to width
    369369PASS <object width="200.25in"> mapping to width
     
    398398PASS <object width=".%"> mapping to width
    399399PASS <object width=".x"> mapping to width
    400 FAIL <object width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    401 FAIL <object width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     400PASS <object width=".5"> mapping to width
     401PASS <object width=".5%"> mapping to width
    402402PASS <object height="200"> mapping to height
    403403PASS <object height="1007"> mapping to height
     
    405405PASS <object height="200.25"> mapping to height
    406406FAIL <object height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    407 FAIL <object height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     407PASS <object height="200."> mapping to height
    408408PASS <object height="200in"> mapping to height
    409409PASS <object height="200.25in"> mapping to height
     
    438438PASS <object height=".%"> mapping to height
    439439PASS <object height=".x"> mapping to height
    440 FAIL <object height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    441 FAIL <object height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     440PASS <object height=".5"> mapping to height
     441PASS <object height=".5%"> mapping to height
    442442PASS <embed width="200"> mapping to width
    443443PASS <embed width="1007"> mapping to width
     
    445445PASS <embed width="200.25"> mapping to width
    446446FAIL <embed width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    447 FAIL <embed width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     447PASS <embed width="200."> mapping to width
    448448PASS <embed width="200in"> mapping to width
    449449PASS <embed width="200.25in"> mapping to width
     
    478478PASS <embed width=".%"> mapping to width
    479479PASS <embed width=".x"> mapping to width
    480 FAIL <embed width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    481 FAIL <embed width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     480PASS <embed width=".5"> mapping to width
     481PASS <embed width=".5%"> mapping to width
    482482PASS <embed height="200"> mapping to height
    483483PASS <embed height="1007"> mapping to height
     
    485485PASS <embed height="200.25"> mapping to height
    486486FAIL <embed height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    487 FAIL <embed height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     487PASS <embed height="200."> mapping to height
    488488PASS <embed height="200in"> mapping to height
    489489PASS <embed height="200.25in"> mapping to height
     
    518518PASS <embed height=".%"> mapping to height
    519519PASS <embed height=".x"> mapping to height
    520 FAIL <embed height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    521 FAIL <embed height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     520PASS <embed height=".5"> mapping to height
     521PASS <embed height=".5%"> mapping to height
    522522PASS <img width="200"> mapping to width
    523523PASS <img width="1007"> mapping to width
     
    525525PASS <img width="200.25"> mapping to width
    526526FAIL <img width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    527 FAIL <img width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     527PASS <img width="200."> mapping to width
    528528PASS <img width="200in"> mapping to width
    529529PASS <img width="200.25in"> mapping to width
     
    558558PASS <img width=".%"> mapping to width
    559559PASS <img width=".x"> mapping to width
    560 FAIL <img width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    561 FAIL <img width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     560PASS <img width=".5"> mapping to width
     561PASS <img width=".5%"> mapping to width
    562562PASS <img height="200"> mapping to height
    563563PASS <img height="1007"> mapping to height
     
    565565PASS <img height="200.25"> mapping to height
    566566FAIL <img height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    567 FAIL <img height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     567PASS <img height="200."> mapping to height
    568568PASS <img height="200in"> mapping to height
    569569PASS <img height="200.25in"> mapping to height
     
    598598PASS <img height=".%"> mapping to height
    599599PASS <img height=".x"> mapping to height
    600 FAIL <img height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    601 FAIL <img height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     600PASS <img height=".5"> mapping to height
     601PASS <img height=".5%"> mapping to height
    602602PASS <td width="200"> mapping to width
    603603PASS <td width="1007"> mapping to width
     
    605605PASS <td width="200.25"> mapping to width
    606606FAIL <td width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    607 FAIL <td width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     607PASS <td width="200."> mapping to width
    608608PASS <td width="200in"> mapping to width
    609609PASS <td width="200.25in"> mapping to width
     
    645645PASS <td height="200.25"> mapping to height
    646646FAIL <td height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    647 FAIL <td height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     647PASS <td height="200."> mapping to height
    648648PASS <td height="200in"> mapping to height
    649649PASS <td height="200.25in"> mapping to height
     
    685685PASS <table width="200.25"> mapping to width
    686686FAIL <table width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    687 FAIL <table width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     687PASS <table width="200."> mapping to width
    688688PASS <table width="200in"> mapping to width
    689689PASS <table width="200.25in"> mapping to width
     
    715715PASS <table width=".%"> mapping to width
    716716PASS <table width=".x"> mapping to width
    717 FAIL <table width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    718 FAIL <table width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     717PASS <table width=".5"> mapping to width
     718PASS <table width=".5%"> mapping to width
    719719FAIL <table width="0"> mapping to width assert_equals: expected "auto" but got "0px"
    720720FAIL <table width="0%"> mapping to width assert_equals: expected "auto" but got "0%"
     
    725725PASS <table height="200.25"> mapping to height
    726726FAIL <table height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    727 FAIL <table height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     727PASS <table height="200."> mapping to height
    728728PASS <table height="200in"> mapping to height
    729729PASS <table height="200.25in"> mapping to height
     
    755755PASS <table height=".%"> mapping to height
    756756PASS <table height=".x"> mapping to height
    757 FAIL <table height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    758 FAIL <table height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     757PASS <table height=".5"> mapping to height
     758PASS <table height=".5%"> mapping to height
    759759FAIL <table height="0"> mapping to height assert_equals: expected "auto" but got "0px"
    760760FAIL <table height="0%"> mapping to height assert_equals: expected "auto" but got "0%"
     
    765765PASS <tr height="200.25"> mapping to height
    766766FAIL <tr height="200.7"> mapping to height assert_equals: expected "200.7px" but got "200.6999969482422px"
    767 FAIL <tr height="200."> mapping to height assert_equals: expected "200px" but got "auto"
     767PASS <tr height="200."> mapping to height
    768768PASS <tr height="200in"> mapping to height
    769769PASS <tr height="200.25in"> mapping to height
     
    795795PASS <tr height=".%"> mapping to height
    796796PASS <tr height=".x"> mapping to height
    797 FAIL <tr height=".5"> mapping to height assert_equals: expected "auto" but got "0.5px"
    798 FAIL <tr height=".5%"> mapping to height assert_equals: expected "auto" but got "0.5%"
     797PASS <tr height=".5"> mapping to height
     798PASS <tr height=".5%"> mapping to height
    799799FAIL <tr height="0"> mapping to height assert_equals: expected "auto" but got "0px"
    800800FAIL <tr height="0%"> mapping to height assert_equals: expected "auto" but got "0%"
     
    805805PASS <col width="200.25"> mapping to width
    806806FAIL <col width="200.7"> mapping to width assert_equals: expected "200.7px" but got "200.6999969482422px"
    807 FAIL <col width="200."> mapping to width assert_equals: expected "200px" but got "auto"
     807PASS <col width="200."> mapping to width
    808808PASS <col width="200in"> mapping to width
    809809PASS <col width="200.25in"> mapping to width
     
    835835PASS <col width=".%"> mapping to width
    836836PASS <col width=".x"> mapping to width
    837 FAIL <col width=".5"> mapping to width assert_equals: expected "auto" but got "0.5px"
    838 FAIL <col width=".5%"> mapping to width assert_equals: expected "auto" but got "0.5%"
     837PASS <col width=".5"> mapping to width
     838PASS <col width=".5%"> mapping to width
    839839FAIL <col width="0"> mapping to width assert_equals: expected "auto" but got "0px"
    840840FAIL <col width="0%"> mapping to width assert_equals: expected "auto" but got "0%"
     
    845845PASS <embed hspace="200.25"> mapping to marginLeft
    846846FAIL <embed hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
    847 FAIL <embed hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
     847PASS <embed hspace="200."> mapping to marginLeft
    848848PASS <embed hspace="200in"> mapping to marginLeft
    849849PASS <embed hspace="200.25in"> mapping to marginLeft
     
    878878PASS <embed hspace=".%"> mapping to marginLeft
    879879PASS <embed hspace=".x"> mapping to marginLeft
    880 FAIL <embed hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
    881 FAIL <embed hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
     880PASS <embed hspace=".5"> mapping to marginLeft
     881PASS <embed hspace=".5%"> mapping to marginLeft
    882882PASS <embed hspace="200"> mapping to marginRight
    883883PASS <embed hspace="1007"> mapping to marginRight
     
    885885PASS <embed hspace="200.25"> mapping to marginRight
    886886FAIL <embed hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
    887 FAIL <embed hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
     887PASS <embed hspace="200."> mapping to marginRight
    888888PASS <embed hspace="200in"> mapping to marginRight
    889889PASS <embed hspace="200.25in"> mapping to marginRight
     
    918918PASS <embed hspace=".%"> mapping to marginRight
    919919PASS <embed hspace=".x"> mapping to marginRight
    920 FAIL <embed hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
    921 FAIL <embed hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
     920PASS <embed hspace=".5"> mapping to marginRight
     921PASS <embed hspace=".5%"> mapping to marginRight
    922922PASS <embed vspace="200"> mapping to marginTop
    923923PASS <embed vspace="1007"> mapping to marginTop
     
    925925PASS <embed vspace="200.25"> mapping to marginTop
    926926FAIL <embed vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
    927 FAIL <embed vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
     927PASS <embed vspace="200."> mapping to marginTop
    928928PASS <embed vspace="200in"> mapping to marginTop
    929929PASS <embed vspace="200.25in"> mapping to marginTop
     
    958958PASS <embed vspace=".%"> mapping to marginTop
    959959PASS <embed vspace=".x"> mapping to marginTop
    960 FAIL <embed vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
    961 FAIL <embed vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
     960PASS <embed vspace=".5"> mapping to marginTop
     961PASS <embed vspace=".5%"> mapping to marginTop
    962962PASS <embed vspace="200"> mapping to marginBottom
    963963PASS <embed vspace="1007"> mapping to marginBottom
     
    965965PASS <embed vspace="200.25"> mapping to marginBottom
    966966FAIL <embed vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
    967 FAIL <embed vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
     967PASS <embed vspace="200."> mapping to marginBottom
    968968PASS <embed vspace="200in"> mapping to marginBottom
    969969PASS <embed vspace="200.25in"> mapping to marginBottom
     
    998998PASS <embed vspace=".%"> mapping to marginBottom
    999999PASS <embed vspace=".x"> mapping to marginBottom
    1000 FAIL <embed vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
    1001 FAIL <embed vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
     1000PASS <embed vspace=".5"> mapping to marginBottom
     1001PASS <embed vspace=".5%"> mapping to marginBottom
    10021002PASS <img hspace="200"> mapping to marginLeft
    10031003PASS <img hspace="1007"> mapping to marginLeft
     
    10051005PASS <img hspace="200.25"> mapping to marginLeft
    10061006FAIL <img hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
    1007 FAIL <img hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
     1007PASS <img hspace="200."> mapping to marginLeft
    10081008PASS <img hspace="200in"> mapping to marginLeft
    10091009PASS <img hspace="200.25in"> mapping to marginLeft
     
    10381038PASS <img hspace=".%"> mapping to marginLeft
    10391039PASS <img hspace=".x"> mapping to marginLeft
    1040 FAIL <img hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
    1041 FAIL <img hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
     1040PASS <img hspace=".5"> mapping to marginLeft
     1041PASS <img hspace=".5%"> mapping to marginLeft
    10421042PASS <img hspace="200"> mapping to marginRight
    10431043PASS <img hspace="1007"> mapping to marginRight
     
    10451045PASS <img hspace="200.25"> mapping to marginRight
    10461046FAIL <img hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
    1047 FAIL <img hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
     1047PASS <img hspace="200."> mapping to marginRight
    10481048PASS <img hspace="200in"> mapping to marginRight
    10491049PASS <img hspace="200.25in"> mapping to marginRight
     
    10781078PASS <img hspace=".%"> mapping to marginRight
    10791079PASS <img hspace=".x"> mapping to marginRight
    1080 FAIL <img hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
    1081 FAIL <img hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
     1080PASS <img hspace=".5"> mapping to marginRight
     1081PASS <img hspace=".5%"> mapping to marginRight
    10821082PASS <img vspace="200"> mapping to marginTop
    10831083PASS <img vspace="1007"> mapping to marginTop
     
    10851085PASS <img vspace="200.25"> mapping to marginTop
    10861086FAIL <img vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
    1087 FAIL <img vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
     1087PASS <img vspace="200."> mapping to marginTop
    10881088PASS <img vspace="200in"> mapping to marginTop
    10891089PASS <img vspace="200.25in"> mapping to marginTop
     
    11181118PASS <img vspace=".%"> mapping to marginTop
    11191119PASS <img vspace=".x"> mapping to marginTop
    1120 FAIL <img vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
    1121 FAIL <img vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
     1120PASS <img vspace=".5"> mapping to marginTop
     1121PASS <img vspace=".5%"> mapping to marginTop
    11221122PASS <img vspace="200"> mapping to marginBottom
    11231123PASS <img vspace="1007"> mapping to marginBottom
     
    11251125PASS <img vspace="200.25"> mapping to marginBottom
    11261126FAIL <img vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
    1127 FAIL <img vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
     1127PASS <img vspace="200."> mapping to marginBottom
    11281128PASS <img vspace="200in"> mapping to marginBottom
    11291129PASS <img vspace="200.25in"> mapping to marginBottom
     
    11581158PASS <img vspace=".%"> mapping to marginBottom
    11591159PASS <img vspace=".x"> mapping to marginBottom
    1160 FAIL <img vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
    1161 FAIL <img vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
     1160PASS <img vspace=".5"> mapping to marginBottom
     1161PASS <img vspace=".5%"> mapping to marginBottom
    11621162PASS <object hspace="200"> mapping to marginLeft
    11631163PASS <object hspace="1007"> mapping to marginLeft
     
    11651165PASS <object hspace="200.25"> mapping to marginLeft
    11661166FAIL <object hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
    1167 FAIL <object hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
     1167PASS <object hspace="200."> mapping to marginLeft
    11681168PASS <object hspace="200in"> mapping to marginLeft
    11691169PASS <object hspace="200.25in"> mapping to marginLeft
     
    11981198PASS <object hspace=".%"> mapping to marginLeft
    11991199PASS <object hspace=".x"> mapping to marginLeft
    1200 FAIL <object hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
    1201 FAIL <object hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
     1200PASS <object hspace=".5"> mapping to marginLeft
     1201PASS <object hspace=".5%"> mapping to marginLeft
    12021202PASS <object hspace="200"> mapping to marginRight
    12031203PASS <object hspace="1007"> mapping to marginRight
     
    12051205PASS <object hspace="200.25"> mapping to marginRight
    12061206FAIL <object hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
    1207 FAIL <object hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
     1207PASS <object hspace="200."> mapping to marginRight
    12081208PASS <object hspace="200in"> mapping to marginRight
    12091209PASS <object hspace="200.25in"> mapping to marginRight
     
    12381238PASS <object hspace=".%"> mapping to marginRight
    12391239PASS <object hspace=".x"> mapping to marginRight
    1240 FAIL <object hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
    1241 FAIL <object hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
     1240PASS <object hspace=".5"> mapping to marginRight
     1241PASS <object hspace=".5%"> mapping to marginRight
    12421242PASS <object vspace="200"> mapping to marginTop
    12431243PASS <object vspace="1007"> mapping to marginTop
     
    12451245PASS <object vspace="200.25"> mapping to marginTop
    12461246FAIL <object vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
    1247 FAIL <object vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
     1247PASS <object vspace="200."> mapping to marginTop
    12481248PASS <object vspace="200in"> mapping to marginTop
    12491249PASS <object vspace="200.25in"> mapping to marginTop
     
    12781278PASS <object vspace=".%"> mapping to marginTop
    12791279PASS <object vspace=".x"> mapping to marginTop
    1280 FAIL <object vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
    1281 FAIL <object vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
     1280PASS <object vspace=".5"> mapping to marginTop
     1281PASS <object vspace=".5%"> mapping to marginTop
    12821282PASS <object vspace="200"> mapping to marginBottom
    12831283PASS <object vspace="1007"> mapping to marginBottom
     
    12851285PASS <object vspace="200.25"> mapping to marginBottom
    12861286FAIL <object vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
    1287 FAIL <object vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
     1287PASS <object vspace="200."> mapping to marginBottom
    12881288PASS <object vspace="200in"> mapping to marginBottom
    12891289PASS <object vspace="200.25in"> mapping to marginBottom
     
    13181318PASS <object vspace=".%"> mapping to marginBottom
    13191319PASS <object vspace=".x"> mapping to marginBottom
    1320 FAIL <object vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
    1321 FAIL <object vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
     1320PASS <object vspace=".5"> mapping to marginBottom
     1321PASS <object vspace=".5%"> mapping to marginBottom
    13221322PASS <input hspace="200"> mapping to marginLeft
    13231323PASS <input hspace="1007"> mapping to marginLeft
     
    13251325PASS <input hspace="200.25"> mapping to marginLeft
    13261326FAIL <input hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
    1327 FAIL <input hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
     1327PASS <input hspace="200."> mapping to marginLeft
    13281328PASS <input hspace="200in"> mapping to marginLeft
    13291329PASS <input hspace="200.25in"> mapping to marginLeft
     
    13581358PASS <input hspace=".%"> mapping to marginLeft
    13591359PASS <input hspace=".x"> mapping to marginLeft
    1360 FAIL <input hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
    1361 FAIL <input hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
     1360PASS <input hspace=".5"> mapping to marginLeft
     1361PASS <input hspace=".5%"> mapping to marginLeft
    13621362PASS <input hspace="200"> mapping to marginRight
    13631363PASS <input hspace="1007"> mapping to marginRight
     
    13651365PASS <input hspace="200.25"> mapping to marginRight
    13661366FAIL <input hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
    1367 FAIL <input hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
     1367PASS <input hspace="200."> mapping to marginRight
    13681368PASS <input hspace="200in"> mapping to marginRight
    13691369PASS <input hspace="200.25in"> mapping to marginRight
     
    13981398PASS <input hspace=".%"> mapping to marginRight
    13991399PASS <input hspace=".x"> mapping to marginRight
    1400 FAIL <input hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
    1401 FAIL <input hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
     1400PASS <input hspace=".5"> mapping to marginRight
     1401PASS <input hspace=".5%"> mapping to marginRight
    14021402PASS <input vspace="200"> mapping to marginTop
    14031403PASS <input vspace="1007"> mapping to marginTop
     
    14051405PASS <input vspace="200.25"> mapping to marginTop
    14061406FAIL <input vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
    1407 FAIL <input vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
     1407PASS <input vspace="200."> mapping to marginTop
    14081408PASS <input vspace="200in"> mapping to marginTop
    14091409PASS <input vspace="200.25in"> mapping to marginTop
     
    14381438PASS <input vspace=".%"> mapping to marginTop
    14391439PASS <input vspace=".x"> mapping to marginTop
    1440 FAIL <input vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
    1441 FAIL <input vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
     1440PASS <input vspace=".5"> mapping to marginTop
     1441PASS <input vspace=".5%"> mapping to marginTop
    14421442PASS <input vspace="200"> mapping to marginBottom
    14431443PASS <input vspace="1007"> mapping to marginBottom
     
    14451445PASS <input vspace="200.25"> mapping to marginBottom
    14461446FAIL <input vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
    1447 FAIL <input vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
     1447PASS <input vspace="200."> mapping to marginBottom
    14481448PASS <input vspace="200in"> mapping to marginBottom
    14491449PASS <input vspace="200.25in"> mapping to marginBottom
     
    14781478PASS <input vspace=".%"> mapping to marginBottom
    14791479PASS <input vspace=".x"> mapping to marginBottom
    1480 FAIL <input vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
    1481 FAIL <input vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
     1480PASS <input vspace=".5"> mapping to marginBottom
     1481PASS <input vspace=".5%"> mapping to marginBottom
    14821482PASS <marquee hspace="200"> mapping to marginLeft
    14831483PASS <marquee hspace="1007"> mapping to marginLeft
     
    14851485PASS <marquee hspace="200.25"> mapping to marginLeft
    14861486FAIL <marquee hspace="200.7"> mapping to marginLeft assert_equals: expected "200.7px" but got "200.6999969482422px"
    1487 FAIL <marquee hspace="200."> mapping to marginLeft assert_equals: expected "200px" but got "0px"
     1487PASS <marquee hspace="200."> mapping to marginLeft
    14881488PASS <marquee hspace="200in"> mapping to marginLeft
    14891489PASS <marquee hspace="200.25in"> mapping to marginLeft
     
    15181518PASS <marquee hspace=".%"> mapping to marginLeft
    15191519PASS <marquee hspace=".x"> mapping to marginLeft
    1520 FAIL <marquee hspace=".5"> mapping to marginLeft assert_equals: expected "0px" but got "0.5px"
    1521 FAIL <marquee hspace=".5%"> mapping to marginLeft assert_equals: expected "0px" but got "0.5%"
     1520PASS <marquee hspace=".5"> mapping to marginLeft
     1521PASS <marquee hspace=".5%"> mapping to marginLeft
    15221522PASS <marquee hspace="200"> mapping to marginRight
    15231523PASS <marquee hspace="1007"> mapping to marginRight
     
    15251525PASS <marquee hspace="200.25"> mapping to marginRight
    15261526FAIL <marquee hspace="200.7"> mapping to marginRight assert_equals: expected "200.7px" but got "200.6999969482422px"
    1527 FAIL <marquee hspace="200."> mapping to marginRight assert_equals: expected "200px" but got "0px"
     1527PASS <marquee hspace="200."> mapping to marginRight
    15281528PASS <marquee hspace="200in"> mapping to marginRight
    15291529PASS <marquee hspace="200.25in"> mapping to marginRight
     
    15581558PASS <marquee hspace=".%"> mapping to marginRight
    15591559PASS <marquee hspace=".x"> mapping to marginRight
    1560 FAIL <marquee hspace=".5"> mapping to marginRight assert_equals: expected "0px" but got "0.5px"
    1561 FAIL <marquee hspace=".5%"> mapping to marginRight assert_equals: expected "0px" but got "0.5%"
     1560PASS <marquee hspace=".5"> mapping to marginRight
     1561PASS <marquee hspace=".5%"> mapping to marginRight
    15621562PASS <marquee vspace="200"> mapping to marginTop
    15631563PASS <marquee vspace="1007"> mapping to marginTop
     
    15651565PASS <marquee vspace="200.25"> mapping to marginTop
    15661566FAIL <marquee vspace="200.7"> mapping to marginTop assert_equals: expected "200.7px" but got "200.6999969482422px"
    1567 FAIL <marquee vspace="200."> mapping to marginTop assert_equals: expected "200px" but got "0px"
     1567PASS <marquee vspace="200."> mapping to marginTop
    15681568PASS <marquee vspace="200in"> mapping to marginTop
    15691569PASS <marquee vspace="200.25in"> mapping to marginTop
     
    15981598PASS <marquee vspace=".%"> mapping to marginTop
    15991599PASS <marquee vspace=".x"> mapping to marginTop
    1600 FAIL <marquee vspace=".5"> mapping to marginTop assert_equals: expected "0px" but got "0.5px"
    1601 FAIL <marquee vspace=".5%"> mapping to marginTop assert_equals: expected "0px" but got "0.5%"
     1600PASS <marquee vspace=".5"> mapping to marginTop
     1601PASS <marquee vspace=".5%"> mapping to marginTop
    16021602PASS <marquee vspace="200"> mapping to marginBottom
    16031603PASS <marquee vspace="1007"> mapping to marginBottom
     
    16051605PASS <marquee vspace="200.25"> mapping to marginBottom
    16061606FAIL <marquee vspace="200.7"> mapping to marginBottom assert_equals: expected "200.7px" but got "200.6999969482422px"
    1607 FAIL <marquee vspace="200."> mapping to marginBottom assert_equals: expected "200px" but got "0px"
     1607PASS <marquee vspace="200."> mapping to marginBottom
    16081608PASS <marquee vspace="200in"> mapping to marginBottom
    16091609PASS <marquee vspace="200.25in"> mapping to marginBottom
     
    16381638PASS <marquee vspace=".%"> mapping to marginBottom
    16391639PASS <marquee vspace=".x"> mapping to marginBottom
    1640 FAIL <marquee vspace=".5"> mapping to marginBottom assert_equals: expected "0px" but got "0.5px"
    1641 FAIL <marquee vspace=".5%"> mapping to marginBottom assert_equals: expected "0px" but got "0.5%"
     1640PASS <marquee vspace=".5"> mapping to marginBottom
     1641PASS <marquee vspace=".5%"> mapping to marginBottom
    16421642
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt

    r267646 r278765  
    171171PASS <body marginwidth="1007"> mapping to marginLeft
    172172PASS <body marginwidth="   00523   "> mapping to marginLeft
    173 FAIL <body marginwidth="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
     173PASS <body marginwidth="200."> mapping to marginLeft
    174174FAIL <body marginwidth="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
    175175FAIL <body marginwidth="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
     
    192192PASS <body marginwidth="1007"> mapping to marginRight
    193193PASS <body marginwidth="   00523   "> mapping to marginRight
    194 FAIL <body marginwidth="200."> mapping to marginRight assert_equals: expected "200px" but got "8px"
     194PASS <body marginwidth="200."> mapping to marginRight
    195195FAIL <body marginwidth="200.25"> mapping to marginRight assert_equals: expected "200px" but got "200.25px"
    196196FAIL <body marginwidth="200.7"> mapping to marginRight assert_equals: expected "200px" but got "200.6999969482422px"
     
    213213PASS <body leftmargin="1007"> mapping to marginLeft
    214214PASS <body leftmargin="   00523   "> mapping to marginLeft
    215 FAIL <body leftmargin="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
     215PASS <body leftmargin="200."> mapping to marginLeft
    216216FAIL <body leftmargin="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
    217217FAIL <body leftmargin="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
     
    255255PASS <body marginheight="1007"> mapping to marginTop
    256256PASS <body marginheight="   00523   "> mapping to marginTop
    257 FAIL <body marginheight="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
     257PASS <body marginheight="200."> mapping to marginTop
    258258FAIL <body marginheight="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
    259259FAIL <body marginheight="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
     
    276276PASS <body marginheight="1007"> mapping to marginBottom
    277277PASS <body marginheight="   00523   "> mapping to marginBottom
    278 FAIL <body marginheight="200."> mapping to marginBottom assert_equals: expected "200px" but got "8px"
     278PASS <body marginheight="200."> mapping to marginBottom
    279279FAIL <body marginheight="200.25"> mapping to marginBottom assert_equals: expected "200px" but got "200.25px"
    280280FAIL <body marginheight="200.7"> mapping to marginBottom assert_equals: expected "200px" but got "200.6999969482422px"
     
    297297PASS <body topmargin="1007"> mapping to marginTop
    298298PASS <body topmargin="   00523   "> mapping to marginTop
    299 FAIL <body topmargin="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
     299PASS <body topmargin="200."> mapping to marginTop
    300300FAIL <body topmargin="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
    301301FAIL <body topmargin="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
  • trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt

    r267658 r278765  
    171171PASS <body marginwidth="1007"> mapping to marginLeft
    172172PASS <body marginwidth="   00523   "> mapping to marginLeft
    173 FAIL <body marginwidth="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
     173PASS <body marginwidth="200."> mapping to marginLeft
    174174FAIL <body marginwidth="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
    175175FAIL <body marginwidth="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
     
    192192PASS <body marginwidth="1007"> mapping to marginRight
    193193PASS <body marginwidth="   00523   "> mapping to marginRight
    194 FAIL <body marginwidth="200."> mapping to marginRight assert_equals: expected "200px" but got "8px"
     194PASS <body marginwidth="200."> mapping to marginRight
    195195FAIL <body marginwidth="200.25"> mapping to marginRight assert_equals: expected "200px" but got "200.25px"
    196196FAIL <body marginwidth="200.7"> mapping to marginRight assert_equals: expected "200px" but got "200.6999969482422px"
     
    213213PASS <body leftmargin="1007"> mapping to marginLeft
    214214PASS <body leftmargin="   00523   "> mapping to marginLeft
    215 FAIL <body leftmargin="200."> mapping to marginLeft assert_equals: expected "200px" but got "8px"
     215PASS <body leftmargin="200."> mapping to marginLeft
    216216FAIL <body leftmargin="200.25"> mapping to marginLeft assert_equals: expected "200px" but got "200.25px"
    217217FAIL <body leftmargin="200.7"> mapping to marginLeft assert_equals: expected "200px" but got "200.6999969482422px"
     
    255255PASS <body marginheight="1007"> mapping to marginTop
    256256PASS <body marginheight="   00523   "> mapping to marginTop
    257 FAIL <body marginheight="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
     257PASS <body marginheight="200."> mapping to marginTop
    258258FAIL <body marginheight="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
    259259FAIL <body marginheight="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
     
    276276PASS <body marginheight="1007"> mapping to marginBottom
    277277PASS <body marginheight="   00523   "> mapping to marginBottom
    278 FAIL <body marginheight="200."> mapping to marginBottom assert_equals: expected "200px" but got "8px"
     278PASS <body marginheight="200."> mapping to marginBottom
    279279FAIL <body marginheight="200.25"> mapping to marginBottom assert_equals: expected "200px" but got "200.25px"
    280280FAIL <body marginheight="200.7"> mapping to marginBottom assert_equals: expected "200px" but got "200.6999969482422px"
     
    297297PASS <body topmargin="1007"> mapping to marginTop
    298298PASS <body topmargin="   00523   "> mapping to marginTop
    299 FAIL <body topmargin="200."> mapping to marginTop assert_equals: expected "200px" but got "8px"
     299PASS <body topmargin="200."> mapping to marginTop
    300300FAIL <body topmargin="200.25"> mapping to marginTop assert_equals: expected "200px" but got "200.25px"
    301301FAIL <body topmargin="200.7"> mapping to marginTop assert_equals: expected "200px" but got "200.6999969482422px"
  • trunk/Source/WebCore/ChangeLog

    r278764 r278765  
     12021-06-11  Cathie Chen  <cathiechen@igalia.com>
     2
     3        Use HTMLDimension to parse different HTML attribute length values
     4        https://bugs.webkit.org/show_bug.cgi?id=226810
     5
     6        Reviewed by Darin Adler.
     7
     8        This patch uses HTMLDimension to parse different kind of html length values which are defined in [1].
     9        Then according the length types to determine if the value is valid.
     10
     11        [1] https://www.w3.org/TR/html4/sgml/dtd.html#Length
     12
     13        * html/HTMLElement.cpp:
     14        (WebCore::HTMLElement::addHTMLLengthToStyle):
     15        (WebCore::HTMLElement::addHTMLLengthToStyle): Add HTMLLength (including percentage values and pixel values) to style.
     16        (WebCore::HTMLElement::addHTMLMultiLengthToStyle): Add MultiLength (including percentage, pixel and relative values) to style.
     17        (WebCore::HTMLElement::addHTMLPixelsToStyle): Add pixel values to style.
     18        (WebCore::HTMLElement::addHTMLNumberToStyle): Add number (including percentage values and numbers) to style.
     19        * html/HTMLElement.h:
     20        * html/HTMLImageElement.cpp:
     21        (WebCore::HTMLImageElement::collectPresentationalHintsForAttribute): <img>'s width and height attributes are multiLength.
     22        * html/HTMLMarqueeElement.cpp:
     23        (WebCore::HTMLMarqueeElement::collectPresentationalHintsForAttribute): scrolldelayAttr and loopAttr are numbers.
     24        * html/HTMLTableColElement.cpp:
     25        (WebCore::HTMLTableColElement::collectPresentationalHintsForAttribute): <col>'s width and height attributes are multiLength.
     26        * html/HTMLTableElement.cpp:
     27        (WebCore::HTMLTableElement::collectPresentationalHintsForAttribute): <table>'s cellspacingAttr only supports pixel values.
     28        * html/parser/HTMLParserIdioms.cpp:
     29        (WebCore::parseHTMLDimensionInternal):
     30        (WebCore::parseHTMLDimension):
     31        (WebCore::parseHTMLMultiLength): MultiLength doesn't support relative_length (number + *), but make sure relative_length not be treated as a pixel value.
     32        * html/parser/HTMLParserIdioms.h:
     33
    1342021-06-11  Youenn Fablet  <youenn@apple.com>
    235
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r278747 r278765  
    10171017}
    10181018
    1019 void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, const String& value)
    1020 {
    1021     // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct
    1022     // length unit and make the appropriate parsed value.
    1023 
    1024     if (StringImpl* string = value.impl()) {
    1025         unsigned parsedLength = 0;
    1026 
    1027         while (parsedLength < string->length() && (*string)[parsedLength] <= ' ')
    1028             ++parsedLength;
    1029 
    1030         for (; parsedLength < string->length(); ++parsedLength) {
    1031             UChar cc = (*string)[parsedLength];
    1032             if (cc > '9')
    1033                 break;
    1034             if (cc < '0') {
    1035                 if (cc == '%' || cc == '*')
    1036                     ++parsedLength;
    1037                 if (cc != '.')
    1038                     break;
    1039             }
    1040         }
    1041 
    1042         if (parsedLength != string->length()) {
    1043             addPropertyToPresentationalHintStyle(style, propertyID, string->substring(0, parsedLength));
    1044             return;
    1045         }
    1046     }
    1047 
    1048     addPropertyToPresentationalHintStyle(style, propertyID, value);
     1019void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value, AllowPercentage allowPercentage, UseCSSPXAsUnitType useCSSPX, IsMultiLength isMultiLength)
     1020{
     1021    auto dimensionValue = isMultiLength == IsMultiLength::No ? parseHTMLDimension(value) : parseHTMLMultiLength(value);
     1022    if (!dimensionValue)
     1023        return;
     1024    if (dimensionValue->type == HTMLDimension::Type::Percentage) {
     1025        if (allowPercentage == AllowPercentage::Yes)
     1026            addPropertyToPresentationalHintStyle(style, propertyID, dimensionValue->number, CSSUnitType::CSS_PERCENTAGE);
     1027        return;
     1028    }
     1029    if (useCSSPX == UseCSSPXAsUnitType::Yes)
     1030        addPropertyToPresentationalHintStyle(style, propertyID, dimensionValue->number, CSSUnitType::CSS_PX);
     1031    else
     1032        addPropertyToPresentationalHintStyle(style, propertyID, dimensionValue->number, CSSUnitType::CSS_NUMBER);
     1033}
     1034
     1035// https://www.w3.org/TR/html4/sgml/dtd.html#Length, including pixel and percentage values.
     1036void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
     1037{
     1038    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::Yes, IsMultiLength::No);
     1039}
     1040
     1041// https://www.w3.org/TR/html4/sgml/dtd.html#MultiLength, including pixel, percentage, and relative values.
     1042void HTMLElement::addHTMLMultiLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
     1043{
     1044    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::Yes, IsMultiLength::Yes);
     1045}
     1046
     1047// https://www.w3.org/TR/html4/sgml/dtd.html#Pixels, including pixel value.
     1048void HTMLElement::addHTMLPixelsToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
     1049{
     1050    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::No, UseCSSPXAsUnitType::Yes, IsMultiLength::No);
     1051}
     1052
     1053// This is specific to <marquee> attributes, including pixel and CSS_NUMBER values.
     1054void HTMLElement::addHTMLNumberToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
     1055{
     1056    addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::No, IsMultiLength::No);
    10491057}
    10501058
  • trunk/Source/WebCore/html/HTMLElement.h

    r278747 r278765  
    151151    HTMLElement(const QualifiedName& tagName, Document&, ConstructionType);
    152152
    153     void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, const String& value);
     153    void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
     154    void addHTMLMultiLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
     155    void addHTMLPixelsToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
     156    void addHTMLNumberToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
     157
    154158    void addHTMLColorToStyle(MutableStyleProperties&, CSSPropertyID, const String& color);
    155159
     
    183187    static void populateEventHandlerNameMap(EventHandlerNameMap&, const QualifiedName* const table[], size_t tableSize);
    184188    static EventHandlerNameMap createEventHandlerNameMap();
     189
     190    enum class AllowPercentage : bool { No, Yes };
     191    enum class UseCSSPXAsUnitType : bool { No, Yes };
     192    enum class IsMultiLength : bool { No, Yes };
     193    void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value, AllowPercentage, UseCSSPXAsUnitType, IsMultiLength);
    185194};
    186195
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r278277 r278765  
    117117{
    118118    if (name == widthAttr) {
    119         addHTMLLengthToStyle(style, CSSPropertyWidth, value);
     119        addHTMLMultiLengthToStyle(style, CSSPropertyWidth, value);
    120120        applyAspectRatioFromWidthAndHeightAttributesToStyle(style);
    121121    } else if (name == heightAttr) {
    122         addHTMLLengthToStyle(style, CSSPropertyHeight, value);
     122        addHTMLMultiLengthToStyle(style, CSSPropertyHeight, value);
    123123        applyAspectRatioFromWidthAndHeightAttributesToStyle(style);
    124124    } else if (name == borderAttr)
  • trunk/Source/WebCore/html/HTMLMarqueeElement.cpp

    r278277 r278765  
    9696    } else if (name == scrolldelayAttr) {
    9797        if (!value.isEmpty())
    98             addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeSpeed, value);
     98            addHTMLNumberToStyle(style, CSSPropertyWebkitMarqueeSpeed, value);
    9999    } else if (name == loopAttr) {
    100100        if (!value.isEmpty()) {
     
    102102                addPropertyToPresentationalHintStyle(style, CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite);
    103103            else
    104                 addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeRepetition, value);
     104                addHTMLNumberToStyle(style, CSSPropertyWebkitMarqueeRepetition, value);
    105105        }
    106106    } else if (name == behaviorAttr) {
  • trunk/Source/WebCore/html/HTMLTableColElement.cpp

    r278277 r278765  
    6565{
    6666    if (name == widthAttr)
    67         addHTMLLengthToStyle(style, CSSPropertyWidth, value);
     67        addHTMLMultiLengthToStyle(style, CSSPropertyWidth, value);
     68    else if (name == heightAttr)
     69        addHTMLMultiLengthToStyle(style, CSSPropertyHeight, value);
    6870    else
    6971        HTMLTablePartElement::collectPresentationalHintsForAttribute(name, value, style);
  • trunk/Source/WebCore/html/HTMLTableElement.cpp

    r278277 r278765  
    327327    } else if (name == cellspacingAttr) {
    328328        if (!value.isEmpty())
    329             addHTMLLengthToStyle(style, CSSPropertyBorderSpacing, value);
     329            addHTMLPixelsToStyle(style, CSSPropertyBorderSpacing, value);
    330330    } else if (name == vspaceAttr) {
    331331        addHTMLLengthToStyle(style, CSSPropertyMarginTop, value);
  • trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp

    r278689 r278765  
    513513}
    514514
    515 std::optional<HTMLDimension> parseHTMLDimension(StringView dimensionString)
     515enum class IsMultiLength : bool { No, Yes };
     516static std::optional<HTMLDimension> parseHTMLDimensionInternal(StringView dimensionString, IsMultiLength isMultiLength)
    516517{
    517518    std::optional<HTMLDimensionParsingResult> result;
     
    524525        return std::nullopt;
    525526
     527    // The relative_length is not supported, here to make sure number + * does not map to number
     528    if (isMultiLength == IsMultiLength::Yes && result->parsedLength < length && dimensionString[result->parsedLength] == '*')
     529        return std::nullopt;
     530
    526531    HTMLDimension dimension;
    527532    dimension.number = result->number;
     
    532537}
    533538
    534 }
     539std::optional<HTMLDimension> parseHTMLDimension(StringView dimensionString)
     540{
     541    return parseHTMLDimensionInternal(dimensionString, IsMultiLength::No);
     542}
     543
     544std::optional<HTMLDimension> parseHTMLMultiLength(StringView multiLengthString)
     545{
     546    return parseHTMLDimensionInternal(multiLengthString, IsMultiLength::Yes);
     547}
     548
     549}
  • trunk/Source/WebCore/html/parser/HTMLParserIdioms.h

    r278689 r278765  
    9494};
    9595std::optional<HTMLDimension> parseHTMLDimension(StringView);
     96std::optional<HTMLDimension> parseHTMLMultiLength(StringView);
    9697
    9798// Inline implementations of some of the functions declared above.
Note: See TracChangeset for help on using the changeset viewer.