[chromium] removed unused preferences from testRunner.overridePreference
authorjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2012 18:46:33 +0000 (18:46 +0000)
committerjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2012 18:46:33 +0000 (18:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=105169

Reviewed by Tony Chang.

Most notably this removes the code related to font family maps which is
now handled via window.internals.settings

* DumpRenderTree/chromium/TestRunner/public/WebPreferences.h:
(WebPreferences):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::overridePreference):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp:
(WebTestRunner::WebPreferences::applyTo):

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

Tools/ChangeLog
Tools/DumpRenderTree/chromium/TestRunner/public/WebPreferences.h
Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
Tools/DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp

index 87bffba..8bdaed3 100644 (file)
@@ -1,3 +1,22 @@
+2012-12-17  Jochen Eisinger  <jochen@chromium.org>
+
+        [chromium] removed unused preferences from testRunner.overridePreference
+        https://bugs.webkit.org/show_bug.cgi?id=105169
+
+        Reviewed by Tony Chang.
+
+        Most notably this removes the code related to font family maps which is
+        now handled via window.internals.settings
+
+        * DumpRenderTree/chromium/TestRunner/public/WebPreferences.h:
+        (WebPreferences):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::overridePreference):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp:
+        (WebTestRunner::WebPreferences::applyTo):
+
 2012-12-17  James Robinson  <jamesr@chromium.org>
 
         [chromium] Move creation of WebLayerTreeView to WebWidgetClient
index f3a3507..15d4e07 100644 (file)
@@ -34,7 +34,6 @@
 #include "Platform/chromium/public/WebString.h"
 #include "Platform/chromium/public/WebURL.h"
 #include "WebKit/chromium/public/WebSettings.h"
