[Settings] Miscellaneous cleanup of the settings generation scripts
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2017 17:10:16 +0000 (17:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2017 17:10:16 +0000 (17:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178462

Patch by Sam Weinig <sam@webkit.org> on 2017-10-18
Reviewed by Daniel Bates.

- Stop generating and remove now unused SettingsMacros.h
- Make functions operating on the python Setting object member functions
- Add predicate to determine if a Setting's type is a value type, allowing
  us to exclude those from using const references.

* CMakeLists.txt:
* DerivedSources.make:
* Scripts/GenerateSettings.py:
* Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py:
* Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py:
* Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py:
* Scripts/GenerateSettings/GenerateSettings.py:
* Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
* Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
* Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py: Removed.
* Scripts/GenerateSettings/Settings.py:
* WebCoreMacros.cmake:
* WebCore.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223612 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Scripts/GenerateSettings.py
Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py
Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py
Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py
Source/WebCore/Scripts/GenerateSettings/GenerateSettings.py
Source/WebCore/Scripts/GenerateSettings/GenerateSettingsHeaderFile.py
Source/WebCore/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py
Source/WebCore/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py [deleted file]
Source/WebCore/Scripts/GenerateSettings/Settings.py
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/WebCoreMacros.cmake

index f9e8359..d73461e 100644 (file)
@@ -4000,8 +4000,7 @@ GENERATE_EVENT_FACTORY(${WEBCORE_DIR}/dom/EventTargetFactory.in EventTargetInter
 list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/EventTargetInterfaces.h)
 
 
-GENERATE_SETTINGS_MACROS(${WEBCORE_DIR}/page/Settings.in SettingsMacros.h)
-list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/SettingsMacros.h)
+GENERATE_SETTINGS_MACROS(${WEBCORE_DIR}/page/Settings.in Settings.h)
 list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/Settings.h)
 list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/Settings.cpp)
 list(APPEND WebCoreTestSupport_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp)
index 1593497..1f9fe75 100644 (file)
@@ -1,3 +1,29 @@
+2017-10-18  Sam Weinig  <sam@webkit.org>
+
+        [Settings] Miscellaneous cleanup of the settings generation scripts
+        https://bugs.webkit.org/show_bug.cgi?id=178462
+
+        Reviewed by Daniel Bates.
+
+        - Stop generating and remove now unused SettingsMacros.h
+        - Make functions operating on the python Setting object member functions
+        - Add predicate to determine if a Setting's type is a value type, allowing
+          us to exclude those from using const references.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Scripts/GenerateSettings.py:
+        * Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py:
+        * Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py:
+        * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py:
+        * Scripts/GenerateSettings/GenerateSettings.py:
+        * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
+        * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
+        * Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py: Removed.
+        * Scripts/GenerateSettings/Settings.py:
+        * WebCoreMacros.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2017-10-18  Chris Dumez  <cdumez@apple.com>
 
         Align ImageData constructor with the specification
index 252317b..47a7866 100644 (file)
@@ -1370,12 +1370,11 @@ GENERATE_SETTINGS_SCRIPTS = \
     $(WebCore)/Scripts/GenerateSettings/GenerateSettings.py \
     $(WebCore)/Scripts/GenerateSettings/GenerateSettingsHeaderFile.py \
     $(WebCore)/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py \
-    $(WebCore)/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py \
     $(WebCore)/Scripts/GenerateSettings/Settings.py \
     $(WebCore)/Scripts/GenerateSettings/__init__.py
 
