Title: [275834] trunk
Revision
275834
Author
[email protected]
Date
2021-04-12 12:31:19 -0700 (Mon, 12 Apr 2021)

Log Message

border-image-width computed values should be a calc() value if it contains a percentage
https://bugs.webkit.org/show_bug.cgi?id=224420

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

We now pass the final test that was a FAIL result for the border-image-width computed style test.
We also pass a fair few border-image-width interpolation tests since we used to fail them as a
result of the expected value being expected to be a resolved value rather than a calc() value
due the computed style we returned for such values. There are a few PASS results than became
FAIL results because we now correctly expect a calc() value, but we return the keyframe value
as-is for 0 and 1 progress, a bug we will fix shortly.

* web-platform-tests/css/css-backgrounds/animations/border-image-width-interpolation-expected.txt:
* web-platform-tests/css/css-backgrounds/parsing/border-image-width-computed-expected.txt:

Source/WebCore:

When handling calc() values containing a percentage, we must retain the calc() form when creating
the computed style for border-image-width.

* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapNinePieceImageQuad):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (275833 => 275834)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-12 19:20:13 UTC (rev 275833)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-12 19:31:19 UTC (rev 275834)
@@ -1,3 +1,20 @@
+2021-04-12  Antoine Quint  <[email protected]>
+
+        border-image-width computed values should be a calc() value if it contains a percentage
+        https://bugs.webkit.org/show_bug.cgi?id=224420
+
+        Reviewed by Simon Fraser.
+
+        We now pass the final test that was a FAIL result for the border-image-width computed style test.
+        We also pass a fair few border-image-width interpolation tests since we used to fail them as a
+        result of the expected value being expected to be a resolved value rather than a calc() value
+        due the computed style we returned for such values. There are a few PASS results than became
+        FAIL results because we now correctly expect a calc() value, but we return the keyframe value
+        as-is for 0 and 1 progress, a bug we will fix shortly.
+
+        * web-platform-tests/css/css-backgrounds/animations/border-image-width-interpolation-expected.txt:
+        * web-platform-tests/css/css-backgrounds/parsing/border-image-width-computed-expected.txt:
+
 2021-04-12  Youenn Fablet  <[email protected]>
 
         Block loading for port 10080

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/animations/border-image-width-interpolation-expected.txt (275833 => 275834)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/animations/border-image-width-interpolation-expected.txt	2021-04-12 19:20:13 UTC (rev 275833)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/animations/border-image-width-interpolation-expected.txt	2021-04-12 19:31:19 UTC (rev 275834)
@@ -247,54 +247,54 @@
 PASS Web Animations: property <border-image-width> from [10px 20% 30 40px] to [80px 70% 60 50px] at (1.5) should be [115px  95%  75  55px]
 PASS Web Animations: property <border-image-width> from [10px 20% 30 40px] to [80px 70% 60 50px] at (5) should be [360px 270% 180  90px]
 PASS Web Animations: property <border-image-width> from [10px 20% 30 40px] to [80px 70% 60 50px] at (10) should be [710px 520% 330 140px]
-FAIL CSS Transitions: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)] assert_equals: expected "7px " but got "calc ( 13 % - 6px ) "
+PASS CSS Transitions: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)]
 PASS CSS Transitions: property <border-image-width> from [10%] to [20px] at (0) should be [10%]
-FAIL CSS Transitions: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)] assert_equals: expected "13px " but got "calc ( 7 % + 6px ) "
-FAIL CSS Transitions: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)] assert_equals: expected "16px " but got "calc ( 4 % + 12px ) "
-PASS CSS Transitions: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)]
-FAIL CSS Transitions: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)] assert_equals: expected "25px " but got "calc ( - 5 % + 30px ) "
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)] assert_equals: expected "7px " but got "calc ( 13 % - 6px ) "
+PASS CSS Transitions: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)]
+PASS CSS Transitions: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)]
+FAIL CSS Transitions: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)] assert_equals: expected "calc ( 0 % + 20px ) " but got "20px "
+PASS CSS Transitions: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)]
+PASS CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)]
 PASS CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (0) should be [10%]
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)] assert_equals: expected "13px " but got "calc ( 7 % + 6px ) "
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)] assert_equals: expected "16px " but got "calc ( 4 % + 12px ) "
-PASS CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)]
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)] assert_equals: expected "25px " but got "calc ( - 5 % + 30px ) "
-FAIL CSS Animations: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)] assert_equals: expected "7px " but got "calc ( 13 % - 6px ) "
+PASS CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)]
+PASS CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)]
+FAIL CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)] assert_equals: expected "calc ( 0 % + 20px ) " but got "20px "
+PASS CSS Transitions with transition: all: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)]
+PASS CSS Animations: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)]
 PASS CSS Animations: property <border-image-width> from [10%] to [20px] at (0) should be [10%]
