Title: [222647] trunk/Source/WebCore
Revision
222647
Author
[email protected]
Date
2017-09-28 22:37:57 -0700 (Thu, 28 Sep 2017)

Log Message

Re-write Settings generation in python for some reason
https://bugs.webkit.org/show_bug.cgi?id=177621

Patch by Sam Weinig <[email protected]> on 2017-09-28
Reviewed by Tim Horton.

Re-writes and splits up generation of InternalSettingsGenerated.{h|cpp|idl}
and SettingsMacros.h in python in preparation for larger changes.

* DerivedSources.make:
* Scripts/GenerateSettings: Added.
* Scripts/GenerateSettings.py: Added.
* Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py: Added.
* Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py: Added.
* Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py: Added.
* Scripts/GenerateSettings/GenerateSettings.py: Added.
* Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py: Added.
* Scripts/GenerateSettings/Settings.py: Added.
* Scripts/GenerateSettings/__init__.py: Added.
* WebCore.xcodeproj/project.pbxproj:
* page/make_settings.pl: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (222646 => 222647)


--- trunk/Source/WebCore/ChangeLog	2017-09-29 03:07:21 UTC (rev 222646)
+++ trunk/Source/WebCore/ChangeLog	2017-09-29 05:37:57 UTC (rev 222647)
@@ -1,3 +1,26 @@
+2017-09-28  Sam Weinig  <[email protected]>
+
+        Re-write Settings generation in python for some reason
+        https://bugs.webkit.org/show_bug.cgi?id=177621
+
+        Reviewed by Tim Horton.
+
+        Re-writes and splits up generation of InternalSettingsGenerated.{h|cpp|idl}
+        and SettingsMacros.h in python in preparation for larger changes.
+
+        * DerivedSources.make:
+        * Scripts/GenerateSettings: Added.
+        * Scripts/GenerateSettings.py: Added.
+        * Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py: Added.
+        * Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py: Added.
+        * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py: Added.
+        * Scripts/GenerateSettings/GenerateSettings.py: Added.
+        * Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py: Added.
+        * Scripts/GenerateSettings/Settings.py: Added.
+        * Scripts/GenerateSettings/__init__.py: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/make_settings.pl: Removed.
+
 2017-09-28  Don Olmstead  <[email protected]>
 
         Simplify PLATFORM ifdefs within Editor around writing selections

Modified: trunk/Source/WebCore/DerivedSources.make (222646 => 222647)


--- trunk/Source/WebCore/DerivedSources.make	2017-09-29 03:07:21 UTC (rev 222646)
+++ trunk/Source/WebCore/DerivedSources.make	2017-09-29 05:37:57 UTC (rev 222647)
@@ -75,12 +75,12 @@
     $(WebCore)/platform/network \
     $(WebCore)/plugins \
     $(WebCore)/storage \
-    $(WebCore)/xml \
-    $(WebCore)/workers \
-    $(WebCore)/workers/service \
     $(WebCore)/svg \
     $(WebCore)/testing \
     $(WebCore)/websockets \
+    $(WebCore)/workers \
+    $(WebCore)/workers/service \
+    $(WebCore)/xml \
 #
 
 JS_BINDING_IDLS = \
@@ -1373,9 +1373,18 @@
 
 # Internal Settings
 
+GENERATE_SETTINGS_SCRIPTS = \
+    $(WebCore)/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py \
+    $(WebCore)/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py \
+    $(WebCore)/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py \
+    $(WebCore)/Scripts/GenerateSettings/GenerateSettings.py \
+    $(WebCore)/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py \
+    $(WebCore)/Scripts/GenerateSettings/Settings.py \
+    $(WebCore)/Scripts/GenerateSettings/__init__.py
+
 all : InternalSettingsGenerated.idl InternalSettingsGenerated.cpp InternalSettingsGenerated.h SettingsMacros.h
-InternalSettingsGenerated%idl InternalSettingsGenerated%cpp InternalSettingsGenerated%h SettingsMacros%h : page/make_settings.pl page/Settings.in
-	$(PERL) $< --input $(WebCore)/page/Settings.in
+InternalSettingsGenerated%idl InternalSettingsGenerated%cpp InternalSettingsGenerated%h SettingsMacros%h : $(WebCore)/Scripts/GenerateSettings.py $(GENERATE_SETTINGS_SCRIPTS) page/Settings.in
+	$(PYTHON) $< --input $(WebCore)/page/Settings.in
 
 # --------
 