-all : InternalSettingsGenerated.idl InternalSettingsGenerated.cpp InternalSettingsGenerated.h Settings.cpp Settings.h SettingsMacros.h
-InternalSettingsGenerated%idl InternalSettingsGenerated%cpp InternalSettingsGenerated%h Settings%cpp Settings%h SettingsMacros%h : $(WebCore)/Scripts/GenerateSettings.py $(GENERATE_SETTINGS_SCRIPTS) page/Settings.in
+all : InternalSettingsGenerated.idl InternalSettingsGenerated.cpp InternalSettingsGenerated.h Settings.cpp Settings.h
+InternalSettingsGenerated%idl InternalSettingsGenerated%cpp InternalSettingsGenerated%h Settings%cpp Settings%h : $(WebCore)/Scripts/GenerateSettings.py $(GENERATE_SETTINGS_SCRIPTS) page/Settings.in
        $(PYTHON) $< --input $(WebCore)/page/Settings.in
 
 # --------
index 04970bd..e2bac81 100755 (executable)
@@ -51,7 +51,6 @@ def main():
 
     generateSettingsHeaderFile(outputDirectory, settings)
     generateSettingsImplementationFile(outputDirectory, settings)
-    generateSettingsMacrosHeader(outputDirectory, settings)
     generateInternalSettingsIDLFile(outputDirectory, settings)
     generateInternalSettingsHeaderFile(outputDirectory, settings)
     generateInternalSettingsImplementationFile(outputDirectory, settings)
index 6dc6ecb..6219bea 100755 (executable)
@@ -25,7 +25,7 @@
 
 import os.path
 
-from Settings import license, makeConditionalString, mapToIDLType, makeSetterFunctionName
+from Settings import license, makeConditionalString
 
 
 def generateInternalSettingsHeaderFile(outputDirectory, settings):
@@ -51,12 +51,12 @@ def generateInternalSettingsHeaderFile(outputDirectory, settings):
 
     for settingName in sorted(settings.iterkeys()):
         setting = settings[settingName]
-        idlType = mapToIDLType(setting)
+        idlType = setting.idlType()
         if not idlType:
             continue
 
         type = "const String&" if setting.type == "String" else setting.type
-        outputFile.write("    void " + makeSetterFunctionName(setting) + "(" + type + " " + setting.name + ");\n")
+        outputFile.write("    void " + setting.setterFunctionName() + "(" + type + " " + setting.name + ");\n")
 
     outputFile.write("\n")
     outputFile.write("private:\n")
@@ -64,7 +64,7 @@ def generateInternalSettingsHeaderFile(outputDirectory, settings):
 
     for settingName in sorted(settings.iterkeys()):
         setting = settings[settingName]
-        idlType = mapToIDLType(setting)
+        idlType = setting.idlType()
         if not idlType:
             continue
 
index 18dddde..1b8358e 100755 (executable)
@@ -25,7 +25,7 @@
 
 import os.path
 
-from Settings import license, mapToIDLType, makeSetterFunctionName
+from Settings import license
 
 
 def generateInternalSettingsIDLFile(outputDirectory, settings):
@@ -40,10 +40,10 @@ def generateInternalSettingsIDLFile(outputDirectory, settings):
 
     for settingName in sorted(settings.iterkeys()):
         setting = settings[settingName]
-        idlType = mapToIDLType(setting)
+        idlType = setting.idlType()
         if not idlType:
             continue
-        outputFile.write("    void " + makeSetterFunctionName(setting) + "(" + idlType + " " + setting.name + ");\n")
+        outputFile.write("    void " + setting.setterFunctionName() + "(" + idlType + " " + setting.name + ");\n")
 
     outputFile.write("};\n")
     outputFile.close()
index f08ca20..d45bbcd 100755 (executable)
@@ -25,7 +25,7 @@
 
 import os.path
 
-from Settings import license, makeSetterFunctionName, makeConditionalString, mapToIDLType, makeConditionalString
+from Settings import license, makeConditionalString, makeConditionalString
 
 
 def generateInternalSettingsImplementationFile(outputDirectory, settings):
@@ -46,14 +46,14 @@ def generateInternalSettingsImplementationFile(outputDirectory, settings):
 
     for settingName in sorted(settings.iterkeys()):
         setting = settings[settingName]
-        idlType = mapToIDLType(setting)
+        idlType = setting.idlType()
         if not idlType:
             continue
 
         if setting.conditional:
             outputFile.write("#if " + makeConditionalString(setting.conditional) + "\n")
 
