Diff
Modified: trunk/LayoutTests/ChangeLog (273384 => 273385)
--- trunk/LayoutTests/ChangeLog 2021-02-24 14:01:05 UTC (rev 273384)
+++ trunk/LayoutTests/ChangeLog 2021-02-24 16:45:08 UTC (rev 273385)
@@ -1,3 +1,18 @@
+2021-02-24 Simon Fraser <simon.fra...@apple.com>
+
+ Runtime-disabled CSS features still appear enabled via CSS.supports()
+ https://bugs.webkit.org/show_bug.cgi?id=222280
+ rdar://74595641
+
+ Reviewed by Sam Weinig.
+
+ * css3/color-filters/color-filter-exposed-if-disabled-expected.txt: Added. Fails tracked in webkit.org/b/217626
+ * css3/color-filters/color-filter-exposed-if-disabled.html: Added.
+ * fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
+ * fast/css/overscroll-behavior-invalidate-if-disabled.html:
+ * fast/css/scroll-behavior-exposed-if-disabled-expected.txt: Added.
+ * fast/css/scroll-behavior-exposed-if-disabled.html: Added.
+
2021-02-24 Imanol Fernandez <ifernan...@igalia.com>
Implement WebXR getViewport
Added: trunk/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt (0 => 273385)
--- trunk/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt 2021-02-24 16:45:08 UTC (rev 273385)
@@ -0,0 +1,14 @@
+Tests that -apple-color-filter is not exposed when the feature is disabled
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL '-apple-color-filter' in document.documentElement.style should be false. Was true.
+FAIL '-apple-color-filter' in getComputedStyle(document.documentElement) should be false. Was true.
+PASS CSS.supports('-apple-color-filter: contrast(1)') is false
+PASS CSS.supports('-apple-color-filter: inherit') is false
+PASS successfullyParsed is true
+Some tests failed.
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html (0 => 273385)
--- trunk/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html (rev 0)
+++ trunk/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html 2021-02-24 16:45:08 UTC (rev 273385)
@@ -0,0 +1,18 @@
+<!DOCTYPE html><!-- webkit-test-runner [ ColorFilterEnabled=false ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+description("Tests that -apple-color-filter is not exposed when the feature is disabled");
+
+shouldBeFalse("'-apple-color-filter' in document.documentElement.style");
+shouldBeFalse("'-apple-color-filter' in getComputedStyle(document.documentElement)");
+shouldBeFalse("CSS.supports('-apple-color-filter: contrast(1)')");
+shouldBeFalse("CSS.supports('-apple-color-filter: inherit')");
+
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt (273384 => 273385)
--- trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt 2021-02-24 14:01:05 UTC (rev 273384)
+++ trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt 2021-02-24 16:45:08 UTC (rev 273385)
@@ -6,9 +6,8 @@
PASS 'aspectRatio' in document.documentElement.style is false
PASS 'aspect-ratio' in getComputedStyle(document.documentElement) is false
PASS CSS.supports('aspect-ratio: 1 / 1') is false
-FAIL CSS.supports('aspect-ratio: inherit') should be false. Was true.
+PASS CSS.supports('aspect-ratio: inherit') is false
PASS successfullyParsed is true
-Some tests failed.
TEST COMPLETE
Modified: trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt (273384 => 273385)
--- trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt 2021-02-24 14:01:05 UTC (rev 273384)
+++ trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt 2021-02-24 16:45:08 UTC (rev 273385)
@@ -1,4 +1,4 @@
-Test overscrollBehavior should be invalidated if overscrollBehaviorEnabled is disabled
+Tests that overscroll-behavior is not exposed when the feature is disabled
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -5,6 +5,10 @@
PASS 'overscrollBehavior' in document.documentElement.style is false
PASS 'overscroll-behavior' in getComputedStyle(document.documentElement) is false
+PASS CSS.supports('overscroll-behavior: contain') is false
+PASS CSS.supports('overscroll-behavior: inherit') is false
+PASS CSS.supports('overscroll-behavior-x: inherit') is false
+PASS CSS.supports('overscroll-behavior-y: inherit') is false
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html (273384 => 273385)
--- trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html 2021-02-24 14:01:05 UTC (rev 273384)
+++ trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html 2021-02-24 16:45:08 UTC (rev 273385)
@@ -6,10 +6,14 @@
</head>
<body>
<script>
-description("Test overscrollBehavior should be invalidated if overscrollBehaviorEnabled is disabled");
+description("Tests that overscroll-behavior is not exposed when the feature is disabled");
shouldBeFalse("'overscrollBehavior' in document.documentElement.style");
shouldBeFalse("'overscroll-behavior' in getComputedStyle(document.documentElement)");
+shouldBeFalse("CSS.supports('overscroll-behavior: contain')");
+shouldBeFalse("CSS.supports('overscroll-behavior: inherit')");
+shouldBeFalse("CSS.supports('overscroll-behavior-x: inherit')");
+shouldBeFalse("CSS.supports('overscroll-behavior-y: inherit')");
</script>
</body>
Added: trunk/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt (0 => 273385)
--- trunk/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt 2021-02-24 16:45:08 UTC (rev 273385)
@@ -0,0 +1,15 @@
+Tests that scroll-behavior is not exposed when the feature is disabled
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'scrollBehavior' in document.documentElement.style is false
+PASS 'scroll-behavior' in getComputedStyle(document.documentElement) is false
+PASS CSS.supports('scroll-behavior: smooth') is false
+PASS CSS.supports('scroll-behavior: inherit') is false
+PASS CSS.supports('scroll-behavior-x: inherit') is false
+PASS CSS.supports('scroll-behavior-y: inherit') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html (0 => 273385)
--- trunk/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html (rev 0)
+++ trunk/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html 2021-02-24 16:45:08 UTC (rev 273385)
@@ -0,0 +1,20 @@
+<!DOCTYPE html><!-- webkit-test-runner [ CSSOMViewSmoothScrollingEnabled=false ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+description("Tests that scroll-behavior is not exposed when the feature is disabled");
+
+shouldBeFalse("'scrollBehavior' in document.documentElement.style");
+shouldBeFalse("'scroll-behavior' in getComputedStyle(document.documentElement)");
+shouldBeFalse("CSS.supports('scroll-behavior: smooth')");
+shouldBeFalse("CSS.supports('scroll-behavior: inherit')");
+shouldBeFalse("CSS.supports('scroll-behavior-x: inherit')");
+shouldBeFalse("CSS.supports('scroll-behavior-y: inherit')");
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (273384 => 273385)
--- trunk/Source/WebCore/ChangeLog 2021-02-24 14:01:05 UTC (rev 273384)
+++ trunk/Source/WebCore/ChangeLog 2021-02-24 16:45:08 UTC (rev 273385)
@@ -1,3 +1,24 @@
+2021-02-24 Simon Fraser <simon.fra...@apple.com>
+
+ Runtime-disabled CSS features still appear enabled via CSS.supports()
+ https://bugs.webkit.org/show_bug.cgi?id=222280
+ rdar://74595641
+
+ Reviewed by Sam Weinig.
+
+ When parsing CSS.supports() for a runtime-disabled property, we'd successfully
+ parse a CSS-wide keyword like "inherit" and report that the property is supported.
+
+ We need to explicitly check for runtime-disabled properties.
+
+ Tests: css3/color-filters/color-filter-exposed-if-disabled.html
+ fast/css/scroll-behavior-exposed-if-disabled.html
+
+ * css/parser/CSSParserImpl.cpp:
+ (WebCore::CSSParserImpl::isPropertyRuntimeDisabled const):
+ (WebCore::CSSParserImpl::consumeDeclaration):
+ * css/parser/CSSParserImpl.h:
+
2021-02-24 Imanol Fernandez <ifernan...@igalia.com>
Refactor OpenXR platform code into different classes and files.
Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (273384 => 273385)
--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2021-02-24 14:01:05 UTC (rev 273384)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2021-02-24 16:45:08 UTC (rev 273385)
@@ -773,6 +773,40 @@
}
}
+bool CSSParserImpl::isPropertyRuntimeDisabled(CSSPropertyID property) const
+{
+ switch (property) {
+ case CSSPropertyAspectRatio:
+ return !m_context.aspectRatioEnabled;
+ case CSSPropertyAppleColorFilter:
+ return !m_context.colorFilterEnabled;
+ case CSSPropertyTranslate:
+ case CSSPropertyRotate:
+ case CSSPropertyScale:
+ return !m_context.individualTransformPropertiesEnabled;
+ case CSSPropertyOverscrollBehavior:
+ case CSSPropertyOverscrollBehaviorX:
+ case CSSPropertyOverscrollBehaviorY:
+ return !m_context.overscrollBehaviorEnabled;
+ case CSSPropertyScrollBehavior:
+ return !m_context.scrollBehaviorEnabled;
+#if ENABLE(TEXT_AUTOSIZING)
+ case CSSPropertyWebkitTextSizeAdjust:
+#if !PLATFORM(IOS_FAMILY)
+ return !m_context.textAutosizingEnabled;
+#endif
+ return false;
+#endif // ENABLE(TEXT_AUTOSIZING)
+#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
+ case CSSPropertyWebkitOverflowScrolling:
+ return !m_context.legacyOverflowScrollingTouchEnabled;
+#endif
+ default:
+ return false;
+ }
+ return false;
+}
+
void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRuleType ruleType)
{
CSSParserTokenRange rangeCopy = range; // For inspector callbacks
@@ -783,6 +817,9 @@
if (range.consume().type() != ColonToken)
return; // Parse error
+ if (isPropertyRuntimeDisabled(propertyID))
+ propertyID = CSSPropertyInvalid;
+
bool important = false;
const CSSParserToken* declarationValueEnd = range.end();
const CSSParserToken* last = range.end() - 1;
Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.h (273384 => 273385)
--- trunk/Source/WebCore/css/parser/CSSParserImpl.h 2021-02-24 14:01:05 UTC (rev 273384)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.h 2021-02-24 16:45:08 UTC (rev 273385)
@@ -143,6 +143,8 @@
void consumeDeclaration(CSSParserTokenRange, StyleRuleType);
void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool important, StyleRuleType);
void consumeCustomPropertyValue(CSSParserTokenRange, const AtomString& propertyName, bool important);
+
+ bool isPropertyRuntimeDisabled(CSSPropertyID) const;
static Vector<double> consumeKeyframeKeyList(CSSParserTokenRange);