Added: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,82 @@
+#!/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, mapToIDLType, makeSetterFunctionName
+
+
+def generateInternalSettingsHeaderFile(outputDirectory, settings):
+    outputPath = os.path.join(outputDirectory, "InternalSettingsGenerated.h")
+    outputFile = open(outputPath, 'w')
+    outputFile.write(license())
+
+    outputFile.write("#pragma once\n\n")
+
+    outputFile.write("#include \"Supplementable.h\"\n")
+    outputFile.write("#include <wtf/RefCounted.h>\n")
+    outputFile.write("#include <wtf/text/WTFString.h>\n\n")
+
+    outputFile.write("namespace WebCore {\n\n")
+
+    outputFile.write("class Page;\n\n")
+
+    outputFile.write("class InternalSettingsGenerated : public RefCounted<InternalSettingsGenerated> {\n")
+    outputFile.write("public:\n")
+    outputFile.write("    explicit InternalSettingsGenerated(Page*);\n")
+    outputFile.write("    virtual ~InternalSettingsGenerated();\n\n")
+    outputFile.write("    void resetToConsistentState();\n\n")
+
+    for settingName in sorted(settings.iterkeys()):
+        setting = settings[settingName]
+        idlType = mapToIDLType(setting)
+        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("\n")
+    outputFile.write("private:\n")
+    outputFile.write("    Page* m_page;\n\n")
+
+    for settingName in sorted(settings.iterkeys()):
+        setting = settings[settingName]
+        idlType = mapToIDLType(setting)
+        if not idlType:
+            continue
+
+        if setting.conditional:
+            outputFile.write("#if " + makeConditionalString(setting.conditional) + "\n")
+
+        outputFile.write("    " + setting.type + " m_" + setting.name + ";\n")
+
+        if setting.conditional:
+            outputFile.write("#endif\n")
+
+    outputFile.write("};\n\n")
+    outputFile.write("} // namespace WebCore\n")
+
+    outputFile.close()
Property changes on: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Added: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,49 @@
+#!/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, mapToIDLType, makeSetterFunctionName
+
+
+def generateInternalSettingsIDLFile(outputDirectory, settings):
+    outputPath = os.path.join(outputDirectory, "InternalSettingsGenerated.idl")
+    outputFile = open(outputPath, 'w')
+    outputFile.write(license())
+
+    outputFile.write("[\n")
+    outputFile.write("    NoInterfaceObject,\n")
+    outputFile.write("    ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,\n")
+    outputFile.write("] interface InternalSettingsGenerated {\n")
+
+    for settingName in sorted(settings.iterkeys()):
+        setting = settings[settingName]
+        idlType = mapToIDLType(setting)
+        if not idlType:
+            continue
+        outputFile.write("    void " + makeSetterFunctionName(setting) + "(" + idlType + " " + setting.name + ");\n")
+
+    outputFile.write("};\n")
+    outputFile.close()
Property changes on: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Added: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,112 @@
+#!/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, makeSetterFunctionName, makeConditionalString, mapToIDLType, makeConditionalString
+
+
+def generateInternalSettingsImplementationFile(outputDirectory, settings):
+    outputPath = os.path.join(outputDirectory, "InternalSettingsGenerated.cpp")
+    outputFile = open(outputPath, 'w')
+    outputFile.write(license())
+
+    outputFile.write("#include \"config.h\"\n")
+    outputFile.write("#include \"InternalSettingsGenerated.h\"\n\n")
+
+    outputFile.write("#include \"Page.h\"\n")
+    outputFile.write("#include \"Settings.h\"\n\n")
+
+    outputFile.write("namespace WebCore {\n\n")
+
+    outputFile.write("InternalSettingsGenerated::InternalSettingsGenerated(Page* page)\n")
+    outputFile.write("    : m_page(page)\n")
+
+    for settingName in sorted(settings.iterkeys()):
+        setting = settings[settingName]
+        idlType = mapToIDLType(setting)
+        if not idlType:
+            continue
+
+        if setting.conditional:
+            outputFile.write("#if " + makeConditionalString(setting.conditional) + "\n")
+
+        outputFile.write("    , m_" + setting.name + "(page->settings()." + setting.name + "())\n")
+
+        if setting.conditional:
+            outputFile.write("#endif\n")
+
+    outputFile.write("{\n")
+    outputFile.write("}\n\n")
+
+    outputFile.write("InternalSettingsGenerated::~InternalSettingsGenerated()\n")
+    outputFile.write("{\n")
+    outputFile.write("}\n\n")
+
+    outputFile.write("void InternalSettingsGenerated::resetToConsistentState()\n")
+    outputFile.write("{\n")
+
+    for settingName in sorted(settings.iterkeys()):
+        setting = settings[settingName]
+        idlType = mapToIDLType(setting)
+        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")
+
+        if setting.conditional:
+            outputFile.write("#endif\n")
+
+    outputFile.write("}\n\n")
+
+    for settingName in sorted(settings.iterkeys()):
+        setting = settings[settingName]
+        idlType = mapToIDLType(setting)
+        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("{\n")
+
+        if setting.conditional:
+            outputFile.write("#if " + makeConditionalString(setting.conditional) + "\n")
+
+        outputFile.write("    m_page->settings()." + makeSetterFunctionName(setting) + "(" + setting.name + ");\n")
+
+        if setting.conditional:
+            outputFile.write("#else\n")
+            outputFile.write("    UNUSED_PARAM(" + setting.name + ");\n")
+            outputFile.write("#endif\n")
+
+        outputFile.write("}\n\n")
+
+    outputFile.write("} // namespace WebCore\n")
+
+    outputFile.close()
Property changes on: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Added: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettings.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettings.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettings.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,5 @@
+from Settings import *
+from GenerateInternalSettingsHeaderFile import *
+from GenerateInternalSettingsIDLFile import *
+from GenerateInternalSettingsImplementationFile import *
+from GenerateSettingsMacrosHeader import *