-FAIL CSS Animations: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)] assert_equals: expected "13px " but got "calc ( 7 % + 6px ) "
-FAIL CSS Animations: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)] assert_equals: expected "16px " but got "calc ( 4 % + 12px ) "
-PASS CSS Animations: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)]
-FAIL CSS Animations: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)] assert_equals: expected "25px " but got "calc ( - 5 % + 30px ) "
-FAIL Web Animations: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)] assert_equals: expected "7px " but got "calc ( 13 % - 6px ) "
+PASS CSS Animations: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)]
+PASS CSS Animations: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)]
+FAIL CSS Animations: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)] assert_equals: expected "calc ( 0 % + 20px ) " but got "20px "
+PASS CSS Animations: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)]
+PASS Web Animations: property <border-image-width> from [10%] to [20px] at (-0.3) should be [calc(13% + -6px)]
 PASS Web Animations: property <border-image-width> from [10%] to [20px] at (0) should be [10%]
-FAIL Web Animations: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)] assert_equals: expected "13px " but got "calc ( 7 % + 6px ) "
-FAIL Web Animations: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)] assert_equals: expected "16px " but got "calc ( 4 % + 12px ) "
-PASS Web Animations: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)]
-FAIL Web Animations: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)] assert_equals: expected "25px " but got "calc ( - 5 % + 30px ) "
-FAIL CSS Transitions: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)] assert_equals: expected "7px " but got "calc ( - 6 % + 13px ) "
-PASS CSS Transitions: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)]
-FAIL CSS Transitions: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)] assert_equals: expected "13px " but got "calc ( 6 % + 7px ) "
-FAIL CSS Transitions: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)] assert_equals: expected "16px " but got "calc ( 12 % + 4px ) "
+PASS Web Animations: property <border-image-width> from [10%] to [20px] at (0.3) should be [calc(7% + 6px)]
+PASS Web Animations: property <border-image-width> from [10%] to [20px] at (0.6) should be [calc(4% + 12px)]
+FAIL Web Animations: property <border-image-width> from [10%] to [20px] at (1) should be [calc(0% + 20px)] assert_equals: expected "calc ( 0 % + 20px ) " but got "20px "
+PASS Web Animations: property <border-image-width> from [10%] to [20px] at (1.5) should be [calc(-5% + 30px)]
+PASS CSS Transitions: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)]
+FAIL CSS Transitions: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)] assert_equals: expected "calc ( 0 % + 10px ) " but got "10px "
+PASS CSS Transitions: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)]
+PASS CSS Transitions: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)]
 PASS CSS Transitions: property <border-image-width> from [10px] to [20%] at (1) should be [20%]
-FAIL CSS Transitions: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)] assert_equals: expected "25px " but got "calc ( 30 % - 5px ) "
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)] assert_equals: expected "7px " but got "calc ( - 6 % + 13px ) "
-PASS CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)]
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)] assert_equals: expected "13px " but got "calc ( 6 % + 7px ) "
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)] assert_equals: expected "16px " but got "calc ( 12 % + 4px ) "
+PASS CSS Transitions: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)]
+PASS CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)]
+FAIL CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)] assert_equals: expected "calc ( 0 % + 10px ) " but got "10px "
+PASS CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)]
+PASS CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)]
 PASS CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (1) should be [20%]
-FAIL CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)] assert_equals: expected "25px " but got "calc ( 30 % - 5px ) "
-FAIL CSS Animations: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)] assert_equals: expected "7px " but got "calc ( - 6 % + 13px ) "
-PASS CSS Animations: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)]
-FAIL CSS Animations: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)] assert_equals: expected "13px " but got "calc ( 6 % + 7px ) "
-FAIL CSS Animations: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)] assert_equals: expected "16px " but got "calc ( 12 % + 4px ) "
+PASS CSS Transitions with transition: all: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)]
+PASS CSS Animations: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)]
+FAIL CSS Animations: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)] assert_equals: expected "calc ( 0 % + 10px ) " but got "10px "
+PASS CSS Animations: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)]
+PASS CSS Animations: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)]
 PASS CSS Animations: property <border-image-width> from [10px] to [20%] at (1) should be [20%]
-FAIL CSS Animations: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)] assert_equals: expected "25px " but got "calc ( 30 % - 5px ) "
-FAIL Web Animations: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)] assert_equals: expected "7px " but got "calc ( - 6 % + 13px ) "
-PASS Web Animations: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)]
-FAIL Web Animations: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)] assert_equals: expected "13px " but got "calc ( 6 % + 7px ) "
-FAIL Web Animations: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)] assert_equals: expected "16px " but got "calc ( 12 % + 4px ) "
+PASS CSS Animations: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)]
+PASS Web Animations: property <border-image-width> from [10px] to [20%] at (-0.3) should be [calc(13px + -6%)]
+FAIL Web Animations: property <border-image-width> from [10px] to [20%] at (0) should be [calc(0% + 10px)] assert_equals: expected "calc ( 0 % + 10px ) " but got "10px "
+PASS Web Animations: property <border-image-width> from [10px] to [20%] at (0.3) should be [calc(7px + 6%)]
+PASS Web Animations: property <border-image-width> from [10px] to [20%] at (0.6) should be [calc(4px + 12%)]
 PASS Web Animations: property <border-image-width> from [10px] to [20%] at (1) should be [20%]
