- Revision
- 284207
- Author
- [email protected]
- Date
- 2021-10-14 15:50:23 -0700 (Thu, 14 Oct 2021)
Log Message
CSSProperties.json should not require a 'converter' for color properties
https://bugs.webkit.org/show_bug.cgi?id=231376
Reviewed by Antti Koivisto.
r283742 used StyleBuilderCustom to implement 'accent-color' as
specifying 'auto-functions' and 'color-property' resulted in an
incorrect value setter.
Upon further investigation, specifying 'converter: SVGColor'
solved the issue, as the CSSPrimitiveValue was then correctly
converted into a Color.
Rather than renaming the converter for use with non-SVG color
properties, this patch removes the existing color converter entirely,
as the need for color conversion can be inferred from the existence
of 'color-property'.
* css/CSSProperties.json:
Remove now unecessary 'converter', and use 'auto-functions' for
'accent-color' rather than 'custom'.
* css/makeprop.pl:
(generateValueSetter):
Perform Color conversion from CSSPrimitiveValue if 'color-property'
is specified.
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertSVGColor): Deleted.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialAccentColor): Deleted.
(WebCore::Style::BuilderCustom::applyInheritAccentColor): Deleted.
(WebCore::Style::BuilderCustom::applyValueAccentColor): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (284206 => 284207)
--- trunk/Source/WebCore/ChangeLog 2021-10-14 22:42:42 UTC (rev 284206)
+++ trunk/Source/WebCore/ChangeLog 2021-10-14 22:50:23 UTC (rev 284207)
@@ -1,3 +1,41 @@
+2021-10-14 Aditya Keerthi <[email protected]>
+
+ CSSProperties.json should not require a 'converter' for color properties
+ https://bugs.webkit.org/show_bug.cgi?id=231376
+
+ Reviewed by Antti Koivisto.
+
+ r283742 used StyleBuilderCustom to implement 'accent-color' as
+ specifying 'auto-functions' and 'color-property' resulted in an
+ incorrect value setter.
+
+ Upon further investigation, specifying 'converter: SVGColor'
+ solved the issue, as the CSSPrimitiveValue was then correctly
+ converted into a Color.
+
+ Rather than renaming the converter for use with non-SVG color
+ properties, this patch removes the existing color converter entirely,
+ as the need for color conversion can be inferred from the existence
+ of 'color-property'.
+
+ * css/CSSProperties.json:
+
+ Remove now unecessary 'converter', and use 'auto-functions' for
+ 'accent-color' rather than 'custom'.
+
+ * css/makeprop.pl:
+ (generateValueSetter):
+
+ Perform Color conversion from CSSPrimitiveValue if 'color-property'
+ is specified.
+
+ * style/StyleBuilderConverter.h:
+ (WebCore::Style::BuilderConverter::convertSVGColor): Deleted.
+ * style/StyleBuilderCustom.h:
+ (WebCore::Style::BuilderCustom::applyInitialAccentColor): Deleted.
+ (WebCore::Style::BuilderCustom::applyInheritAccentColor): Deleted.
+ (WebCore::Style::BuilderCustom::applyValueAccentColor): Deleted.
+
2021-10-14 Antoine Quint <[email protected]>
Remove DocumentTimeline::isRunningAnimationOnRenderer()
Modified: trunk/Source/WebCore/css/CSSProperties.json (284206 => 284207)
--- trunk/Source/WebCore/css/CSSProperties.json 2021-10-14 22:42:42 UTC (rev 284206)
+++ trunk/Source/WebCore/css/CSSProperties.json 2021-10-14 22:50:23 UTC (rev 284207)
@@ -219,8 +219,8 @@
"accent-color": {
"inherited": true,
"codegen-properties": {
+ "auto-functions": true,
"color-property": true,
- "custom": "All",
"settings-flag": "accentColorEnabled"
},
"status": {
@@ -2748,7 +2748,6 @@
},
"flood-color": {
"codegen-properties": {
- "converter": "SVGColor",
"svg": true,
"color-property": true
},
@@ -3024,7 +3023,6 @@
},
"lighting-color": {
"codegen-properties": {
- "converter": "SVGColor",
"svg": true,
"color-property": true
}
@@ -4134,7 +4132,6 @@
},
"stop-color": {
"codegen-properties": {
- "converter": "SVGColor",
"svg": true,
"color-property": true
},
Modified: trunk/Source/WebCore/css/makeprop.pl (284206 => 284207)
--- trunk/Source/WebCore/css/makeprop.pl 2021-10-14 22:42:42 UTC (rev 284206)
+++ trunk/Source/WebCore/css/makeprop.pl 2021-10-14 22:50:23 UTC (rev 284207)
@@ -1313,6 +1313,8 @@
} elsif (exists($propertiesWithStyleBuilderOptions{$name}{"conditional-converter"})) {
$setterContent .= $indent . " auto convertedValue = BuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"conditional-converter"} . "(builderState, value);\n";
$convertedValue = "WTFMove(convertedValue.value())";
+ } elsif ($nameIsColorProperty{$name}) {
+ $convertedValue = colorFromPrimitiveValue("downcast<CSSPrimitiveValue>(value)");
} else {
$convertedValue = "downcast<CSSPrimitiveValue>(value)";
}
Modified: trunk/Source/WebCore/style/StyleBuilderConverter.h (284206 => 284207)
--- trunk/Source/WebCore/style/StyleBuilderConverter.h 2021-10-14 22:42:42 UTC (rev 284206)
+++ trunk/Source/WebCore/style/StyleBuilderConverter.h 2021-10-14 22:50:23 UTC (rev 284207)
@@ -145,7 +145,6 @@
static PaintOrder convertPaintOrder(BuilderState&, const CSSValue&);
static float convertOpacity(BuilderState&, const CSSValue&);
static String convertSVGURIReference(BuilderState&, const CSSValue&);
- static Color convertSVGColor(BuilderState&, const CSSValue&);
static StyleSelfAlignmentData convertSelfOrDefaultAlignmentData(BuilderState&, const CSSValue&);
static StyleContentAlignmentData convertContentAlignmentData(BuilderState&, const CSSValue&);
static GlyphOrientation convertGlyphOrientation(BuilderState&, const CSSValue&);
@@ -1432,11 +1431,6 @@
return SVGURIReference::fragmentIdentifierFromIRIString(s, builderState.document());
}
-inline Color BuilderConverter::convertSVGColor(BuilderState& builderState, const CSSValue& value)
-{
- return builderState.colorFromPrimitiveValue(downcast<CSSPrimitiveValue>(value));
-}
-
inline StyleSelfAlignmentData BuilderConverter::convertSelfOrDefaultAlignmentData(BuilderState&, const CSSValue& value)
{
StyleSelfAlignmentData alignmentData = RenderStyle::initialSelfAlignment();
Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (284206 => 284207)
--- trunk/Source/WebCore/style/StyleBuilderCustom.h 2021-10-14 22:42:42 UTC (rev 284206)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h 2021-10-14 22:50:23 UTC (rev 284207)
@@ -71,7 +71,6 @@
class BuilderCustom {
public:
// Custom handling of inherit, initial and value setting.
- DECLARE_PROPERTY_CUSTOM_HANDLERS(AccentColor);
DECLARE_PROPERTY_CUSTOM_HANDLERS(AspectRatio);
DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageOutset);
DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageRepeat);
@@ -794,29 +793,6 @@
builderState.style().setOutlineStyle(primitiveValue);
}
-inline void BuilderCustom::applyInitialAccentColor(BuilderState& builderState)
-{
- builderState.style().setHasAutoAccentColor();
-}
-
-inline void BuilderCustom::applyInheritAccentColor(BuilderState& builderState)
-{
- Color color = builderState.parentStyle().accentColor();
- if (builderState.parentStyle().hasAutoAccentColor())
- builderState.style().setHasAutoAccentColor();
- else
- builderState.style().setAccentColor(color);
-}
-
-inline void BuilderCustom::applyValueAccentColor(BuilderState& builderState, CSSValue& value)
-{
- auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
- if (primitiveValue.valueID() == CSSValueAuto)
- builderState.style().setHasAutoAccentColor();
- else
- builderState.style().setAccentColor(builderState.colorFromPrimitiveValue(primitiveValue));
-}
-
inline void BuilderCustom::applyInitialCaretColor(BuilderState& builderState)
{
if (builderState.applyPropertyToRegularStyle())