⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278611 in webkit


Ignore:
Timestamp:
Jun 8, 2021, 9:35:09 AM (5 years ago)
Author:
weinig@apple.com
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.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r278610 r278611  
     12021-06-08  Sam Weinig  <weinig@apple.com>
     2
     3        Move some hand rolled CSSProperty predicates to be generated based on new CSSProperties.json properties
     4        https://bugs.webkit.org/show_bug.cgi?id=226768
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Replace hand rolled isDescriptorOnly, isDirectionAwareProperty and isColorProperty
     9        functions with generated versions using new "color-property", "direction-aware-property"
     10        and "descriptor-only" properties in CSSProperties.json.
     11
     12        * css/CSSProperties.json:
     13        * css/CSSProperty.cpp:
     14        (WebCore::CSSProperty::isDescriptorOnly): Deleted.
     15        (WebCore::CSSProperty::isDirectionAwareProperty): Deleted.
     16        (WebCore::CSSProperty::isColorProperty): Deleted.
     17        * css/makeprop.pl:
     18        (addProperty):
     19
    1202021-06-08  Antoine Quint  <graouts@webkit.org>
    221
  • trunk/Source/WebCore/css/CSSProperties.json

    r278185 r278611  
    8888        "The regular setter on RenderStyle will only be called if",
    8989        "StyleResolver::applyPropertyToRegularStyle() returns true.",
     90        "",
     91        "* color-property:",
     92        "Indicates that this CSS property is color-related (populates",
     93        "CSSProperty::isColorProperty().",
     94        "",
     95        "* direction-aware-property:",
     96        "Indicates that this CSS property is direction aware (populates.",
     97        "CSSProperty::isDirectionAwareProperty().",
     98        "",
     99        "* descriptor-only:",
     100        "Indicates that this CSS property is descriptor only (populates.",
     101        "CSSProperty::isDescriptorOnly().",
     102        "",
    90103        "",
    91104        "* font-property:",
     
    186199    ],
    187200    "properties": {
    188         "caret-color" : {
     201        "caret-color": {
    189202            "inherited": true,
    190203            "codegen-properties": {
    191204                "visited-link-color-support": true,
     205                "color-property": true,
    192206                "custom": "All"
    193207            },
     
    201215            "codegen-properties": {
    202216                "visited-link-color-support": true,
     217                "color-property": true,
    203218                "high-priority": true
    204219            },
     
    10741089        "background-color": {
    10751090            "codegen-properties": {
    1076                 "visited-link-color-support": true
     1091                "visited-link-color-support": true,
     1092                "color-property": true
    10771093            },
    10781094            "specification": {
     
    12061222                    "-webkit-logical-height"
    12071223                ],
    1208                 "skip-builder": true
     1224                "skip-builder": true,
     1225                "direction-aware-property": true
    12091226            },
    12101227            "specification": {
     
    12721289                    "border-block-end-style",
    12731290                    "border-block-end-color"
    1274                 ]
     1291                ],
     1292                "direction-aware-property": true
    12751293            },
    12761294            "specification": {
     
    12841302                    "-webkit-border-after-color"
    12851303                ],
    1286                 "skip-builder": true
     1304                "skip-builder": true,
     1305                "color-property": true,
     1306                "direction-aware-property": true
    12871307            },
    12881308            "specification": {
     
    13081328                    "-webkit-border-after-style"
    13091329                ],
    1310                 "skip-builder": true
     1330                "skip-builder": true,
     1331                "direction-aware-property": true
    13111332            },
    13121333            "specification": {
     
    13201341                    "-webkit-border-after-width"
    13211342                ],
    1322                 "skip-builder": true
     1343                "skip-builder": true,
     1344                "direction-aware-property": true
    13231345            },
    13241346            "specification": {
     
    13361358                    "border-block-start-style",
    13371359                    "border-block-start-color"
    1338                 ]
     1360                ],
     1361                "direction-aware-property": true
    13391362            },
    13401363            "specification": {
     
    13481371                    "-webkit-border-before-color"
    13491372                ],
    1350                 "skip-builder": true
     1373                "skip-builder": true,
     1374                "color-property": true,
     1375                "direction-aware-property": true
    13511376            },
    13521377            "specification": {
     
    13721397                    "-webkit-border-before-style"
    13731398                ],
    1374                 "skip-builder": true
     1399                "skip-builder": true,
     1400                "direction-aware-property": true
    13751401            },
    13761402            "specification": {
     
    13841410                    "-webkit-border-before-width"
    13851411                ],
    1386                 "skip-builder": true
     1412                "skip-builder": true,
     1413                "direction-aware-property": true
    13871414            },
    13881415            "specification": {
     
    14311458            "codegen-properties": {
    14321459                "initial": "currentColor",
    1433                 "visited-link-color-support": true
     1460                "visited-link-color-support": true,
     1461                "color-property": true
    14341462            },
    14351463            "specification": {
     
    15261554        "border-end-end-radius": {
    15271555            "codegen-properties": {
    1528                 "skip-builder": true
     1556                "skip-builder": true,
     1557                "direction-aware-property": true
    15291558            },
    15301559            "specification": {
     
    15351564        "border-end-start-radius": {
    15361565            "codegen-properties": {
    1537                 "skip-builder": true
     1566                "skip-builder": true,
     1567                "direction-aware-property": true
    15381568            },
    15391569            "specification": {
     
    16391669                    "border-inline-end-style",
    16401670                    "border-inline-end-color"
    1641                 ]
     1671                ],
     1672                "direction-aware-property": true
    16421673            },
    16431674            "specification": {
     
    16511682                    "-webkit-border-end-color"
    16521683                ],
    1653                 "skip-builder": true
     1684                "skip-builder": true,
     1685                "color-property": true,
     1686                "direction-aware-property": true
    16541687            },
    16551688            "specification": {
     
    16751708                    "-webkit-border-end-style"
    16761709                ],
    1677                 "skip-builder": true
     1710                "skip-builder": true,
     1711                "direction-aware-property": true
    16781712            },
    16791713            "specification": {
     
    16871721                    "-webkit-border-end-width"
    16881722                ],
    1689                 "skip-builder": true
     1723                "skip-builder": true,
     1724                "direction-aware-property": true
    16901725            },
    16911726            "specification": {
     
    17031738                    "border-inline-start-style",
    17041739                    "border-inline-start-color"
    1705                 ]
     1740                ],
     1741                "direction-aware-property": true
    17061742            },
    17071743            "specification": {
     
    17151751                    "-webkit-border-start-color"
    17161752                ],
    1717                 "skip-builder": true
     1753                "skip-builder": true,
     1754                "color-property": true,
     1755                "direction-aware-property": true
    17181756            },
    17191757            "specification": {
     
    17391777                    "-webkit-border-start-style"
    17401778                ],
    1741                 "skip-builder": true
     1779                "skip-builder": true,
     1780                "direction-aware-property": true
    17421781            },
    17431782            "specification": {
     
    17511790                    "-webkit-border-start-width"
    17521791                ],
    1753                 "skip-builder": true
     1792                "skip-builder": true,
     1793                "direction-aware-property": true
    17541794            },
    17551795            "specification": {
     
    17981838            "codegen-properties": {
    17991839                "initial": "currentColor",
    1800                 "visited-link-color-support": true
     1840                "visited-link-color-support": true,
     1841                "color-property": true
    18011842            },
    18021843            "specification": {
     
    18661907            "codegen-properties": {
    18671908                "initial": "currentColor",
    1868                 "visited-link-color-support": true
     1909                "visited-link-color-support": true,
     1910                "color-property": true
    18691911            },
    18701912            "specification": {
     
    19191961        "border-start-end-radius": {
    19201962            "codegen-properties": {
    1921                 "skip-builder": true
     1963                "skip-builder": true,
     1964                "direction-aware-property": true
    19221965            },
    19231966            "specification": {
     
    19281971        "border-start-start-radius": {
    19291972            "codegen-properties": {
    1930                 "skip-builder": true
     1973                "skip-builder": true,
     1974                "direction-aware-property": true
    19311975            },
    19321976            "specification": {
     
    19652009            "codegen-properties": {
    19662010                "initial": "currentColor",
    1967                 "visited-link-color-support": true
     2011                "visited-link-color-support": true,
     2012                "color-property": true
    19682013            },
    19692014            "specification": {
     
    24612506            "codegen-properties": {
    24622507                "custom": "All",
    2463                 "svg": true
     2508                "svg": true,
     2509                "color-property": true
    24642510            },
    24652511            "specification": {
     
    25102556            "codegen-properties": {
    25112557                "converter": "SVGColor",
    2512                 "svg": true
     2558                "svg": true,
     2559                "color-property": true
    25132560            },
    25142561            "specification": {
     
    26282675                    "-webkit-logical-width"
    26292676                ],
    2630                 "skip-builder": true
     2677                "skip-builder": true,
     2678                "direction-aware-property": true
    26312679            },
    26322680            "specification": {
     
    26632711        "inset-block-end": {
    26642712            "codegen-properties": {
    2665                 "skip-builder": true
     2713                "skip-builder": true,
     2714                "direction-aware-property": true
    26662715            },
    26672716            "specification": {
     
    26722721        "inset-block-start": {
    26732722            "codegen-properties": {
    2674                 "skip-builder": true
     2723                "skip-builder": true,
     2724                "direction-aware-property": true
    26752725            },
    26762726            "specification": {
     
    26932743        "inset-inline-end": {
    26942744            "codegen-properties": {
    2695                 "skip-builder": true
     2745                "skip-builder": true,
     2746                "direction-aware-property": true
    26962747            },
    26972748            "specification": {
     
    27022753        "inset-inline-start": {
    27032754            "codegen-properties": {
    2704                 "skip-builder": true
     2755                "skip-builder": true,
     2756                "direction-aware-property": true
    27052757            },
    27062758            "specification": {
     
    27472799            "codegen-properties": {
    27482800                "converter": "SVGColor",
    2749                 "svg": true
     2801                "svg": true,
     2802                "color-property": true
    27502803            }
    27512804        },
     
    29272980                    "-webkit-margin-after"
    29282981                ],
    2929                 "skip-builder": true
     2982                "skip-builder": true,
     2983                "direction-aware-property": true
    29302984            },
    29312985            "specification": {
     
    29392993                    "-webkit-margin-before"
    29402994                ],
    2941                 "skip-builder": true
     2995                "skip-builder": true,
     2996                "direction-aware-property": true
    29422997            },
    29432998            "specification": {
     
    29733028                    "-webkit-margin-end"
    29743029                ],
    2975                 "skip-builder": true
     3030                "skip-builder": true,
     3031                "direction-aware-property": true
    29763032            },
    29773033            "specification": {
     
    29853041                    "-webkit-margin-start"
    29863042                ],
    2987                 "skip-builder": true
     3043                "skip-builder": true,
     3044                "direction-aware-property": true
    29883045            },
    29893046            "specification": {
     
    31113168                    "-webkit-max-logical-height"
    31123169                ],
    3113                 "skip-builder": true
     3170                "skip-builder": true,
     3171                "direction-aware-property": true
    31143172            },
    31153173            "specification": {
     
    31333191                    "-webkit-max-logical-width"
    31343192                ],
    3135                 "skip-builder": true
     3193                "skip-builder": true,
     3194                "direction-aware-property": true
    31363195            },
    31373196            "specification": {
     
    31553214                    "-webkit-min-logical-height"
    31563215                ],
    3157                 "skip-builder": true
     3216                "skip-builder": true,
     3217                "direction-aware-property": true
    31583218            },
    31593219            "specification": {
     
    31773237                    "-webkit-min-logical-width"
    31783238                ],
    3179                 "skip-builder": true
     3239                "skip-builder": true,
     3240                "direction-aware-property": true
    31803241            },
    31813242            "specification": {
     
    32573318            "codegen-properties": {
    32583319                "initial": "currentColor",
    3259                 "visited-link-color-support": true
     3320                "visited-link-color-support": true,
     3321                "color-property": true
    32603322            },
    32613323            "specification": {
     
    34393501                    "-webkit-padding-after"
    34403502                ],
    3441                 "skip-builder": true
     3503                "skip-builder": true,
     3504                "direction-aware-property": true
    34423505            },
    34433506            "specification": {
     
    34513514                    "-webkit-padding-before"
    34523515                ],
    3453                 "skip-builder": true
     3516                "skip-builder": true,
     3517                "direction-aware-property": true
    34543518            },
    34553519            "specification": {
     
    34853549                    "-webkit-padding-end"
    34863550                ],
    3487                 "skip-builder": true
     3551                "skip-builder": true,
     3552                "direction-aware-property": true
    34883553            },
    34893554            "specification": {
     
    34973562                    "-webkit-padding-start"
    34983563                ],
    3499                 "skip-builder": true
     3564                "skip-builder": true,
     3565                "direction-aware-property": true
    35003566            },
    35013567            "specification": {
     
    37213787        "src": {
    37223788            "codegen-properties": {
    3723                 "skip-builder": true
     3789                "skip-builder": true,
     3790                "descriptor-only": true
    37243791            },
    37253792            "specification": {
     
    37313798            "codegen-properties": {
    37323799                "converter": "SVGColor",
    3733                 "svg": true
     3800                "svg": true,
     3801                "color-property": true
    37343802            },
    37353803            "specification": {
     
    37523820            "codegen-properties": {
    37533821                "custom": "All",
    3754                 "svg": true
     3822                "svg": true,
     3823                "color-property": true
    37553824            },
    37563825            "specification": {
     
    38483917            "codegen-properties": {
    38493918                "custom": "Value",
    3850                 "visited-link-color-support": true
     3919                "visited-link-color-support": true,
     3920                "color-property": true
    38513921            },
    38523922            "status": "supported",
     
    43334403        "unicode-range": {
    43344404            "codegen-properties": {
    4335                 "skip-builder": true
     4405                "skip-builder": true,
     4406                "descriptor-only": true
    43364407            },
    43374408            "specification": {
     
    43424413        "font-display": {
    43434414            "codegen-properties": {
    4344                 "skip-builder": true
     4415                "skip-builder": true,
     4416                "descriptor-only": true
    43454417            },
    43464418            "specification": {
     
    49725044                ],
    49735045                "initial": "currentColor",
    4974                 "visited-link-color-support": true
     5046                "visited-link-color-support": true,
     5047                "color-property": true
    49755048            },
    49765049            "specification":  {
     
    63456418        "text-decoration-color": {
    63466419            "codegen-properties": {
     6420                "aliases": [
     6421                    "-webkit-text-decoration-color"
     6422                ],
    63476423                "initial": "currentColor",
    63486424                "visited-link-color-support": true,
    6349                 "aliases": [
    6350                     "-webkit-text-decoration-color"
    6351                 ]
     6425                "color-property": true
    63526426            },
    63536427            "status": {
     
    64596533                ],
    64606534                "initial": "currentColor",
    6461                 "visited-link-color-support": true
     6535                "visited-link-color-support": true,
     6536                "color-property": true
    64626537            },
    64636538            "status": {
     
    65066581            "codegen-properties": {
    65076582                "initial": "currentColor",
    6508                 "visited-link-color-support": true
     6583                "visited-link-color-support": true,
     6584                "color-property": true
    65096585            },
    65106586            "status": {
     
    65376613            "codegen-properties": {
    65386614                "initial": "currentColor",
    6539                 "visited-link-color-support": true
     6615                "visited-link-color-support": true,
     6616                "color-property": true
    65406617            },
    65416618            "status": {
     
    68146891        "scroll-margin-inline-start": {
    68156892            "codegen-properties": {
    6816                 "skip-builder": true
     6893                "skip-builder": true,
     6894                "direction-aware-property": true
    68176895            },
    68186896            "specification": {
     
    68236901        "scroll-margin-block-start": {
    68246902            "codegen-properties": {
    6825                 "skip-builder": true
     6903                "skip-builder": true,
     6904                "direction-aware-property": true
    68266905            },
    68276906            "specification": {
     
    68326911        "scroll-margin-inline-end": {
    68336912            "codegen-properties": {
    6834                 "skip-builder": true
     6913                "skip-builder": true,
     6914                "direction-aware-property": true
    68356915            },
    68366916            "specification": {
     
    68416921        "scroll-margin-block-end": {
    68426922            "codegen-properties": {
    6843                 "skip-builder": true
     6923                "skip-builder": true,
     6924                "direction-aware-property": true
    68446925            },
    68456926            "specification": {
     
    69287009        "scroll-padding-inline-start": {
    69297010            "codegen-properties": {
    6930                 "skip-builder": true
     7011                "skip-builder": true,
     7012                "direction-aware-property": true
    69317013            },
    69327014            "specification": {
     
    69377019        "scroll-padding-block-start": {
    69387020            "codegen-properties": {
    6939                 "skip-builder": true
     7021                "skip-builder": true,
     7022                "direction-aware-property": true
    69407023            },
    69417024            "specification": {
     
    69467029        "scroll-padding-inline-end": {
    69477030            "codegen-properties": {
    6948                 "skip-builder": true
     7031                "skip-builder": true,
     7032                "direction-aware-property": true
    69497033            },
    69507034            "specification": {
     
    69557039        "scroll-padding-block-end": {
    69567040            "codegen-properties": {
    6957                 "skip-builder": true
     7041                "skip-builder": true,
     7042                "direction-aware-property": true
    69587043            },
    69597044            "specification": {
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r272035 r278611  
    11/**
    22 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
    3  * Copyright (C) 2004, 2005, 2006 Apple Inc.
     3 * Copyright (C) 2004-2021 Apple Inc.
    44 *
    55 * This library is free software; you can redistribute it and/or
     
    193193}
    194194
    195 bool CSSProperty::isDescriptorOnly(CSSPropertyID propertyID)
    196 {
    197     switch (propertyID) {
    198     case CSSPropertySrc:
    199     case CSSPropertyUnicodeRange:
    200     case CSSPropertyFontDisplay:
    201         return true;
    202     default:
    203         return false;
    204     }
    205 }
    206 
    207 bool CSSProperty::isDirectionAwareProperty(CSSPropertyID propertyID)
    208 {
    209     switch (propertyID) {
    210     case CSSPropertyBorderBlockEnd:
    211     case CSSPropertyBorderBlockEndColor:
    212     case CSSPropertyBorderBlockEndStyle:
    213     case CSSPropertyBorderBlockEndWidth:
    214     case CSSPropertyBorderBlockStart:
    215     case CSSPropertyBorderBlockStartColor:
    216     case CSSPropertyBorderBlockStartStyle:
    217     case CSSPropertyBorderBlockStartWidth:
    218     case CSSPropertyBorderInlineEnd:
    219     case CSSPropertyBorderInlineEndColor:
    220     case CSSPropertyBorderInlineEndStyle:
    221     case CSSPropertyBorderInlineEndWidth:
    222     case CSSPropertyBorderInlineStart:
    223     case CSSPropertyBorderInlineStartColor:
    224     case CSSPropertyBorderInlineStartStyle:
    225     case CSSPropertyBorderInlineStartWidth:
    226     case CSSPropertyInsetInlineEnd:
    227     case CSSPropertyInsetInlineStart:
    228     case CSSPropertyInsetBlockStart:
    229     case CSSPropertyInsetBlockEnd:
    230     case CSSPropertyMarginInlineEnd:
    231     case CSSPropertyMarginInlineStart:
    232     case CSSPropertyMarginBlockStart:
    233     case CSSPropertyMarginBlockEnd:
    234     case CSSPropertyPaddingInlineEnd:
    235     case CSSPropertyPaddingInlineStart:
    236     case CSSPropertyPaddingBlockStart:
    237     case CSSPropertyPaddingBlockEnd:
    238     case CSSPropertyInlineSize:
    239     case CSSPropertyBlockSize:
    240     case CSSPropertyMinInlineSize:
    241     case CSSPropertyMinBlockSize:
    242     case CSSPropertyMaxInlineSize:
    243     case CSSPropertyMaxBlockSize:
    244     case CSSPropertyBorderStartStartRadius:
    245     case CSSPropertyBorderStartEndRadius:
    246     case CSSPropertyBorderEndStartRadius:
    247     case CSSPropertyBorderEndEndRadius:
    248     case CSSPropertyScrollMarginInlineStart:
    249     case CSSPropertyScrollMarginInlineEnd:
    250     case CSSPropertyScrollMarginBlockStart:
    251     case CSSPropertyScrollMarginBlockEnd:
    252     case CSSPropertyScrollPaddingInlineStart:
    253     case CSSPropertyScrollPaddingInlineEnd:
    254     case CSSPropertyScrollPaddingBlockStart:
    255     case CSSPropertyScrollPaddingBlockEnd:
    256         return true;
    257     default:
    258         return false;
    259     }
    260 }
    261 
    262 bool CSSProperty::isColorProperty(CSSPropertyID propertyId)
    263 {
    264     switch (propertyId) {
    265     case CSSPropertyColor:
    266     case CSSPropertyBackgroundColor:
    267     case CSSPropertyBorderBottomColor:
    268     case CSSPropertyBorderLeftColor:
    269     case CSSPropertyBorderRightColor:
    270     case CSSPropertyBorderTopColor:
    271     case CSSPropertyFill:
    272     case CSSPropertyFloodColor:
    273     case CSSPropertyLightingColor:
    274     case CSSPropertyOutlineColor:
    275     case CSSPropertyStopColor:
    276     case CSSPropertyStroke:
    277     case CSSPropertyStrokeColor:
    278     case CSSPropertyBorderBlockEndColor:
    279     case CSSPropertyBorderBlockStartColor:
    280     case CSSPropertyBorderInlineEndColor:
    281     case CSSPropertyBorderInlineStartColor:
    282     case CSSPropertyColumnRuleColor:
    283     case CSSPropertyWebkitTextEmphasisColor:
    284     case CSSPropertyWebkitTextFillColor:
    285     case CSSPropertyWebkitTextStrokeColor:
    286     case CSSPropertyTextDecorationColor:
    287     case CSSPropertyCaretColor:
    288         return true;
    289     default:
    290         return false;
    291     }
    292 }
    293 
    294195} // namespace WebCore
  • trunk/Source/WebCore/css/makeprop.pl

    r275808 r278611  
    6666my %settingsFlags;
    6767my $numPredefinedProperties = 2;
     68my %nameIsColorProperty;
     69my %nameIsDescriptorOnly;
     70my %nameIsDirectionAwareProperty;
     71my %nameIsHighPriority;
    6872my %nameIsInherited;
    69 my %nameIsHighPriority;
    7073my %namePriorityShouldSink;
    7174my %propertiesWithStyleBuilderOptions;
     
    258261                } elsif ($codegenOptionName eq "settings-flag") {
    259262                    $settingsFlags{$name} = $codegenProperties->{"settings-flag"};
     263                } elsif ($codegenOptionName eq "color-property") {
     264                    $nameIsColorProperty{$name} = 1;
     265                } elsif ($codegenOptionName eq "direction-aware-property") {
     266                    $nameIsDirectionAwareProperty{$name} = 1;
     267                } elsif ($codegenOptionName eq "descriptor-only") {
     268                    $nameIsDescriptorOnly{$name} = 1;
    260269                } else {
    261270                    die "Unrecognized codegen property \"$codegenOptionName\" for $name property.";
     
    513522CSSPropertyID getRelatedPropertyId(CSSPropertyID id)
    514523{
    515     switch(id) {
     524    switch (id) {
    516525EOF
    517526for my $name (@names) {
     
    545554    default:
    546555        return { };
     556    }
     557}
     558
     559bool CSSProperty::isColorProperty(CSSPropertyID id)
     560{
     561    switch (id) {
     562EOF
     563for my $name (@names) {
     564    if (!$nameIsColorProperty{$name}) {
     565        next;
     566    }
     567    print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
     568}
     569
     570print GPERF << "EOF";
     571        return true;
     572    default:
     573        return false;
     574    }
     575}
     576
     577bool CSSProperty::isDirectionAwareProperty(CSSPropertyID id)
     578{
     579    switch (id) {
     580EOF
     581for my $name (@names) {
     582    if (!$nameIsDirectionAwareProperty{$name}) {
     583        next;
     584    }
     585    print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
     586}
     587
     588print GPERF << "EOF";
     589        return true;
     590    default:
     591        return false;
     592    }
     593}
     594
     595bool CSSProperty::isDescriptorOnly(CSSPropertyID id)
     596{
     597    switch (id) {
     598EOF
     599for my $name (@names) {
     600    if (!$nameIsDescriptorOnly{$name}) {
     601        next;
     602    }
     603    print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
     604}
     605
     606print GPERF << "EOF";
     607        return true;
     608    default:
     609        return false;
    547610    }
    548611}
  • trunk/Tools/ChangeLog

    r278606 r278611  
     12021-06-08  Sam Weinig  <weinig@apple.com>
     2
     3        Move some hand rolled CSSProperty predicates to be generated based on new CSSProperties.json properties
     4        https://bugs.webkit.org/show_bug.cgi?id=226768
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * Scripts/webkitpy/style/checkers/jsonchecker.py:
     9        (JSONCSSPropertiesChecker.check_codegen_properties):
     10        Add new codegen properties to the checker.
     11
    1122021-06-08  Philippe Normand  <pnormand@igalia.com>
    213
  • trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py

    r276564 r278611  
    274274            'aliases': self.validate_array,
    275275            'auto-functions': self.validate_boolean,
     276            'color-property': self.validate_boolean,
    276277            'comment': self.validate_string,
    277278            'conditional-converter': self.validate_string,
    278279            'converter': self.validate_string,
    279280            'custom': self.validate_string,
     281            'descriptor-only': self.validate_boolean,
     282            'direction-aware-property': self.validate_boolean,
    280283            'enable-if': self.validate_string,
    281284            'fill-layer-property': self.validate_boolean,
     
    283286            'getter': self.validate_string,
    284287            'high-priority': self.validate_boolean,
    285             'sink-priority': self.validate_boolean,
    286288            'initial': self.validate_string,
    287289            'internal-only': self.validate_boolean,
     
    293295            'setter': self.validate_string,
    294296            'settings-flag': self.validate_string,
     297            'sink-priority': self.validate_boolean,
    295298            'skip-builder': self.validate_boolean,
    296299            'skip-codegen': self.validate_boolean,
Note: See TracChangeset for help on using the changeset viewer.