-        outputFile.write("    , m_" + setting.name + "(page->settings()." + setting.name + "())\n")
+        outputFile.write("    , m_" + setting.name + "(page->settings()." + setting.getterFunctionName() + "())\n")
 
         if setting.conditional:
             outputFile.write("#endif\n")
@@ -70,14 +70,14 @@ def generateInternalSettingsImplementationFile(outputDirectory, settings):
 
     for settingName in sorted(settings.iterkeys()):
         setting = settings[settingName]
-        idlType = mapToIDLType(setting)
+        idlType = setting.idlType()
         if not idlType:
             continue
 
         if setting.conditional:
             outputFile.write("#if " + makeConditionalString(setting.conditional) + "\n")
 
-        outputFile.write("    m_page->settings()." + makeSetterFunctionName(setting) + "(m_" + setting.name + ");\n")
+        outputFile.write("    m_page->settings()." + setting.setterFunctionName() + "(m_" + setting.name + ");\n")
 
         if setting.conditional:
             outputFile.write("#endif\n")
@@ -86,19 +86,19 @@ def generateInternalSettingsImplementationFile(outputDirectory, settings):
 
     for settingName in sorted(settings.iterkeys()):
         setting = settings[settingName]
-        idlType = mapToIDLType(setting)
+        idlType = setting.idlType()
         if not idlType:
             continue
 
         type = "const String&" if setting.type == "String" else setting.type
 
-        outputFile.write("void InternalSettingsGenerated::" + makeSetterFunctionName(setting) + "(" + type + " " + setting.name + ")\n")
+        outputFile.write("void InternalSettingsGenerated::" + setting.setterFunctionName() + "(" + type + " " + setting.name + ")\n")
         outputFile.write("{\n")
 
         if setting.conditional:
             outputFile.write("#if " + makeConditionalString(setting.conditional) + "\n")
 
-        outputFile.write("    m_page->settings()." + makeSetterFunctionName(setting) + "(" + setting.name + ");\n")
+        outputFile.write("    m_page->settings()." + setting.setterFunctionName() + "(" + setting.name + ");\n")
 
         if setting.conditional:
             outputFile.write("#else\n")
index 05765a6..158c0bf 100644 (file)
@@ -4,4 +4,3 @@ from GenerateInternalSettingsIDLFile import *
 from GenerateInternalSettingsImplementationFile import *
 from GenerateSettingsHeaderFile import *
 from GenerateSettingsImplementationFile import *
-from GenerateSettingsMacrosHeader import *
index 546efac..2165daf 100755 (executable)
@@ -25,7 +25,7 @@
 
 import os.path
 
-from Settings import license, makeConditionalString, makeSetterFunctionName, makePreferredConditional
+from Settings import license, makeConditionalString, makePreferredConditional
 
 
 def generateSettingsHeaderFile(outputDirectory, settings):
@@ -78,21 +78,22 @@ def generateSettingsHeaderFile(outputDirectory, settings):
 
 
 def printGetterAndSetter(outputFile, setting):
-    setterFunctionName = makeSetterFunctionName(setting)
+    setterFunctionName = setting.setterFunctionName()
+    getterFunctionName = setting.getterFunctionName()
 
-    webcoreExport = "WEBCORE_EXPORT " if setting.setNeedsStyleRecalcInAllFrames else ""
+    webcoreExport = "WEBCORE_EXPORT " if setting.hasComplexSetter() else ""
 
-    if setting.type[0].islower():
-        outputFile.write("    " + setting.type + " " + setting.name + "() const { return m_" + setting.name + "; }\n")
+    if setting.typeIsValueType():
+        outputFile.write("    " + setting.type + " " + getterFunctionName + "() const { return m_" + setting.name + "; }\n")
         outputFile.write("    " + webcoreExport + "void " + setterFunctionName + "(" + setting.type + " " + setting.name + ")")
     else:
-        outputFile.write("    const " + setting.type + "& " + setting.name + "() const { return m_" + setting.name + "; } \n")
+        outputFile.write("    const " + setting.type + "& " + getterFunctionName + "() const { return m_" + setting.name + "; }\n")
         outputFile.write("    " + webcoreExport + "void " + setterFunctionName + "(const " + setting.type + "& " + setting.name + ")")
 
-    if setting.setNeedsStyleRecalcInAllFrames:
-        outputFile.write("; \n")
+    if setting.hasComplexSetter():
+        outputFile.write(";\n")
     else:
-        outputFile.write(" { m_" + setting.name + " = " + setting.name + "; } \n")
+        outputFile.write(" { m_" + setting.name + " = " + setting.name + "; }\n")
 
 
 def printGettersAndSetters(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settingsByConditional, settings):
index 145fcc4..9c8323e 100755 (executable)
@@ -25,7 +25,7 @@
 
 import os.path
 
-from Settings import license, makeConditionalString, makeSetterFunctionName, makePreferredConditional
+from Settings import license, makeConditionalString, makePreferredConditional
 
 
 def generateSettingsImplementationFile(outputDirectory, settings):
@@ -147,12 +147,12 @@ def printInitializerList(outputFile, sortedUnconditionalSettingsNames, sortedCon
 
 
 def printSetterBody(outputFile, setting):
-    if not setting.setNeedsStyleRecalcInAllFrames:
+    if not setting.hasComplexSetter():
         return
 
-    setterFunctionName = makeSetterFunctionName(setting)
+    setterFunctionName = setting.setterFunctionName()
 
-    if setting.type[0].islower():
+    if setting.typeIsValueType():
         outputFile.write("void Settings::" + setterFunctionName + "(" + setting.type + " " + setting.name + ")\n")
     else:
         outputFile.write("void Settings::" + setterFunctionName + "(const " + setting.type + "& " + setting.name + ")\n")
@@ -174,7 +174,7 @@ def printSetterBodies(outputFile, sortedUnconditionalSettingsNames, sortedCondit
         hasSetterBody = False
         for settingName in sorted(settingsByConditional[conditional].iterkeys()):
             setting = settings[settingName]
-            if setting.setNeedsStyleRecalcInAllFrames:
+            if setting.hasComplexSetter():
                 hasSetterBody = True
                 break
 
diff --git a/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py b/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py
deleted file mode 100755 (executable)
index f0c3265..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2017 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-# THE POSSIBILITY OF SUCH DAMAGE.
-
-import os.path
-
-from Settings import license, makeConditionalString, makeSetterFunctionName, makePreferredConditional
-
-
-def generateSettingsMacrosHeader(outputDirectory, settings):
-    settingsByConditional = {}
-    unconditionalSettings = {}
-
-    for settingName in sorted(settings.iterkeys()):
-        setting = settings[settingName]
-        if setting.conditional:
-            if setting.conditional not in settingsByConditional:
-                settingsByConditional[setting.conditional] = {}
-            settingsByConditional[setting.conditional][setting.name] = True
-        else:
-            unconditionalSettings[setting.name] = True
-
-    outputPath = os.path.join(outputDirectory, "SettingsMacros.h")
-    outputFile = open(outputPath, 'w')
-    outputFile.write(license())
-
-    # FIXME: Sort by type so bools come last and are bit packed.
-
-    # FIXME: Convert to #pragma once
-    outputFile.write("#ifndef SettingsMacros_h\n")
-    outputFile.write("#define SettingsMacros_h\n\n")
-
-    sortedUnconditionalSettingsNames = sorted(unconditionalSettings.iterkeys())
-    sortedConditionals = sorted(settingsByConditional.iterkeys())
-
-    printConditionalMacros(outputFile, sortedConditionals, settingsByConditional, settings)
-
-    printGettersAndSetters(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings)
-    printMemberVariables(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings)
-    printInitializerList(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings)
-    printSetterBodies(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings)
-
-    outputFile.write("#endif // SettingsMacros_h\n")
-    outputFile.close()
-
-
-def printGetterAndSetter(outputFile, setting):
-    setterFunctionName = makeSetterFunctionName(setting)
-
-    # Export is only needed if the definition is not in the header.
-    webcoreExport = "WEBCORE_EXPORT" if setting.setNeedsStyleRecalcInAllFrames else ""
-
-    # FIXME: When webcoreExport is "", line has extra space.
-
-    if setting.type[0].islower():
-        outputFile.write("    " + setting.type + " " + setting.name + "() const { return m_" + setting.name + "; } \\\n")
-        outputFile.write("    " + webcoreExport + " void " + setterFunctionName + "(" + setting.type + " " + setting.name + ")")
-    else:
-        outputFile.write("    const " + setting.type + "& " + setting.name + "() const { return m_" + setting.name + "; } \\\n")
-        outputFile.write("    " + webcoreExport + " void " + setterFunctionName + "(const " + setting.type + "& " + setting.name + ")")
-
-    if setting.setNeedsStyleRecalcInAllFrames:
-        outputFile.write("; \\\n")
-    else:
-        outputFile.write(" { m_" + setting.name + " = " + setting.name + "; } \\\n")
-
-
-def printSetterBody(outputFile, setting):
-    if not setting.setNeedsStyleRecalcInAllFrames:
-        return
-
-    setterFunctionName = makeSetterFunctionName(setting)
-
-    if setting.type[0].islower():
-        outputFile.write("void Settings::" + setterFunctionName + "(" + setting.type + " " + setting.name + ") \\\n")
-    else:
-        outputFile.write("void Settings::" + setterFunctionName + "(const " + setting.type + "& " + setting.name + ") \\\n")
-
-    outputFile.write("{ \\\n")
-    outputFile.write("    if (m_" + setting.name + " == " + setting.name + ") \\\n")
-    outputFile.write("        return; \\\n")
-    outputFile.write("    m_" + setting.name + " = " + setting.name + "; \\\n")
-    outputFile.write("    m_page->setNeedsRecalcStyleInAllFrames(); \\\n")
-    outputFile.write("} \\\n")
-
-
-def printConditionalMacros(outputFile, sortedConditionals, settingsByConditional, settings):
-    for conditional in sortedConditionals:
-        outputFile.write("#if " + makeConditionalString(conditional) + "\n")
-
-        # Getter/Setters
-
-        sortedSettingsNames = sorted(settingsByConditional[conditional].iterkeys())
-
-        preferredConditional = makePreferredConditional(conditional)
-
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_GETTER_AND_SETTERS \\\n")
-
-        for settingName in sortedSettingsNames:
-            printGetterAndSetter(outputFile, settings[settingName])
-
-        outputFile.write("// End of " + preferredConditional + "_SETTINGS_GETTER_AND_SETTERS\n")
-
-        # Member variables
-
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_NON_BOOL_MEMBER_VARIABLES \\\n")
-
-        for settingName in sortedSettingsNames:
-            setting = settings[settingName]
-            if setting.type == 'bool':
-                continue
-            outputFile.write("    " + setting.type + " m_" + setting.name + "; \\\n")
-
-        outputFile.write("// End of " + preferredConditional + "_SETTINGS_NON_BOOL_MEMBER_VARIABLES\n")
-
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_BOOL_MEMBER_VARIABLES \\\n")
-
-        for settingName in sortedSettingsNames:
-            setting = settings[settingName]
-            if setting.type != 'bool':
-                continue
-            outputFile.write("    " + setting.type + " m_" + setting.name + " : 1; \\\n")
-
-        outputFile.write("// End of " + preferredConditional + "_SETTINGS_BOOL_MEMBER_VARIABLES\n")
-
-        # Initializers
-
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_NON_BOOL_INITIALIZERS \\\n")
-
-        for settingName in sortedSettingsNames:
-            setting = settings[settingName]
-            if setting.type == 'bool':
-                continue
-            if not setting.initial:
-                continue
-            outputFile.write("    , m_" + setting.name + "(" + setting.initial + ") \\\n")
-
-        outputFile.write("// End of " + preferredConditional + "_SETTINGS_NON_BOOL_INITIALIZERS\n")
-
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_BOOL_INITIALIZERS \\\n")
-
-        for settingName in sortedSettingsNames:
-            setting = settings[settingName]
-            if setting.type != 'bool':
-                continue
-            if not setting.initial:
-                continue
-            outputFile.write("    , m_" + setting.name + "(" + setting.initial + ") \\\n")
-
-        outputFile.write("// End of " + preferredConditional + "_SETTINGS_BOOL_INITIALIZERS\n")
-
-        # Setter Bodies
-
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_SETTER_BODIES \\\n")
-
-        for settingName in sortedSettingsNames:
-            setting = settings[settingName]
-            printSetterBody(outputFile, setting)
-
-        outputFile.write("// End of " + preferredConditional + "_SETTINGS_SETTER_BODIES\n")
-
-        outputFile.write("#else\n")
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_GETTER_AND_SETTERS\n")
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_NON_BOOL_MEMBER_VARIABLES\n")
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_BOOL_MEMBER_VARIABLES\n")
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_NON_BOOL_INITIALIZERS\n")
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_BOOL_INITIALIZERS\n")
-        outputFile.write("#define " + preferredConditional + "_SETTINGS_SETTER_BODIES\n")
-        outputFile.write("#endif\n")
-        outputFile.write("\n")
-
-
-def printGettersAndSetters(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings):
-    outputFile.write("#define SETTINGS_GETTERS_AND_SETTERS \\\n")
-
-    for unconditionalSettingName in sortedUnconditionalSettingsNames:
-        printGetterAndSetter(outputFile, settings[unconditionalSettingName])
-
-    for conditional in sortedConditionals:
-        outputFile.write("    " + makePreferredConditional(conditional) + "_SETTINGS_GETTER_AND_SETTERS \\\n")
-
-    outputFile.write("// End of SETTINGS_GETTERS_AND_SETTERS.\n\n")
-
-
-def printMemberVariables(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings):
-    outputFile.write("#define SETTINGS_MEMBER_VARIABLES \\\n")
-
-    # We list the bools last so we can bit pack them.
-
-    for unconditionalSettingName in sortedUnconditionalSettingsNames:
-        setting = settings[unconditionalSettingName]
-        if setting.type == "bool":
-            continue
-        outputFile.write("    " + setting.type + " m_" + setting.name + "; \\\n")
-
-    for conditional in sortedConditionals:
-        outputFile.write("    " + makePreferredConditional(conditional) + "_SETTINGS_NON_BOOL_MEMBER_VARIABLES \\\n")
-
-    for unconditionalSettingName in sortedUnconditionalSettingsNames:
-        setting = settings[unconditionalSettingName]
-        if setting.type != "bool":
-            continue
-        outputFile.write("    " + setting.type + " m_" + setting.name + " : 1; \\\n")
-
-    for conditional in sortedConditionals:
-        outputFile.write("    " + makePreferredConditional(conditional) + "_SETTINGS_BOOL_MEMBER_VARIABLES \\\n")
-
-    outputFile.write("// End of SETTINGS_MEMBER_VARIABLES.\n\n")
-
-
-def printInitializerList(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings):
-    outputFile.write("#define SETTINGS_INITIALIZER_LIST \\\n")
-
-    # We list the bools last so we can bit pack them.
-
-    for unconditionalSettingName in sortedUnconditionalSettingsNames:
-        setting = settings[unconditionalSettingName]
-        if setting.type == "bool":
-            continue
-        if not setting.initial:
-            continue
-        outputFile.write("    , m_" + setting.name + "(" + setting.initial + ") \\\n")
-
-    for conditional in sortedConditionals:
-        outputFile.write("    " + makePreferredConditional(conditional) + "_SETTINGS_NON_BOOL_INITIALIZERS \\\n")
-
-    for unconditionalSettingName in sortedUnconditionalSettingsNames:
-        setting = settings[unconditionalSettingName]
-        if setting.type != "bool":
-            continue
-        if not setting.initial:
-            continue
-        outputFile.write("    , m_" + setting.name + "(" + setting.initial + ") \\\n")
-
-    for conditional in sortedConditionals:
-        outputFile.write("    " + makePreferredConditional(conditional) + "_SETTINGS_BOOL_INITIALIZERS \\\n")
-
-    outputFile.write("// End of SETTINGS_INITIALIZER_LIST.\n\n")
-
-
-def printSetterBodies(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settings):
-    outputFile.write("#define SETTINGS_SETTER_BODIES \\\n")
-
-    for unconditionalSettingName in sortedUnconditionalSettingsNames:
-        setting = settings[unconditionalSettingName]
-        printSetterBody(outputFile, setting)
-
-    for conditional in sortedConditionals:
-        outputFile.write("    " + makePreferredConditional(conditional) + "_SETTINGS_SETTER_BODIES \\\n")
-
-    outputFile.write("// End of SETTINGS_SETTER_BODIES.\n\n")
index 47f1b9e..af91dcf 100755 (executable)
@@ -76,18 +76,46 @@ class Setting:
             result += " RECALC:" + self.setNeedsStyleRecalcInAllFrames
         return result
 
+    def hasComplexSetter(self):
+        if self.setNeedsStyleRecalcInAllFrames:
+            return True
+        return False
+
+    def typeIsValueType(self):
+        if self.type == 'String':
+            return False
+        return True
+
+    def setterFunctionName(self):
+        for prefix in ["css", "xss", "ftp", "dom"]:
+            if self.name.startswith(prefix):
+                return "set" + uppercaseFirstN(self.name, len(prefix))
+        return "set" + uppercaseFirstN(self.name, 1)
+
+    def getterFunctionName(self):
+        return self.name
+
+    def idlType(self):
+        # FIXME: Add support for more types including enumerate types.
+        if self.type == 'int':
+            return 'long'
+        if self.type == 'unsigned':
+            return 'unsigned long'
+        if self.type == 'double':
+            return 'double'
+        if self.type == 'float':
+            return 'float'
+        if self.type == 'String':
+            return 'DOMString'
+        if self.type == 'bool':
+            return 'boolean'
+        return None
+
 
 def uppercaseFirstN(string, n):
     return string[:n].upper() + string[n:]
 
 
-def makeSetterFunctionName(setting):
-    for prefix in ["css", "xss", "ftp", "dom"]:
-        if setting.name.startswith(prefix):
-            return "set" + uppercaseFirstN(setting.name, len(prefix))
-    return "set" + uppercaseFirstN(setting.name, 1)
-
-
 def makePreferredConditional(conditional):
     return conditional.split('|')[0]
 
@@ -97,23 +125,6 @@ def makeConditionalString(conditional):
     return "ENABLE(" + ") || ENABLE(".join(conditionals) + ")"
 
 
-def mapToIDLType(setting):
-    # FIXME: Add support for more types including enumerate types.
-    if setting.type == 'int':
-        return 'long'
-    if setting.type == 'unsigned' or setting.type == 'size_t':
-        return 'unsigned long'
-    if setting.type == 'double':
-        return 'double'
-    if setting.type == 'float':
-        return 'float'
-    if setting.type == 'String':
-        return 'DOMString'
-    if setting.type == 'bool':
-        return 'boolean'
-    return None
-
-
 def parseInput(input):
     settings = {}
     for line in open(input, "r"):
index d5a9204..3f8904c 100644 (file)
                53E29E5F167A8A1900586D3D /* InternalSettingsGenerated.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E29E5D167A8A1900586D3D /* InternalSettingsGenerated.h */; };
                53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53ED3FDC167A88E7006762E6 /* JSInternalSettingsGenerated.cpp */; };
                53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */ = {isa = PBXBuildFile; fileRef = 53ED3FDD167A88E7006762E6 /* JSInternalSettingsGenerated.h */; };
