Generate internal.settings from Settings.in
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Jan 2013 20:07:09 +0000 (20:07 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Jan 2013 20:07:09 +0000 (20:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104740

Reviewed by Adam Barth.

.:

* Source/cmake/WebKitMacros.cmake: Specify additional output files from make_settings.pl.

Source/WebCore:

If the setting is declared in Settings.in and is a basic type, generate a
setter function at internals.settings.

InternalSettingsGenerated.idl is created by make_settings.pl. InternalSettings.idl
inherits from InternalSettingsGenerated.idl so we can override generated functions if
needed or add additional custom setters.

This patch removes 2 password echo methods from InternalSettings.idl since they are
auto generated. There are other methods we could remove, but I'll do that in a followup.

No new tests, existing tests should pass. Specifically, editing/input/password* tests should pass.

* CMakeLists.txt: Add generated cpp file to the testing lib.
* DerivedSources.make: Add generated idl file and specify all the outputs of make_settings.pl
* DerivedSources.pri: Generate idl file before generating bindings and include generated idl
for bindings generation.
* GNUmakefile.am: Specify all the generated files of make_settings.pl. Add generated idl to
list of files to be processed and resulting output to be compiled.
* UseJSC.cmake: Add generated idl file to list of idl files to process.
* UseV8.cmake: Same as UseJSC.cmake.
* WebCore.gyp/WebCore.gyp: Run make_settings.pl earlier so we can run the output through the
bindings generator.
* WebCore.gypi: Add new files.
* WebCore.vcproj/WebCoreTestSupport.vcproj: Add new files.
* WebCore.xcodeproj/project.pbxproj: Add new files.
* bindings/scripts/CodeGenerator.pm:
(IDLFileForInterface): Add current directory to the include path so DerivedSources.make can
find the generated idl file.
* page/make_settings.pl:
(generateCode): Generate InternalSettingsGenerated.{idl,h,cpp}.
(generateSettingsMacrosHeader): Rename since we're generating 2 headers now.
(setterFunctionName): Helper function for naming a setter.
(printGetterAndSetter): Use setterFunctionName.
(enumerateParsedItems): Helper function that visits each parsed item.
(generateInternalSettingsIdlFile): Generate idl file.
(generateInternalSettingsHeaderFile): Generate header file.
(generateInternalSettingsCppFile): Generate C++ file.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup): Remove password echo members.
(WebCore::InternalSettings::Backup::restoreTo): Remove password echo members.
(InternalSettingsWrapper): We can't use RefCountedSupplemental because we're we're already
RefCounted. Create a wrapper class to wrap the RefCounted InternalSettings for Supplement<>::provideTo,
which uses an OwnPtr.
(WebCore::InternalSettingsWrapper::InternalSettingsWrapper): Wraps an InternalSettings that the Page can own.
(WebCore::InternalSettingsWrapper::~InternalSettingsWrapper): Clear's m_page when the Page goes away.
(WebCore::InternalSettingsWrapper::internalSettings): Unwrap InternalSettings.
(WebCore::InternalSettings::from): Update to use InternalSettingsWrapper.
(WebCore::InternalSettings::InternalSettings): Call base class constructor.
(WebCore::InternalSettings::resetToConsistentState): Renamed from reset() and pass through to base class.
Also remove unnecessary pageScaleFactor reset (done in Internals::resetToConsistentState).
* testing/InternalSettings.h:
(Backup): Remove password echo members.
(WebCore::InternalSettings::create): Create an instance instead of using new.
(WebCore::InternalSettings::hostDestroyed): Clear the page. This is similar to the code that
RefCountedSupplemental has.
* testing/InternalSettings.idl: Extends InternalSettingsGenerated.
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::resetInternalsObject): Rename to resetToConsistentState to be like other code.
* testing/v8/WebCoreTestSupport.cpp:
(WebCoreTestSupport::resetInternalsObject): Rename to resetToConsistentState to be like other code.
Remove an unused header.

Tools:

* GNUmakefile.am: Compile new generated files on GTK+.
* qmake/mkspecs/features/default_post.prf: Qt: Make it so an action
with both extra_sources and add_output_to_sources=false will still
compile the files in extra_sources. This makes it possible to compile
InternalSettingsGenerated.cpp and not be confused by
InternalSettingsGenerated.idl.

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

23 files changed:
ChangeLog
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/DerivedSources.pri
Source/WebCore/GNUmakefile.am
Source/WebCore/UseJSC.cmake
Source/WebCore/UseV8.cmake
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCoreTestSupport.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/page/make_settings.pl
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebCore/testing/js/WebCoreTestSupport.cpp
Source/WebCore/testing/v8/WebCoreTestSupport.cpp
Source/cmake/WebKitMacros.cmake
Tools/ChangeLog
Tools/GNUmakefile.am
Tools/qmake/mkspecs/features/default_post.prf