Added: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,272 @@
+#!/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")
Property changes on: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Added: trunk/Source/WebCore/Scripts/GenerateSettings/Settings.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings/Settings.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/Settings.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,142 @@
+#!/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
+import re
+
+
+def license():
+    return """/*
+ * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
+ *
+ * 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.
+ */
+
+"""
+
+
+class Setting:
+    def __init__(self, name):
+        self.name = name
+        self.type = "bool"
+        self.initial = None
+        self.conditional = None
+        self.setNeedsStyleRecalcInAllFrames = None
+
+    def __str__(self):
+        result = self.name + " TYPE:" + self.type
+        if (self.initial):
+            result += " INIT:" + self.initial
+        if (self.conditional):
+            result += " COND:" + self.conditional
+        if (self.setNeedsStyleRecalcInAllFrames):
+            result += " RECALC:" + self.setNeedsStyleRecalcInAllFrames
+        return result
+
+
+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]
+
+
+def makeConditionalString(conditional):
+    conditionals = conditional.split('|')
+    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"):
+        if not line.startswith("#") and not line.isspace():
+
+            (name, optionsString) = line.rstrip().split(' ', 1)
+
+            options = re.split(r' *, *', optionsString)
+
+            setting = Setting(name)
+            for option in options:
+                (name, value) = re.split(r' *= *', option)
+                if (name == 'type'):
+                    setting.type = value
+                if (name == 'initial'):
+                    setting.initial = value
+                if (name == 'conditional'):
+                    setting.conditional = value
+                if (name == 'setNeedsStyleRecalcInAllFrames'):
+                    setting.setNeedsStyleRecalcInAllFrames = value
+
+            # FIXME: ASSERT something about setting.initial
+
+            settings[setting.name] = setting
+
+    return settings
Property changes on: trunk/Source/WebCore/Scripts/GenerateSettings/Settings.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Added: trunk/Source/WebCore/Scripts/GenerateSettings/__init__.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings/__init__.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/__init__.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,3 @@
+# Required for Python to search this directory for module files
+
+from GenerateSettings import *

Added: trunk/Source/WebCore/Scripts/GenerateSettings.py (0 => 222647)


--- trunk/Source/WebCore/Scripts/GenerateSettings.py	                        (rev 0)
+++ trunk/Source/WebCore/Scripts/GenerateSettings.py	2017-09-29 05:37:57 UTC (rev 222647)
@@ -0,0 +1,59 @@
+#!/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
+import sys
+from optparse import OptionParser
+
+from GenerateSettings import *
+
+
+def main():
+    parser = OptionParser(usage="usage: %prog --input file")
+    parser.add_option('--input', dest='input', help='file to generate settings from', metavar='file')
+    parser.add_option('--outputDir', dest='outputDir', help='directory to generate file in', metavar='dir')
+
+    (options, arguments) = parser.parse_args()
+
+    if not options.input:
+        print "Error: must provide an input file"
+        parser.print_usage()
+        exit(-1)
+
+    outputDirectory = options.outputDir if options.outputDir else os.getcwd()
+
+    if not os.path.exists(outputDirectory):
+        os.makedirs(outputDirectory)
+
+    settings = parseInput(options.input)
+
+    generateSettingsMacrosHeader(outputDirectory, settings)
+    generateInternalSettingsIDLFile(outputDirectory, settings)
+    generateInternalSettingsHeaderFile(outputDirectory, settings)
+    generateInternalSettingsImplementationFile(outputDirectory, settings)
+
+
+if __name__ == '__main__':
+    main()
Property changes on: trunk/Source/WebCore/Scripts/GenerateSettings.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (222646 => 222647)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-09-29 03:07:21 UTC (rev 222646)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-09-29 05:37:57 UTC (rev 222647)
@@ -11417,6 +11417,8 @@
 		7C39C36E1DDBA3E000FEFB29 /* SVGPathSegListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegListValues.cpp; sourceTree = "<group>"; };
 		7C39C36F1DDBA3E000FEFB29 /* SVGPathSegListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegListValues.h; sourceTree = "<group>"; };
 		7C39C3701DDBA44000FEFB29 /* SVGPathSegList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegList.cpp; sourceTree = "<group>"; };
+		7C3A8C5E1F7D72B400F46E84 /* GenerateSettings */ = {isa = PBXFileReference; lastKnownFileType = folder; name = GenerateSettings; path = Scripts/GenerateSettings; sourceTree = "<group>"; };
+		7C3A8C601F7D72B500F46E84 /* GenerateSettings.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = GenerateSettings.py; path = Scripts/GenerateSettings.py; sourceTree = "<group>"; };
 		7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardAccessPolicy.h; sourceTree = "<group>"; };
 		7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandler.cpp; sourceTree = "<group>"; };
 		7C3B79701908757B00B47A2D /* UserMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandler.h; sourceTree = "<group>"; };
@@ -14501,7 +14503,6 @@
 		BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElementCustom.cpp; sourceTree = "<group>"; };
 		BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleDeclarationCustom.cpp; sourceTree = "<group>"; };
 		BC59DEF8169DEDC30016AC34 /* Settings.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = Settings.in; sourceTree = "<group>"; };
-		BC59DEFA169DEDD80016AC34 /* make_settings.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = make_settings.pl; sourceTree = "<group>"; };
 		BC5A12DD0DC0414800C9AFAD /* CSSReflectValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSReflectValue.cpp; sourceTree = "<group>"; };
 		BC5A12DE0DC0414800C9AFAD /* CSSReflectValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSReflectValue.h; sourceTree = "<group>"; };
 		BC5A86810C33676000EEA649 /* DOMSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMSelection.cpp; sourceTree = "<group>"; };
@@ -17988,7 +17989,9 @@
 			isa = PBXGroup;
 			children = (
 				F48389791E1DD23A0076B7EA /* EditingHistory */,
