WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-222280-20210223150359.patch (text/plain), 11.94 KB, created by
Simon Fraser (smfr)
on 2021-02-23 15:04:00 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2021-02-23 15:04:00 PST
Size:
11.94 KB
patch
obsolete
>Subversion Revision: 273315 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1a76ee4c5db5dc11ee2a2eca924f8b3d2639b365..556aac186ee7d69349eeae5b6c554ed17a820c15 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2021-02-22 Simon Fraser <simon.fraser@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-23 Rob Buis <rbuis@igalia.com> > > aspect-ratio shows in computed style when disabled >diff --git a/Source/WebCore/css/parser/CSSParserImpl.cpp b/Source/WebCore/css/parser/CSSParserImpl.cpp >index 15d332dd8675edad7b5329106ef43fdd0d6451ce..c7ed27d5be9447d94659a7ddafec703bacf6e6ab 100644 >--- a/Source/WebCore/css/parser/CSSParserImpl.cpp >+++ b/Source/WebCore/css/parser/CSSParserImpl.cpp >@@ -773,6 +773,40 @@ void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, StyleRuleT > } > } > >+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 @@ void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRuleType > 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; >diff --git a/Source/WebCore/css/parser/CSSParserImpl.h b/Source/WebCore/css/parser/CSSParserImpl.h >index 613f85f4f2aab89093791235a3fd07709846c4b7..f272de11de8e0b272f1b88d801bf0bfbc6f69a9a 100644 >--- a/Source/WebCore/css/parser/CSSParserImpl.h >+++ b/Source/WebCore/css/parser/CSSParserImpl.h >@@ -143,6 +143,8 @@ private: > 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); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index df13f53bf5cd3772951ab0fc4e24b7bb5c3b98e1..6fc4a4960e068d4a4e4716d2b00031116fdfdaba 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2021-02-22 Simon Fraser <simon.fraser@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-23 Rob Buis <rbuis@igalia.com> > > aspect-ratio shows in computed style when disabled >diff --git a/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt b/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..71e516870a6cd909eb5620dae992bee35c35f51a >--- /dev/null >+++ b/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt >@@ -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 >+ >diff --git a/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html b/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html >new file mode 100644 >index 0000000000000000000000000000000000000000..fb1085759ce0594c7adc80185d4d69a984872fd5 >--- /dev/null >+++ b/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html >@@ -0,0 +1,18 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ ColorFilterEnabled=false ] --> >+<html> >+<head> >+<meta charset="utf-8"> >+<script src="../../resources/js-test.js"></script> >+</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> >diff --git a/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt b/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt >index 32eba767011f1d0277ac89f2bf6ac3ff2f06f90f..046184678e93c0869bc8fea05e9fb030450f1ac3 100644 >--- a/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt >+++ b/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt >@@ -6,9 +6,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE > 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 > >diff --git a/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt b/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt >index 8378ba773351b222a8521f3d8075f0d65f791e2c..4d9cd871c3a34e83f829ea2588cc2b61b278623c 100644 >--- a/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt >+++ b/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt >@@ -1,10 +1,14 @@ >-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". > > > 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 >diff --git a/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html b/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html >index bd064a7358bc3823988550922c5bee7353da4fd2..5443a901f1c021eef8ffe2dac78205cc9c87d50b 100644 >--- a/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html >+++ b/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html >@@ -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> >diff --git a/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt b/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4ddf53466d6fd480a55c40095c3946495f4c4f67 >--- /dev/null >+++ b/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt >@@ -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 >+ >diff --git a/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html b/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html >new file mode 100644 >index 0000000000000000000000000000000000000000..db3a136284185c42e7c320f298c92c18906e6a3f >--- /dev/null >+++ b/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html >@@ -0,0 +1,20 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ CSSOMViewSmoothScrollingEnabled=false ] --> >+<html> >+<head> >+<meta charset="utf-8"> >+<script src="../../resources/js-test.js"></script> >+</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>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 222280
:
421236
|
421264
| 421356