index 988b0e4..58cf6af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-01-03  Tony Chang  <tony@chromium.org>
+
+        Generate internal.settings from Settings.in
+        https://bugs.webkit.org/show_bug.cgi?id=104740
+
+        Reviewed by Adam Barth.
+
+        * Source/cmake/WebKitMacros.cmake: Specify additional output files from make_settings.pl.
+
 2013-01-02  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         [EFL][CMAKE] Remove duplicated conditionals
index 4943fe6..021c1d9 100644 (file)
@@ -2943,7 +2943,7 @@ list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/ExceptionCodeDescript
 
 
 GENERATE_SETTINGS_MACROS(${WEBCORE_DIR}/page/Settings.in SettingsMacros.h)
-list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/SettingsMacros.h)
+list(APPEND WebCoreTestSupport_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp)
 
 
 GENERATE_FONT_NAMES(${WEBCORE_DIR}/css/WebKitFontFamilyNames.in)
index 70664e3..7eeac18 100644 (file)
@@ -1,3 +1,72 @@
+2013-01-03  Tony Chang  <tony@chromium.org>
+
+        Generate internal.settings from Settings.in
+        https://bugs.webkit.org/show_bug.cgi?id=104740
+
+        Reviewed by Adam Barth.
+
+        If the setting is declared in Settings.in and is a basic type, generate a
+        setter function at internals.settings.
+
+        InternalSettingsGenerated.idl is created by make_settings.pl. InternalSettings.idl
+        inherits from InternalSettingsGenerated.idl so we can override generated functions if
+        needed or add additional custom setters.
+
+        This patch removes 2 password echo methods from InternalSettings.idl since they are
+        auto generated. There are other methods we could remove, but I'll do that in a followup.
+
+        No new tests, existing tests should pass. Specifically, editing/input/password* tests should pass.
+
+        * CMakeLists.txt: Add generated cpp file to the testing lib.
+        * DerivedSources.make: Add generated idl file and specify all the outputs of make_settings.pl
+        * DerivedSources.pri: Generate idl file before generating bindings and include generated idl
+        for bindings generation.
+        * GNUmakefile.am: Specify all the generated files of make_settings.pl. Add generated idl to
+        list of files to be processed and resulting output to be compiled.
+        * UseJSC.cmake: Add generated idl file to list of idl files to process.
+        * UseV8.cmake: Same as UseJSC.cmake.
+        * WebCore.gyp/WebCore.gyp: Run make_settings.pl earlier so we can run the output through the
+        bindings generator.
+        * WebCore.gypi: Add new files.
+        * WebCore.vcproj/WebCoreTestSupport.vcproj: Add new files.
+        * WebCore.xcodeproj/project.pbxproj: Add new files.
+        * bindings/scripts/CodeGenerator.pm:
+        (IDLFileForInterface): Add current directory to the include path so DerivedSources.make can
+        find the generated idl file.
+        * page/make_settings.pl:
+        (generateCode): Generate InternalSettingsGenerated.{idl,h,cpp}.
+        (generateSettingsMacrosHeader): Rename since we're generating 2 headers now.
+        (setterFunctionName): Helper function for naming a setter.
+        (printGetterAndSetter): Use setterFunctionName.
+        (enumerateParsedItems): Helper function that visits each parsed item.
+        (generateInternalSettingsIdlFile): Generate idl file.
+        (generateInternalSettingsHeaderFile): Generate header file.
+        (generateInternalSettingsCppFile): Generate C++ file.
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::Backup::Backup): Remove password echo members.
+        (WebCore::InternalSettings::Backup::restoreTo): Remove password echo members.
+        (InternalSettingsWrapper): We can't use RefCountedSupplemental because we're we're already
+        RefCounted. Create a wrapper class to wrap the RefCounted InternalSettings for Supplement<>::provideTo,
+        which uses an OwnPtr.
+        (WebCore::InternalSettingsWrapper::InternalSettingsWrapper): Wraps an InternalSettings that the Page can own.
+        (WebCore::InternalSettingsWrapper::~InternalSettingsWrapper): Clear's m_page when the Page goes away.
+        (WebCore::InternalSettingsWrapper::internalSettings): Unwrap InternalSettings.
+        (WebCore::InternalSettings::from): Update to use InternalSettingsWrapper.
+        (WebCore::InternalSettings::InternalSettings): Call base class constructor.
+        (WebCore::InternalSettings::resetToConsistentState): Renamed from reset() and pass through to base class.
+        Also remove unnecessary pageScaleFactor reset (done in Internals::resetToConsistentState).
+        * testing/InternalSettings.h:
+        (Backup): Remove password echo members.
+        (WebCore::InternalSettings::create): Create an instance instead of using new.
+        (WebCore::InternalSettings::hostDestroyed): Clear the page. This is similar to the code that
+        RefCountedSupplemental has.
+        * testing/InternalSettings.idl: Extends InternalSettingsGenerated.
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::resetInternalsObject): Rename to resetToConsistentState to be like other code.
+        * testing/v8/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::resetInternalsObject): Rename to resetToConsistentState to be like other code.
+        Remove an unused header.
+
 2013-01-03  Rik Cabanier  <cabanier@adobe.com>
 
         Canvas blending tests fail on Mac WK2
