Changeset 251662 in webkit


Ignore:
Timestamp:
Oct 28, 2019, 11:56:19 AM (5 years ago)
Author:
Simon Fraser
Message:

Add support for the Q unit
https://bugs.webkit.org/show_bug.cgi?id=203469

Reviewed by Antti Koivisto.
LayoutTests/imported/w3c:

Add support for the CSS "Q" unit (quater-millimeter):
<https://drafts.csswg.org/css-values-4/#Q>

  • web-platform-tests/css/css-values/absolute-length-units-001-expected.txt:
  • web-platform-tests/css/css-values/calc-serialization-002-expected.txt:
  • web-platform-tests/css/css-values/minmax-length-computed-expected.txt:
  • web-platform-tests/css/css-values/minmax-length-percent-computed-expected.txt:
  • web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt:
  • web-platform-tests/css/css-values/minmax-length-serialize-expected.txt:

Source/WebCore:

Add support for the CSS "Q" unit (quater-millimeter):
<https://drafts.csswg.org/css-values-4/#Q>

Tested by web platform tests.

  • css/CSSCalculationValue.cpp:

(WebCore::unitCategory):
(WebCore::hasDoubleValue):

  • css/CSSPrimitiveValue.cpp:

(WebCore::isValidCSSUnitTypeForDoubleConversion):
(WebCore::isStringType):
(WebCore::CSSPrimitiveValue::unitCategory):
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
(WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
(WebCore::CSSPrimitiveValue::equals const):

  • css/CSSPrimitiveValue.h:

(WebCore::CSSPrimitiveValue::isLength):

  • css/parser/CSSParserToken.cpp:

(WebCore::cssPrimitiveValueUnitFromTrie):

  • css/parser/CSSPropertyParserHelpers.cpp:

(WebCore::CSSPropertyParserHelpers::consumeLength):

  • editing/cocoa/HTMLConverter.mm:

(floatValueFromPrimitiveValue):

LayoutTests:

More tests now pass.

  • TestExpectations:
  • fast/dom/HTMLImageElement/sizes/image-sizes-w3c-1-expected.txt:
  • fast/dom/HTMLImageElement/sizes/image-sizes-w3c-2-expected.txt:
  • fast/dom/HTMLImageElement/sizes/image-sizes-w3c-3-expected.txt:
  • fast/dom/HTMLImageElement/sizes/image-sizes-w3c-4-expected.txt:
  • platform/ios/imported/w3c/web-platform-tests/css/css-values/minmax-length-computed-expected.txt:
  • platform/ios/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-computed-expected.txt:
Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/LayoutTests/ChangeLog

    r251660 r251662  
    77        * platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/module/integrity-expected.txt:
    88        The important part of this test is that there are 3 PASSes, not that the console log is consistent.
     9
     102019-10-28  Simon Fraser  <simon.fraser@apple.com>
     11
     12        Add support for the Q unit
     13        https://bugs.webkit.org/show_bug.cgi?id=203469
     14
     15        Reviewed by Antti Koivisto.
     16
     17        More tests now pass.
     18
     19        * TestExpectations:
     20        * fast/dom/HTMLImageElement/sizes/image-sizes-w3c-1-expected.txt:
     21        * fast/dom/HTMLImageElement/sizes/image-sizes-w3c-2-expected.txt:
     22        * fast/dom/HTMLImageElement/sizes/image-sizes-w3c-3-expected.txt:
     23        * fast/dom/HTMLImageElement/sizes/image-sizes-w3c-4-expected.txt:
     24        * platform/ios/imported/w3c/web-platform-tests/css/css-values/minmax-length-computed-expected.txt:
     25        * platform/ios/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-computed-expected.txt:
    926
    10272019-10-28  Antoine Quint  <graouts@apple.com>
  • TabularUnified trunk/LayoutTests/TestExpectations

    r251648 r251662  
    38833883# wpt css-values failures
    38843884webkit.org/b/203320 imported/w3c/web-platform-tests/css/css-values/percentage-rem-low.html [ ImageOnlyFailure ]
    3885 webkit.org/b/203321 imported/w3c/web-platform-tests/css/css-values/q-unit-case-insensitivity-001.html [ ImageOnlyFailure ]
    3886 webkit.org/b/203321 imported/w3c/web-platform-tests/css/css-values/q-unit-case-insensitivity-002.html [ ImageOnlyFailure ]
    38873885webkit.org/b/203322 imported/w3c/web-platform-tests/css/css-values/attr-color-invalid-cast.html [ ImageOnlyFailure ]
    38883886webkit.org/b/203323 imported/w3c/web-platform-tests/css/css-values/attr-color-valid.html [ ImageOnlyFailure ]
  • TabularUnified trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-invalids-expected.txt

    r205905 r251662  
    1 PASS document.getElementById(elementId).clientWidth is 800
    2 PASS currentSrcFileName(elementId) is "image-set-2x.png"
    3 PASS document.getElementById(elementId).clientWidth is 800
    4 PASS currentSrcFileName(elementId) is "image-set-2x.png"
    51PASS document.getElementById(elementId).clientWidth is 800
    62PASS currentSrcFileName(elementId) is "image-set-2x.png"
     
    2218
    2319TEST COMPLETE
    24         
     20       
  • TabularUnified trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-invalids.html

    r205905 r251662  
    88    var elementId;
    99    addEventListener("load", function() {
    10         for (var i = 1; i <= 9; ++i) {
     10        for (var i = 1; i <= 7; ++i) {
    1111            elementId = "crash" + i;
    12             shouldBe('document.getElementById(elementId).clientWidth', i == 8 ? '56' : '800');
     12            shouldBe('document.getElementById(elementId).clientWidth', i == 6 ? '56' : '800');
    1313            shouldBe('currentSrcFileName(elementId)', '"image-set-2x.png"');
    1414        }
    1515       
    16         elementId = "crash10";
     16        elementId = "crash8";
    1717        shouldBe('document.getElementById(elementId).clientWidth', '1600');
    1818        shouldBe('currentSrcFileName(elementId)', '"image-set-4x.png"');
     
    2020</script>
    2121<!-- crash tests -->
    22 <img id="crash1" sizes="1q" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    23 <img id="crash2" sizes="1pxllll" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    24 <img id="crash3" sizes="1dfsdf4534fddd" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    25 <img id="crash4" sizes="calc()" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    26 <img id="crash5" sizes="calc(3q)" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    27 <img id="crash6" sizes="calcssdff()" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    28 <img id="crash7" sizes="calc(2px+dfmjbsf,,,skidkk)" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    29 <img id="crash8" sizes="calc(2px+dfmjbsf,,,skidkk) + 2px, 56px" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    30 <img id="crash9" sizes="1dpi" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
    31 <img id="crash10" sizes="(max-width: 10px) 1hz, 1600px" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 1600w">
     22<img id="crash1" sizes="1pxllll" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
     23<img id="crash2" sizes="1dfsdf4534fddd" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
     24<img id="crash3" sizes="calc()" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
     25<img id="crash4" sizes="calcssdff()" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
     26<img id="crash5" sizes="calc(2px+dfmjbsf,,,skidkk)" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
     27<img id="crash6" sizes="calc(2px+dfmjbsf,,,skidkk) + 2px, 56px" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
     28<img id="crash7" sizes="1dpi" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
     29<img id="crash8" sizes="(max-width: 10px) 1hz, 1600px" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 1600w">
  • TabularUnified trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-1-expected.txt

    r227295 r251662  
    1818PASS "green-1x1.png" is "green-1x1.png"
    1919PASS "green-1x1.png" is "green-1x1.png"
    20 FAIL "green-16x16.png" should be green-1x1.png. Was green-16x16.png.
     20PASS "green-1x1.png" is "green-1x1.png"
    2121PASS "green-1x1.png" is "green-1x1.png"
    2222PASS "green-1x1.png" is "green-1x1.png"
  • TabularUnified trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-2-expected.txt

    r227295 r251662  
    1818PASS "green-1x1.png" is "green-1x1.png"
    1919PASS "green-1x1.png" is "green-1x1.png"
    20 FAIL "green-16x16.png" should be green-1x1.png. Was green-16x16.png.
     20PASS "green-1x1.png" is "green-1x1.png"
    2121PASS "green-1x1.png" is "green-1x1.png"
    2222PASS "green-1x1.png" is "green-1x1.png"
  • TabularUnified trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-3-expected.txt

    r227295 r251662  
    1818PASS "green-1x1.png" is "green-1x1.png"
    1919PASS "green-1x1.png" is "green-1x1.png"
    20 FAIL "green-16x16.png" should be green-1x1.png. Was green-16x16.png.
     20PASS "green-1x1.png" is "green-1x1.png"
    2121PASS "green-1x1.png" is "green-1x1.png"
    2222PASS "green-1x1.png" is "green-1x1.png"
  • TabularUnified trunk/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-4-expected.txt

    r227295 r251662  
    1818PASS "green-1x1.png" is "green-1x1.png"
    1919PASS "green-1x1.png" is "green-1x1.png"
    20 FAIL "green-16x16.png" should be green-1x1.png. Was green-16x16.png.
     20PASS "green-1x1.png" is "green-1x1.png"
    2121PASS "green-1x1.png" is "green-1x1.png"
    2222PASS "green-1x1.png" is "green-1x1.png"
  • TabularUnified trunk/LayoutTests/imported/w3c/ChangeLog

    r251658 r251662  
     12019-10-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add support for the Q unit
     4        https://bugs.webkit.org/show_bug.cgi?id=203469
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Add support for the CSS "Q" unit (quater-millimeter):
     9        <https://drafts.csswg.org/css-values-4/#Q>
     10
     11        * web-platform-tests/css/css-values/absolute-length-units-001-expected.txt:
     12        * web-platform-tests/css/css-values/calc-serialization-002-expected.txt:
     13        * web-platform-tests/css/css-values/minmax-length-computed-expected.txt:
     14        * web-platform-tests/css/css-values/minmax-length-percent-computed-expected.txt:
     15        * web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt:
     16        * web-platform-tests/css/css-values/minmax-length-serialize-expected.txt:
     17
    1182019-10-28  Antoine Quint  <graouts@apple.com>
    219
  • TabularUnified trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/absolute-length-units-001-expected.txt

    r251521 r251662  
    11
    2 FAIL all width and height should be same assert_equals: expected "0px" but got "96px"
     2PASS all width and height should be same
    33
  • TabularUnified trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-serialization-002-expected.txt

    r251521 r251662  
    66FAIL testing calc(-8px + 9em + 1vh) assert_equals: expected "calc(9em - 8px + 1vh)" but got "calc((-8px + 9em) + 1vh)"
    77FAIL testing calc(1pc + 1in + 1vh + 10%) assert_equals: expected "calc(10% + 112px + 1vh)" but got "calc((112px + 1vh) + 10%)"
    8 FAIL testing calc(25.4q + 1vh + 12%) assert_equals: expected "calc(12% + 24px + 1vh)" but got "calc((112px + 1vh) + 10%)"
     8FAIL testing calc(25.4q + 1vh + 12%) assert_equals: expected "calc(12% + 24px + 1vh)" but got "calc((25.4q + 1vh) + 12%)"
    99FAIL testing calc(1em + 1.27cm + 13% + 3em) assert_equals: expected "calc(13% + 4em + 48px)" but got "calc(((1em + 1.27cm) + 13%) + 3em)"
    1010FAIL testing calc(1vmin - 14%) assert_equals: expected "calc(-14% + 1vmin)" but got "calc(1vmin - 14%)"
  • TabularUnified trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-computed-expected.txt

    r251634 r251662  
    33PASS Property letter-spacing value 'min(1cm)' computes to '37.7952766418457px'
    44PASS Property letter-spacing value 'min(1mm)' computes to '3.7795276641845703px'
    5 FAIL Property letter-spacing value 'min(1Q)' computes to 'normal' assert_true: 'min(1Q)' is a supported value for letter-spacing. expected true got false
     5PASS Property letter-spacing value 'min(1Q)' computes to '0.9448819160461426px'
    66PASS Property letter-spacing value 'min(1in)' computes to '96px'
    77PASS Property letter-spacing value 'min(1pc)' computes to '16px'
     
    1818PASS Property letter-spacing value 'max(1cm)' computes to '37.7952766418457px'
    1919PASS Property letter-spacing value 'max(1mm)' computes to '3.7795276641845703px'
    20 FAIL Property letter-spacing value 'max(1Q)' computes to 'normal' assert_true: 'max(1Q)' is a supported value for letter-spacing. expected true got false
     20PASS Property letter-spacing value 'max(1Q)' computes to '0.9448819160461426px'
    2121PASS Property letter-spacing value 'max(1in)' computes to '96px'
    2222PASS Property letter-spacing value 'max(1pc)' computes to '16px'
     
    3333PASS Property letter-spacing value 'min(1cm, 2cm)' computes to '37.7952766418457px'
    3434PASS Property letter-spacing value 'min(1mm, 2mm)' computes to '3.7795276641845703px'
    35 FAIL Property letter-spacing value 'min(1Q, 2Q)' computes to 'normal' assert_true: 'min(1Q, 2Q)' is a supported value for letter-spacing. expected true got false
     35PASS Property letter-spacing value 'min(1Q, 2Q)' computes to '0.9448819160461426px'
    3636PASS Property letter-spacing value 'min(1in, 2in)' computes to '96px'
    3737PASS Property letter-spacing value 'min(1pc, 2pc)' computes to '16px'
     
    4848PASS Property letter-spacing value 'max(1cm, 2cm)' computes to '75.5905532836914px'
    4949PASS Property letter-spacing value 'max(1mm, 2mm)' computes to '7.559055328369141px'
    50 FAIL Property letter-spacing value 'max(1Q, 2Q)' computes to 'normal' assert_true: 'max(1Q, 2Q)' is a supported value for letter-spacing. expected true got false
     50PASS Property letter-spacing value 'max(1Q, 2Q)' computes to '1.8897638320922852px'
    5151PASS Property letter-spacing value 'max(1in, 2in)' computes to '192px'
    5252PASS Property letter-spacing value 'max(1pc, 2pc)' computes to '32px'
  • TabularUnified trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-computed-expected.txt

    r251634 r251662  
    33PASS Property margin-left value 'min(1cm + 1%)' computes to '41.78125px'
    44PASS Property margin-left value 'min(1mm + 1%)' computes to '7.765625px'
    5 FAIL Property margin-left value 'min(1Q + 1%)' computes to '0px' assert_true: 'min(1Q + 1%)' is a supported value for margin-left. expected true got false
     5PASS Property margin-left value 'min(1Q + 1%)' computes to '4.9375px'
    66PASS Property margin-left value 'min(1in + 1%)' computes to '100px'
    77PASS Property margin-left value 'min(1pc + 1%)' computes to '20px'
     
    1818PASS Property margin-left value 'max(1cm + 1%)' computes to '41.78125px'
    1919PASS Property margin-left value 'max(1mm + 1%)' computes to '7.765625px'
    20 FAIL Property margin-left value 'max(1Q + 1%)' computes to '0px' assert_true: 'max(1Q + 1%)' is a supported value for margin-left. expected true got false
     20PASS Property margin-left value 'max(1Q + 1%)' computes to '4.9375px'
    2121PASS Property margin-left value 'max(1in + 1%)' computes to '100px'
    2222PASS Property margin-left value 'max(1pc + 1%)' computes to '20px'
  • TabularUnified trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt

    r251521 r251662  
    33FAIL e.style['margin-left'] = "min(1cm + 1%)" should set the property value assert_equals: serialization should be canonical expected "min(1cm + 1%)" but got "calc(min((1cm + 1%)))"
    44FAIL e.style['margin-left'] = "min(1mm + 1%)" should set the property value assert_equals: serialization should be canonical expected "min(1mm + 1%)" but got "calc(min((1mm + 1%)))"
    5 FAIL e.style['margin-left'] = "min(1Q + 1%)" should set the property value assert_not_equals: property should be set got disallowed value ""
     5FAIL e.style['margin-left'] = "min(1Q + 1%)" should set the property value assert_equals: serialization should be canonical expected "min(1q + 1%)" but got "calc(min((1q + 1%)))"
    66FAIL e.style['margin-left'] = "min(1in + 1%)" should set the property value assert_equals: serialization should be canonical expected "min(1in + 1%)" but got "calc(min((1in + 1%)))"
    77FAIL e.style['margin-left'] = "min(1pc + 1%)" should set the property value assert_equals: serialization should be canonical expected "min(1pc + 1%)" but got "calc(min((1pc + 1%)))"
     
    1818FAIL e.style['margin-left'] = "max(1cm + 1%)" should set the property value assert_equals: serialization should be canonical expected "max(1cm + 1%)" but got "calc(max((1cm + 1%)))"
    1919FAIL e.style['margin-left'] = "max(1mm + 1%)" should set the property value assert_equals: serialization should be canonical expected "max(1mm + 1%)" but got "calc(max((1mm + 1%)))"
    20 FAIL e.style['margin-left'] = "max(1Q + 1%)" should set the property value assert_not_equals: property should be set got disallowed value ""
     20FAIL e.style['margin-left'] = "max(1Q + 1%)" should set the property value assert_equals: serialization should be canonical expected "max(1q + 1%)" but got "calc(max((1q + 1%)))"
    2121FAIL e.style['margin-left'] = "max(1in + 1%)" should set the property value assert_equals: serialization should be canonical expected "max(1in + 1%)" but got "calc(max((1in + 1%)))"
    2222FAIL e.style['margin-left'] = "max(1pc + 1%)" should set the property value assert_equals: serialization should be canonical expected "max(1pc + 1%)" but got "calc(max((1pc + 1%)))"
  • TabularUnified trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-serialize-expected.txt

    r251521 r251662  
    33FAIL e.style['letter-spacing'] = "min(1cm)" should set the property value assert_equals: serialization should be canonical expected "min(1cm)" but got "calc(min(1cm))"
    44FAIL e.style['letter-spacing'] = "min(1mm)" should set the property value assert_equals: serialization should be canonical expected "min(1mm)" but got "calc(min(1mm))"
    5 FAIL e.style['letter-spacing'] = "min(1Q)" should set the property value assert_not_equals: property should be set got disallowed value ""
     5FAIL e.style['letter-spacing'] = "min(1Q)" should set the property value assert_equals: serialization should be canonical expected "min(1q)" but got "calc(min(1q))"
    66FAIL e.style['letter-spacing'] = "min(1in)" should set the property value assert_equals: serialization should be canonical expected "min(1in)" but got "calc(min(1in))"
    77FAIL e.style['letter-spacing'] = "min(1pc)" should set the property value assert_equals: serialization should be canonical expected "min(1pc)" but got "calc(min(1pc))"
     
    1818FAIL e.style['letter-spacing'] = "max(1cm)" should set the property value assert_equals: serialization should be canonical expected "max(1cm)" but got "calc(max(1cm))"
    1919FAIL e.style['letter-spacing'] = "max(1mm)" should set the property value assert_equals: serialization should be canonical expected "max(1mm)" but got "calc(max(1mm))"
    20 FAIL e.style['letter-spacing'] = "max(1Q)" should set the property value assert_not_equals: property should be set got disallowed value ""
     20FAIL e.style['letter-spacing'] = "max(1Q)" should set the property value assert_equals: serialization should be canonical expected "max(1q)" but got "calc(max(1q))"
    2121FAIL e.style['letter-spacing'] = "max(1in)" should set the property value assert_equals: serialization should be canonical expected "max(1in)" but got "calc(max(1in))"
    2222FAIL e.style['letter-spacing'] = "max(1pc)" should set the property value assert_equals: serialization should be canonical expected "max(1pc)" but got "calc(max(1pc))"
  • TabularUnified trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-values/minmax-length-computed-expected.txt

    r251641 r251662  
    33PASS Property letter-spacing value 'min(1cm)' computes to '37.7952766418457px'
    44PASS Property letter-spacing value 'min(1mm)' computes to '3.7795276641845703px'
    5 FAIL Property letter-spacing value 'min(1Q)' computes to 'normal' assert_true: 'min(1Q)' is a supported value for letter-spacing. expected true got false
     5PASS Property letter-spacing value 'min(1Q)' computes to '0.9448819160461426px'
    66PASS Property letter-spacing value 'min(1in)' computes to '96px'
    77PASS Property letter-spacing value 'min(1pc)' computes to '16px'
     
    1818PASS Property letter-spacing value 'max(1cm)' computes to '37.7952766418457px'
    1919PASS Property letter-spacing value 'max(1mm)' computes to '3.7795276641845703px'
    20 FAIL Property letter-spacing value 'max(1Q)' computes to 'normal' assert_true: 'max(1Q)' is a supported value for letter-spacing. expected true got false
     20PASS Property letter-spacing value 'max(1Q)' computes to '0.9448819160461426px'
    2121PASS Property letter-spacing value 'max(1in)' computes to '96px'
    2222PASS Property letter-spacing value 'max(1pc)' computes to '16px'
     
    3333PASS Property letter-spacing value 'min(1cm, 2cm)' computes to '37.7952766418457px'
    3434PASS Property letter-spacing value 'min(1mm, 2mm)' computes to '3.7795276641845703px'
    35 FAIL Property letter-spacing value 'min(1Q, 2Q)' computes to 'normal' assert_true: 'min(1Q, 2Q)' is a supported value for letter-spacing. expected true got false
     35PASS Property letter-spacing value 'min(1Q, 2Q)' computes to '0.9448819160461426px'
    3636PASS Property letter-spacing value 'min(1in, 2in)' computes to '96px'
    3737PASS Property letter-spacing value 'min(1pc, 2pc)' computes to '16px'
     
    4848PASS Property letter-spacing value 'max(1cm, 2cm)' computes to '75.5905532836914px'
    4949PASS Property letter-spacing value 'max(1mm, 2mm)' computes to '7.559055328369141px'
    50 FAIL Property letter-spacing value 'max(1Q, 2Q)' computes to 'normal' assert_true: 'max(1Q, 2Q)' is a supported value for letter-spacing. expected true got false
     50PASS Property letter-spacing value 'max(1Q, 2Q)' computes to '1.8897638320922852px'
    5151PASS Property letter-spacing value 'max(1in, 2in)' computes to '192px'
    5252PASS Property letter-spacing value 'max(1pc, 2pc)' computes to '32px'
  • TabularUnified trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-computed-expected.txt

    r251641 r251662  
    33PASS Property margin-left value 'min(1cm + 1%)' computes to '41.78125px'
    44PASS Property margin-left value 'min(1mm + 1%)' computes to '7.765625px'
    5 FAIL Property margin-left value 'min(1Q + 1%)' computes to '0px' assert_true: 'min(1Q + 1%)' is a supported value for margin-left. expected true got false
     5PASS Property margin-left value 'min(1Q + 1%)' computes to '4.9375px'
    66PASS Property margin-left value 'min(1in + 1%)' computes to '100px'
    77PASS Property margin-left value 'min(1pc + 1%)' computes to '20px'
     
    1818PASS Property margin-left value 'max(1cm + 1%)' computes to '41.78125px'
    1919PASS Property margin-left value 'max(1mm + 1%)' computes to '7.765625px'
    20 FAIL Property margin-left value 'max(1Q + 1%)' computes to '0px' assert_true: 'max(1Q + 1%)' is a supported value for margin-left. expected true got false
     20PASS Property margin-left value 'max(1Q + 1%)' computes to '4.9375px'
    2121PASS Property margin-left value 'max(1in + 1%)' computes to '100px'
    2222PASS Property margin-left value 'max(1pc + 1%)' computes to '20px'
  • TabularUnified trunk/Source/WebCore/ChangeLog

    r251659 r251662  
    1010        (WebCore::LegacySchemeRegistry::canDisplayOnlyIfCanRequest):
    1111        (WebCore::LegacySchemeRegistry::registerAsCanDisplayOnlyIfCanRequest):
     12
     132019-10-28  Simon Fraser  <simon.fraser@apple.com>
     14
     15        Add support for the Q unit
     16        https://bugs.webkit.org/show_bug.cgi?id=203469
     17
     18        Reviewed by Antti Koivisto.
     19       
     20        Add support for the CSS "Q" unit (quater-millimeter):
     21        <https://drafts.csswg.org/css-values-4/#Q>
     22
     23        Tested by web platform tests.
     24
     25        * css/CSSCalculationValue.cpp:
     26        (WebCore::unitCategory):
     27        (WebCore::hasDoubleValue):
     28        * css/CSSPrimitiveValue.cpp:
     29        (WebCore::isValidCSSUnitTypeForDoubleConversion):
     30        (WebCore::isStringType):
     31        (WebCore::CSSPrimitiveValue::unitCategory):
     32        (WebCore::CSSPrimitiveValue::cleanup):
     33        (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
     34        (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
     35        (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
     36        (WebCore::CSSPrimitiveValue::equals const):
     37        * css/CSSPrimitiveValue.h:
     38        (WebCore::CSSPrimitiveValue::isLength):
     39        * css/parser/CSSParserToken.cpp:
     40        (WebCore::cssPrimitiveValueUnitFromTrie):
     41        * css/parser/CSSPropertyParserHelpers.cpp:
     42        (WebCore::CSSPropertyParserHelpers::consumeLength):
     43        * editing/cocoa/HTMLConverter.mm:
     44        (floatValueFromPrimitiveValue):
    1245
    13462019-10-28  Antoine Quint  <graouts@apple.com>
  • TabularUnified trunk/Source/WebCore/css/CSSCalculationValue.cpp

    r251595 r251662  
    6666    case CSSPrimitiveValue::CSS_PT:
    6767    case CSSPrimitiveValue::CSS_PC:
     68    case CSSPrimitiveValue::CSS_Q:
    6869    case CSSPrimitiveValue::CSS_REMS:
    6970    case CSSPrimitiveValue::CSS_CHS:
     
    9495{
    9596    switch (type) {
    96     case CSSPrimitiveValue::CSS_FR:
    9797    case CSSPrimitiveValue::CSS_NUMBER:
    9898    case CSSPrimitiveValue::CSS_PERCENTAGE:
     
    123123    case CSSPrimitiveValue::CSS_DPI:
    124124    case CSSPrimitiveValue::CSS_DPCM:
     125    case CSSPrimitiveValue::CSS_FR:
     126    case CSSPrimitiveValue::CSS_Q:
    125127        return true;
    126128    case CSSPrimitiveValue::CSS_UNKNOWN:
  • TabularUnified trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r249013 r251662  
    5959    case CSSPrimitiveValue::CSS_DIMENSION:
    6060    case CSSPrimitiveValue::CSS_EMS:
    61     case CSSPrimitiveValue::CSS_QUIRKY_EMS:
    6261    case CSSPrimitiveValue::CSS_EXS:
    6362    case CSSPrimitiveValue::CSS_FR:
     
    7372    case CSSPrimitiveValue::CSS_PT:
    7473    case CSSPrimitiveValue::CSS_PX:
     74    case CSSPrimitiveValue::CSS_Q:
     75    case CSSPrimitiveValue::CSS_QUIRKY_EMS:
    7576    case CSSPrimitiveValue::CSS_RAD:
    7677    case CSSPrimitiveValue::CSS_REMS:
     
    135136    case CSSPrimitiveValue::CSS_DPPX:
    136137    case CSSPrimitiveValue::CSS_EMS:
    137     case CSSPrimitiveValue::CSS_QUIRKY_EMS:
    138138    case CSSPrimitiveValue::CSS_EXS:
    139139    case CSSPrimitiveValue::CSS_FONT_FAMILY:
     
    153153    case CSSPrimitiveValue::CSS_PT:
    154154    case CSSPrimitiveValue::CSS_PX:
     155    case CSSPrimitiveValue::CSS_Q:
    155156    case CSSPrimitiveValue::CSS_QUAD:
     157    case CSSPrimitiveValue::CSS_QUIRKY_EMS:
    156158    case CSSPrimitiveValue::CSS_RAD:
    157159    case CSSPrimitiveValue::CSS_RECT:
     
    192194    case CSS_PT:
    193195    case CSS_PC:
     196    case CSS_Q:
    194197        return ULength;
    195198    case CSS_MS:
     
    526529    case CSS_DPCM:
    527530    case CSS_FR:
     531    case CSS_Q:
    528532    case CSS_IDENT:
    529533    case CSS_UNKNOWN:
     
    602606}
    603607
     608static constexpr double mmPerInch = 25.4;
     609static constexpr double cmPerInch = 2.54;
     610static constexpr double QPerInch = 25.4 * 4.0;
     611
    604612double CSSPrimitiveValue::computeNonCalcLengthDouble(const CSSToLengthConversionData& conversionData, UnitType primitiveType, double value)
    605613{
     
    637645        break;
    638646    case CSS_CM:
    639         factor = cssPixelsPerInch / 2.54; // (2.54 cm/in)
     647        factor = cssPixelsPerInch / cmPerInch;
    640648        break;
    641649    case CSS_MM:
    642         factor = cssPixelsPerInch / 25.4;
     650        factor = cssPixelsPerInch / mmPerInch;
     651        break;
     652    case CSS_Q:
     653        factor = cssPixelsPerInch / QPerInch;
    643654        break;
    644655    case CSS_IN:
     
    710721        break;
    711722    case CSS_CM:
    712         factor = cssPixelsPerInch / 2.54; // (2.54 cm/in)
     723        factor = cssPixelsPerInch / cmPerInch;
    713724        break;
    714725    case CSS_DPCM:
    715         factor = 2.54 / cssPixelsPerInch; // (2.54 cm/in)
     726        factor = cmPerInch / cssPixelsPerInch; // (2.54 cm/in)
    716727        break;
    717728    case CSS_MM:
    718         factor = cssPixelsPerInch / 25.4;
     729        factor = cssPixelsPerInch / mmPerInch;
    719730        break;
    720731    case CSS_IN:
     
    970981    case CSS_FR:
    971982        return formatNumberValue("fr");
     983    case CSS_Q:
     984        return formatNumberValue("q");
    972985    case CSS_DIMENSION:
    973986        // FIXME: We currently don't handle CSS_DIMENSION properly as we don't store
     
    10911104    case CSS_VMIN:
    10921105    case CSS_FR:
     1106    case CSS_Q:
    10931107        return m_value.num == other.m_value.num;
    10941108    case CSS_PROPERTY_ID:
  • TabularUnified trunk/Source/WebCore/css/CSSPrimitiveValue.h

    r246285 r251662  
    111111        CSS_DPCM = 32,
    112112        CSS_FR = 33,
     113        CSS_Q = 34,
    113114        CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
    114115        CSS_UNICODE_RANGE = 102,
     
    360361        || type == CSS_REMS
    361362        || type == CSS_CHS
     363        || type == CSS_Q
    362364        || isViewportPercentageLength(type)
    363365        || type == CSS_QUIRKY_EMS;
  • TabularUnified trunk/Source/WebCore/css/parser/CSSParserToken.cpp

    r242713 r251662  
    4848    case 1:
    4949        switch (toASCIILower(data[0])) {
     50        case 'q':
     51            return CSSPrimitiveValue::UnitType::CSS_Q;
    5052        case 's':
    5153            return CSSPrimitiveValue::UnitType::CSS_S;
  • TabularUnified trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

    r251658 r251662  
    297297        case CSSPrimitiveValue::UnitType::CSS_VMIN:
    298298        case CSSPrimitiveValue::UnitType::CSS_VMAX:
     299        case CSSPrimitiveValue::UnitType::CSS_Q:
    299300            break;
    300301        default:
  • TabularUnified trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm

    r250863 r251662  
    723723        result = 96 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_PC) / 25.4;
    724724        return true;
     725    case CSSPrimitiveValue::CSS_Q:
     726        result = 96 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_PC) / (25.4 * 4.0);
     727        return true;
    725728    case CSSPrimitiveValue::CSS_IN:
    726729        result = 96 * primitiveValue.floatValue(CSSPrimitiveValue::CSS_IN);
Note: See TracChangeset for help on using the changeset viewer.