Changeset 209001 in webkit


Ignore:
Timestamp:
Nov 28, 2016 11:11:38 AM (7 years ago)
Author:
dbates@webkit.org
Message:

Replace CSSPropertyNames.in with a JSON file
https://bugs.webkit.org/show_bug.cgi?id=164691

Reviewed by Simon Fraser.

Convert CSSPropertyNames.in to a structured JSON file. This is the first step towards
exposing a CSS feature status dashboard and generating more of the boilerplate code
for a CSS property.

A side effect of this change is that makeprop.pl no longer detects duplicate CSS property
definitions. We will look to bring such duplication detection back in a subsequent
commit.

  • CMakeLists.txt: Substitute CSSProperties.json for CSSPropertyNames.in and update the

invocation of makeprop.pl as we no longer need to pass the bindings/scripts/preprocessor.pm
Perl module. Makeprop.pl supports conditional CSS properties and values without the need
to preprocess CSSProperties.json using the C preprocessor.

  • DerivedSources.make: Ditto. Pass WTF_PLATFORM_IOS to makeprop.pl when building for iOS

as we no longer make use of bindings/scripts/preprocessor.pm.

  • css/CSSProperties.json: Added.
  • css/CSSPropertyNames.in: Removed.
  • css/StyleResolver.cpp: Remove variable lastHighPriorityProperty as we now generate it.
  • css/makeprop.pl: Extracted the input file name, now CSSProperties.json, into a global variable

and referenced this variable throughout this script instead of hardcoding the input file name at
each call site. Updated code to handle CSS longhand names being encoded in a JSON array as opposed
to a string of '|'-separated values. I added a FIXME comment to do the same for the codegen property
"custom". Fixed Perl uninitialized variable warnings when die()-ing with error "Unknown CSS property
used in all shorthand ..." or "Unknown CSS property used in longhands ...".
(isPropertyEnabled): Added. Determine whether code should be generated for a property.
(addProperty): Added.
(sortByDescendingPriorityAndName): Added.
(getScopeForFunction): Lowercase option names so that we can use a consistent case throughout
the JSON file.
(getNameForMethods): Ditto.
(generateColorValueSetter):
(generateAnimationPropertyInitialValueSetter): Ditto.
(generateAnimationPropertyInheritValueSetter): Ditto.
(generateFillLayerPropertyInitialValueSetter): Ditto.
(generateFillLayerPropertyInheritValueSetter): Ditto.
(generateSetValueStatement): Ditto.
(generateInitialValueSetter): Ditto.
(generateInheritValueSetter): Ditto.
(generateValueSetter): Ditto.

