- Revision
- 294534
- Author
- commit-qu...@webkit.org
- Date
- 2022-05-19 23:51:32 -0700 (Thu, 19 May 2022)
Log Message
CSSMotionPathEnabled setting does not prevent parsing of CSS Motion Path properties
https://bugs.webkit.org/show_bug.cgi?id=240594
<rdar://93522039>
Patch by Antoine Quint <grao...@apple.com> on 2022-05-19
Reviewed by Antti Koivisto.
* Source/WebCore/css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::parseShorthand):
Canonical link: https://commits.webkit.org/250789@main
Modified Paths
Diff
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (294533 => 294534)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2022-05-20 06:39:43 UTC (rev 294533)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2022-05-20 06:51:32 UTC (rev 294534)
@@ -3464,16 +3464,28 @@
case CSSPropertyOffsetPath:
// The computed value of offset-path must only contain absolute draw commands.
// https://github.com/w3c/fxtf-drafts/issues/225#issuecomment-334322738
+ if (!m_element->document().settings().cssMotionPathEnabled())
+ return nullptr;
return valueForPathOperation(style, style.offsetPath(), SVGPathConversion::ForceAbsolute);
case CSSPropertyOffsetDistance:
+ if (!m_element->document().settings().cssMotionPathEnabled())
+ return nullptr;
return cssValuePool.createValue(style.offsetDistance(), style);
case CSSPropertyOffsetPosition:
+ if (!m_element->document().settings().cssMotionPathEnabled())
+ return nullptr;
return valueForPositionOrAuto(style, style.offsetPosition());
case CSSPropertyOffsetAnchor:
+ if (!m_element->document().settings().cssMotionPathEnabled())
+ return nullptr;
return valueForPositionOrAuto(style, style.offsetAnchor());
case CSSPropertyOffsetRotate:
+ if (!m_element->document().settings().cssMotionPathEnabled())
+ return nullptr;
return valueForOffsetRotate(style.offsetRotate());
case CSSPropertyOffset:
+ if (!m_element->document().settings().cssMotionPathEnabled())
+ return nullptr;
return valueForOffsetShorthand(style);
case CSSPropertyOpacity:
return cssValuePool.createValue(style.opacity(), CSSUnitType::CSS_NUMBER);
Modified: trunk/Source/WebCore/css/CSSProperties.json (294533 => 294534)
--- trunk/Source/WebCore/css/CSSProperties.json 2022-05-20 06:39:43 UTC (rev 294533)
+++ trunk/Source/WebCore/css/CSSProperties.json 2022-05-20 06:51:32 UTC (rev 294534)
@@ -3726,7 +3726,8 @@
"offset-position",
"offset-anchor",
"offset-rotate"
- ]
+ ],
+ "settings-flag": "cssMotionPathEnabled"
},
"specification": {
"category": "css-motion-path",
Modified: trunk/Source/WebCore/css/parser/CSSParserContext.cpp (294533 => 294534)
--- trunk/Source/WebCore/css/parser/CSSParserContext.cpp 2022-05-20 06:39:43 UTC (rev 294533)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.cpp 2022-05-20 06:51:32 UTC (rev 294534)
@@ -113,6 +113,7 @@
, inputSecurityEnabled { document.settings().cssInputSecurityEnabled() }
, subgridEnabled { document.settings().subgridEnabled() }
, containIntrinsicSizeEnabled { document.settings().cssContainIntrinsicSizeEnabled() }
+ , motionPathEnabled { document.settings().cssMotionPathEnabled() }
#if ENABLE(ATTACHMENT_ELEMENT)
, attachmentEnabled { RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled() }
#endif
@@ -167,6 +168,7 @@
#endif
&& a.subgridEnabled == b.subgridEnabled
&& a.containIntrinsicSizeEnabled == b.containIntrinsicSizeEnabled
+ && a.motionPathEnabled == b.motionPathEnabled
;
}
@@ -212,8 +214,8 @@
| context.inputSecurityEnabled << 30
| context.subgridEnabled << 31
| (uint64_t)context.containIntrinsicSizeEnabled << 32
- | (uint64_t)context.mode << 33; // This is multiple bits, so keep it last.
-
+ | (uint64_t)context.motionPathEnabled << 33
+ | (uint64_t)context.mode << 34; // This is multiple bits, so keep it last.
add(hasher, context.baseURL, context.charset, bits);
}
@@ -266,6 +268,13 @@
case CSSPropertyContainIntrinsicBlockSize:
case CSSPropertyContainIntrinsicInlineSize:
return !containIntrinsicSizeEnabled;
+ case CSSPropertyOffset:
+ case CSSPropertyOffsetPath:
+ case CSSPropertyOffsetDistance:
+ case CSSPropertyOffsetPosition:
+ case CSSPropertyOffsetAnchor:
+ case CSSPropertyOffsetRotate:
+ return !motionPathEnabled;
default:
return false;
}
Modified: trunk/Source/WebCore/css/parser/CSSParserContext.h (294533 => 294534)
--- trunk/Source/WebCore/css/parser/CSSParserContext.h 2022-05-20 06:39:43 UTC (rev 294533)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.h 2022-05-20 06:51:32 UTC (rev 294534)
@@ -90,6 +90,7 @@
bool inputSecurityEnabled { false };
bool subgridEnabled { false };
bool containIntrinsicSizeEnabled { false };
+ bool motionPathEnabled { false };
// RuntimeEnabledFeatures.
#if ENABLE(ATTACHMENT_ELEMENT)
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (294533 => 294534)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2022-05-20 06:39:43 UTC (rev 294533)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2022-05-20 06:51:32 UTC (rev 294534)
@@ -4594,13 +4594,21 @@
return parsedValue;
return consumePercent(m_range, ValueRange::All);
case CSSPropertyOffsetPath:
+ if (!m_context.motionPathEnabled)
+ return nullptr;
return consumePathOperation(m_range, m_context, ConsumeRay::Include);
case CSSPropertyOffsetDistance:
+ if (!m_context.motionPathEnabled)
+ return nullptr;
return consumeLengthOrPercent(m_range, m_context.mode, ValueRange::All, UnitlessQuirk::Forbid);
case CSSPropertyOffsetPosition:
case CSSPropertyOffsetAnchor:
+ if (!m_context.motionPathEnabled)
+ return nullptr;
return consumePositionOrAuto(m_range, m_context.mode, UnitlessQuirk::Forbid, PositionSyntax::Position);
case CSSPropertyOffsetRotate:
+ if (!m_context.motionPathEnabled)
+ return nullptr;
return consumeOffsetRotate(m_range, m_context.mode);
case CSSPropertyWebkitBoxFlex:
return consumeNumber(m_range, ValueRange::All);
@@ -6437,6 +6445,8 @@
case CSSPropertyOutline:
return consumeShorthandGreedily(outlineShorthand(), important);
case CSSPropertyOffset:
+ if (!m_context.motionPathEnabled)
+ return false;
return consumeOffset(important);
case CSSPropertyBorderInline: {
RefPtr<CSSValue> width;