Title: [294224] trunk
Revision
294224
Author
mrobin...@webkit.org
Date
2022-05-16 01:14:46 -0700 (Mon, 16 May 2022)

Log Message

Do not allow unitless values for CSS unprefixed perspective property
https://bugs.webkit.org/show_bug.cgi?id=104805
<rdar://problem/77016090>

Reviewed by Tim Nguyen.

LayoutTests/imported/w3c:

* web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* web-platform-tests/quirks/unitless-length/excluded-properties-001-expected.txt:

Source/WebCore:

No new tests. This is tested by an existing WPT test:
    web-platform-tests/quirks/unitless-length/excluded-properties-001.html

* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumePerspective):
(WebCore::CSSPropertyParser::consumePrefixedPerspective):
(WebCore::CSSPropertyParser::parseShorthand):
* css/parser/CSSPropertyParser.h:
* rendering/style/WillChangeData.cpp:
(WebCore::WillChangeData::propertyCreatesStackingContext):

LayoutTests:

* platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (294223 => 294224)


--- trunk/LayoutTests/ChangeLog	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/ChangeLog	2022-05-16 08:14:46 UTC (rev 294224)
@@ -1,3 +1,17 @@
+2022-05-16  Martin Robinson  <mrobin...@webkit.org>
+
+        Do not allow unitless values for CSS unprefixed perspective property
+        https://bugs.webkit.org/show_bug.cgi?id=104805
+        <rdar://problem/77016090>
+
+        Reviewed by Tim Nguyen.
+
+        * platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+
 2022-05-15  Fujii Hironori  <hironori.fu...@sony.com>
 
         [WinCairo] Unreviewed test gardening

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (294223 => 294224)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-05-16 08:14:46 UTC (rev 294224)
@@ -1,3 +1,14 @@
+2022-05-16  Martin Robinson  <mrobin...@webkit.org>
+
+        Do not allow unitless values for CSS unprefixed perspective property
+        https://bugs.webkit.org/show_bug.cgi?id=104805
+        <rdar://problem/77016090>
+
+        Reviewed by Tim Nguyen.
+
+        * web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * web-platform-tests/quirks/unitless-length/excluded-properties-001-expected.txt:
+
 2022-05-13  Tim Nguyen  <n...@apple.com>
 
         [css-ui] Unexpose appearance property values already handled by appearance: auto

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (294223 => 294224)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -390,6 +390,7 @@
 PASS -webkit-mask-position-y
 PASS -webkit-mask-source-type
 PASS -webkit-nbsp-mode
+PASS -webkit-perspective
 PASS -webkit-rtl-ordering
 PASS -webkit-ruby-position
 PASS -webkit-text-combine

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294223 => 294224)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 400
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 400
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 400
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 400
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 401
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 401
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 401
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 401
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-001-expected.txt (294223 => 294224)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-001-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/unitless-length/excluded-properties-001-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -35,7 +35,7 @@
 PASS Property padding-block-start does not support quirky length
 PASS Property padding-inline-end does not support quirky length
 PASS Property padding-inline-start does not support quirky length
-FAIL Property perspective does not support quirky length assert_equals: expected "567px" but got "1234px"
+PASS Property perspective does not support quirky length
 PASS Property row-gap does not support quirky length
 PASS Property scroll-margin-block-end does not support quirky length
 PASS Property scroll-margin-block-start does not support quirky length

Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (294223 => 294224)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -388,6 +388,7 @@
 PASS -webkit-mask-position-y
 PASS -webkit-mask-source-type
 PASS -webkit-nbsp-mode
+PASS -webkit-perspective
 PASS -webkit-rtl-ordering
 PASS -webkit-ruby-position
 PASS -webkit-tap-highlight-color

Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294223 => 294224)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 398
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 398
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 398
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 399
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 399
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 399
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 399
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294223 => 294224)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 402
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 402
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 402
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 402
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 403
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 403
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 403
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 403
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (294223 => 294224)


--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -387,6 +387,7 @@
 PASS -webkit-mask-position-y
 PASS -webkit-mask-source-type
 PASS -webkit-nbsp-mode
+PASS -webkit-perspective
 PASS -webkit-rtl-ordering
 PASS -webkit-ruby-position
 PASS -webkit-tap-highlight-color

Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294223 => 294224)


--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-16 08:14:46 UTC (rev 294224)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 397
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 397
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 397
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 397
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 398
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/Source/WebCore/ChangeLog (294223 => 294224)


--- trunk/Source/WebCore/ChangeLog	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/Source/WebCore/ChangeLog	2022-05-16 08:14:46 UTC (rev 294224)
@@ -1,3 +1,27 @@
+2022-05-16  Martin Robinson  <mrobin...@webkit.org>
+
+        Do not allow unitless values for CSS unprefixed perspective property
+        https://bugs.webkit.org/show_bug.cgi?id=104805
+        <rdar://problem/77016090>
+
+        Reviewed by Tim Nguyen.
+
+        No new tests. This is tested by an existing WPT test:
+            web-platform-tests/quirks/unitless-length/excluded-properties-001.html
+
+        * animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/CSSProperties.json:
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumePerspective):
+        (WebCore::CSSPropertyParser::consumePrefixedPerspective):
+        (WebCore::CSSPropertyParser::parseShorthand):
+        * css/parser/CSSPropertyParser.h:
+        * rendering/style/WillChangeData.cpp:
+        (WebCore::WillChangeData::propertyCreatesStackingContext):
+
 2022-05-16  Youenn Fablet  <you...@apple.com>
 
         MockAudioSharedInternalUnit should exit early when being stopped in generateSampleBuffers

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (294223 => 294224)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-05-16 08:14:46 UTC (rev 294224)
@@ -3636,6 +3636,7 @@
         case CSSPropertyWebkitMaskComposite:
         case CSSPropertyWebkitMaskSourceType:
         case CSSPropertyWebkitNbspMode:
+        case CSSPropertyWebkitPerspective:
 #if ENABLE(OVERFLOW_SCROLLING_TOUCH)
         case CSSPropertyWebkitOverflowScrolling:
 #endif

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (294223 => 294224)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-05-16 08:14:46 UTC (rev 294224)
@@ -3847,6 +3847,7 @@
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
             return cssValuePool.createIdentifierValue(CSSValueSmooth);
         case CSSPropertyPerspective:
+        case CSSPropertyWebkitPerspective:
             if (!style.hasPerspective())
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             return zoomAdjustedPixelValue(style.perspective(), style);

Modified: trunk/Source/WebCore/css/CSSProperties.json (294223 => 294224)


--- trunk/Source/WebCore/css/CSSProperties.json	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/Source/WebCore/css/CSSProperties.json	2022-05-16 08:14:46 UTC (rev 294224)
@@ -6699,16 +6699,27 @@
         },
         "perspective": {
             "codegen-properties": {
-                "aliases": [
-                    "-webkit-perspective"
-                ],
                 "conditional-converter": "Perspective"
             },
             "specification": {
                 "category": "css-transforms",
-                "url": "https://www.w3.org/TR/css-transforms-1/#transform-style-property"
+                "url": "https://www.w3.org/TR/css-transforms-2/#perspective-property"
             }
         },
+        "-webkit-perspective": {
+            "codegen-properties": {
+                "longhands": [
+                    "perspective"
+                ]
+            },
+            "specification": {
+                "category": "css-transforms",
+                "url": "https://www.w3.org/TR/css-transforms-2/#perspective-property"
+            },
+            "status": {
+                "comment": "Differs from unprefixed perspective only through support for unitless values, which are interpreted as 'px'."
+            }
+        },
         "perspective-origin": {
             "codegen-properties": {
                 "aliases": [

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (294223 => 294224)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-05-16 08:14:46 UTC (rev 294224)
@@ -2466,16 +2466,29 @@
     if (auto parsedValue = consumeLength(range, cssParserMode, ValueRange::All)) {
         if (!parsedValue->isNegative().value_or(false))
             return parsedValue;
-        return nullptr;
     }
 
-    // FIXME: Make this quirk only apply to the webkit prefixed version of the property.
-    auto perspective = consumeNumberRaw(range);
-    if (!perspective || perspective->value < 0)
-        return nullptr;
-    return CSSPrimitiveValue::create(perspective->value, CSSUnitType::CSS_PX);
+    return nullptr;
 }
 
+bool CSSPropertyParser::consumePrefixedPerspective(bool important)
+{
+    if (auto value = consumePerspective(m_range, m_context.mode)) {
+        addProperty(CSSPropertyPerspective, CSSPropertyWebkitPerspective, value.releaseNonNull(), important);
+        return m_range.atEnd();
+    }
+
+    if (auto perspective = consumeNumberRaw(m_range)) {
+        if (perspective->value < 0)
+            return false;
+        auto value = CSSPrimitiveValue::create(perspective->value, CSSUnitType::CSS_PX);
+        addProperty(CSSPropertyPerspective, CSSPropertyWebkitPerspective, WTFMove(value), important);
+        return m_range.atEnd();
+    }
+
+    return false;
+}
+
 static RefPtr<CSSValueList> consumeScrollSnapAlign(CSSParserTokenRange& range)
 {
     auto firstValue = consumeIdent<CSSValueNone, CSSValueStart, CSSValueCenter, CSSValueEnd>(range);
@@ -6578,6 +6591,8 @@
         return consumeTransformOrigin(important);
     case CSSPropertyPerspectiveOrigin:
         return consumePerspectiveOrigin(important);
+    case CSSPropertyWebkitPerspective:
+        return consumePrefixedPerspective(important);
     case CSSPropertyGap: {
         RefPtr<CSSValue> rowGap = consumeGapLength(m_range, m_context.mode);
         RefPtr<CSSValue> columnGap = consumeGapLength(m_range, m_context.mode);

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (294223 => 294224)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2022-05-16 08:14:46 UTC (rev 294224)
@@ -121,6 +121,7 @@
 
     bool consumeTransformOrigin(bool important);
     bool consumePerspectiveOrigin(bool important);
+    bool consumePrefixedPerspective(bool important);
     bool consumeOffset(bool important);
 
     bool consumeOverscrollBehaviorShorthand(bool important);

Modified: trunk/Source/WebCore/rendering/style/WillChangeData.cpp (294223 => 294224)


--- trunk/Source/WebCore/rendering/style/WillChangeData.cpp	2022-05-16 07:26:25 UTC (rev 294223)
+++ trunk/Source/WebCore/rendering/style/WillChangeData.cpp	2022-05-16 08:14:46 UTC (rev 294224)
@@ -90,6 +90,7 @@
 {
     switch (property) {
     case CSSPropertyPerspective:
+    case CSSPropertyWebkitPerspective:
     case CSSPropertyScale:
     case CSSPropertyRotate:
     case CSSPropertyTranslate:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to