-               53EF766B16530A61004CBE49 /* SettingsMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EF766A16530A61004CBE49 /* SettingsMacros.h */; };
-               53EF766C16531994004CBE49 /* SettingsMacros.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 53EF766A16530A61004CBE49 /* SettingsMacros.h */; };
                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5550CB411E955E3C00111AA0 /* ImageTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                                1403BA0F09EB18F900797C7F /* JSDOMWindow.h in Copy Generated Headers */,
                                14DC0D3809FED073007B0235 /* JSNode.h in Copy Generated Headers */,
                                7CD58DFE1F9565EC00112791 /* Settings.h in Copy Generated Headers */,
-                               53EF766C16531994004CBE49 /* SettingsMacros.h in Copy Generated Headers */,
                                08C7A2C710DC7462002D368B /* SVGNames.h in Copy Generated Headers */,
                                1A1414B613A0F0500019996C /* WebKitFontFamilyNames.h in Copy Generated Headers */,
                        );
                53E29E5D167A8A1900586D3D /* InternalSettingsGenerated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalSettingsGenerated.h; sourceTree = "<group>"; };
                53ED3FDC167A88E7006762E6 /* JSInternalSettingsGenerated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInternalSettingsGenerated.cpp; sourceTree = "<group>"; };
                53ED3FDD167A88E7006762E6 /* JSInternalSettingsGenerated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInternalSettingsGenerated.h; sourceTree = "<group>"; };
-               53EF766A16530A61004CBE49 /* SettingsMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsMacros.h; sourceTree = "<group>"; };
                550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                5550CB411E955E3C00111AA0 /* ImageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTypes.h; sourceTree = "<group>"; };
                                26AA0F9F18D2A1C100419381 /* SelectorPseudoElementTypeMap.gperf */,
                                7CEB57EA1F95651500097AEC /* Settings.cpp */,
                                7CEB57E91F95651500097AEC /* Settings.h */,