-#include <map>
 
 namespace WebKit {
 class WebView;
@@ -50,15 +49,6 @@ struct WebPreferences {
     WebKit::WebString cursiveFontFamily;
     WebKit::WebString fantasyFontFamily;
 
-    // Map of UScriptCode to font such as USCRIPT_ARABIC to "My Arabic Font".
-    typedef std::map<int, WebKit::WebString> ScriptFontFamilyMap;
-    ScriptFontFamilyMap standardFontMap;
-    ScriptFontFamilyMap fixedFontMap;
-    ScriptFontFamilyMap serifFontMap;
-    ScriptFontFamilyMap sansSerifFontMap;
-    ScriptFontFamilyMap cursiveFontMap;
-    ScriptFontFamilyMap fantasyFontMap;
-
     int defaultFontSize;
     int defaultFixedFontSize;
     int minimumFontSize;
index 46e5201..075d63a 100644 (file)
@@ -60,27 +60,6 @@ using namespace std;
 
 namespace WebTestRunner {
 
-namespace {
-
-// Sets map based on scriptFontPairs, a collapsed vector of pairs of ISO 15924
-// four-letter script code and font such as:
-// { "Arab", "My Arabic Font", "Grek", "My Greek Font" }
-static void setFontMap(WebPreferences::ScriptFontFamilyMap& map, const Vector<WebString>& scriptFontPairs)
-{
-    map.clear();
-    size_t i = 0;
-    while (i + 1 < scriptFontPairs.size()) {
-        const WebString& script = scriptFontPairs[i++];
-        const WebString& font = scriptFontPairs[i++];
-
-        int32_t code = u_getPropertyValueEnum(UCHAR_SCRIPT, script.utf8().data());
-        if (code >= 0 && code < USCRIPT_CODE_LIMIT)
-            map[static_cast<int>(code)] = font;
-    }
-}
-
-}
-
 TestRunner::TestRunner()
     : m_delegate(0)
     , m_webView(0)
@@ -794,72 +773,26 @@ void TestRunner::overridePreference(const CppArgumentList& arguments, CppVariant
     string key = arguments[0].toString();
     CppVariant value = arguments[1];
     WebPreferences* prefs = m_delegate->preferences();
-    if (key == "WebKitStandardFont")
-        prefs->standardFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitFixedFont")
-        prefs->fixedFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitSerifFont")
-        prefs->serifFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitSansSerifFont")
-        prefs->sansSerifFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitCursiveFont")
-        prefs->cursiveFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitFantasyFont")
-        prefs->fantasyFontFamily = cppVariantToWebString(value);
-    else if (key == "WebKitStandardFontMap")
-        setFontMap(prefs->standardFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitFixedFontMap")
-        setFontMap(prefs->fixedFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitSerifFontMap")
-        setFontMap(prefs->serifFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitSansSerifFontMap")
-        setFontMap(prefs->sansSerifFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitCursiveFontMap")
-        setFontMap(prefs->cursiveFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitFantasyFontMap")
-        setFontMap(prefs->fantasyFontMap, cppVariantToWebStringArray(value));
-    else if (key == "WebKitDefaultFontSize")
+    if (key == "WebKitDefaultFontSize")
         prefs->defaultFontSize = cppVariantToInt32(value);
-    else if (key == "WebKitDefaultFixedFontSize")
-        prefs->defaultFixedFontSize = cppVariantToInt32(value);
     else if (key == "WebKitMinimumFontSize")
         prefs->minimumFontSize = cppVariantToInt32(value);
-    else if (key == "WebKitMinimumLogicalFontSize")
-        prefs->minimumLogicalFontSize = cppVariantToInt32(value);
     else if (key == "WebKitDefaultTextEncodingName")
         prefs->defaultTextEncodingName = cppVariantToWebString(value);
     else if (key == "WebKitJavaScriptEnabled")
         prefs->javaScriptEnabled = cppVariantToBool(value);
-    else if (key == "WebKitWebSecurityEnabled")
-        prefs->webSecurityEnabled = cppVariantToBool(value);
-    else if (key == "WebKitJavaScriptCanOpenWindowsAutomatically")
-        prefs->javaScriptCanOpenWindowsAutomatically = cppVariantToBool(value);
     else if (key == "WebKitSupportsMultipleWindows")
         prefs->supportsMultipleWindows = cppVariantToBool(value);
     else if (key == "WebKitDisplayImagesKey")
         prefs->loadsImagesAutomatically = cppVariantToBool(value);
     else if (key == "WebKitPluginsEnabled")
         prefs->pluginsEnabled = cppVariantToBool(value);
-    else if (key == "WebKitDOMPasteAllowedPreferenceKey")
-        prefs->DOMPasteAllowed = cppVariantToBool(value);
-    else if (key == "WebKitDeveloperExtrasEnabledPreferenceKey")
-        prefs->developerExtrasEnabled = cppVariantToBool(value);
-    else if (key == "WebKitShrinksStandaloneImagesToFit")
-        prefs->shrinksStandaloneImagesToFit = cppVariantToBool(value);
-    else if (key == "WebKitTextAreasAreResizable")
-        prefs->textAreasAreResizable = cppVariantToBool(value);
     else if (key == "WebKitJavaEnabled")
         prefs->javaEnabled = cppVariantToBool(value);
     else if (key == "WebKitUsesPageCachePreferenceKey")
         prefs->usesPageCache = cppVariantToBool(value);
     else if (key == "WebKitPageCacheSupportsPluginsPreferenceKey")
         prefs->pageCacheSupportsPlugins = cppVariantToBool(value);
-    else if (key == "WebKitJavaScriptCanAccessClipboard")
-        prefs->javaScriptCanAccessClipboard = cppVariantToBool(value);
-    else if (key == "WebKitXSSAuditorEnabled")
-        prefs->XSSAuditorEnabled = cppVariantToBool(value);
-    else if (key == "WebKitLocalStorageEnabledPreferenceKey")
-        prefs->localStorageEnabled = cppVariantToBool(value);
     else if (key == "WebKitOfflineWebApplicationCacheEnabled")
         prefs->offlineWebApplicationCacheEnabled = cppVariantToBool(value);
     else if (key == "WebKitTabToLinksPreferenceKey")
@@ -950,19 +883,6 @@ WebString TestRunner::cppVariantToWebString(const CppVariant& value)
     return WebString::fromUTF8(value.toString());
 }
 
-Vector<WebString> TestRunner::cppVariantToWebStringArray(const CppVariant& value)
-{
-    if (!value.isObject()) {
-        printErrorMessage("Invalid value for preference. Expected object value.");
-        return Vector<WebString>();
-    }
-    Vector<WebString> resultVector;
-    Vector<string> stringVector = value.toStringVector();
-    for (size_t i = 0; i < stringVector.size(); ++i)
-        resultVector.append(WebString::fromUTF8(stringVector[i].c_str()));
-    return resultVector;
-}
-
 void TestRunner::printErrorMessage(const string& text)
 {
     m_delegate->printMessage(string("CONSOLE MESSAGE: ") + text + "\n");
index 6e6778e..345a134 100644 (file)
@@ -60,7 +60,6 @@ protected:
     bool cppVariantToBool(const CppVariant&);
     int32_t cppVariantToInt32(const CppVariant&);
     WebKit::WebString cppVariantToWebString(const CppVariant&);
-    Vector<WebKit::WebString> cppVariantToWebStringArray(const CppVariant&);
 
     void printErrorMessage(const std::string&);
 
index d2eec25..5f4d3a2 100644 (file)
@@ -38,51 +38,6 @@ using namespace WebKit;
 
 namespace WebTestRunner {
 
-namespace {
-
-void setStandardFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setStandardFontFamily(font, script);
-}
-
-void setFixedFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setFixedFontFamily(font, script);
-}
-
-void setSerifFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setSerifFontFamily(font, script);
-}
-
-void setSansSerifFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setSansSerifFontFamily(font, script);
-}
-
-void setCursiveFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setCursiveFontFamily(font, script);
-}
-
-void setFantasyFontFamilyWrapper(WebSettings* settings, const WebString& font, UScriptCode script)
-{
-    settings->setFantasyFontFamily(font, script);
-}
-
-typedef void (*SetFontFamilyWrapper)(WebSettings*, const WebString&, UScriptCode);
-
-void applyFontMap(WebSettings* settings, const WebPreferences::ScriptFontFamilyMap& map, SetFontFamilyWrapper setter)
-{
-    for (WebPreferences::ScriptFontFamilyMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) {
-        const WebString& font = iter->second;
-        if (!font.isNull() && !font.isEmpty())
-            (*setter)(settings, font, static_cast<UScriptCode>(iter->first));
-    }
-}
-
-}
-
 void WebPreferences::reset()
 {
 #if OS(MAC_OS_X)
@@ -186,13 +141,6 @@ void WebPreferences::applyTo(WebView* webView)
     settings->setCursiveFontFamily(cursiveFontFamily);
     settings->setFantasyFontFamily(fantasyFontFamily);
 
-    applyFontMap(settings, standardFontMap, setStandardFontFamilyWrapper);
-    applyFontMap(settings, fixedFontMap, setFixedFontFamilyWrapper);
-    applyFontMap(settings, serifFontMap, setSerifFontFamilyWrapper);
-    applyFontMap(settings, sansSerifFontMap, setSansSerifFontFamilyWrapper);
-    applyFontMap(settings, cursiveFontMap, setCursiveFontFamilyWrapper);
-    applyFontMap(settings, fantasyFontMap, setFantasyFontFamilyWrapper);
-
     settings->setDefaultFontSize(defaultFontSize);
     settings->setDefaultFixedFontSize(defaultFixedFontSize);
     settings->setMinimumFontSize(minimumFontSize);