Title: [278611] trunk
Revision
278611
Author
wei...@apple.com
Date
2021-06-08 09:35:09 -0700 (Tue, 08 Jun 2021)

Log Message

Move some hand rolled CSSProperty predicates to be generated based on new CSSProperties.json properties
https://bugs.webkit.org/show_bug.cgi?id=226768

Reviewed by Antti Koivisto.

Source/WebCore:

Replace hand rolled isDescriptorOnly, isDirectionAwareProperty and isColorProperty
functions with generated versions using new "color-property", "direction-aware-property"
and "descriptor-only" properties in CSSProperties.json.

* css/CSSProperties.json:
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isDescriptorOnly): Deleted.
(WebCore::CSSProperty::isDirectionAwareProperty): Deleted.
(WebCore::CSSProperty::isColorProperty): Deleted.
* css/makeprop.pl:
(addProperty):

Tools:

* Scripts/webkitpy/style/checkers/jsonchecker.py:
(JSONCSSPropertiesChecker.check_codegen_properties):
Add new codegen properties to the checker.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278610 => 278611)


--- trunk/Source/WebCore/ChangeLog	2021-06-08 16:27:50 UTC (rev 278610)
+++ trunk/Source/WebCore/ChangeLog	2021-06-08 16:35:09 UTC (rev 278611)
@@ -1,3 +1,22 @@
+2021-06-08  Sam Weinig  <wei...@apple.com>
+
+        Move some hand rolled CSSProperty predicates to be generated based on new CSSProperties.json properties
+        https://bugs.webkit.org/show_bug.cgi?id=226768
+
+        Reviewed by Antti Koivisto.
+
+        Replace hand rolled isDescriptorOnly, isDirectionAwareProperty and isColorProperty
+        functions with generated versions using new "color-property", "direction-aware-property"
+        and "descriptor-only" properties in CSSProperties.json.
+
+        * css/CSSProperties.json:
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isDescriptorOnly): Deleted.
+        (WebCore::CSSProperty::isDirectionAwareProperty): Deleted.
+        (WebCore::CSSProperty::isColorProperty): Deleted.
+        * css/makeprop.pl:
+        (addProperty):
+
 2021-06-08  Antoine Quint  <grao...@webkit.org>
 
         REGRESSION (r256095): Adding a border-radius, border, or box-shadow breaks animations from scale(0)

Modified: trunk/Source/WebCore/css/CSSProperties.json (278610 => 278611)


--- trunk/Source/WebCore/css/CSSProperties.json	2021-06-08 16:27:50 UTC (rev 278610)
+++ trunk/Source/WebCore/css/CSSProperties.json	2021-06-08 16:35:09 UTC (rev 278611)
@@ -88,6 +88,19 @@
         "The regular setter on RenderStyle will only be called if",
         "StyleResolver::applyPropertyToRegularStyle() returns true.",
         "",
+        "* color-property:",
+        "Indicates that this CSS property is color-related (populates",
+        "CSSProperty::isColorProperty().",
+        "",
+        "* direction-aware-property:",
+        "Indicates that this CSS property is direction aware (populates.",
+        "CSSProperty::isDirectionAwareProperty().",
+        "",
+        "* descriptor-only:",
+        "Indicates that this CSS property is descriptor only (populates.",
+        "CSSProperty::isDescriptorOnly().",
+        "",
+        "",
         "* font-property:",
         "Indicates that this CSS property is font-related. It must have corresponding",
         "methods on the FontDescription class.",
