Skip to content
Permalink
Browse files
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:

Canonical link: https://commits.webkit.org/250582@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mrobinson committed May 16, 2022
1 parent 2a99601 commit 103005c919942dac1686f88a909b6181ebe32d36
Showing 17 changed files with 109 additions and 27 deletions.
@@ -1,3 +1,17 @@
2022-05-16 Martin Robinson <mrobinson@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.Fujii@sony.com>

[WinCairo] Unreviewed test gardening
@@ -1,3 +1,14 @@
2022-05-16 Martin Robinson <mrobinson@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 <ntim@apple.com>

[css-ui] Unexpose appearance property values already handled by appearance: auto
@@ -390,6 +390,7 @@ PASS -webkit-mask-position-x
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
@@ -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

@@ -35,7 +35,7 @@ PASS Property padding-block-end does not support quirky length
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
@@ -388,6 +388,7 @@ PASS -webkit-mask-position-x
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
@@ -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

@@ -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

@@ -387,6 +387,7 @@ PASS -webkit-mask-position-x
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
@@ -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

@@ -1,3 +1,27 @@
2022-05-16 Martin Robinson <mrobinson@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 <youenn@apple.com>

MockAudioSharedInternalUnit should exit early when being stopped in generateSampleBuffers
@@ -3636,6 +3636,7 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
case CSSPropertyWebkitMaskComposite:
case CSSPropertyWebkitMaskSourceType:
case CSSPropertyWebkitNbspMode:
case CSSPropertyWebkitPerspective:
#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
case CSSPropertyWebkitOverflowScrolling:
#endif
@@ -3847,6 +3847,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty
return cssValuePool.createIdentifierValue(CSSValueAuto);
return cssValuePool.createIdentifierValue(CSSValueSmooth);
case CSSPropertyPerspective:
case CSSPropertyWebkitPerspective:
if (!style.hasPerspective())
return cssValuePool.createIdentifierValue(CSSValueNone);
return zoomAdjustedPixelValue(style.perspective(), style);
@@ -6699,14 +6699,25 @@
},
"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": {
@@ -2466,14 +2466,27 @@ static RefPtr<CSSPrimitiveValue> consumePerspective(CSSParserTokenRange& range,
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)
@@ -6578,6 +6591,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID property, bool important)
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);
@@ -121,6 +121,7 @@ class CSSPropertyParser {

bool consumeTransformOrigin(bool important);
bool consumePerspectiveOrigin(bool important);
bool consumePrefixedPerspective(bool important);
bool consumeOffset(bool important);

bool consumeOverscrollBehaviorShorthand(bool important);
@@ -90,6 +90,7 @@ bool WillChangeData::propertyCreatesStackingContext(CSSPropertyID property)
{
switch (property) {
case CSSPropertyPerspective:
case CSSPropertyWebkitPerspective:
case CSSPropertyScale:
case CSSPropertyRotate:
case CSSPropertyTranslate:

0 comments on commit 103005c

Please sign in to comment.