index 9890f01..77b6cf4 100644 (file)
@@ -618,6 +618,7 @@ BINDING_IDLS = \
     $(WebCore)/xml/XPathNSResolver.idl \
     $(WebCore)/xml/XPathResult.idl \
     $(WebCore)/xml/XSLTProcessor.idl \
+    InternalSettingsGenerated.idl
 #
 
 .PHONY : all
@@ -927,9 +928,7 @@ MathMLElementFactory.cpp MathMLNames.cpp : dom/make_names.pl mathml/mathtags.in
 
 # --------
 
-all : SettingsMacros.h
-
-SettingsMacros.h : page/make_settings.pl page/Settings.in
+InternalSettingsGenerated.idl InternalSettingsGenerated.cpp InternalSettingsGenerated.h SettingsMacros.h : page/make_settings.pl page/Settings.in
        perl -I $(WebCore)/bindings/scripts $< --input $(WebCore)/page/Settings.in
 
 # --------
index d58afb9..fb72e94 100644 (file)
@@ -693,6 +693,21 @@ cssvalues.depends = ${QMAKE_FILE_NAME} $${EXTRACSSVALUES} $$cssvalues.script
 cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_FUNC_FILE_OUT_PATH}/${QMAKE_FILE_BASE}.h
 GENERATORS += cssvalues
 
+INTERNAL_SETTINGS_GENERATED_IDL = InternalSettingsGenerated.idl
+# GENERATOR 6-C:
+settingsmacros.output = $$INTERNAL_SETTINGS_GENERATED_IDL InternalSettingsGenerated.cpp
+settingsmacros.input = SETTINGS_MACROS
+settingsmacros.script = $$PWD/page/make_settings.pl
+settingsmacros.commands = perl -I$$PWD/bindings/scripts $$settingsmacros.script --input $$SETTINGS_MACROS --outputDir ${QMAKE_FUNC_FILE_OUT_PATH}
+settingsmacros.depends = $$PWD/page/make_settings.pl $$SETTINGS_MACROS
+settingsmacros.add_output_to_sources = false
+settingsmacros.extra_sources = InternalSettingsGenerated.cpp
+GENERATORS += settingsmacros
+
+# make_settings.pl generates this file. We can't use ${QMAKE_FUNC_FILE_OUT_PATH} here since generateBindings.input
+# doesn't know how to resolve ${QMAKE_FUNC_FILE_OUT_PATH}.
+IDL_BINDINGS += generated/$$INTERNAL_SETTINGS_GENERATED_IDL
+
 # GENERATOR 0: Resolve [Supplemental] dependency in IDLs
 SUPPLEMENTAL_DEPENDENCY_FILE = supplemental_dependency.tmp
 IDL_FILES_TMP = ${QMAKE_FUNC_FILE_OUT_PATH}/idl_files.tmp
@@ -871,14 +886,6 @@ exceptioncodedescription.commands = perl -I$$PWD/bindings/scripts $$exceptioncod
 exceptioncodedescription.depends = $$PWD/dom/make_dom_exceptions.pl $$DOM_EXCEPTIONS
 GENERATORS += exceptioncodedescription
 
-# GENERATOR 5-H:
-settingsmacros.output = SettingsMacros.h
-settingsmacros.input = SETTINGS_MACROS
-settingsmacros.script = $$PWD/page/make_settings.pl
-settingsmacros.commands = perl -I$$PWD/bindings/scripts $$settingsmacros.script --input $$SETTINGS_MACROS --outputDir ${QMAKE_FUNC_FILE_OUT_PATH}
-settingsmacros.depends = $$PWD/page/make_settings.pl $$SETTINGS_MACROS
-GENERATORS += settingsmacros
-
 # GENERATOR 8-A:
 entities.output = HTMLEntityTable.cpp
 entities.input = HTML_ENTITIES
index 02c4c6d..bd07b3d 100644 (file)
@@ -462,9 +462,12 @@ DerivedSources/WebCore/EventTargetHeaders.h DerivedSources/WebCore/EventTargetIn
 DerivedSources/WebCore/ExceptionCodeDescription.cpp DerivedSources/WebCore/ExceptionCodeDescription.h DerivedSources/WebCore/ExceptionHeaders.h DerivedSources/WebCore/ExceptionInterfaces.h: $(WebCore)/dom/make_dom_exceptions.pl $(WebCore)/dom/DOMExceptions.in
        $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --input $(WebCore)/dom/DOMExceptions.in --outputDir "$(GENSOURCES_WEBCORE)"
 
-DerivedSources/WebCore/SettingsMacros.h: $(WebCore)/page/make_settings.pl $(WebCore)/page/Settings.in
+DerivedSources/WebCore/SettingsMacros.h DerivedSources/WebCore/InternalSettingsGenerated.idl DerivedSources/WebCore/InternalSettingsGenerated.cpp DerivedSources/WebCore/InternalSettingsGenerated.h: $(WebCore)/page/make_settings.pl $(WebCore)/page/Settings.in
        $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --input $(WebCore)/page/Settings.in --outputDir "$(GENSOURCES_WEBCORE)"
 