-FAIL Web Animations: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)] assert_equals: expected "25px " but got "calc ( 30 % - 5px ) "
+PASS Web Animations: property <border-image-width> from [10px] to [20%] at (1.5) should be [calc(-5px + 30%)]
 PASS CSS Transitions: property <border-image-width> from [10px auto auto 20] to [110px auto auto 120] at (-0.3) should be [  0px auto auto   0]
 PASS CSS Transitions: property <border-image-width> from [10px auto auto 20] to [110px auto auto 120] at (0) should be [ 10px auto auto  20]
 PASS CSS Transitions: property <border-image-width> from [10px auto auto 20] to [110px auto auto 120] at (0.3) should be [ 40px auto auto  50]

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-width-computed-expected.txt (275833 => 275834)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-width-computed-expected.txt	2021-04-12 19:20:13 UTC (rev 275833)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-width-computed-expected.txt	2021-04-12 19:31:19 UTC (rev 275834)
@@ -4,7 +4,7 @@
 PASS Property border-image-width value 'auto'
 PASS Property border-image-width value '10px'
 PASS Property border-image-width value '20%'
-FAIL Property border-image-width value 'calc(20% + 10px)' assert_equals: expected "calc(20% + 10px)" but got "30px"
+PASS Property border-image-width value 'calc(20% + 10px)'
 PASS Property border-image-width value 'calc(-0.5em + 10px)'
 PASS Property border-image-width value 'calc(0.5em + 10px)'
 PASS Property border-image-width value '1 auto'

Modified: trunk/Source/WebCore/ChangeLog (275833 => 275834)


--- trunk/Source/WebCore/ChangeLog	2021-04-12 19:20:13 UTC (rev 275833)
+++ trunk/Source/WebCore/ChangeLog	2021-04-12 19:31:19 UTC (rev 275834)
@@ -1,3 +1,16 @@
+2021-04-12  Antoine Quint  <[email protected]>
+
+        border-image-width computed values should be a calc() value if it contains a percentage
+        https://bugs.webkit.org/show_bug.cgi?id=224420
+
+        Reviewed by Simon Fraser.
+
+        When handling calc() values containing a percentage, we must retain the calc() form when creating
+        the computed style for border-image-width.
+
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::mapNinePieceImageQuad):
+
 2021-04-12  Youenn Fablet  <[email protected]>
 
         Add support for RTCEncodedFrame metadata

Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (275833 => 275834)


--- trunk/Source/WebCore/css/CSSToStyleMap.cpp	2021-04-12 19:20:13 UTC (rev 275833)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp	2021-04-12 19:31:19 UTC (rev 275834)
@@ -596,6 +596,8 @@
         box.top() = Length(slices->top()->floatValue(), LengthType::Relative);
     else if (slices->top()->isPercentage())
         box.top() = Length(slices->top()->doubleValue(CSSUnitType::CSS_PERCENTAGE), LengthType::Percent);
+    else if (slices->top()->isCalculatedPercentageWithLength())
+        box.top() = Length(slices->top()->cssCalcValue()->createCalculationValue(conversionData));
     else if (slices->top()->valueID() != CSSValueAuto)
         box.top() = slices->top()->computeLength<Length>(conversionData);
 
@@ -603,6 +605,8 @@
         box.right() = Length(slices->right()->floatValue(), LengthType::Relative);
     else if (slices->right()->isPercentage())
         box.right() = Length(slices->right()->doubleValue(CSSUnitType::CSS_PERCENTAGE), LengthType::Percent);
+    else if (slices->right()->isCalculatedPercentageWithLength())
+        box.right() = Length(slices->right()->cssCalcValue()->createCalculationValue(conversionData));
     else if (slices->right()->valueID() != CSSValueAuto)
         box.right() = slices->right()->computeLength<Length>(conversionData);
 
@@ -610,6 +614,8 @@
         box.bottom() = Length(slices->bottom()->floatValue(), LengthType::Relative);
     else if (slices->bottom()->isPercentage())
         box.bottom() = Length(slices->bottom()->doubleValue(CSSUnitType::CSS_PERCENTAGE), LengthType::Percent);
+    else if (slices->bottom()->isCalculatedPercentageWithLength())
+        box.bottom() = Length(slices->bottom()->cssCalcValue()->createCalculationValue(conversionData));
     else if (slices->bottom()->valueID() != CSSValueAuto)
         box.bottom() = slices->bottom()->computeLength<Length>(conversionData);
 
@@ -617,6 +623,8 @@
         box.left() = Length(slices->left()->floatValue(), LengthType::Relative);
     else if (slices->left()->isPercentage())
         box.left() = Length(slices->left()->doubleValue(CSSUnitType::CSS_PERCENTAGE), LengthType::Percent);
+    else if (slices->left()->isCalculatedPercentageWithLength())
+        box.left() = Length(slices->left()->cssCalcValue()->createCalculationValue(conversionData));
     else if (slices->left()->valueID() != CSSValueAuto)
         box.left() = slices->left()->computeLength<Length>(conversionData);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to