-                               53EF766A16530A61004CBE49 /* SettingsMacros.h */,
                                9908B0FD1BCAD07D00ED0F55 /* StreamInternalsBuiltins.cpp */,
                                9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */,
                                8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */,
                                B8DBDB4C130B0F8A00F5CDB1 /* SetSelectionCommand.h in Headers */,
                                7CD58DFB1F9565A500112791 /* Settings.h in Headers */,
                                7CC9722E1F93E3360004D4CF /* SettingsBase.h in Headers */,
-                               53EF766B16530A61004CBE49 /* SettingsMacros.h in Headers */,
                                0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */,
                                BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */,
                                A6D169641346B4C1000EB770 /* ShadowRoot.h in Headers */,
index a746055..9f4d541 100644 (file)
@@ -209,7 +209,6 @@ macro(GENERATE_SETTINGS_MACROS _infile _outfile)
     # build in parallel or the two instances of the rule may conflict.
     # <https://cmake.org/cmake/help/v3.0/command/add_custom_command.html>
     set(_extra_output
-        ${DERIVED_SOURCES_WEBCORE_DIR}/Settings.h
         ${DERIVED_SOURCES_WEBCORE_DIR}/Settings.cpp
         ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.h
         ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp
@@ -222,7 +221,6 @@ macro(GENERATE_SETTINGS_MACROS _infile _outfile)
         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py
         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsHeaderFile.py
         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py
         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettings.py
         ${WEBCORE_DIR}/Scripts/GenerateSettings/Settings.py
         ${WEBCORE_DIR}/Scripts/GenerateSettings/__init__.py