+				7C3A8C5E1F7D72B400F46E84 /* GenerateSettings */,
 				3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */,
+				7C3A8C601F7D72B500F46E84 /* GenerateSettings.py */,
 				37D456FB1A9A50B6003330A1 /* LocalizableStrings.pm */,
 			);
 			name = Scripts;
@@ -19744,7 +19747,6 @@
 				BCE1C4220D9829F2003B02F2 /* Location.idl */,
 				932AD70317EFA2C30038F8FF /* MainFrame.cpp */,
 				932AD70417EFA2C30038F8FF /* MainFrame.h */,
-				BC59DEFA169DEDD80016AC34 /* make_settings.pl */,
 				931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */,
 				52E2CAFB19FF0207001EEB4F /* MediaProducer.h */,
 				413E00771DB0E4DE002341D2 /* MemoryRelease.cpp */,

Modified: trunk/Source/WebCore/WebCoreMacros.cmake (222646 => 222647)


--- trunk/Source/WebCore/WebCoreMacros.cmake	2017-09-29 03:07:21 UTC (rev 222646)
+++ trunk/Source/WebCore/WebCoreMacros.cmake	2017-09-29 05:37:57 UTC (rev 222647)
@@ -203,7 +203,7 @@
 
 
 macro(GENERATE_SETTINGS_MACROS _infile _outfile)
-    set(NAMES_GENERATOR ${WEBCORE_DIR}/page/make_settings.pl)
+    set(NAMES_GENERATOR ${WEBCORE_DIR}/Scripts/GenerateSettings.py)
 
     # Do not list the output in more than one independent target that may
     # build in parallel or the two instances of the rule may conflict.
@@ -213,12 +213,23 @@
         ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp
         ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl
     )