+dom_binding_idls += \
+  DerivedSources/WebCore/InternalSettingsGenerated.idl
+
 # All Web Inspector generated files are created with this one call to CodeGeneratorInspector.py
 DerivedSources/WebCore/InspectorProtocolVersion.h : $(WebCore)/inspector/Inspector.json $(WebCore)/inspector/generate-inspector-protocol-version
        $(AM_V_GEN)$(PYTHON) $(WebCore)/inspector/generate-inspector-protocol-version -o $(GENSOURCES_WEBCORE)/InspectorProtocolVersion.h $(WebCore)/inspector/Inspector.json
@@ -550,6 +553,10 @@ DerivedSources/WebCore/JS%.cpp: DerivedSources/WebCore/JS%.h;
 DerivedSources/WebCore/JS%.h: %.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file)
        $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $<
 
+.SECONDARY:
+DerivedSources/WebCore/JSInternalSettingsGenerated.h: DerivedSources/WebCore/InternalSettingsGenerated.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file)
+       $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $<
+
 # See https://bugs.webkit.org/show_bug.cgi?id=76388
 # We need to introduce a manual dependency to prevent non-generated sources from
 # trying to build before the generated ones. This can happen if the supplemental
index edac2e4..a301dc9 100644 (file)
@@ -304,6 +304,10 @@ foreach (_idl ${WebCoreTestSupport_IDL_FILES})
     set(IDL_FILES_LIST "${IDL_FILES_LIST}${WEBCORE_DIR}/${_idl}\n")
 endforeach ()
 
+set(IDL_FILES_LIST "${IDL_FILES_LIST}${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl\n")
+list(APPEND IDL_INCLUDES --include=${DERIVED_SOURCES_WEBCORE_DIR})
+list(APPEND WebCoreTestSupport_IDL_FILES ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl)
+
 file(WRITE ${IDL_FILES_TMP} ${IDL_FILES_LIST})
 
 add_custom_command(
index 4a08148..11b4476 100644 (file)
@@ -255,6 +255,10 @@ foreach (_idl ${WebCoreTestSupport_IDL_FILES})
     set(IDL_FILES_LIST "${IDL_FILES_LIST}${WEBCORE_DIR}/${_idl}\n")
 endforeach ()
 
+set(IDL_FILES_LIST "${IDL_FILES_LIST}${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl\n")
+list(APPEND WebCoreTestSupport_IDL_FILES ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl)
+list(APPEND IDL_INCLUDES --include=${DERIVED_SOURCES_WEBCORE_DIR})
+
 file(WRITE ${IDL_FILES_TMP} ${IDL_FILES_LIST})
 
 add_custom_command(
index 3fb2d6e..bec2dcb 100644 (file)
       ]
     },
     {
+      'target_name': 'generate_settings',
+      'type': 'none',
+      'actions': [
+        {
+          'action_name': 'Settings',
+          'inputs': [
+            '../page/make_settings.pl',
+            '../page/Settings.in',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/SettingsMacros.h',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalSettingsGenerated.idl',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalSettingsGenerated.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalSettingsGenerated.h',
+          ],
+          'action': [
+            'python',
+            'scripts/action_makenames.py',
+            '<@(_outputs)',
+            '--',
+            '<@(_inputs)',
+          ],
+        },
+      ]
+    },
+    {
       'target_name': 'generate_supplemental_dependency',
       'type': 'none',
       'actions': [
-         {
+        {
           'action_name': 'generateSupplementalDependency',
           'variables': {
             # Write sources into a file, so that the action command line won't
       'hard_dependency': 1,
       'dependencies': [
         'generate_supplemental_dependency',
+        'generate_settings',
       ],
       'sources': [
         # bison rule
           ],
         },
         {
-          'action_name': 'Settings',
-          'inputs': [
-            '../page/make_settings.pl',
-            '../page/Settings.in',
-          ],
-          'outputs': [
-            '<(SHARED_INTERMEDIATE_DIR)/webkit/SettingsMacros.h',
-          ],
-          'action': [
-            'python',
-            'scripts/action_makenames.py',
-            '<@(_outputs)',
-            '--',
-            '<@(_inputs)',
-          ],
-        },
-        {
           'action_name': 'UserAgentStyleSheets',
           'variables': {
             'scripts': [
               '--include', '../testing',
               '--include', '../workers',
               '--include', '../xml',
+              '--include', '<(SHARED_INTERMEDIATE_DIR)/webkit',
             ],
           },
           'msvs_cygwin_shell': 0,
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8Internals.h',
         '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8InternalSettings.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalSettings.h',
+        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8InternalSettingsGenerated.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalSettingsGenerated.h',
       ],
       'sources/': [
         ['exclude', 'testing/js'],
index 3387bcb..3967497 100644 (file)
           'testing/Internals.idl',
           'testing/InternalSettings.idl',
           'testing/MallocStatistics.idl',
+          '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalSettingsGenerated.idl',
         ],
         'webcore_test_support_files': [
             'inspector/InspectorFrontendClientLocal.cpp',
             'testing/MallocStatistics.h',
             'testing/MockPagePopupDriver.cpp',
             'testing/MockPagePopupDriver.h',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalSettingsGenerated.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalSettingsGenerated.h',
         ],
         'webinspector_files': [
             'inspector/front-end/inspector.html',
index 501f9da..9c54f4e 100644 (file)
                        Name="DerivedSources"
                        >
                        <File
+                               RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\InternalSettingsGenerated.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_Cairo_CFLite|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_Cairo_CFLite|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_All|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Production|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\InternalSettingsGenerated.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSMallocStatistics.cpp"
                                >
                                <FileConfiguration
                                RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSInternalSettings.h"
                                >
                        </File>
+                       <File
+                               RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSInternalSettingsGenerated.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_Cairo_CFLite|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_Cairo_CFLite|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_All|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Production|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               UsePrecompiledHeader="0"
+                                               DisableSpecificWarnings="4065;4273;4565;4701;4702"
+                                               ForcedIncludeFiles="$(NOINHERIT)"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSInternalSettingsGenerated.h"
+                               >
+                       </File>
                </Filter>
                <Filter
                        Name="testing"
index 2a673a7..9b09289 100644 (file)
                5317612313C516690026E454 /* StyleFlexibleBoxData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5317612113C516690026E454 /* StyleFlexibleBoxData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                53C8298D13D8D92700DE2DEB /* RenderFlexibleBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53C8298B13D8D92700DE2DEB /* RenderFlexibleBox.cpp */; };
                53C8298E13D8D92700DE2DEB /* RenderFlexibleBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */; };
+               53E29E5E167A8A1900586D3D /* InternalSettingsGenerated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */; };
+               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 */; };
                5317612113C516690026E454 /* StyleFlexibleBoxData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleFlexibleBoxData.h; path = style/StyleFlexibleBoxData.h; sourceTree = "<group>"; };
                53C8298B13D8D92700DE2DEB /* RenderFlexibleBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFlexibleBox.cpp; sourceTree = "<group>"; };
                53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFlexibleBox.h; sourceTree = "<group>"; };
+               53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InternalSettingsGenerated.cpp; sourceTree = "<group>"; };
+               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; };
                                417DA71C13735DFA007C57FB /* JSInternals.h */,
                                A7B4EA7814C9348400C8F5BF /* JSInternalSettings.cpp */,
                                A7B4EA7914C9348400C8F5BF /* JSInternalSettings.h */,
+                               53ED3FDC167A88E7006762E6 /* JSInternalSettingsGenerated.cpp */,
+                               53ED3FDD167A88E7006762E6 /* JSInternalSettingsGenerated.h */,
                                A7B4EA6814C9348400C8F5BF /* JSMallocStatistics.cpp */,
                                A7B4EA6914C9348400C8F5BF /* JSMallocStatistics.h */,
                        );
                                A8BC04911214F69600B5F122 /* HTMLEntityTable.cpp */,
                                A8D06B380A265DCD005E7203 /* HTMLNames.cpp */,
                                A8D06B370A265DCD005E7203 /* HTMLNames.h */,