@@ -185,10 +198,11 @@
         "to true is chosen for code generation."
     ],
     "properties": {
-        "caret-color" : {
+        "caret-color": {
             "inherited": true,
             "codegen-properties": {
                 "visited-link-color-support": true,
+                "color-property": true,
                 "custom": "All"
             },
             "specification": {
@@ -200,6 +214,7 @@
             "inherited": true,
             "codegen-properties": {
                 "visited-link-color-support": true,
+                "color-property": true,
                 "high-priority": true
             },
             "status": {
@@ -1073,7 +1088,8 @@
         },
         "background-color": {
             "codegen-properties": {
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "specification": {
                 "category": "css-backgrounds",
@@ -1205,7 +1221,8 @@
                 "aliases": [
                     "-webkit-logical-height"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1271,7 +1288,8 @@
                     "border-block-end-width",
                     "border-block-end-style",
                     "border-block-end-color"
-                ]
+                ],
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1283,7 +1301,9 @@
                 "aliases": [
                     "-webkit-border-after-color"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "color-property": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1307,7 +1327,8 @@
                 "aliases": [
                     "-webkit-border-after-style"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1319,7 +1340,8 @@
                 "aliases": [
                     "-webkit-border-after-width"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1335,7 +1357,8 @@
                     "border-block-start-width",
                     "border-block-start-style",
                     "border-block-start-color"
-                ]
+                ],
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1347,7 +1370,9 @@
                 "aliases": [
                     "-webkit-border-before-color"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "color-property": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1371,7 +1396,8 @@
                 "aliases": [
                     "-webkit-border-before-style"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1383,7 +1409,8 @@
                 "aliases": [
                     "-webkit-border-before-width"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1430,7 +1457,8 @@
         "border-bottom-color": {
             "codegen-properties": {
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "specification": {
                 "category": "css-backgrounds",
@@ -1525,7 +1553,8 @@
         },
         "border-end-end-radius": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1534,7 +1563,8 @@
         },
         "border-end-start-radius": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1638,7 +1668,8 @@
                     "border-inline-end-width",
                     "border-inline-end-style",
                     "border-inline-end-color"
-                ]
+                ],
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1650,7 +1681,9 @@
                 "aliases": [
                     "-webkit-border-end-color"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "color-property": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1674,7 +1707,8 @@
                 "aliases": [
                     "-webkit-border-end-style"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1686,7 +1720,8 @@
                 "aliases": [
                     "-webkit-border-end-width"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1702,7 +1737,8 @@
                     "border-inline-start-width",
                     "border-inline-start-style",
                     "border-inline-start-color"
-                ]
+                ],
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1714,7 +1750,9 @@
                 "aliases": [
                     "-webkit-border-start-color"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "color-property": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1738,7 +1776,8 @@
                 "aliases": [
                     "-webkit-border-start-style"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1750,7 +1789,8 @@
                 "aliases": [
                     "-webkit-border-start-width"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1797,7 +1837,8 @@
         "border-left-color": {
             "codegen-properties": {
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "specification": {
                 "category": "css-backgrounds",
@@ -1865,7 +1906,8 @@
         "border-right-color": {
             "codegen-properties": {
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "specification": {
                 "category": "css-backgrounds",
@@ -1918,7 +1960,8 @@
         },
         "border-start-end-radius": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1927,7 +1970,8 @@
         },
         "border-start-start-radius": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -1964,7 +2008,8 @@
         "border-top-color": {
             "codegen-properties": {
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "specification": {
                 "category": "css-backgrounds",
@@ -2460,7 +2505,8 @@
             "inherited": true,
             "codegen-properties": {
                 "custom": "All",
-                "svg": true
+                "svg": true,
+                "color-property": true
             },
             "specification": {
                 "category": "svg",
@@ -2509,7 +2555,8 @@
         "flood-color": {
             "codegen-properties": {
                 "converter": "SVGColor",
-                "svg": true
+                "svg": true,
+                "color-property": true
             },
             "specification": {
                 "category": "svg",
@@ -2627,7 +2674,8 @@
                 "aliases": [
                     "-webkit-logical-width"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2662,7 +2710,8 @@
         },
         "inset-block-end": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2671,7 +2720,8 @@
         },
         "inset-block-start": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2692,7 +2742,8 @@
         },
         "inset-inline-end": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2701,7 +2752,8 @@
         },
         "inset-inline-start": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2746,7 +2798,8 @@
         "lighting-color": {
             "codegen-properties": {
                 "converter": "SVGColor",
-                "svg": true
+                "svg": true,
+                "color-property": true
             }
         },
         "line-height": {
@@ -2926,7 +2979,8 @@
                 "aliases": [
                     "-webkit-margin-after"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2938,7 +2992,8 @@
                 "aliases": [
                     "-webkit-margin-before"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2972,7 +3027,8 @@
                 "aliases": [
                     "-webkit-margin-end"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -2984,7 +3040,8 @@
                 "aliases": [
                     "-webkit-margin-start"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3110,7 +3167,8 @@
                 "aliases": [
                     "-webkit-max-logical-height"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3132,7 +3190,8 @@
                 "aliases": [
                     "-webkit-max-logical-width"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3154,7 +3213,8 @@
                 "aliases": [
                     "-webkit-min-logical-height"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3176,7 +3236,8 @@
                 "aliases": [
                     "-webkit-min-logical-width"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3256,7 +3317,8 @@
         "outline-color": {
             "codegen-properties": {
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "specification": {
                 "category": "css-ui",
@@ -3438,7 +3500,8 @@
                 "aliases": [
                     "-webkit-padding-after"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3450,7 +3513,8 @@
                 "aliases": [
                     "-webkit-padding-before"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3484,7 +3548,8 @@
                 "aliases": [
                     "-webkit-padding-end"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3496,7 +3561,8 @@
                 "aliases": [
                     "-webkit-padding-start"
                 ],
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-logical-props",
@@ -3720,7 +3786,8 @@
         },
         "src": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "descriptor-only": true
             },
             "specification": {
                 "category": "css-fonts",
@@ -3730,7 +3797,8 @@
         "stop-color": {
             "codegen-properties": {
                 "converter": "SVGColor",
-                "svg": true
+                "svg": true,
+                "color-property": true
             },
             "specification": {
                 "category": "svg",
@@ -3751,7 +3819,8 @@
             "inherited": true,
             "codegen-properties": {
                 "custom": "All",
-                "svg": true
+                "svg": true,
+                "color-property": true
             },
             "specification": {
                 "category": "svg",
@@ -3847,7 +3916,8 @@
             "inherited": true,
             "codegen-properties": {
                 "custom": "Value",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "status": "supported",
             "specification": {
@@ -4332,7 +4402,8 @@
         },
         "unicode-range": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "descriptor-only": true
             },
             "specification": {
                 "category": "css-fonts",
@@ -4341,7 +4412,8 @@
         },
         "font-display": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "descriptor-only": true
             },
             "specification": {
                 "category": "css-fonts-4",
@@ -4971,7 +5043,8 @@
                     "-webkit-column-rule-color"
                 ],
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "specification":  {
                 "category": "css-multicol",
@@ -6344,11 +6417,12 @@
         },
         "text-decoration-color": {
             "codegen-properties": {
+                "aliases": [
+                    "-webkit-text-decoration-color"
+                ],
                 "initial": "currentColor",
                 "visited-link-color-support": true,
-                "aliases": [
-                    "-webkit-text-decoration-color"
-                ]
+                "color-property": true
             },
             "status": {
                 "status": "experimental"
@@ -6458,7 +6532,8 @@
                     "text-emphasis-color"
                 ],
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "status": {
                 "status": "experimental"
@@ -6505,7 +6580,8 @@
             "inherited": true,
             "codegen-properties": {
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "status": {
                 "status": "non-standard",
@@ -6536,7 +6612,8 @@
             "inherited": true,
             "codegen-properties": {
                 "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "color-property": true
             },
             "status": {
                 "status": "non-standard",
@@ -6813,7 +6890,8 @@
         },
         "scroll-margin-inline-start": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",
@@ -6822,7 +6900,8 @@
         },
         "scroll-margin-block-start": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",
@@ -6831,7 +6910,8 @@
         },
         "scroll-margin-inline-end": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",
@@ -6840,7 +6920,8 @@
         },
         "scroll-margin-block-end": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",
@@ -6927,7 +7008,8 @@
         },
         "scroll-padding-inline-start": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",
@@ -6936,7 +7018,8 @@
         },
         "scroll-padding-block-start": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",
@@ -6945,7 +7028,8 @@
         },
         "scroll-padding-inline-end": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",
@@ -6954,7 +7038,8 @@
         },
         "scroll-padding-block-end": {
             "codegen-properties": {
-                "skip-builder": true
+                "skip-builder": true,
+                "direction-aware-property": true
             },
             "specification": {
                 "category": "css-scroll-snap",

Modified: trunk/Source/WebCore/css/CSSProperty.cpp (278610 => 278611)


--- trunk/Source/WebCore/css/CSSProperty.cpp	2021-06-08 16:27:50 UTC (rev 278610)
+++ trunk/Source/WebCore/css/CSSProperty.cpp	2021-06-08 16:35:09 UTC (rev 278611)
@@ -1,6 +1,6 @@
 /**
  * (C) 1999-2003 Lars Knoll (kn...@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Inc.
+ * Copyright (C) 2004-2021 Apple Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -192,103 +192,4 @@
     }
 }
 
-bool CSSProperty::isDescriptorOnly(CSSPropertyID propertyID)
-{
-    switch (propertyID) {
-    case CSSPropertySrc:
-    case CSSPropertyUnicodeRange:
-    case CSSPropertyFontDisplay:
-        return true;
-    default:
-        return false;
-    }
-}
-
-bool CSSProperty::isDirectionAwareProperty(CSSPropertyID propertyID)
-{
-    switch (propertyID) {
-    case CSSPropertyBorderBlockEnd:
-    case CSSPropertyBorderBlockEndColor:
-    case CSSPropertyBorderBlockEndStyle:
-    case CSSPropertyBorderBlockEndWidth:
-    case CSSPropertyBorderBlockStart:
-    case CSSPropertyBorderBlockStartColor:
-    case CSSPropertyBorderBlockStartStyle:
-    case CSSPropertyBorderBlockStartWidth:
-    case CSSPropertyBorderInlineEnd:
-    case CSSPropertyBorderInlineEndColor:
-    case CSSPropertyBorderInlineEndStyle:
-    case CSSPropertyBorderInlineEndWidth:
-    case CSSPropertyBorderInlineStart:
-    case CSSPropertyBorderInlineStartColor:
-    case CSSPropertyBorderInlineStartStyle:
-    case CSSPropertyBorderInlineStartWidth:
-    case CSSPropertyInsetInlineEnd:
-    case CSSPropertyInsetInlineStart:
-    case CSSPropertyInsetBlockStart:
-    case CSSPropertyInsetBlockEnd:
-    case CSSPropertyMarginInlineEnd:
-    case CSSPropertyMarginInlineStart:
-    case CSSPropertyMarginBlockStart:
-    case CSSPropertyMarginBlockEnd:
-    case CSSPropertyPaddingInlineEnd:
-    case CSSPropertyPaddingInlineStart:
-    case CSSPropertyPaddingBlockStart:
-    case CSSPropertyPaddingBlockEnd:
-    case CSSPropertyInlineSize:
-    case CSSPropertyBlockSize:
-    case CSSPropertyMinInlineSize:
-    case CSSPropertyMinBlockSize:
-    case CSSPropertyMaxInlineSize:
-    case CSSPropertyMaxBlockSize:
-    case CSSPropertyBorderStartStartRadius:
-    case CSSPropertyBorderStartEndRadius:
-    case CSSPropertyBorderEndStartRadius:
-    case CSSPropertyBorderEndEndRadius:
-    case CSSPropertyScrollMarginInlineStart:
-    case CSSPropertyScrollMarginInlineEnd:
-    case CSSPropertyScrollMarginBlockStart:
-    case CSSPropertyScrollMarginBlockEnd:
-    case CSSPropertyScrollPaddingInlineStart:
-    case CSSPropertyScrollPaddingInlineEnd:
-    case CSSPropertyScrollPaddingBlockStart:
-    case CSSPropertyScrollPaddingBlockEnd:
-        return true;
-    default:
-        return false;
-    }
-}
-
-bool CSSProperty::isColorProperty(CSSPropertyID propertyId)
-{
-    switch (propertyId) {
-    case CSSPropertyColor:
-    case CSSPropertyBackgroundColor:
-    case CSSPropertyBorderBottomColor:
-    case CSSPropertyBorderLeftColor:
-    case CSSPropertyBorderRightColor:
-    case CSSPropertyBorderTopColor:
-    case CSSPropertyFill:
-    case CSSPropertyFloodColor:
-    case CSSPropertyLightingColor:
-    case CSSPropertyOutlineColor:
-    case CSSPropertyStopColor:
-    case CSSPropertyStroke:
-    case CSSPropertyStrokeColor:
-    case CSSPropertyBorderBlockEndColor:
-    case CSSPropertyBorderBlockStartColor:
-    case CSSPropertyBorderInlineEndColor:
-    case CSSPropertyBorderInlineStartColor:
-    case CSSPropertyColumnRuleColor:
-    case CSSPropertyWebkitTextEmphasisColor:
-    case CSSPropertyWebkitTextFillColor:
-    case CSSPropertyWebkitTextStrokeColor:
-    case CSSPropertyTextDecorationColor:
-    case CSSPropertyCaretColor:
-        return true;
-    default:
-        return false;
-    }
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/makeprop.pl (278610 => 278611)


--- trunk/Source/WebCore/css/makeprop.pl	2021-06-08 16:27:50 UTC (rev 278610)
+++ trunk/Source/WebCore/css/makeprop.pl	2021-06-08 16:35:09 UTC (rev 278611)
@@ -65,8 +65,11 @@
 my %runtimeFlags;
 my %settingsFlags;
 my $numPredefinedProperties = 2;
+my %nameIsColorProperty;
+my %nameIsDescriptorOnly;
+my %nameIsDirectionAwareProperty;
+my %nameIsHighPriority;
 my %nameIsInherited;
-my %nameIsHighPriority;
 my %namePriorityShouldSink;
 my %propertiesWithStyleBuilderOptions;
 my %styleBuilderOptions = (
@@ -257,6 +260,12 @@
                     $runtimeFlags{$name} = $codegenProperties->{"runtime-flag"};
                 } elsif ($codegenOptionName eq "settings-flag") {
                     $settingsFlags{$name} = $codegenProperties->{"settings-flag"};
+                } elsif ($codegenOptionName eq "color-property") {
+                    $nameIsColorProperty{$name} = 1;
+                } elsif ($codegenOptionName eq "direction-aware-property") {
+                    $nameIsDirectionAwareProperty{$name} = 1;
+                } elsif ($codegenOptionName eq "descriptor-only") {
+                    $nameIsDescriptorOnly{$name} = 1;
                 } else {
                     die "Unrecognized codegen property \"$codegenOptionName\" for $name property.";
                 }
@@ -512,7 +521,7 @@
     
 CSSPropertyID getRelatedPropertyId(CSSPropertyID id)
 {
-    switch(id) {
+    switch (id) {
 EOF
 for my $name (@names) {
     if (!$relatedProperty{$name}) {
@@ -547,6 +556,60 @@
     }
 }
 
+bool CSSProperty::isColorProperty(CSSPropertyID id)
+{
+    switch (id) {
+EOF
+for my $name (@names) {
+    if (!$nameIsColorProperty{$name}) {
+        next;
+    }
+    print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
+}
+
+print GPERF << "EOF";
+        return true;
+    default:
+        return false;
+    }
+}
+
+bool CSSProperty::isDirectionAwareProperty(CSSPropertyID id)
+{
+    switch (id) {
+EOF
+for my $name (@names) {
+    if (!$nameIsDirectionAwareProperty{$name}) {
+        next;
+    }
+    print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
+}
+
+print GPERF << "EOF";
+        return true;
+    default:
+        return false;
+    }
+}
+
+bool CSSProperty::isDescriptorOnly(CSSPropertyID id)
+{
+    switch (id) {
+EOF
+for my $name (@names) {
+    if (!$nameIsDescriptorOnly{$name}) {
+        next;
+    }
+    print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
+}
+
+print GPERF << "EOF";
+        return true;
+    default:
+        return false;
+    }
+}
+
 } // namespace WebCore
 
 IGNORE_WARNINGS_END

Modified: trunk/Tools/ChangeLog (278610 => 278611)


--- trunk/Tools/ChangeLog	2021-06-08 16:27:50 UTC (rev 278610)
+++ trunk/Tools/ChangeLog	2021-06-08 16:35:09 UTC (rev 278611)
@@ -1,3 +1,14 @@
+2021-06-08  Sam Weinig  <wei...@apple.com>
+
+        Move some hand rolled CSSProperty predicates to be generated based on new CSSProperties.json properties
+        https://bugs.webkit.org/show_bug.cgi?id=226768
+
+        Reviewed by Antti Koivisto.
+
+        * Scripts/webkitpy/style/checkers/jsonchecker.py:
+        (JSONCSSPropertiesChecker.check_codegen_properties):
+        Add new codegen properties to the checker.
+
 2021-06-08  Philippe Normand  <pnorm...@igalia.com>
 
         [Flatpak SDK] Enable network access in the WPE build sandbox

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py (278610 => 278611)


--- trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py	2021-06-08 16:27:50 UTC (rev 278610)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py	2021-06-08 16:35:09 UTC (rev 278611)
@@ -273,16 +273,18 @@
         keys_and_validators = {
             'aliases': self.validate_array,
             'auto-functions': self.validate_boolean,
+            'color-property': self.validate_boolean,
             'comment': self.validate_string,
             'conditional-converter': self.validate_string,
             'converter': self.validate_string,
             'custom': self.validate_string,
+            'descriptor-only': self.validate_boolean,
+            'direction-aware-property': self.validate_boolean,
             'enable-if': self.validate_string,
             'fill-layer-property': self.validate_boolean,
             'font-property': self.validate_boolean,
             'getter': self.validate_string,
             'high-priority': self.validate_boolean,
-            'sink-priority': self.validate_boolean,
             'initial': self.validate_string,
             'internal-only': self.validate_boolean,
             'longhands': self.validate_array,
@@ -292,6 +294,7 @@
             'runtime-flag': self.validate_string,
             'setter': self.validate_string,
             'settings-flag': self.validate_string,
+            'sink-priority': self.validate_boolean,
             'skip-builder': self.validate_boolean,
             'skip-codegen': self.validate_boolean,
             'svg': self.validate_boolean,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to