+
+    set(GENERATE_SETTINGS_SCRIPTS
+        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py
+        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py
+        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py
+        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettings.py
+        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py
+        ${WEBCORE_DIR}/Scripts/GenerateSettings/Settings.py
+        ${WEBCORE_DIR}/Scripts/GenerateSettings/__init__.py
+    )
+
     set(_args BYPRODUCTS ${_extra_output})
     add_custom_command(
         OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
         MAIN_DEPENDENCY ${_infile}
-        DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+        DEPENDS ${NAMES_GENERATOR} ${GENERATE_SETTINGS_SCRIPTS} ${SCRIPTS_BINDINGS}
+        COMMAND ${PYTHON_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
         VERBATIM ${_args})
 endmacro()
 

Modified: trunk/Source/WebCore/page/Settings.in (222646 => 222647)


--- trunk/Source/WebCore/page/Settings.in	2017-09-29 03:07:21 UTC (rev 222646)
+++ trunk/Source/WebCore/page/Settings.in	2017-09-29 05:37:57 UTC (rev 222647)
@@ -304,3 +304,4 @@
 paymentRequestEnabled initial=false, conditional=PAYMENT_REQUEST
 
 storageAccessAPIEnabled initial=false
+

Deleted: trunk/Source/WebCore/page/make_settings.pl (222646 => 222647)


--- trunk/Source/WebCore/page/make_settings.pl	2017-09-29 03:07:21 UTC (rev 222646)
+++ trunk/Source/WebCore/page/make_settings.pl	2017-09-29 05:37:57 UTC (rev 222647)
@@ -1,539 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 2012 Tony Chang <[email protected]>
-#
-# 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 GOOGLE, INC. `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
-# 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.
-
-use strict;
-use FindBin;
-use lib "$FindBin::Bin/../bindings/scripts";
-
-use InFilesCompiler;
-
-my %defaultParameters = (
-);
-
-my %webcoreTypeToIdlType = (
-    'int' => 'long',
-    'unsigned' => 'unsigned long',
-    'size_t' => 'unsigned long',
-    'double' => 'double',
-    'float' => 'float',
-    'String' => 'DOMString',
-    'bool' => 'boolean'
-);
-
-sub defaultItemFactory
-{
-    return (
-        'conditional' => 0,
-        'initial' => '',
-        'type' => 'bool',
-        'setNeedsStyleRecalcInAllFrames' => 0,
-    );
-}
-
-my $InCompiler = InFilesCompiler->new(\%defaultParameters, \&defaultItemFactory);
-
-my $outputDir = $InCompiler->initializeFromCommandLine();
-$InCompiler->compile(\&generateCode);
-
-sub generateCode()
-{
-    my $parsedParametersRef = shift;
-    my $parsedItemsRef = shift;
-
-    generateSettingsMacrosHeader($parsedItemsRef);
-    generateInternalSettingsIdlFile($parsedItemsRef);
-    generateInternalSettingsHeaderFile($parsedItemsRef);
-    generateInternalSettingsCppFile($parsedItemsRef);
-}
-
-sub generateSettingsMacrosHeader($)
-{
-    my $parsedItemsRef = shift;
-
-    my %parsedItems = %{ $parsedItemsRef };
-    my $outputFile = "$outputDir/SettingsMacros.h";
-
-    my %unconditionalSettings = ();
-    my %settingsByConditional = ();
-
-    for my $settingName (sort keys %parsedItems) {
-        my $conditional = $parsedItems{$settingName}{"conditional"};
-
-        if ($conditional) {
-            if (!defined($settingsByConditional{$conditional})) {
-                $settingsByConditional{$conditional} = ();
-            }
-            $settingsByConditional{$conditional}{$settingName} = 1;
-        } else {
-            $unconditionalSettings{$settingName} = 1;
-        }
-    }
-
-    open my $file, ">$outputFile" or die "Failed to open file: $!";
-
-    print $file $InCompiler->license();
-
-    # FIXME: Sort by type so bools come last and are bit packed.
-
-    print $file "#ifndef SettingsMacros_h\n";
-    print $file "#define SettingsMacros_h\n\n";
-
-    printConditionalMacros($file, \%settingsByConditional, $parsedItemsRef);
-
-    printGettersAndSetters($file, \%unconditionalSettings, \%settingsByConditional, $parsedItemsRef);
-    printMemberVariables($file, \%unconditionalSettings, \%settingsByConditional, $parsedItemsRef);
-    printInitializerList($file, \%unconditionalSettings, \%settingsByConditional, $parsedItemsRef);
-    printSetterBodies($file, \%unconditionalSettings, \%settingsByConditional, $parsedItemsRef);
-
-    print $file "#endif // SettingsMacros_h\n";
-
-    close $file;
-}
-
-sub printConditionalMacros($$$)
-{
-    my ($file, $settingsByConditionalRef, $parsedItemsRef) = @_;
-    my %parsedItems = %{ $parsedItemsRef };
-    my %settingsByConditional = %{ $settingsByConditionalRef };
-
-    for my $conditional (sort keys %settingsByConditional) {
-        my $preferredConditional = $InCompiler->preferredConditional($conditional);
-        print $file "#if " . $InCompiler->conditionalStringFromAttributeValue($conditional) . "\n";
-
-        print $file "#define ${preferredConditional}_SETTINGS_GETTER_AND_SETTERS \\\n";
-        for my $settingName (sort keys %{ $settingsByConditional{$conditional} }) {
-            printGetterAndSetter($file, $settingName, $parsedItems{$settingName}{"type"}, $parsedItems{$settingName}{"setNeedsStyleRecalcInAllFrames"});
-        }
-        print $file "// End of ${preferredConditional}_SETTINGS_GETTER_AND_SETTERS\n";
-
-        print $file "#define ${preferredConditional}_SETTINGS_NON_BOOL_MEMBER_VARIABLES \\\n";
-        for my $settingName (sort keys %{ $settingsByConditional{$conditional} }) {
-            my $type = $parsedItems{$settingName}{"type"};
-            next if $type eq "bool";
-            print $file "    $type m_$settingName; \\\n"
-        }
-        print $file "// End of ${preferredConditional}_SETTINGS_NON_BOOL_MEMBER_VARIABLES\n";
-
-        print $file "#define ${preferredConditional}_SETTINGS_BOOL_MEMBER_VARIABLES \\\n";
-        for my $settingName (sort keys %{ $settingsByConditional{$conditional} }) {
-            next if $parsedItems{$settingName}{"type"} ne "bool";
-            print $file "    bool m_$settingName : 1; \\\n"
-        }
-        print $file "// End of ${preferredConditional}_SETTINGS_BOOL_MEMBER_VARIABLES\n";
-
-        print $file "#define ${preferredConditional}_SETTINGS_NON_BOOL_INITIALIZERS \\\n";
-        for my $settingName (sort keys %{ $settingsByConditional{$conditional} }) {
-            next if $parsedItems{$settingName}{"type"} eq "bool";
-            printInitializer($file, $settingName, $parsedItemsRef);
-        }
-        print $file "// End of ${preferredConditional}_SETTINGS_NON_BOOL_INITIALIZERS\n";
-
-        print $file "#define ${preferredConditional}_SETTINGS_BOOL_INITIALIZERS \\\n";
-        for my $settingName (sort keys %{ $settingsByConditional{$conditional} }) {
-            next if $parsedItems{$settingName}{"type"} ne "bool";
-            printInitializer($file, $settingName, $parsedItemsRef);
-        }
-        print $file "// End of ${preferredConditional}_SETTINGS_BOOL_INITIALIZERS\n";
-
-        print $file "#define ${preferredConditional}_SETTINGS_SETTER_BODIES \\\n";
-        for my $settingName (sort keys %{ $settingsByConditional{$conditional} }) {
-            printSetterBody($file, $settingName, $parsedItems{$settingName}{"type"}, $parsedItems{$settingName}{"setNeedsStyleRecalcInAllFrames"});
-        }
-        print $file "// End of ${preferredConditional}_SETTINGS_SETTER_BODIES\n";
-
-        print $file "#else\n";
-        print $file "#define ${preferredConditional}_SETTINGS_GETTER_AND_SETTERS\n";
-        print $file "#define ${preferredConditional}_SETTINGS_NON_BOOL_MEMBER_VARIABLES\n";
-        print $file "#define ${preferredConditional}_SETTINGS_BOOL_MEMBER_VARIABLES\n";
-        print $file "#define ${preferredConditional}_SETTINGS_NON_BOOL_INITIALIZERS\n";
-        print $file "#define ${preferredConditional}_SETTINGS_BOOL_INITIALIZERS\n";
-        print $file "#define ${preferredConditional}_SETTINGS_SETTER_BODIES\n";
-        print $file "#endif\n";
-        print $file "\n";
-    }
-}
-
-sub printGettersAndSetters($$$$)
-{
-    my ($file, $unconditionalSettingsRef, $settingsByConditionalRef, $parsedItemsRef) = @_;
-    my %parsedItems = %{ $parsedItemsRef };
-    my %unconditionalSettings = %{ $unconditionalSettingsRef };
-    my %settingsByConditional = %{ $settingsByConditionalRef };
-
-    print $file "#define SETTINGS_GETTERS_AND_SETTERS \\\n";
-    for my $settingName (sort keys %unconditionalSettings) {
-        printGetterAndSetter($file, $settingName, $parsedItems{$settingName}{"type"}, $parsedItems{$settingName}{"setNeedsStyleRecalcInAllFrames"});
-    }
-    for my $conditional (sort keys %settingsByConditional) {
-        my $preferredConditional = $InCompiler->preferredConditional($conditional);
-        print $file "    ${preferredConditional}_SETTINGS_GETTER_AND_SETTERS \\\n";
-    }
-    print $file "// End of SETTINGS_GETTERS_AND_SETTERS.\n\n";
-}
-
-sub printMemberVariables($$$$)
-{
-    my ($file, $unconditionalSettingsRef, $settingsByConditionalRef, $parsedItemsRef) = @_;
-    my %parsedItems = %{ $parsedItemsRef };
-    my %unconditionalSettings = %{ $unconditionalSettingsRef };
-    my %settingsByConditional = %{ $settingsByConditionalRef };
-
-    print $file "#define SETTINGS_MEMBER_VARIABLES \\\n";
-    # We list the bools last so we can bit pack them.
-    for my $settingName (sort keys %unconditionalSettings) {
-        my $type = $parsedItems{$settingName}{"type"};
-        next if $type eq "bool";
-        print $file "    $type m_$settingName; \\\n"
-    }
-    for my $conditional (sort keys %settingsByConditional) {
-        my $preferredConditional = $InCompiler->preferredConditional($conditional);
-        print $file "    ${preferredConditional}_SETTINGS_NON_BOOL_MEMBER_VARIABLES \\\n";
-    }
-    for my $settingName (sort keys %unconditionalSettings) {
-        next if $parsedItems{$settingName}{"type"} ne "bool";
-        print $file "    bool m_$settingName : 1; \\\n"
-    }
-    for my $conditional (sort keys %settingsByConditional) {
-        my $preferredConditional = $InCompiler->preferredConditional($conditional);
-        print $file "    ${preferredConditional}_SETTINGS_BOOL_MEMBER_VARIABLES \\\n";
-    }
-    print $file "// End of SETTINGS_MEMBER_VARIABLES.\n\n";
-}
-
-sub setterFunctionName($)
-{
-    my $settingName = shift;
-    my $setterFunctionName = "set" . $settingName;
-    substr($setterFunctionName, 3, 1) = uc(substr($setterFunctionName, 3, 1));
-    my @prefixesToUpperCase = ("css", "xss", "ftp", "dom");
-    foreach my $prefix (@prefixesToUpperCase) {
-        my $prefixLength = length($prefix);
-        if (substr($settingName, 0, $prefixLength) eq $prefix) {
-            substr($setterFunctionName, $prefixLength, $prefixLength) = uc(substr($setterFunctionName, 3, 3));
-        }
-    }
-    return $setterFunctionName;
-}
-
-sub printGetterAndSetter($$$$)
-{
-    my ($file, $settingName, $type, $setNeedsStyleRecalcInAllFrames) = @_;
-    my $setterFunctionName = setterFunctionName($settingName);
-
-    my $webcoreExport = "";
-    if ($setNeedsStyleRecalcInAllFrames) {
-        $webcoreExport = "WEBCORE_EXPORT"; # Export is only needed if the definition is not in the header.
-    }
-
-    if (lc(substr($type, 0, 1)) eq substr($type, 0, 1)) {
-        print $file "    $type $settingName() const { return m_$settingName; } \\\n";
-        print $file "    $webcoreExport void $setterFunctionName($type $settingName)";
-    } else {
-        print $file "    const $type& $settingName() const { return m_$settingName; } \\\n";
-        print $file "    $webcoreExport void $setterFunctionName(const $type& $settingName)";
-    }
-    if ($setNeedsStyleRecalcInAllFrames) {
-        print $file "; \\\n";
-    } else {
-        print $file " { m_$settingName = $settingName; } \\\n";
-    }
-}
-
-sub printInitializerList($$$$)
-{
-    my ($file, $unconditionalSettingsRef, $settingsByConditionalRef, $parsedItemsRef) = @_;
-    my %parsedItems = %{ $parsedItemsRef };
-    my %unconditionalSettings = %{ $unconditionalSettingsRef };
-    my %settingsByConditional = %{ $settingsByConditionalRef };
-
-    print $file "#define SETTINGS_INITIALIZER_LIST \\\n";
-    for my $settingName (sort keys %unconditionalSettings) {
-        next if $parsedItems{$settingName}{"type"} eq "bool";
-        printInitializer($file, $settingName, $parsedItemsRef);
-    }
-    for my $conditional (sort keys %settingsByConditional) {
-        my $preferredConditional = $InCompiler->preferredConditional($conditional);
-        print $file "    ${preferredConditional}_SETTINGS_NON_BOOL_INITIALIZERS \\\n";
-    }
-    for my $settingName (sort keys %unconditionalSettings) {
-        next if $parsedItems{$settingName}{"type"} ne "bool";
-        printInitializer($file, $settingName, $parsedItemsRef);
-    }
-    for my $conditional (sort keys %settingsByConditional) {
-        my $preferredConditional = $InCompiler->preferredConditional($conditional);
-        print $file "    ${preferredConditional}_SETTINGS_BOOL_INITIALIZERS \\\n";
-    }
-    print $file "// End of SETTINGS_INITIALIZER_LIST.\n\n";
-}
-
-sub printInitializer($$$)
-{
-    my ($file, $settingName, $parsedItemsRef) = @_;
-    my %parsedItems = %{ $parsedItemsRef };
-
-    my $initialValue = $parsedItems{$settingName}{"initial"};
-    my $type = $parsedItems{$settingName}{"type"};
-    die "Must provide an initial value for $settingName." if ($initialValue eq '' && lc(substr($type, 0, 1)) eq substr($type, 0, 1));
-    return if ($initialValue eq '');
-    print $file "    , m_$settingName($initialValue) \\\n"
-}
-
-sub printSetterBodies($$$$)
-{
-    my ($file, $unconditionalSettingsRef, $settingsByConditionalRef, $parsedItemsRef) = @_;
-    my %parsedItems = %{ $parsedItemsRef };
-    my %unconditionalSettings = %{ $unconditionalSettingsRef };
-    my %settingsByConditional = %{ $settingsByConditionalRef };
-
-    print $file "#define SETTINGS_SETTER_BODIES \\\n";
-    for my $settingName (sort keys %unconditionalSettings) {
-        printSetterBody($file, $settingName, $parsedItems{$settingName}{"type"}, $parsedItems{$settingName}{"setNeedsStyleRecalcInAllFrames"});
-    }
-    for my $conditional (sort keys %settingsByConditional) {
-        my $preferredConditional = $InCompiler->preferredConditional($conditional);
-        print $file "    ${preferredConditional}_SETTINGS_SETTER_BODIES \\\n";
-    }
-    print $file "// End of SETTINGS_SETTER_BODIES.\n\n";
-}
-
-sub printSetterBody($$$$)
-{
-    my ($file, $settingName, $type, $setNeedsStyleRecalcInAllFrames) = @_;
-    return if (!$setNeedsStyleRecalcInAllFrames);
-
-    my $setterFunctionName = setterFunctionName($settingName);
-    if (lc(substr($type, 0, 1)) eq substr($type, 0, 1)) {
-        print $file "void Settings::$setterFunctionName($type $settingName) \\\n";
-    } else {
-        print $file "void Settings::$setterFunctionName(const $type& $settingName) \\\n";
-    }
-    print $file "{ \\\n";
-    print $file "    if (m_$settingName == $settingName) \\\n";
-    print $file "        return; \\\n";
-    print $file "    m_$settingName = $settingName; \\\n";
-    print $file "    m_page->setNeedsRecalcStyleInAllFrames(); \\\n";
-    print $file "} \\\n";
-}
-
-sub enumerateParsedItems($$$)
-{
-    my ($file, $parsedItemsRef, $visitorFunction) = @_;
-    my %parsedItems = %{ $parsedItemsRef };
-
-    for my $settingName (sort keys %parsedItems) {
-        my $type = $parsedItems{$settingName}{"type"};
-        # FIXME: Learn how to auto-generate code for enumerate types.
-        next if (!defined($webcoreTypeToIdlType{$type}));
-
-        &$visitorFunction($file, $parsedItemsRef, $settingName)
-    }
-}
-
-sub generateInternalSettingsIdlFile($)
-{
-    my $parsedItemsRef = shift;
-
-    my $filename = "$outputDir/InternalSettingsGenerated.idl";
-    open my $file, ">$filename" or die "Failed to open file: $!";
-    print $file $InCompiler->license();
-
-    print $file "[\n";
-    print $file "    NoInterfaceObject,\n";
-    print $file "    ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,\n";
-    print $file "] interface InternalSettingsGenerated {\n";
-
-    sub writeIdlSetter($$$) {
-        my ($file, $parsedItemsRef, $settingName) = @_;
-        my %parsedItems = %{ $parsedItemsRef };
-        my $type = $parsedItems{$settingName}{"type"};
-        my $idlType = $webcoreTypeToIdlType{$type};
-        my $setterFunctionName = setterFunctionName($settingName);
-        print $file "    void $setterFunctionName($idlType $settingName);\n";
-    };
-
-    enumerateParsedItems($file, $parsedItemsRef, \&writeIdlSetter);
-
-    print $file "};\n";
-    close $file;
-}
-
-sub generateInternalSettingsHeaderFile($)
-{
-    my $parsedItemsRef = shift;
-    my %parsedItems = %{ $parsedItemsRef };
-
-    my $filename = "$outputDir/InternalSettingsGenerated.h";
-    open my $file, ">$filename" or die "Failed to open file: $!";
-    print $file $InCompiler->license();
-
-    print $file <<EOF;
-#pragma once
-
-#include "Supplementable.h"
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class Page;
-
-class InternalSettingsGenerated : public RefCounted<InternalSettingsGenerated> {
-public:
-    explicit InternalSettingsGenerated(Page*);
-    virtual ~InternalSettingsGenerated();
-    void resetToConsistentState();
-EOF
-    sub writeHeaderPrototypes($$$) {
-        my ($file, $parsedItemsRef, $settingName) = @_;
-        my %parsedItems = %{ $parsedItemsRef };
-        my $type = $parsedItems{$settingName}{"type"};
-        my $setterFunctionName = setterFunctionName($settingName);
-        $type = "const String&" if $type eq "String";
-        print $file "    void $setterFunctionName($type $settingName);\n";
-    };
-    enumerateParsedItems($file, $parsedItemsRef, \&writeHeaderPrototypes);
-
-    print $file <<EOF;
-
-private:
-    Page* m_page;
-
-EOF
-
-    sub writeBackupMembers($$$) {
-        my ($file, $parsedItemsRef, $settingName) = @_;
-        my %parsedItems = %{ $parsedItemsRef };
-        my $type = $parsedItems{$settingName}{"type"};
-        my $conditional = $parsedItems{$settingName}{"conditional"};
-        if ($conditional) {
-            print $file "#if " . $InCompiler->conditionalStringFromAttributeValue($conditional) . "\n";
-        }
-        print $file "    $type m_$settingName;\n";
-        if ($conditional) {
-            print $file "#endif\n";
-        }
-    };
-    enumerateParsedItems($file, $parsedItemsRef, \&writeBackupMembers);
-
-    print $file "};\n\n";
-    print $file "} // namespace WebCore\n";
-
-    close $file;
-}
-
-sub generateInternalSettingsCppFile($)
-{
-    my $parsedItemsRef = shift;
-    my %parsedItems = %{ $parsedItemsRef };
-
-    my $filename = "$outputDir/InternalSettingsGenerated.cpp";
-    open my $file, ">$filename" or die "Failed to open file: $!";
-    print $file $InCompiler->license();
-
-    print $file <<EOF;
-#include "config.h"
-#include "InternalSettingsGenerated.h"
-
-#include "Page.h"
-#include "Settings.h"
-
-namespace WebCore {
-
-InternalSettingsGenerated::InternalSettingsGenerated(Page* page)
-    : m_page(page)
-EOF
-
-    sub writeBackupInitializers($$$) {
-        my ($file, $parsedItemsRef, $settingName) = @_;
-        my %parsedItems = %{ $parsedItemsRef };
-        my $type = $parsedItems{$settingName}{"type"};
-        my $conditional = $parsedItems{$settingName}{"conditional"};
-        if ($conditional) {
-            print $file "#if " . $InCompiler->conditionalStringFromAttributeValue($conditional) . "\n";
-        }
-        print $file "    , m_$settingName(page->settings().$settingName())\n";
-        if ($conditional) {
-            print $file "#endif\n";
-        }
-    };
-    enumerateParsedItems($file, $parsedItemsRef, \&writeBackupInitializers);
-
-    print $file <<EOF;
-{
-}
-
-InternalSettingsGenerated::~InternalSettingsGenerated()
-{
-}
-
-void InternalSettingsGenerated::resetToConsistentState()
-{
-EOF
-    sub writeResetToConsistentState($$$) {
-        my ($file, $parsedItemsRef, $settingName) = @_;
-        my %parsedItems = %{ $parsedItemsRef };
-        my $type = $parsedItems{$settingName}{"type"};
-        my $setterFunctionName = setterFunctionName($settingName);
-        my $conditional = $parsedItems{$settingName}{"conditional"};
-        if ($conditional) {
-            print $file "#if " . $InCompiler->conditionalStringFromAttributeValue($conditional) . "\n";
-        }
-        print $file "    m_page->settings().$setterFunctionName(m_$settingName);\n";
-        if ($conditional) {
-            print $file "#endif\n";
-        }
-    };
-    enumerateParsedItems($file, $parsedItemsRef, \&writeResetToConsistentState);
-
-    print $file "}\n";
-
-    sub writeSetterFunctions($$$) {
-        my ($file, $parsedItemsRef, $settingName) = @_;
-        my %parsedItems = %{ $parsedItemsRef };
-        my $type = $parsedItems{$settingName}{"type"};
-        my $conditional = $parsedItems{$settingName}{"conditional"};
-        my $setterFunctionName = setterFunctionName($settingName);
-        $type = "const String&" if $type eq "String";
-
-        print $file "void InternalSettingsGenerated::$setterFunctionName($type $settingName)\n";
-        print $file "{\n";
-
-        if ($conditional) {
-            print $file "#if " . $InCompiler->conditionalStringFromAttributeValue($conditional) . "\n";
-        }
-        print $file "    m_page->settings().$setterFunctionName($settingName);\n";
-        if ($conditional) {
-            print $file "#else\n";
-            print $file "    UNUSED_PARAM($settingName);\n";
-            print $file "#endif\n";
-        }
-        print $file "}\n\n";
-    };
-    enumerateParsedItems($file, $parsedItemsRef, \&writeSetterFunctions);
-
-    print $file "} // namespace WebCore\n";
-
-    close $file;
-}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to