+                               53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */,
+                               53E29E5D167A8A1900586D3D /* InternalSettingsGenerated.h */,
                                938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */,
                                938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */,
                                8574D1F10ADE6122004CBA11 /* JSSVGElementWrapperFactory.cpp */,
                                A740B5A514C935AB00A77FA4 /* JSInternalSettings.h in Headers */,
                                A740B59514C935AB00A77FA4 /* JSMallocStatistics.h in Headers */,
                                41815C1F138319830057AAA4 /* WebCoreTestSupport.h in Headers */,
+                               53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */,
+                               53E29E5F167A8A1900586D3D /* InternalSettingsGenerated.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */,
                                A740B59714C935AF00A77FA4 /* JSMallocStatistics.cpp in Sources */,
                                41815C1E138319830057AAA4 /* WebCoreTestSupport.cpp in Sources */,
+                               53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */,
+                               53E29E5E167A8A1900586D3D /* InternalSettingsGenerated.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 78c63d6..86d8012 100644 (file)
@@ -267,6 +267,7 @@ sub IDLFileForInterface
     unless ($idlFiles) {
         my $sourceRoot = $ENV{SOURCE_ROOT};
         my @directories = map { $_ = "$sourceRoot/$_" if $sourceRoot && -d "$sourceRoot/$_"; $_ } @$useDirectories;
+        push(@directories, ".");
 
         $idlFiles = { };
 
index d99cc0f..c8db267 100755 (executable)
@@ -30,6 +30,16 @@ 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 (
@@ -49,10 +59,13 @@ sub generateCode()
     my $parsedParametersRef = shift;
     my $parsedItemsRef = shift;
 
-    generateHeader($parsedItemsRef);
+    generateSettingsMacrosHeader($parsedItemsRef);
+    generateInternalSettingsIdlFile($parsedItemsRef);
+    generateInternalSettingsHeaderFile($parsedItemsRef);
+    generateInternalSettingsCppFile($parsedItemsRef);
 }
 
-sub generateHeader($)
+sub generateSettingsMacrosHeader($)
 {
     my $parsedItemsRef = shift;
 
@@ -198,14 +211,21 @@ sub printMemberVariables($$$$)
     print $file "// End of SETTINGS_MEMBER_VARIABLES.\n\n";
 }
 
-sub printGetterAndSetter($$$)
+sub setterFunctionName($)
 {
-    my ($file, $settingName, $type) = @_;
+    my $settingName = shift;
     my $setterFunctionName = "set" . $settingName;
     substr($setterFunctionName, 3, 1) = uc(substr($setterFunctionName, 3, 1));
     if (substr($settingName, 0, 3) eq "css" || substr($settingName, 0, 3) eq "xss" || substr($settingName, 0, 3) eq "ftp") {
         substr($setterFunctionName, 3, 3) = uc(substr($setterFunctionName, 3, 3));
     }
+    return $setterFunctionName;
+}
+
+sub printGetterAndSetter($$$)
+{
+    my ($file, $settingName, $type) = @_;
+    my $setterFunctionName = setterFunctionName($settingName);
     if (lc(substr($type, 0, 1)) eq substr($type, 0, 1)) {
         print $file "    $type $settingName() const { return m_$settingName; } \\\n";
         print $file "    void $setterFunctionName($type $settingName) { m_$settingName = $settingName; } \\\n";
@@ -253,3 +273,206 @@ sub printInitializer($$$)
     return if ($initialValue eq '');
     print $file "    , m_$settingName($initialValue) \\\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 "    OmitConstructor\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(in $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;
+#ifndef InternalSettingsGenerated_h
+#define InternalSettingsGenerated_h
+
+#include "RefCountedSupplement.h"
+#include <wtf/PassRefPtr.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";
+    print $file "#endif // InternalSettingsGenerated_h\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;
+}
index 2fc6dd2..3a29c8d 100644 (file)
@@ -35,6 +35,7 @@
 #include "Page.h"
 #include "RuntimeEnabledFeatures.h"
 #include "Settings.h"
+#include "Supplementable.h"
 #include "TextRun.h"
 
 #if ENABLE(INPUT_TYPE_COLOR)
@@ -62,9 +63,7 @@
 namespace WebCore {
 
 InternalSettings::Backup::Backup(Settings* settings)
-    : m_originalPasswordEchoDurationInSeconds(settings->passwordEchoDurationInSeconds())
-    , m_originalPasswordEchoEnabled(settings->passwordEchoEnabled())
-    , m_originalFixedElementsLayoutRelativeToFrame(settings->fixedElementsLayoutRelativeToFrame())
+    : m_originalFixedElementsLayoutRelativeToFrame(settings->fixedElementsLayoutRelativeToFrame())
     , m_originalCSSExclusionsEnabled(RuntimeEnabledFeatures::cssExclusionsEnabled())
     , m_originalCSSVariablesEnabled(settings->cssVariablesEnabled())
 #if ENABLE(SHADOW_DOM)
@@ -109,8 +108,6 @@ InternalSettings::Backup::Backup(Settings* settings)
 
 void InternalSettings::Backup::restoreTo(Settings* settings)
 {
-    settings->setPasswordEchoDurationInSeconds(m_originalPasswordEchoDurationInSeconds);
-    settings->setPasswordEchoEnabled(m_originalPasswordEchoEnabled);
     settings->setFixedElementsLayoutRelativeToFrame(m_originalFixedElementsLayoutRelativeToFrame);
     RuntimeEnabledFeatures::setCSSExclusionsEnabled(m_originalCSSExclusionsEnabled);
     settings->setCSSVariablesEnabled(m_originalCSSVariablesEnabled);
@@ -153,12 +150,29 @@ void InternalSettings::Backup::restoreTo(Settings* settings)
 #endif
 }
 
+// We can't use RefCountedSupplement because that would try to make InternalSettings RefCounted
+// and InternalSettings is already RefCounted via its base class, InternalSettingsGenerated.
+// Instead, we manually make InternalSettings supplement Page.
+class InternalSettingsWrapper : public Supplement<Page> {
+public:
+    explicit InternalSettingsWrapper(Page* page)
+        : m_internalSettings(InternalSettings::create(page)) { }
+    virtual ~InternalSettingsWrapper() { m_internalSettings->hostDestroyed(); }
+#if !ASSERT_DISABLED
+    virtual bool isRefCountedWrapper() const OVERRIDE { return true; }
+#endif
+    InternalSettings* internalSettings() const { return m_internalSettings.get(); }
+
+private:
+    RefPtr<InternalSettings> m_internalSettings;
+};
+
 InternalSettings* InternalSettings::from(Page* page)
 {
     DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings", AtomicString::ConstructFromLiteral));
-    if (!SuperType::from(page, name))
-        SuperType::provideTo(page, name, adoptRef(new InternalSettings(page)));
-    return static_cast<InternalSettings*>(SuperType::from(page, name));
+    if (!Supplement<Page>::from(page, name))
+        Supplement<Page>::provideTo(page, name, adoptPtr(new InternalSettingsWrapper(page)));
+    return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, name))->internalSettings();
 }
 
 InternalSettings::~InternalSettings()
@@ -166,18 +180,21 @@ InternalSettings::~InternalSettings()
 }
 
 InternalSettings::InternalSettings(Page* page)
-    : m_page(page)
+    : InternalSettingsGenerated(page)
+    , m_page(page)
     , m_backup(page->settings())
 {
 }
 
-void InternalSettings::reset()
+void InternalSettings::resetToConsistentState()
 {
     page()->setPageScaleFactor(1, IntPoint(0, 0));
     page()->setCanStartMedia(true);
 
     m_backup.restoreTo(settings());
     m_backup = Backup(settings());
+
+    InternalSettingsGenerated::resetToConsistentState();
 }
 
 Settings* InternalSettings::settings() const
@@ -229,18 +246,6 @@ void InternalSettings::setMockScrollbarsEnabled(bool enabled, ExceptionCode& ec)
     settings()->setMockScrollbarsEnabled(enabled);
 }
 
-void InternalSettings::setPasswordEchoEnabled(bool enabled, ExceptionCode& ec)
-{
-    InternalSettingsGuardForSettings();
-    settings()->setPasswordEchoEnabled(enabled);
-}
-
-void InternalSettings::setPasswordEchoDurationInSeconds(double durationInSeconds, ExceptionCode& ec)
-{
-    InternalSettingsGuardForSettings();
-    settings()->setPasswordEchoDurationInSeconds(durationInSeconds);
-}
-
 void InternalSettings::setFixedElementsLayoutRelativeToFrame(bool enabled, ExceptionCode& ec)
 {
     InternalSettingsGuardForSettings();
index 3f55fd2..e380e1b 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "EditingBehaviorTypes.h"
 #include "IntSize.h"
-#include "RefCountedSupplement.h"
+#include "InternalSettingsGenerated.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -42,15 +42,13 @@ class Document;
 class Page;
 class Settings;
 
-class InternalSettings : public RefCountedSupplement<Page, InternalSettings> {
+class InternalSettings : public InternalSettingsGenerated {
 public:
     class Backup {
     public:
-        Backup(Settings*);
+        explicit Backup(Settings*);
         void restoreTo(Settings*);
 
-        double m_originalPasswordEchoDurationInSeconds;
-        bool m_originalPasswordEchoEnabled;
         bool m_originalFixedElementsLayoutRelativeToFrame;
         bool m_originalCSSExclusionsEnabled;
         bool m_originalCSSVariablesEnabled;
@@ -94,11 +92,15 @@ public:
 #endif
     };
 
-    typedef RefCountedSupplement<Page, InternalSettings> SuperType;
+    static PassRefPtr<InternalSettings> create(Page* page)
+    {
+        return adoptRef(new InternalSettings(page));
+    }
     static InternalSettings* from(Page*);
+    void hostDestroyed() { m_page = 0; }
 
     virtual ~InternalSettings();
-    void reset();
+    void resetToConsistentState();
 
     void setForceCompositingMode(bool enabled, ExceptionCode&);
     void setEnableCompositingForFixedPosition(bool enabled, ExceptionCode&);
@@ -108,8 +110,6 @@ public:
     void setAcceleratedFiltersEnabled(bool enabled, ExceptionCode&);
     void setMockScrollbarsEnabled(bool enabled, ExceptionCode&);
     void setUsesOverlayScrollbars(bool enabled, ExceptionCode&);
-    void setPasswordEchoEnabled(bool enabled, ExceptionCode&);
-    void setPasswordEchoDurationInSeconds(double durationInSeconds, ExceptionCode&);
     void setFixedElementsLayoutRelativeToFrame(bool, ExceptionCode&);
     void setUnifiedTextCheckingEnabled(bool, ExceptionCode&);
     bool unifiedTextCheckingEnabled(ExceptionCode&);
@@ -152,7 +152,6 @@ public:
 
 private:
     explicit InternalSettings(Page*);
-    virtual void hostDestroyed() OVERRIDE { m_page = 0; }
 
     Settings* settings() const;
     Page* page() const { return m_page; }
index 7e571ca..00509ca 100644 (file)
@@ -24,8 +24,9 @@
  */
 
 [
-    OmitConstructor
-] interface InternalSettings {
+    OmitConstructor,
+    JSGenerateToJSObject
+] interface InternalSettings : InternalSettingsGenerated {
     void setForceCompositingMode(in boolean enabled) raises(DOMException);
     void setEnableCompositingForFixedPosition(in boolean enabled) raises(DOMException);
     void setEnableCompositingForScrollableFrames(in boolean enabled) raises(DOMException);
@@ -33,8 +34,6 @@
     void setAcceleratedDrawingEnabled(in boolean enabled) raises(DOMException);
     void setAcceleratedFiltersEnabled(in boolean enabled) raises(DOMException);
     void setMockScrollbarsEnabled(in boolean enabled) raises(DOMException);
-    void setPasswordEchoEnabled(in boolean enabled) raises(DOMException);
-    void setPasswordEchoDurationInSeconds(in double durationInSeconds) raises(DOMException);
     void setFixedElementsLayoutRelativeToFrame(in boolean enabled) raises(DOMException);
     void setUnifiedTextCheckingEnabled(in boolean enabled) raises (DOMException);
     boolean unifiedTextCheckingEnabled() raises (DOMException);
index 20bc930..823b3ac 100644 (file)
@@ -58,7 +58,7 @@ void resetInternalsObject(JSContextRef context)
     ASSERT(scriptContext->isDocument());
     Page* page = static_cast<Document*>(scriptContext)->frame()->page();
     Internals::resetToConsistentState(page);
-    InternalSettings::from(page)->reset();
+    InternalSettings::from(page)->resetToConsistentState();
 }
 
 }