Location:
trunk/Source/WebCore
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r208948 r209001  
    30033003
    30043004set(WebCore_CSS_PROPERTY_NAMES
    3005     ${WEBCORE_DIR}/css/CSSPropertyNames.in
     3005    ${WEBCORE_DIR}/css/CSSProperties.json
    30063006)
    30073007
     
    36033603# Generate CSS property names
    36043604add_custom_command(
    3605     OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.in ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.h ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.gperf ${DERIVED_SOURCES_WEBCORE_DIR}/StyleBuilder.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/StylePropertyShorthandFunctions.h ${DERIVED_SOURCES_WEBCORE_DIR}/StylePropertyShorthandFunctions.cpp
     3605    OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/CSSProperties.json ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.h ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.gperf ${DERIVED_SOURCES_WEBCORE_DIR}/StyleBuilder.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/StylePropertyShorthandFunctions.h ${DERIVED_SOURCES_WEBCORE_DIR}/StylePropertyShorthandFunctions.cpp
    36063606    MAIN_DEPENDENCY ${WEBCORE_DIR}/css/makeprop.pl
    36073607    DEPENDS ${WebCore_CSS_PROPERTY_NAMES}
    36083608    WORKING_DIRECTORY ${DERIVED_SOURCES_WEBCORE_DIR}
    3609     COMMAND ${PERL_EXECUTABLE} -ne "print" ${WebCore_CSS_PROPERTY_NAMES} > ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.in
    3610     COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/css/makeprop.pl --defines "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}" --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --gperf-executable "${GPERF_EXECUTABLE}"
     3609    COMMAND ${PERL_EXECUTABLE} -ne "print" ${WebCore_CSS_PROPERTY_NAMES} > ${DERIVED_SOURCES_WEBCORE_DIR}/CSSProperties.json
     3610    COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/css/makeprop.pl --defines "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}" --gperf-executable "${GPERF_EXECUTABLE}"
    36113611    VERBATIM)
    36123612list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/CSSPropertyNames.cpp)
  • trunk/Source/WebCore/ChangeLog

    r209000 r209001  
     12016-11-28  Daniel Bates  <dabates@apple.com>
     2
     3        Replace CSSPropertyNames.in with a JSON file
     4        https://bugs.webkit.org/show_bug.cgi?id=164691
     5
     6        Reviewed by Simon Fraser.
     7
     8        Convert CSSPropertyNames.in to a structured JSON file. This is the first step towards
     9        exposing a CSS feature status dashboard and generating more of the boilerplate code
     10        for a CSS property.
     11
     12        A side effect of this change is that makeprop.pl no longer detects duplicate CSS property
     13        definitions. We will look to bring such duplication detection back in a subsequent
     14        commit.
     15
     16        * CMakeLists.txt: Substitute CSSProperties.json for CSSPropertyNames.in and update the
     17        invocation of makeprop.pl as we no longer need to pass the bindings/scripts/preprocessor.pm
     18        Perl module. Makeprop.pl supports conditional CSS properties and values without the need
     19        to preprocess CSSProperties.json using the C preprocessor.
     20        * DerivedSources.make: Ditto. Pass WTF_PLATFORM_IOS to makeprop.pl when building for iOS
     21        as we no longer make use of bindings/scripts/preprocessor.pm.
     22        * css/CSSProperties.json: Added.
     23        * css/CSSPropertyNames.in: Removed.
     24        * css/StyleResolver.cpp: Remove variable lastHighPriorityProperty as we now generate it.
     25        * css/makeprop.pl: Extracted the input file name, now CSSProperties.json, into a global variable
     26        and referenced this variable throughout this script instead of hardcoding the input file name at
     27        each call site. Updated code to handle CSS longhand names being encoded in a JSON array as opposed
     28        to a string of '|'-separated values. I added a FIXME comment to do the same for the codegen property
     29        "custom". Fixed Perl uninitialized variable warnings when die()-ing with error "Unknown CSS property
     30        used in all shorthand ..." or "Unknown CSS property used in longhands ...".
     31        (isPropertyEnabled): Added. Determine whether code should be generated for a property.
     32        (addProperty): Added.
     33        (sortByDescendingPriorityAndName): Added.
     34        (getScopeForFunction): Lowercase option names so that we can use a consistent case throughout
     35        the JSON file.
     36        (getNameForMethods): Ditto.
     37        (generateColorValueSetter):
     38        (generateAnimationPropertyInitialValueSetter): Ditto.
     39        (generateAnimationPropertyInheritValueSetter): Ditto.
     40        (generateFillLayerPropertyInitialValueSetter): Ditto.
     41        (generateFillLayerPropertyInheritValueSetter): Ditto.
     42        (generateSetValueStatement): Ditto.
     43        (generateInitialValueSetter): Ditto.
     44        (generateInheritValueSetter): Ditto.
     45        (generateValueSetter): Ditto.
     46
    1472016-11-28  Dave Hyatt  <hyatt@apple.com>
    248
  • trunk/Source/WebCore/DerivedSources.make

    r208914 r209001  
    933933# --------
    934934
     935ADDITIONAL_CSS_PROPERTIES_DEFINES :=
     936
     937ifeq ($(WTF_PLATFORM_IOS), 1)
     938    ADDITIONAL_CSS_PROPERTIES_DEFINES := WTF_PLATFORM_IOS
     939endif
     940
     941# --------
     942
    935943# CSS property names and value keywords
    936944
    937 WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.in
     945WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSProperties.json
    938946WEBCORE_CSS_VALUE_KEYWORDS := $(WebCore)/css/CSSValueKeywords.in
    939947WEBCORE_CSS_VALUE_KEYWORDS := $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/SVGCSSValueKeywords.in
    940948WEBCORE_CSS_VALUE_KEYWORDS_DEFINES := $(FEATURE_DEFINES) $(ADDITIONAL_CSS_VALUE_KEYWORDS_DEFINES)
     949WEBCORE_CSS_PROPERTIES_DEFINES := $(FEATURE_DEFINES) $(ADDITIONAL_CSS_PROPERTIES_DEFINES)
    941950
    942951CSSPropertyNames.h CSSPropertyNames.cpp StyleBuilder.cpp StylePropertyShorthandFunctions.h StylePropertyShorthandFunctions.cpp : makeprop.intermediate
    943952.INTERMEDIATE : makeprop.intermediate
    944 makeprop.intermediate : $(WEBCORE_CSS_PROPERTY_NAMES) css/makeprop.pl bindings/scripts/preprocessor.pm $(PLATFORM_FEATURE_DEFINES)
    945         $(PERL) -pe '' $(WEBCORE_CSS_PROPERTY_NAMES) > CSSPropertyNames.in
    946         $(PERL) "$(WebCore)/css/makeprop.pl" --defines "$(FEATURE_DEFINES)"
     953makeprop.intermediate : $(WEBCORE_CSS_PROPERTY_NAMES) css/makeprop.pl $(PLATFORM_FEATURE_DEFINES)
     954        $(PERL) -pe '' $(WEBCORE_CSS_PROPERTY_NAMES) > CSSProperties.json
     955        $(PERL) "$(WebCore)/css/makeprop.pl" --defines "$(WEBCORE_CSS_PROPERTIES_DEFINES)"
    947956
    948957CSSValueKeywords.h CSSValueKeywords.cpp : makevalues.intermediate
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r208915 r209001  
    165165using namespace HTMLNames;
    166166
    167 static const CSSPropertyID lastHighPriorityProperty = CSSPropertyFontSynthesis;
    168167static const CSSPropertyID firstLowPriorityProperty = static_cast<CSSPropertyID>(lastHighPriorityProperty + 1);
    169168
  • trunk/Source/WebCore/css/makeprop.pl

    r208668 r209001  
    44#
    55#   Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
    6 #   Copyright (C) 2007, 2008, 2012, 2014, 2015 Apple Inc. All rights reserved.
     6#   Copyright (C) 2007-2016 Apple Inc. All rights reserved.
    77#   Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
    88#   Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged
     
    2323#   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    2424#   Boston, MA 02110-1301, USA.
    25 use FindBin;
    26 use lib "$FindBin::Bin/../bindings/scripts";
    27 
    28 use Getopt::Long;
    29 use preprocessor;
     25
    3026use strict;
    3127use warnings;
    3228
    33 my $defines;
    34 my $preprocessor;
     29use English;
     30use File::Spec;
     31use Getopt::Long;
     32use JSON::PP;
     33
     34sub addProperty($$);
     35sub isPropertyEnabled($);
     36
     37my $inputFile = "CSSProperties.json";
     38
     39my $defines = "";
    3540my $gperf;
    3641GetOptions('defines=s' => \$defines,
    37            'preprocessor=s' => \$preprocessor,
    3842           'gperf-executable=s' => \$gperf);
    3943
    40 my @NAMES = applyPreprocessor("CSSPropertyNames.in", $defines, $preprocessor);
    41 die "We've reached more than 1024 CSS properties, please make sure to update CSSProperty/StylePropertyMetadata accordingly" if (scalar(@NAMES) > 1024);
    42 
    43 my %namesHash;
    44 my @duplicates = ();
    45 
     44my $input;
     45{
     46    local $INPUT_RECORD_SEPARATOR; # No separator; read through until end-of-file.
     47    open(JSON, "<", $inputFile) or die "Cannot open $inputFile.\n";
     48    $input = <JSON>;
     49    close(JSON);
     50}
     51
     52my $jsonDecoder = JSON::PP->new->utf8;
     53my $jsonHashRef = $jsonDecoder->decode($input);
     54my $propertiesHashRef = $jsonHashRef->{properties};
     55my @allNames = keys(%$propertiesHashRef);
     56die "We've reached more than 1024 CSS properties, please make sure to update CSSProperty/StylePropertyMetadata accordingly" if @allNames > 1024;
     57
     58my %defines = map { $_ => 1 } split(/ /, $defines);
     59
     60my @names;
    4661my $numPredefinedProperties = 2;
    47 my @names = ();
    4862my %nameIsInherited;
     63my %nameIsHighPriority;
    4964my %propertiesWithStyleBuilderOptions;
    5065my %styleBuilderOptions = (
    51   AnimationProperty => 1, # Defined in Source/WebCore/css/StyleBuilderConverter.h
    52   AutoFunctions => 1,
    53   ConditionalConverter => 1,
    54   Converter => 1,
    55   Custom => 1,
    56   FillLayerProperty => 1,
    57   FontProperty => 1,
    58   Getter => 1,
    59   Initial => 1,
    60   Longhands => 1,
    61   NameForMethods => 1,
    62   NoDefaultColor => 1,
    63   SVG => 1,
    64   SkipBuilder => 1,
    65   Setter => 1,
    66   VisitedLinkColorSupport => 1,
     66    "animatable" => 1, # Defined in Source/WebCore/css/StyleBuilderConverter.h
     67    "auto-functions" => 1,
     68    "conditional-converter" => 1,
     69    "converter" => 1,
     70    "custom" => 1,
     71    "fill-layer-property" => 1,
     72    "font-property" => 1,
     73    "getter" => 1,
     74    "initial" => 1,
     75    "longhands" => 1,
     76    "name-for-methods" => 1,
     77    "no-default-color" => 1,
     78    "svg" => 1,
     79    "skip-builder" => 1,
     80    "setter" => 1,
     81    "visited-link-color-support" => 1,
    6782);
    6883my %nameToId;
    69 my @aliases = ();
    70 foreach (@NAMES) {
    71   next if (m/(^\s*$)/);
    72   next if (/^#/);
    73 
    74   # Input may use a different EOL sequence than $/, so avoid chomp.
    75   $_ =~ s/\s*\[(.+?)\]\r?$//;
    76   my @options = ();
    77   if ($1) {
    78     @options = split(/\s*,\s*/, $1);
    79   }
    80 
    81   $_ =~ s/[\r\n]+$//g;
    82   if (exists $namesHash{$_}) {
    83     push @duplicates, $_;
    84   } else {
    85     $namesHash{$_} = 1;
    86   }
    87   if ($_ =~ /=/) {
    88     if (@options) {
    89         die "Options are specified on an alias $_: ", join(", ", @options) . "\n";
    90     }
    91     push @aliases, $_;
    92   } else {
    93     $nameIsInherited{$_} = 0;
    94     $propertiesWithStyleBuilderOptions{$_} = {};
    95     foreach my $option (@options) {
    96       my ($optionName, $optionValue) = split(/=/, $option);
    97       if ($optionName eq "Inherited") {
    98         $nameIsInherited{$_} = 1;
    99       } elsif ($styleBuilderOptions{$optionName}) {
    100         $propertiesWithStyleBuilderOptions{$_}{$optionName} = $optionValue;
    101       } else {
    102         die "Unrecognized \"" . $optionName . "\" option for " . $_ . " property.";
    103       }
    104     }
    105 
    106     my $id = $_;
     84my %nameToAliases;
     85
     86for my $name (@allNames) {
     87    my $value = $propertiesHashRef->{$name};
     88    my $valueType = ref($value);
     89    if ($valueType eq "HASH") {
     90        if (isPropertyEnabled($value)) {
     91            addProperty($name, $value);
     92        }
     93    } elsif ($valueType eq "ARRAY") {
     94        for my $v (@$value) {
     95            if (isPropertyEnabled($v)) {
     96                addProperty($name, $v);
     97                last;
     98            }
     99        }
     100    } else {
     101        die "$name does not have a supported value type. Only dictionary and array types are supported.";
     102    }
     103}
     104
     105sub isPropertyEnabled($)
     106{
     107    my ($optionsHashRef) = @_;
     108    if (!$optionsHashRef->{"codegen-properties"} || !$optionsHashRef->{"codegen-properties"}{"enable-if"}) {
     109        return 1;
     110    }
     111    if (exists($defines{$optionsHashRef->{"codegen-properties"}{"enable-if"}})) {
     112        return 1;
     113    }
     114    if (substr($optionsHashRef->{"codegen-properties"}{"enable-if"}, 0, 1) eq "!" && !exists($defines{substr($optionsHashRef->{"codegen-properties"}{"enable-if"}, 1)})) {
     115        return 1;
     116    }
     117    return 0;
     118}
     119
     120sub addProperty($$)
     121{
     122    my ($name, $optionsHashRef) = @_;
     123
     124    push @names, $name;
     125
     126    my $id = $name;
    107127    $id =~ s/(^[^-])|-(.)/uc($1||$2)/ge;
    108     $nameToId{$_} = $id;
    109 
    110     push @names, $_;
    111   }
    112 }
    113 
    114 if (@duplicates > 0) {
    115     die 'Duplicate CSS property names: ', join(', ', @duplicates) . "\n";
    116 }
     128    $nameToId{$name} = $id;
     129
     130    for my $optionName (keys %{$optionsHashRef}) {
     131        if ($optionName eq "codegen-properties") {
     132            my $codegenProperties = $optionsHashRef->{"codegen-properties"};
     133            for my $codegenOptionName (keys %$codegenProperties) {
     134                if ($codegenOptionName eq "enable-if") {
     135                    next;
     136                } elsif ($codegenOptionName eq "high-priority") {
     137                    $nameIsHighPriority{$name} = 1;
     138                } elsif ($codegenOptionName eq "aliases") {
     139                    $nameToAliases{$name} = $codegenProperties->{"aliases"};
     140                } elsif ($styleBuilderOptions{$codegenOptionName}) {
     141                    $propertiesWithStyleBuilderOptions{$name}{$codegenOptionName} = $codegenProperties->{$codegenOptionName};
     142                } else {
     143                    die "Unrecognized codegen property \"$optionName\" for $name property.";
     144                }
     145            }
     146        } elsif ($optionName eq "animatable") {
     147             $propertiesWithStyleBuilderOptions{$name}{"animatable"} = $optionsHashRef->{"animatable"};
     148        } elsif ($optionName eq "inherited") {
     149            $nameIsInherited{$name} = 1;
     150        } elsif ($optionName eq "values") {
     151            # FIXME: Implement.
     152        }
     153        # We allow unrecognized options to pass through without error to support annotation.
     154    }
     155}
     156
     157sub sortByDescendingPriorityAndName
     158{
     159    # Sort names with high priority to the front
     160    if (!!$nameIsHighPriority{$a} < !!$nameIsHighPriority{$b}) {
     161        return 1;
     162    }
     163    if (!!$nameIsHighPriority{$a} > !!$nameIsHighPriority{$b}) {
     164        return -1;
     165    }
     166    # Sort names without leading '-' to the front
     167    if (substr($a, 0, 1) eq "-" && substr($b, 0, 1) ne "-") {
     168        return 1;
     169    }
     170    if (substr($a, 0, 1) ne "-" && substr($b, 0, 1) eq "-") {
     171        return -1;
     172    }
     173    return $a cmp $b;
     174}
     175
     176@names = sort sortByDescendingPriorityAndName @names;
    117177
    118178open GPERF, ">CSSPropertyNames.gperf" || die "Could not open CSSPropertyNames.gperf for writing";
    119179print GPERF << "EOF";
    120180%{
    121 /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */
     181/* This file is automatically generated from $inputFile by makeprop, do not edit */
    122182#include "config.h"
    123183#include \"CSSProperty.h\"
     
    172232}
    173233
    174 foreach my $alias (@aliases) {
    175   $alias =~ /^([^\s]*)[\s]*=[\s]*([^\s]*)/;
    176   my $name = $1;
    177   print GPERF $name . ", CSSProperty" . $nameToId{$2} . "\n";
     234for my $name (@names) {
     235    if (!$nameToAliases{$name}) {
     236        next;
     237    }
     238    for my $alias (@{$nameToAliases{$name}}) {
     239        print GPERF $alias . ", CSSProperty" . $nameToId{$name} . "\n";
     240    }
    178241}
    179242
     
    272335open HEADER, ">CSSPropertyNames.h" || die "Could not open CSSPropertyNames.h for writing";
    273336print HEADER << "EOF";
    274 /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */
     337/* This file is automatically generated from $inputFile by makeprop, do not edit */
    275338
    276339#pragma once
     
    295358my $i = $numPredefinedProperties;
    296359my $maxLen = 0;
     360my $lastHighPriorityPropertyName;
    297361foreach my $name (@names) {
     362  $lastHighPriorityPropertyName = $name if $nameIsHighPriority{$name}; # Assumes that @names is sorted by descending priorities.
    298363  print HEADER "    CSSProperty" . $nameToId{$name} . " = " . $i . ",\n";
    299364  $i = $i + 1;
     
    310375print HEADER "const int lastCSSProperty = $last;\n";
    311376print HEADER "const size_t maxCSSPropertyNameLength = $maxLen;\n";
     377print HEADER "const CSSPropertyID lastHighPriorityProperty = CSSProperty" . $nameToId{$lastHighPriorityPropertyName} . ";\n";
    312378
    313379print HEADER << "EOF";
     
    348414  my $builderFunction = shift;
    349415
    350   return $propertiesWithStyleBuilderOptions{$name}{"Custom"}{$builderFunction} ? "StyleBuilderCustom" : "StyleBuilderFunctions";
     416  return $propertiesWithStyleBuilderOptions{$name}{"custom"}{$builderFunction} ? "StyleBuilderCustom" : "StyleBuilderFunctions";
    351417}
    352418
     
    356422  my $nameForMethods = $nameToId{$name};
    357423  $nameForMethods =~ s/Webkit//g;
    358   if (exists($propertiesWithStyleBuilderOptions{$name}{"NameForMethods"})) {
    359     $nameForMethods = $propertiesWithStyleBuilderOptions{$name}{"NameForMethods"};
     424  if (exists($propertiesWithStyleBuilderOptions{$name}{"name-for-methods"})) {
     425    $nameForMethods = $propertiesWithStyleBuilderOptions{$name}{"name-for-methods"};
    360426  }
    361427  return $nameForMethods;
     
    450516  my $nameForMethods = getNameForMethods($name);
    451517  $nameForMethods =~ s/Webkit//g;
    452   if (exists($propertiesWithStyleBuilderOptions{$name}{"NameForMethods"})) {
    453     $nameForMethods = $propertiesWithStyleBuilderOptions{$name}{"NameForMethods"};
    454   }
    455 
    456   if (!exists($propertiesWithStyleBuilderOptions{$name}{"Getter"})) {
    457     $propertiesWithStyleBuilderOptions{$name}{"Getter"} = lcfirst($nameForMethods);
    458   }
    459   if (!exists($propertiesWithStyleBuilderOptions{$name}{"Setter"})) {
    460     $propertiesWithStyleBuilderOptions{$name}{"Setter"} = "set" . $nameForMethods;
    461   }
    462   if (!exists($propertiesWithStyleBuilderOptions{$name}{"Initial"})) {
    463     if (exists($propertiesWithStyleBuilderOptions{$name}{"FillLayerProperty"})) {
    464       $propertiesWithStyleBuilderOptions{$name}{"Initial"} = "initialFill" . $nameForMethods;
     518  if (exists($propertiesWithStyleBuilderOptions{$name}{"name-for-methods"})) {
     519    $nameForMethods = $propertiesWithStyleBuilderOptions{$name}{"name-for-methods"};
     520  }
     521
     522  if (!exists($propertiesWithStyleBuilderOptions{$name}{"getter"})) {
     523    $propertiesWithStyleBuilderOptions{$name}{"getter"} = lcfirst($nameForMethods);
     524  }
     525  if (!exists($propertiesWithStyleBuilderOptions{$name}{"setter"})) {
     526    $propertiesWithStyleBuilderOptions{$name}{"setter"} = "set" . $nameForMethods;
     527  }
     528  if (!exists($propertiesWithStyleBuilderOptions{$name}{"initial"})) {
     529    if (exists($propertiesWithStyleBuilderOptions{$name}{"fill-layer-property"})) {
     530      $propertiesWithStyleBuilderOptions{$name}{"initial"} = "initialFill" . $nameForMethods;
    465531    } else {
    466       $propertiesWithStyleBuilderOptions{$name}{"Initial"} = "initial" . $nameForMethods;
    467     }
    468   }
    469   if (!exists($propertiesWithStyleBuilderOptions{$name}{"Custom"})) {
    470     $propertiesWithStyleBuilderOptions{$name}{"Custom"} = "";
    471   } elsif ($propertiesWithStyleBuilderOptions{$name}{"Custom"} eq "All") {
    472     $propertiesWithStyleBuilderOptions{$name}{"Custom"} = "Initial|Inherit|Value";
    473   }
    474   my %customValues = map { $_ => 1 } split(/\|/, $propertiesWithStyleBuilderOptions{$name}{"Custom"});
    475   $propertiesWithStyleBuilderOptions{$name}{"Custom"} = \%customValues;
     532      $propertiesWithStyleBuilderOptions{$name}{"initial"} = "initial" . $nameForMethods;
     533    }
     534  }
     535  # FIXME: Convert option custom from a string to an array.
     536  if (!exists($propertiesWithStyleBuilderOptions{$name}{"custom"})) {
     537    $propertiesWithStyleBuilderOptions{$name}{"custom"} = "";
     538  } elsif ($propertiesWithStyleBuilderOptions{$name}{"custom"} eq "All") {
     539    $propertiesWithStyleBuilderOptions{$name}{"custom"} = "Initial|Inherit|Value";
     540  }
     541  my %customValues = map { $_ => 1 } split(/\|/, $propertiesWithStyleBuilderOptions{$name}{"custom"});
     542  $propertiesWithStyleBuilderOptions{$name}{"custom"} = \%customValues;
    476543}
    477544
     
    501568  my $style = "styleResolver.style()";
    502569  my $setterContent .= $indent . "if (styleResolver.applyPropertyToRegularStyle())\n";
    503   my $setValue = $style . "->" . $propertiesWithStyleBuilderOptions{$name}{"Setter"};
     570  my $setValue = $style . "->" . $propertiesWithStyleBuilderOptions{$name}{"setter"};
    504571  my $color = $valueIsPrimitive ? colorFromPrimitiveValue($value) : $value;
    505572  $setterContent .= $indent . "    " . $setValue . "(" . $color . ");\n";
     
    531598  $setterContent .= $indent . "if (list.isEmpty())\n";
    532599  $setterContent .= $indent . "    list.append(Animation::create());\n";
    533   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
    534   my $initial = $propertiesWithStyleBuilderOptions{$name}{"Initial"};
     600  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
     601  my $initial = $propertiesWithStyleBuilderOptions{$name}{"initial"};
    535602  $setterContent .= $indent . "list.animation(0)." . $setter . "(Animation::" . $initial . "());\n";
    536603  if ($name eq "-webkit-transition-property") {
     
    554621  $setterContent .= $indent . "    if (list.size() <= i)\n";
    555622  $setterContent .= $indent . "        list.append(Animation::create());\n";
    556   my $getter = $propertiesWithStyleBuilderOptions{$name}{"Getter"};
    557   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
     623  my $getter = $propertiesWithStyleBuilderOptions{$name}{"getter"};
     624  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
    558625  $setterContent .= $indent . "    list.animation(i)." . $setter . "(parentList->animation(i)." . $getter . "());\n";
    559626  $setterContent .= $indent . "    list.animation(i).setAnimationMode(parentList->animation(i).animationMode());\n";
     
    600667  my $indent = shift;
    601668
    602   my $getter = $propertiesWithStyleBuilderOptions{$name}{"Getter"};
    603   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
     669  my $getter = $propertiesWithStyleBuilderOptions{$name}{"getter"};
     670  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
    604671  my $clearFunction = getClearFunction($name);
    605672  my $testFunction = getTestFunction($name);
    606   my $initial = "FillLayer::" . $propertiesWithStyleBuilderOptions{$name}{"Initial"} . "(" . getFillLayerType($name) . ")";
     673  my $initial = "FillLayer::" . $propertiesWithStyleBuilderOptions{$name}{"initial"} . "(" . getFillLayerType($name) . ")";
    607674
    608675  my $setterContent = "";
     
    624691  my $indent = shift;
    625692
    626   my $getter = $propertiesWithStyleBuilderOptions{$name}{"Getter"};
    627   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
     693  my $getter = $propertiesWithStyleBuilderOptions{$name}{"getter"};
     694  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
    628695  my $clearFunction = getClearFunction($name);
    629696  my $testFunction = getTestFunction($name);
     
    686753  my $value = shift;
    687754
    688   my $isSVG = exists $propertiesWithStyleBuilderOptions{$name}{"SVG"};
    689   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
     755  my $isSVG = exists $propertiesWithStyleBuilderOptions{$name}{"svg"};
     756  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
    690757  return "styleResolver.style()->" .  ($isSVG ? "accessSVGStyle()." : "") . $setter . "(" . $value . ")";
    691758}
     
    695762  my $indent = shift;
    696763
    697   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
    698   my $initial = $propertiesWithStyleBuilderOptions{$name}{"Initial"};
    699   my $isSVG = exists $propertiesWithStyleBuilderOptions{$name}{"SVG"};
     764  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
     765  my $initial = $propertiesWithStyleBuilderOptions{$name}{"initial"};
     766  my $isSVG = exists $propertiesWithStyleBuilderOptions{$name}{"svg"};
    700767  my $setterContent = "";
    701768  $setterContent .= $indent . "static void applyInitial" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
    702769  $setterContent .= $indent . "{\n";
    703770  my $style = "styleResolver.style()";
    704   if (exists $propertiesWithStyleBuilderOptions{$name}{"AutoFunctions"}) {
     771  if (exists $propertiesWithStyleBuilderOptions{$name}{"auto-functions"}) {
    705772    $setterContent .= $indent . "    " . getAutoSetter($name, $style) . ";\n";
    706   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"VisitedLinkColorSupport"}) {
     773  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"visited-link-color-support"}) {
    707774      my $initialColor = "RenderStyle::" . $initial . "()";
    708775      $setterContent .= generateColorValueSetter($name, $initialColor, $indent . "    ");
    709   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"AnimationProperty"}) {
     776  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"animatable"}) {
    710777    $setterContent .= generateAnimationPropertyInitialValueSetter($name, $indent . "    ");
    711   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"FontProperty"}) {
     778  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"font-property"}) {
    712779    $setterContent .= $indent . "    auto fontDescription = styleResolver.fontDescription();\n";
    713780    $setterContent .= $indent . "    fontDescription." . $setter . "(FontCascadeDescription::" . $initial . "());\n";
    714781    $setterContent .= $indent . "    styleResolver.setFontDescription(fontDescription);\n";
    715   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"FillLayerProperty"}) {
     782  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"fill-layer-property"}) {
    716783    $setterContent .= generateFillLayerPropertyInitialValueSetter($name, $indent . "    ");
    717784  } else {
     
    731798  $setterContent .= $indent . "static void applyInherit" . $nameToId{$name} . "(StyleResolver& styleResolver)\n";
    732799  $setterContent .= $indent . "{\n";
    733   my $isSVG = exists $propertiesWithStyleBuilderOptions{$name}{"SVG"};
     800  my $isSVG = exists $propertiesWithStyleBuilderOptions{$name}{"svg"};
    734801  my $parentStyle = "styleResolver.parentStyle()";
    735802  my $style = "styleResolver.style()";
    736   my $getter = $propertiesWithStyleBuilderOptions{$name}{"Getter"};
    737   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
     803  my $getter = $propertiesWithStyleBuilderOptions{$name}{"getter"};
     804  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
    738805  my $didCallSetValue = 0;
    739   if (exists $propertiesWithStyleBuilderOptions{$name}{"AutoFunctions"}) {
     806  if (exists $propertiesWithStyleBuilderOptions{$name}{"auto-functions"}) {
    740807    $setterContent .= $indent . "    if (" . getAutoGetter($name, $parentStyle) . ") {\n";
    741808    $setterContent .= $indent . "        " . getAutoSetter($name, $style) . ";\n";
    742809    $setterContent .= $indent . "        return;\n";
    743810    $setterContent .= $indent . "    }\n";
    744   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"VisitedLinkColorSupport"}) {
     811  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"visited-link-color-support"}) {
    745812    $setterContent .= $indent . "    Color color = " . $parentStyle . "->" . $getter . "();\n";
    746     if (!exists($propertiesWithStyleBuilderOptions{$name}{"NoDefaultColor"})) {
     813    if (!exists($propertiesWithStyleBuilderOptions{$name}{"no-default-color"})) {
    747814      $setterContent .= $indent . "    if (!color.isValid())\n";
    748815      $setterContent .= $indent . "        color = " . $parentStyle . "->color();\n";
     
    750817    $setterContent .= generateColorValueSetter($name, "color", $indent . "    ");
    751818    $didCallSetValue = 1;
    752   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"AnimationProperty"}) {
     819  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"animatable"}) {
    753820    $setterContent .= generateAnimationPropertyInheritValueSetter($name, $indent . "    ");
    754821    $didCallSetValue = 1;
    755   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"FontProperty"}) {
     822  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"font-property"}) {
    756823    $setterContent .= $indent . "    auto fontDescription = styleResolver.fontDescription();\n";
    757824    $setterContent .= $indent . "    fontDescription." . $setter . "(styleResolver.parentFontDescription()." . $getter . "());\n";
    758825    $setterContent .= $indent . "    styleResolver.setFontDescription(fontDescription);\n";
    759826    $didCallSetValue = 1;
    760   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"FillLayerProperty"}) {
     827  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"fill-layer-property"}) {
    761828    $setterContent .= generateFillLayerPropertyInheritValueSetter($name, $indent . "    ");
    762829    $didCallSetValue = 1;
     
    779846  $setterContent .= $indent . "{\n";
    780847  my $convertedValue;
    781   if (exists($propertiesWithStyleBuilderOptions{$name}{"Converter"})) {
    782     $convertedValue = "StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"Converter"} . "(styleResolver, value)";
    783   } elsif (exists($propertiesWithStyleBuilderOptions{$name}{"ConditionalConverter"})) {
    784     $setterContent .= $indent . "    auto convertedValue = StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"ConditionalConverter"} . "(styleResolver, value);\n";
     848  if (exists($propertiesWithStyleBuilderOptions{$name}{"converter"})) {
     849    $convertedValue = "StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"converter"} . "(styleResolver, value)";
     850  } elsif (exists($propertiesWithStyleBuilderOptions{$name}{"conditional-converter"})) {
     851    $setterContent .= $indent . "    auto convertedValue = StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"conditional-converter"} . "(styleResolver, value);\n";
    785852    $convertedValue = "convertedValue.value()";
    786853  } else {
     
    788855  }
    789856
    790   my $setter = $propertiesWithStyleBuilderOptions{$name}{"Setter"};
     857  my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
    791858  my $style = "styleResolver.style()";
    792859  my $didCallSetValue = 0;
    793   if (exists $propertiesWithStyleBuilderOptions{$name}{"AutoFunctions"}) {
     860  if (exists $propertiesWithStyleBuilderOptions{$name}{"auto-functions"}) {
    794861    $setterContent .= $indent . "    if (downcast<CSSPrimitiveValue>(value).valueID() == CSSValueAuto) {\n";
    795862    $setterContent .= $indent . "        ". getAutoSetter($name, $style) . ";\n";
    796863    $setterContent .= $indent . "        return;\n";
    797864    $setterContent .= $indent . "    }\n";
    798   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"VisitedLinkColorSupport"}) {
     865  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"visited-link-color-support"}) {
    799866    $setterContent .= $indent . "    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);\n";
    800867    if ($name eq "color") {
     
    804871    $setterContent .= generateColorValueSetter($name, "primitiveValue", $indent . "    ", VALUE_IS_PRIMITIVE);
    805872    $didCallSetValue = 1;
    806   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"AnimationProperty"}) {
     873  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"animatable"}) {
    807874    $setterContent .= generateAnimationPropertyValueSetter($name, $indent . "    ");
    808875    $didCallSetValue = 1;
    809   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"FontProperty"}) {
     876  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"font-property"}) {
    810877    $setterContent .= $indent . "    auto fontDescription = styleResolver.fontDescription();\n";
    811878    $setterContent .= $indent . "    fontDescription." . $setter . "(" . $convertedValue . ");\n";
    812879    $setterContent .= $indent . "    styleResolver.setFontDescription(fontDescription);\n";
    813880    $didCallSetValue = 1;
    814   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"FillLayerProperty"}) {
     881  } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"fill-layer-property"}) {
    815882    $setterContent .= generateFillLayerPropertyValueSetter($name, $indent . "    ");
    816883    $didCallSetValue = 1;
    817884  }
    818885  if (!$didCallSetValue) {
    819     if (exists($propertiesWithStyleBuilderOptions{$name}{"ConditionalConverter"})) {
     886    if (exists($propertiesWithStyleBuilderOptions{$name}{"conditional-converter"})) {
    820887      $setterContent .= $indent . "    if (convertedValue)\n";
    821888      $setterContent .= "    ";
     
    830897open STYLEBUILDER, ">StyleBuilder.cpp" || die "Could not open StyleBuilder.cpp for writing";
    831898print STYLEBUILDER << "EOF";
    832 /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */
     899/* This file is automatically generated from $inputFile by makeprop, do not edit */
    833900
    834901#include "config.h"
     
    851918foreach my $name (@names) {
    852919  # Skip Shorthand properties and properties that do not use the StyleBuilder.
    853   next if (exists $propertiesWithStyleBuilderOptions{$name}{"Longhands"});
    854   next if (exists $propertiesWithStyleBuilderOptions{$name}{"SkipBuilder"});
     920  next if (exists $propertiesWithStyleBuilderOptions{$name}{"longhands"});
     921  next if (exists $propertiesWithStyleBuilderOptions{$name}{"skip-builder"});
    855922
    856923  my $indent = "    ";
    857   if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Initial"}) {
     924  if (!$propertiesWithStyleBuilderOptions{$name}{"custom"}{"Initial"}) {
    858925    print STYLEBUILDER generateInitialValueSetter($name, $indent);
    859926  }
    860   if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Inherit"}) {
     927  if (!$propertiesWithStyleBuilderOptions{$name}{"custom"}{"Inherit"}) {
    861928    print STYLEBUILDER generateInheritValueSetter($name, $indent);
    862929  }
    863   if (!$propertiesWithStyleBuilderOptions{$name}{"Custom"}{"Value"}) {
     930  if (!$propertiesWithStyleBuilderOptions{$name}{"custom"}{"Value"}) {
    864931    print STYLEBUILDER generateValueSetter($name, $indent);
    865932  }
     
    879946foreach my $name (@names) {
    880947  print STYLEBUILDER "    case CSSProperty" . $nameToId{$name} . ":\n";
    881   if (exists $propertiesWithStyleBuilderOptions{$name}{"Longhands"}) {
     948  if (exists $propertiesWithStyleBuilderOptions{$name}{"longhands"}) {
    882949    print STYLEBUILDER "        ASSERT(isShorthandCSSProperty(property));\n";
    883950    print STYLEBUILDER "        ASSERT_NOT_REACHED();\n";
    884   } elsif (!exists $propertiesWithStyleBuilderOptions{$name}{"SkipBuilder"}) {
     951  } elsif (!exists $propertiesWithStyleBuilderOptions{$name}{"skip-builder"}) {
    885952    print STYLEBUILDER "        if (isInitial)\n";
    886953    print STYLEBUILDER "            " . getScopeForFunction($name, "Initial") . "::applyInitial" . $nameToId{$name} . "(styleResolver);\n";
     
    905972open SHORTHANDS_H, ">StylePropertyShorthandFunctions.h" || die "Could not open StylePropertyShorthandFunctions.h for writing";
    906973print SHORTHANDS_H << "EOF";
    907 /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */
     974/* This file is automatically generated from $inputFile by makeprop, do not edit */
    908975
    909976#pragma once
     
    917984foreach my $name (@names) {
    918985  # Skip non-Shorthand properties.
    919   next if (!exists $propertiesWithStyleBuilderOptions{$name}{"Longhands"});
     986  next if (!exists $propertiesWithStyleBuilderOptions{$name}{"longhands"});
    920987
    921988  print SHORTHANDS_H "StylePropertyShorthand " . lcfirst($nameToId{$name}) . "Shorthand();\n";
     
    931998open SHORTHANDS_CPP, ">StylePropertyShorthandFunctions.cpp" || die "Could not open StylePropertyShorthandFunctions.cpp for writing";
    932999print SHORTHANDS_CPP << "EOF";
    933 /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */
     1000/* This file is automatically generated from $inputFile by makeprop, do not edit */
    9341001
    9351002#include "config.h"
     
    9471014foreach my $name (@names) {
    9481015  # Skip non-Shorthand properties.
    949   next if (!exists $propertiesWithStyleBuilderOptions{$name}{"Longhands"});
     1016  next if (!exists $propertiesWithStyleBuilderOptions{$name}{"longhands"});
    9501017
    9511018  my $lowercaseId = lcfirst($nameToId{$name});
    952   my @longhands = split(/\|/, $propertiesWithStyleBuilderOptions{$name}{"Longhands"});
     1019  my @longhands = @{$propertiesWithStyleBuilderOptions{$name}{"longhands"}};
    9531020
    9541021  print SHORTHANDS_CPP "StylePropertyShorthand " . $lowercaseId . "Shorthand()\n";
     
    9581025    if ($_ eq "all") {
    9591026        foreach my $propname (@names) {
    960             next if (exists $propertiesWithStyleBuilderOptions{$propname}{"Longhands"});
     1027            next if (exists $propertiesWithStyleBuilderOptions{$propname}{"longhands"});
    9611028            next if ($propname eq "direction" || $propname eq "unicode-bidi");
    962             die "Unknown CSS property used in all shorthand: " . $nameToId{$propname} if !exists($nameToId{$propname});
     1029            die "Unknown CSS property used in all shorthand: $propname" if !exists($nameToId{$propname});
    9631030            push(@{$longhandToShorthands{$propname}}, $name);
    9641031            print SHORTHANDS_CPP "        CSSProperty" . $nameToId{$propname} . ",\n";
    9651032        }
    9661033    } else {
    967         die "Unknown CSS property used in Longhands: " . $nameToId{$_} if !exists($nameToId{$_});
     1034        die "Unknown CSS property used in longhands: $_" if !exists($nameToId{$_});
    9681035        push(@{$longhandToShorthands{$_}}, $name);
    9691036        print SHORTHANDS_CPP "        CSSProperty" . $nameToId{$_} . ",\n";
     
    9851052foreach my $name (@names) {
    9861053  # Skip non-Shorthand properties.
    987   next if (!exists $propertiesWithStyleBuilderOptions{$name}{"Longhands"});
     1054  next if (!exists $propertiesWithStyleBuilderOptions{$name}{"longhands"});
    9881055
    9891056  print SHORTHANDS_CPP "    case CSSProperty" . $nameToId{$name} . ":\n";
Note: See TracChangeset for help on using the changeset viewer.