index 8633ddf..1dcd606 100644 (file)
@@ -32,7 +32,6 @@
 #include "Internals.h"
 #include "ScriptExecutionContext.h"
 #include "V8Internals.h"
-#include "V8PagePopupController.h"
 
 #include <v8.h>
 
@@ -63,7 +62,7 @@ void resetInternalsObject(v8::Local<v8::Context> context)
     ASSERT(scriptContext->isDocument());
     Page* page = static_cast<Document*>(scriptContext)->frame()->page();
     Internals::resetToConsistentState(page);
-    InternalSettings::from(page)->reset();
+    InternalSettings::from(page)->resetToConsistentState();
 }
 
 }
index ac536a2..5d971a0 100644 (file)
@@ -100,7 +100,7 @@ macro(GENERATE_SETTINGS_MACROS _infile _outfile)
     set(NAMES_GENERATOR ${WEBCORE_DIR}/page/make_settings.pl)
 
     add_custom_command(
-        OUTPUT  ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile} ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.h ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl
         MAIN_DEPENDENCY ${_infile}
         DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
         COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
index 8f7ee1d..b67312f 100644 (file)
@@ -1,3 +1,17 @@
+2013-01-03  Tony Chang  <tony@chromium.org>
+
+        Generate internal.settings from Settings.in
+        https://bugs.webkit.org/show_bug.cgi?id=104740
+
+        Reviewed by Adam Barth.
+
+        * GNUmakefile.am: Compile new generated files on GTK+.
+        * qmake/mkspecs/features/default_post.prf: Qt: Make it so an action
+        with both extra_sources and add_output_to_sources=false will still
+        compile the files in extra_sources. This makes it possible to compile
+        InternalSettingsGenerated.cpp and not be confused by
+        InternalSettingsGenerated.idl.
+
 2013-01-03  Zan Dobersek  <zandobersek@gmail.com>
 
         [style] WebIDL-reflecting uppercase enums reported as style violation
index 02dc6ed..a9bab90 100644 (file)
@@ -58,12 +58,16 @@ libWebCoreInternals_la_SOURCES = \
        Source/WebCore/testing/js/WebCoreTestSupport.h
 
 libwebcoreinternals_built_sources += \
+       DerivedSources/WebCore/InternalSettingsGenerated.cpp \
+       DerivedSources/WebCore/InternalSettingsGenerated.h   \
        DerivedSources/WebCore/JSMallocStatistics.cpp \
        DerivedSources/WebCore/JSMallocStatistics.h   \
        DerivedSources/WebCore/JSInternals.cpp \
        DerivedSources/WebCore/JSInternals.h   \
        DerivedSources/WebCore/JSInternalSettings.cpp \
-       DerivedSources/WebCore/JSInternalSettings.h
+       DerivedSources/WebCore/JSInternalSettings.h   \
+       DerivedSources/WebCore/JSInternalSettingsGenerated.cpp \
+       DerivedSources/WebCore/JSInternalSettingsGenerated.h
 
 nodist_libWebCoreInternals_la_SOURCES = $(libwebcoreinternals_built_sources)
 BUILT_SOURCES += $(libwebcoreinternals_built_sources)
index d99aa60..c8905b0 100644 (file)
@@ -121,6 +121,9 @@ contains(TEMPLATE, derived) {
 } else {
     # Make sure the generated sources are compiled as well
     for(generator, GENERATORS) {
+        prependEach($${generator}.extra_sources, $${GENERATED_SOURCES_DESTDIR}/)
+        SOURCES += $$eval($${generator}.extra_sources)
+
         isEqual($${generator}.add_output_to_sources, false): next()
 
         output = $$eval($${generator}.output)
@@ -146,9 +149,6 @@ contains(TEMPLATE, derived) {
                 eval($$output_variable += $$output_file)
             }
         }
-
-        prependEach($${generator}.extra_sources, $${GENERATED_SOURCES_DESTDIR}/)
-        SOURCES += $$eval($${generator}.extra_sources)
     }
 }